Skip to content

Commit 0328fa9

Browse files
committed
fix: smoke tests
1 parent a5655ff commit 0328fa9

File tree

10 files changed

+275
-50
lines changed

10 files changed

+275
-50
lines changed

.github/workflows/CI.yml

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,11 @@ jobs:
5656
- name: "Install Foundry"
5757
uses: "foundry-rs/foundry-toolchain@v1"
5858

59+
60+
- name: "Show the Foundry version"
61+
run: "forge --version"
62+
63+
5964
- name: "Show the Foundry config"
6065
run: "forge config"
6166

@@ -171,7 +176,7 @@ jobs:
171176
run: "make coverage"
172177

173178
- name: "Upload coverage report to Codecov"
174-
uses: "codecov/codecov-action@v4"
179+
uses: "codecov/codecov-action@v5"
175180
env:
176181
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
177182
with:

Makefile

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -121,7 +121,7 @@ build-sizes: ## Builds the project and shows sizes
121121

122122
.PHONY: test-vvv
123123
test-vvv: ## Runs tests with verbose output
124-
forge test --match-test test_rewardsDistributor --evm-version cancun -vvv
124+
forge test --match-test test_lzConfig --evm-version cancun -vvv
125125

126126
.PHONY: ftest
127127
ftest: ## Runs tests with cancun evm version
@@ -141,7 +141,7 @@ coverage-t: ## Runs coverage for a specific contract
141141

142142
.PHONY: smoke-test
143143
smoke-test: ## Runs smoke tests
144-
forge test --match-test test_deBridgeValidators -vvv
144+
forge test --match-contract SmokeTest -vvv
145145

146146
.PHONY: invariant
147147
invariant: ## Runs invariant tests

script/forge-scripts/Abstract.Deploy.Single.s.sol

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -438,9 +438,9 @@ abstract contract AbstractDeploySingle is BatchScript {
438438
0xe6ca8aC2D27A1bAd2Ab6b136Eab87488c3c98Fd1,
439439
/// @dev FANTOM https://safe.fantom.network/home?safe=ftm:0xe6ca8aC2D27A1bAd2Ab6b136Eab87488c3c98Fd1
440440
0x62Bbfe3ef3faAb7045d29bC388E5A0c5033D8b77,
441-
/// @dev LINEA https://safe.linea.build/home?safe=linea:0x62Bbfe3ef3faAb7045d29bC388E5A0c5033D8b77
441+
/// @dev LINEA https://app.safe.global/home?safe=linea:0x62Bbfe3ef3faAb7045d29bC388E5A0c5033D8b77
442442
0x95B5837CF46E6ab340fFf3844ca5e7d8ead5B8AF,
443-
/// @dev BLAST https://blast-safe.io/home?safe=blastmainnet:0x95B5837CF46E6ab340fFf3844ca5e7d8ead5B8AF
443+
/// @dev BLAST https://app.safe.global/home?safe=blast:0x95B5837CF46E6ab340fFf3844ca5e7d8ead5B8AF
444444
address(0)
445445
/// @dev BERA
446446
];
Lines changed: 69 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,69 @@
1+
/// SPDX-License-Identifier: BUSL-1.1
2+
3+
pragma solidity ^0.8.23;
4+
5+
import "../EnvironmentUtils.s.sol";
6+
7+
struct UpdateVars {
8+
uint64 chainId;
9+
SuperRegistry superRegistryC;
10+
}
11+
12+
abstract contract FixPostPreBeraStuff is EnvironmentUtils {
13+
function _configure(
14+
uint256 env,
15+
uint256 srcChainIndex,
16+
Cycle cycle,
17+
uint64[] memory finalDeployedChains
18+
)
19+
internal
20+
setEnvDeploy(cycle)
21+
{
22+
assert(salt.length > 0);
23+
UpdateVars memory vars;
24+
25+
vars.chainId = finalDeployedChains[srcChainIndex];
26+
27+
vars.superRegistryC =
28+
SuperRegistry(_readContractsV1(env, chainNames[srcChainIndex], vars.chainId, "SuperRegistry"));
29+
assert(address(vars.superRegistryC) != address(0));
30+
31+
bytes memory txn;
32+
33+
address[] memory rescuerAddress = new address[](2);
34+
bytes32[] memory ids = new bytes32[](2);
35+
uint64[] memory targetChains = new uint64[](2);
36+
targetChains[0] = LINEA;
37+
targetChains[1] = BLAST;
38+
39+
for (uint256 j; j < finalDeployedChains.length; j++) {
40+
if (finalDeployedChains[j] == vars.chainId) {
41+
continue;
42+
}
43+
44+
// disable Axelar's other chain info on LINEA and BLAST
45+
if (vars.chainId == LINEA || vars.chainId == BLAST) { } else {
46+
for (uint256 i; i < rescuerAddress.length; i++) {
47+
ids[i] = keccak256("CORE_STATE_REGISTRY_RESCUER_ROLE");
48+
rescuerAddress[i] = CSR_RESCUER;
49+
}
50+
txn = abi.encodeWithSelector(
51+
vars.superRegistryC.batchSetAddress.selector, ids, rescuerAddress, targetChains
52+
);
53+
addToBatch(address(vars.superRegistryC), 0, txn);
54+
}
55+
}
56+
57+
// Send the batch
58+
executeBatch(vars.chainId, PROTOCOL_ADMINS[srcChainIndex], manualNonces[srcChainIndex], true);
59+
}
60+
61+
function _getTrueIndex(uint256 chainId) public view returns (uint256 index) {
62+
for (uint256 i; i < chainIds.length; i++) {
63+
if (chainId == chainIds[i]) {
64+
index = i;
65+
break;
66+
}
67+
}
68+
}
69+
}

script/forge-scripts/misc/Abstract.Configure.PreBeraLaunch.s.sol

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -108,6 +108,10 @@ abstract contract AbstractPreBeraLaunch is EnvironmentUtils {
108108
vars.srcLzImpl = _readContractsV1(env, chainNames[srcChainIndex], vars.chainId, "LayerzeroImplementation");
109109
assert(vars.srcLzImpl != address(0));
110110

111+
vars.superRegistryC =
112+
SuperRegistry(_readContractsV1(env, chainNames[srcChainIndex], vars.chainId, "SuperRegistry"));
113+
assert(address(vars.superRegistryC) != address(0));
114+
111115
bytes memory txn;
112116

113117
console.log("Setting config");

script/forge-scripts/misc/Abstract.Update.PriceFeeds.s.sol

Lines changed: 12 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -34,27 +34,25 @@ abstract contract AbstractUpdatePriceFeeds is EnvironmentUtils {
3434

3535
address paymentHelper = _readContractsV1(env, chainNames[trueIndex], vars.chainId, "PaymentHelper");
3636
address expectedPaymentHelper =
37-
env == 0 ? 0x69c531E5bdf2458FFb4f5E0dB3DE41745151b2Bd : 0xb69929AC813125EdFaCFad366643c3787C0d1500;
37+
env == 0 ? 0x69c531E5bdf2458FFb4f5E0dB3DE41745151b2Bd : 0xe14BCe82D4a72e4C95402a83fEF3C2299a61fD8C;
3838
assert(paymentHelper == expectedPaymentHelper);
3939
uint256 countFeeds;
4040
for (uint256 j = 0; j < s_superFormChainIds.length; j++) {
41-
if (j != i) {
42-
vars.dstChainId = s_superFormChainIds[j];
41+
vars.dstChainId = s_superFormChainIds[j];
4342

44-
for (uint256 k = 0; k < chainIds.length; k++) {
45-
if (vars.dstChainId == chainIds[k]) {
46-
vars.dstTrueIndex = k;
43+
for (uint256 k = 0; k < chainIds.length; k++) {
44+
if (vars.dstChainId == chainIds[k]) {
45+
vars.dstTrueIndex = k;
4746

48-
break;
49-
}
50-
}
51-
if (PRICE_FEEDS[vars.chainId][vars.dstChainId] != address(0)) {
52-
IPaymentHelper(payable(paymentHelper)).updateRemoteChain(
53-
vars.dstChainId, 1, abi.encode(PRICE_FEEDS[vars.chainId][vars.dstChainId])
54-
);
55-
countFeeds++;
47+
break;
5648
}
5749
}
50+
if (PRICE_FEEDS[vars.chainId][vars.dstChainId] != address(0)) {
51+
IPaymentHelper(payable(paymentHelper)).updateRemoteChain(
52+
vars.dstChainId, 1, abi.encode(PRICE_FEEDS[vars.chainId][vars.dstChainId])
53+
);
54+
countFeeds++;
55+
}
5856
}
5957
console.log("Updated %d feeds", countFeeds);
6058
vm.stopBroadcast();

test/mainnet/SmokeTest.Staging.t.sol

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -498,13 +498,7 @@ contract SmokeTestStaging is MainnetBaseSetup {
498498

499499
for (uint256 j; j < TARGET_DEPLOYMENT_CHAINS.length; ++j) {
500500
/// @dev eoracle is not added in blast & linea
501-
if (
502-
chainId != BLAST
503-
&& (
504-
chainId == LINEA
505-
&& (TARGET_DEPLOYMENT_CHAINS[j] != FANTOM && TARGET_DEPLOYMENT_CHAINS[j] != BSC)
506-
)
507-
) {
501+
if (!(chainId == BLAST || chainId == LINEA) && (chainId != TARGET_DEPLOYMENT_CHAINS[j])) {
508502
assertEq(
509503
address(paymentHelper.nativeFeedOracle(TARGET_DEPLOYMENT_CHAINS[j])),
510504
PRICE_FEEDS[chainId][TARGET_DEPLOYMENT_CHAINS[j]]

test/mainnet/SmokeTest.t.sol

Lines changed: 26 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -54,14 +54,19 @@ contract SmokeTest is MainnetBaseSetup {
5454
for (uint256 j = 0; j < TARGET_DEPLOYMENT_CHAINS.length; ++j) {
5555
uint64 dstChain = TARGET_DEPLOYMENT_CHAINS[j];
5656
if (chain != dstChain && !(dstChain == LINEA || dstChain == BLAST)) {
57-
console.log("send chain", chain);
58-
console.log("dst chain", dstChain);
59-
6057
config = endpoint.getConfig(oapp, lzV2SendLib[i], lz_v2_chainIds[j], 2);
6158
UlnConfig memory ulnConfig = abi.decode(config, (UlnConfig));
62-
63-
console.log("confirmations", ulnConfig.confirmations);
64-
console.log("--");
59+
assert(ulnConfig.confirmations == CONFIRMATIONS[chain][dstChain]);
60+
for (uint256 k = 0; k < ulnConfig.requiredDVNs.length; k++) {
61+
// Validate DVNs are properly ordered (ascending)
62+
if (SuperformDVNs[i] < LzDVNs[i]) {
63+
assert(ulnConfig.requiredDVNs[0] == SuperformDVNs[i]);
64+
assert(ulnConfig.requiredDVNs[1] == LzDVNs[i]);
65+
} else {
66+
assert(ulnConfig.requiredDVNs[0] == LzDVNs[i]);
67+
assert(ulnConfig.requiredDVNs[1] == SuperformDVNs[i]);
68+
}
69+
}
6570
}
6671
}
6772
}
@@ -572,9 +577,17 @@ contract SmokeTest is MainnetBaseSetup {
572577
for (uint256 j; j < TARGET_DEPLOYMENT_CHAINS.length; ++j) {
573578
if (chainId != TARGET_DEPLOYMENT_CHAINS[j]) {
574579
if (TARGET_DEPLOYMENT_CHAINS[j] == LINEA || TARGET_DEPLOYMENT_CHAINS[j] == BLAST) {
575-
assertEq(axelar.authorizedImpl(ambIds_[j]), address(0));
576-
assertEq(axelar.ambChainId(TARGET_DEPLOYMENT_CHAINS[j]), "");
577-
assertEq(axelar.superChainId(ambIds_[j]), 0);
580+
assertEq(
581+
axelar.authorizedImpl(ambIds_[j]),
582+
chainId == LINEA || chainId == BLAST ? address(0xDEAD) : address(0)
583+
);
584+
assertEq(
585+
axelar.ambChainId(TARGET_DEPLOYMENT_CHAINS[j]),
586+
chainId == LINEA ? "blast" : chainId == BLAST ? "linea" : ""
587+
);
588+
assertEq(
589+
axelar.superChainId(ambIds_[j]), chainId == LINEA ? 81_457 : chainId == BLAST ? 59_144 : 0
590+
);
578591
} else {
579592
assertEq(axelar.authorizedImpl(ambIds_[j]), address(0xDEAD));
580593
assertEq(axelar.ambChainId(TARGET_DEPLOYMENT_CHAINS[j]), ambIds_[j]);
@@ -593,7 +606,7 @@ contract SmokeTest is MainnetBaseSetup {
593606

594607
for (uint256 i; i < TARGET_DEPLOYMENT_CHAINS.length; ++i) {
595608
uint64 chainId = TARGET_DEPLOYMENT_CHAINS[i];
596-
if (chainId == FANTOM) continue;
609+
if (chainId == FANTOM || chainId == BLAST) continue;
597610

598611
vm.selectFork(FORKS[chainId]);
599612
superRegistry = SuperRegistry(getContract(chainId, "SuperRegistry"));
@@ -606,6 +619,9 @@ contract SmokeTest is MainnetBaseSetup {
606619

607620
for (uint256 j; j < TARGET_DEPLOYMENT_CHAINS.length; ++j) {
608621
/// RESCUER role not set on other chains based on linea or blast as we're not using broadcaster
622+
if (TARGET_DEPLOYMENT_CHAINS[j] == LINEA || TARGET_DEPLOYMENT_CHAINS[j] == BLAST) {
623+
continue;
624+
}
609625
assertEq(
610626
superRegistry.getAddressByChainId(
611627
keccak256("CORE_STATE_REGISTRY_RESCUER_ROLE"), TARGET_DEPLOYMENT_CHAINS[j]

0 commit comments

Comments
 (0)