Skip to content

Commit

Permalink
fix: test issues
Browse files Browse the repository at this point in the history
  • Loading branch information
0xTimepunk committed Nov 21, 2024
1 parent 0328fa9 commit 470c773
Show file tree
Hide file tree
Showing 15 changed files with 862 additions and 437 deletions.
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,7 @@ build-sizes: ## Builds the project and shows sizes

.PHONY: test-vvv
test-vvv: ## Runs tests with verbose output
forge test --match-test test_lzConfig --evm-version cancun -vvv
forge test --match-test test_printConfirmations --evm-version cancun -vvv

.PHONY: ftest
ftest: ## Runs tests with cancun evm version
Expand Down
292 changes: 147 additions & 145 deletions script/forge-scripts/Abstract.Deploy.Single.s.sol

Large diffs are not rendered by default.

69 changes: 0 additions & 69 deletions script/forge-scripts/misc/Abstract.Configure.FixPostPreBera.s.sol

This file was deleted.

13 changes: 0 additions & 13 deletions script/forge-scripts/misc/Abstract.Configure.NewDVN.s.sol
Original file line number Diff line number Diff line change
Expand Up @@ -48,19 +48,6 @@ abstract contract AbstractConfigureNewDVN is EnvironmentUtils {
0xabC9b1819cc4D9846550F928B985993cF6240439
];

address[] public LzDVNs = [
0x589dEDbD617e0CBcB916A9223F4d1300c294236b,
0xfD6865c841c2d64565562fCc7e05e619A30615f0,
0x962F502A63F5FBeB44DC9ab932122648E8352959,
0x23DE2FE932d9043291f870324B74F820e11dc81A,
0x2f55C492897526677C5B68fb199ea31E2c126416,
0x6A02D83e8d433304bba74EF1c427913958187142,
0x9e059a54699a285714207b43B055483E78FAac25,
0xE60A3959Ca23a92BF5aAf992EF837cA7F828628a,
0x129Ee430Cb2Ff2708CCADDBDb408a88Fe4FFd480,
0xc097ab8CD7b053326DFe9fB3E3a31a0CCe3B526f
];

function _configureSendAndReceiveDVN(
uint256 env,
uint256 i,
Expand Down
55 changes: 12 additions & 43 deletions script/forge-scripts/misc/Abstract.Configure.PreBeraLaunch.s.sol
Original file line number Diff line number Diff line change
Expand Up @@ -27,43 +27,7 @@ struct UpdateVars {
address sendLib;
}

struct UlnConfig {
uint64 confirmations;
// we store the length of required DVNs and optional DVNs instead of using DVN.length directly to save gas
uint8 requiredDVNCount; // 0 indicate DEFAULT, NIL_DVN_COUNT indicate NONE (to override the value of default)
uint8 optionalDVNCount; // 0 indicate DEFAULT, NIL_DVN_COUNT indicate NONE (to override the value of default)
uint8 optionalDVNThreshold; // (0, optionalDVNCount]
address[] requiredDVNs; // no duplicates. sorted an an ascending order. allowed overlap with optionalDVNs
address[] optionalDVNs; // no duplicates. sorted an an ascending order. allowed overlap with requiredDVNs
}

abstract contract AbstractPreBeraLaunch is EnvironmentUtils {
address[] public SuperformDVNs = [
0x7518f30bd5867b5fA86702556245Dead173afE46,
0xF4c489AfD83625F510947e63ff8F90dfEE0aE46C,
0x8fb0B7D74B557e4b45EF89648BAc197EAb2E4325,
0x1E4CE74ccf5498B19900649D9196e64BAb592451,
0x5496d03d9065B08e5677E1c5D1107110Bb05d445,
0xb0B2EF168F52F6d1e42f461e11117295eF992daf,
0xEb62f578497Bdc351dD650853a751135212fAF49,
0x2EdfE0220A74d9609c79711a65E3A2F2A85Dc83b,
0x7A205ED4e3d7f9d0777594501705D8CD405c3B05,
0x0E95cf21aD9376A26997c97f326C5A0a267bB8FF
];

address[] public LzDVNs = [
0x589dEDbD617e0CBcB916A9223F4d1300c294236b,
0xfD6865c841c2d64565562fCc7e05e619A30615f0,
0x962F502A63F5FBeB44DC9ab932122648E8352959,
0x23DE2FE932d9043291f870324B74F820e11dc81A,
0x2f55C492897526677C5B68fb199ea31E2c126416,
0x6A02D83e8d433304bba74EF1c427913958187142,
0x9e059a54699a285714207b43B055483E78FAac25,
0xE60A3959Ca23a92BF5aAf992EF837cA7F828628a,
0x129Ee430Cb2Ff2708CCADDBDb408a88Fe4FFd480,
0xc097ab8CD7b053326DFe9fB3E3a31a0CCe3B526f
];

function _setBlastDelegate(
uint256 env,
uint256 srcChainIndex,
Expand Down Expand Up @@ -112,6 +76,11 @@ abstract contract AbstractPreBeraLaunch is EnvironmentUtils {
SuperRegistry(_readContractsV1(env, chainNames[srcChainIndex], vars.chainId, "SuperRegistry"));
assert(address(vars.superRegistryC) != address(0));

txn = abi.encodeWithSelector(
vars.superRegistryC.setAddress.selector, rewardsAdminRole, REWARDS_ADMIN, vars.chainId
);
addToBatch(address(vars.superRegistryC), 0, txn);

bytes memory txn;

console.log("Setting config");
Expand All @@ -134,6 +103,9 @@ abstract contract AbstractPreBeraLaunch is EnvironmentUtils {

ulnConfig.requiredDVNs = requiredDVNs;

/// @dev default to 0 to use lz v2 defaults
ulnConfig.confirmations = 0;

address[] memory rescuerAddress = new address[](2);
bytes32[] memory ids = new bytes32[](2);
uint64[] memory targetChains = new uint64[](2);
Expand All @@ -147,12 +119,7 @@ abstract contract AbstractPreBeraLaunch is EnvironmentUtils {
vars.dstTrueIndex = _getTrueIndex(finalDeployedChains[j]);

vars.setConfigParams = new SetConfigParam[](1);
ulnConfig.confirmations = CONFIRMATIONS[vars.chainId][finalDeployedChains[j]];
console.log("chainId", vars.chainId);
console.log("finalDeployedChains[j]", finalDeployedChains[j]);
console.log("confirmations", ulnConfig.confirmations);
assert(ulnConfig.confirmations != 0);
console.log("----");

vars.config = abi.encode(ulnConfig);

vars.setConfigParams[0] = SetConfigParam(uint32(lz_chainIds[vars.dstTrueIndex]), uint32(2), vars.config);
Expand All @@ -173,6 +140,7 @@ abstract contract AbstractPreBeraLaunch is EnvironmentUtils {

// disable Axelar's other chain info on LINEA and BLAST
if (vars.chainId == LINEA || vars.chainId == BLAST) {
/*
if (finalDeployedChains[j] == LINEA || finalDeployedChains[j] == BLAST) {
txn = abi.encodeWithSelector(
AxelarImplementation.setChainId.selector,
Expand All @@ -183,10 +151,11 @@ abstract contract AbstractPreBeraLaunch is EnvironmentUtils {
addToBatch(vars.axl, 0, txn);
}
txn = abi.encodeWithSelector(
AxelarImplementation.setReceiver.selector, axelar_chainIds[vars.dstTrueIndex], address(0xDEAD)
AxelarImplementation.setReceiver.selector, axelar_chainIds[vars.dstTrueIndex], address(0xDEAD)
);
addToBatch(vars.axl, 0, txn);
*/
} else {
for (uint256 i; i < rescuerAddress.length; i++) {
ids[i] = keccak256("CORE_STATE_REGISTRY_RESCUER_ROLE");
Expand Down
40 changes: 1 addition & 39 deletions script/forge-scripts/misc/DecodeULNConfig.sol
Original file line number Diff line number Diff line change
Expand Up @@ -5,50 +5,12 @@ import "../EnvironmentUtils.s.sol";
import "src/vendor/layerzero/v2/ILayerZeroEndpointV2.sol";

contract DecodeULNConfig is EnvironmentUtils {
address[] public SuperformDVNs = [
0x7518f30bd5867b5fA86702556245Dead173afE46,
0xF4c489AfD83625F510947e63ff8F90dfEE0aE46C,
0x8fb0B7D74B557e4b45EF89648BAc197EAb2E4325,
0x1E4CE74ccf5498B19900649D9196e64BAb592451,
0x5496d03d9065B08e5677E1c5D1107110Bb05d445,
0xb0B2EF168F52F6d1e42f461e11117295eF992daf,
0xEb62f578497Bdc351dD650853a751135212fAF49,
0x2EdfE0220A74d9609c79711a65E3A2F2A85Dc83b,
0x7A205ED4e3d7f9d0777594501705D8CD405c3B05,
0x0E95cf21aD9376A26997c97f326C5A0a267bB8FF
];

address[] public LzDVNs = [
0x589dEDbD617e0CBcB916A9223F4d1300c294236b,
0xfD6865c841c2d64565562fCc7e05e619A30615f0,
0x962F502A63F5FBeB44DC9ab932122648E8352959,
0x23DE2FE932d9043291f870324B74F820e11dc81A,
0x2f55C492897526677C5B68fb199ea31E2c126416,
0x6A02D83e8d433304bba74EF1c427913958187142,
0x9e059a54699a285714207b43B055483E78FAac25,
0xE60A3959Ca23a92BF5aAf992EF837cA7F828628a,
0x129Ee430Cb2Ff2708CCADDBDb408a88Fe4FFd480,
0xc097ab8CD7b053326DFe9fB3E3a31a0CCe3B526f
];

struct UlnConfig {
uint64 confirmations;
// we store the length of required DVNs and optional DVNs instead of using DVN.length directly to save gas
uint8 requiredDVNCount; // 0 indicate DEFAULT, NIL_DVN_COUNT indicate NONE (to override the value of default)
uint8 optionalDVNCount; // 0 indicate DEFAULT, NIL_DVN_COUNT indicate NONE (to override the value of default)
uint8 optionalDVNThreshold; // (0, optionalDVNCount]
address[] requiredDVNs; // no duplicates. sorted an an ascending order. allowed overlap with optionalDVNs
address[] optionalDVNs; // no duplicates. sorted an an ascending order. allowed overlap with requiredDVNs
}

function decodeULNConfig(uint64 chainid, uint64 dstChainId, bytes memory config) public {
_setEnvironment(0, false);
_preDeploymentSetup();

UlnConfig memory ulnConfig = abi.decode(config, (UlnConfig));

assert(CONFIRMATIONS[chainid][dstChainId] == ulnConfig.confirmations);

address[] memory requiredDVNsToAssert = new address[](2);
requiredDVNsToAssert[0] = SuperformDVNs[_getTrueIndex(chainid)];
requiredDVNsToAssert[1] = LzDVNs[_getTrueIndex(chainid)];
Expand All @@ -59,7 +21,7 @@ contract DecodeULNConfig is EnvironmentUtils {

assert(requiredDVNsToAssert[0] == ulnConfig.requiredDVNs[0]);
assert(requiredDVNsToAssert[1] == ulnConfig.requiredDVNs[1]);
console.log("asserted, SRC, DST, Confirmations: ", chainid, dstChainId, ulnConfig.confirmations);
console.log("asserted, SRC, DST: ", chainid, dstChainId);
}

function _getTrueIndex(uint256 chainId) public view returns (uint256 index) {
Expand Down
8 changes: 6 additions & 2 deletions script/output/1/Ethereum-latest.json
Original file line number Diff line number Diff line change
@@ -1,21 +1,23 @@
{
"AsyncStateRegistry": "0x217D7ED4c370e4f81976A58dc04f5249c59Cd044",
"AxelarImplementation": "0x679Cf01eaF7b48aF3Eb13D8D5dd8E8005675B75D",
"BroadcastRegistry": "0xCEc20ddF2f26a7f2e213B65bBDc3Dba5a94905dB",
"CoreStateRegistry": "0xda4Bc7aD4bfe737f1bAB14E96F345db40A71Ec3D",
"DeBridgeForwarderValidator": "0x33A77A6ac571034579690C2B14dF11E3e803A3AC",
"DeBridgeValidator": "0x4d6bd7F58B111368F7cAa900E25a3Fc345c145e4",
"DstSwapper": "0x0f0f6e8F7Df71f40F76a6085e68cbADfC3693b3c",
"DstSwapper": "0x90206D750dd8FEBbDdef32ca3eD578a278b133D9",
"ERC4626Form": "0xBC696200257Aa524DC33daC962609b1cc5829e7f",
"ERC5115Form": "0xE7c419E8697863945498799445EedFb353D3aB7A",
"ERC5115To4626WrapperFactory": "0xC3d2303C2D7BD590786b2a161d16756459814A4F",
"ERC7540Form": "0x186504843d4F15A5e98E654484F5BC8EE1a9Cbd8",
"EmergencyQueue": "0x97757B4Fbe27844491cda3B766B2Af2C5FC3CdE5",
"HyperlaneImplementation": "0xA32C38a1F734D40d4293688f2B401A99eE34211c",
"LayerzeroImplementation": "0x05D2543d0b6b50e59f6eB548660289502f6095BE",
"LayerzeroV1Implementation": "0x44F11E68B595cb8f6789700BcF8814909093f553",
"LiFiValidator": "0xF279499555c1F70A1e4412b652c376C881Ad0B89",
"OneInchValidator": "0xf4F2b2d0036C5d9be3ddf86fa188B60C73170280",
"PayMaster": "0xcBB80F21cE80877EA652BceF97821D7883A219e9",
"PayloadHelper": "0x89e7F61E97fd5E30B58640ea48FE9109F5434aA2",
"PayloadHelper": "0x9Ff35E68409b615110DB0864bd632E9F9770C182",
"PaymentHelper": "0x5754BdbD9a19037961aa16d53aB6a97fFeC7c9d6",
"RewardsDistributor": "0xBee4aa07Dee132B76d195Bb00eeB7F7B360d2afd",
"SocketOneInchValidator": "0xB0F404e09F4D9660970bE7780Bb453ba4E161F96",
Expand All @@ -25,6 +27,8 @@
"SuperRegistry": "0xD678fDdf21eA7b6722115cb9edBDDC8CF2BFb7d7",
"SuperformFactory": "0xC8E70Ef21FaB64B321E8Aea0Ed1fda4eC481Ea24",
"SuperformRouter": "0x229C2Cd1C67c1b7ab2D6A07718DC622b6EC3d408",
"SuperformRouterPlus": "0x0000000000000000000000000000000000000000",
"SuperformRouterPlusAsync": "0x0000000000000000000000000000000000000000",
"VaultClaimer": "0x36B20e607eDC57da1bcd0475831150E475F58d70",
"WormholeARImplementation": "0x7E76F8602194811eA4E1d36d570b5c3c2C6dd3c2",
"WormholeSRImplementation": "0x802e93000D4F89A5B3c1D30b0D426bB7bCe3084C"
Expand Down
60 changes: 30 additions & 30 deletions script/output/10/Optimism-latest.json
Original file line number Diff line number Diff line change
@@ -1,35 +1,35 @@
{
"AsyncStateRegistry": "0x0000000000000000000000000000000000000000",
"AxelarImplementation": "0x0000000000000000000000000000000000000000",
"BroadcastRegistry": "0x0000000000000000000000000000000000000000",
"CoreStateRegistry": "0x0000000000000000000000000000000000000000",
"DeBridgeForwarderValidator": "0x0000000000000000000000000000000000000000",
"DeBridgeValidator": "0x0000000000000000000000000000000000000000",
"DstSwapper": "0x0000000000000000000000000000000000000000",
"ERC4626Form": "0x0000000000000000000000000000000000000000",
"ERC5115Form": "0x0000000000000000000000000000000000000000",
"ERC5115To4626WrapperFactory": "0x0000000000000000000000000000000000000000",
"ERC7540Form": "0xE2005E8A9b8A21d6dF752db866fA78a574057052",
"EmergencyQueue": "0x0000000000000000000000000000000000000000",
"HyperlaneImplementation": "0x0000000000000000000000000000000000000000",
"LayerzeroImplementation": "0x0000000000000000000000000000000000000000",
"LayerzeroV1Implementation": "0x0000000000000000000000000000000000000000",
"LiFiValidator": "0x0000000000000000000000000000000000000000",
"OneInchValidator": "0x0000000000000000000000000000000000000000",
"PayMaster": "0x0000000000000000000000000000000000000000",
"PayloadHelper": "0x0000000000000000000000000000000000000000",
"PaymentHelper": "0x0000000000000000000000000000000000000000",
"RewardsDistributor": "0x0000000000000000000000000000000000000000",
"SocketOneInchValidator": "0x0000000000000000000000000000000000000000",
"AsyncStateRegistry": "0x217D7ED4c370e4f81976A58dc04f5249c59Cd044",
"AxelarImplementation": "0x679Cf01eaF7b48aF3Eb13D8D5dd8E8005675B75D",
"BroadcastRegistry": "0xCEc20ddF2f26a7f2e213B65bBDc3Dba5a94905dB",
"CoreStateRegistry": "0xda4Bc7aD4bfe737f1bAB14E96F345db40A71Ec3D",
"DeBridgeForwarderValidator": "0x33A77A6ac571034579690C2B14dF11E3e803A3AC",
"DeBridgeValidator": "0x4d6bd7F58B111368F7cAa900E25a3Fc345c145e4",
"DstSwapper": "0x90206D750dd8FEBbDdef32ca3eD578a278b133D9",
"ERC4626Form": "0xBC696200257Aa524DC33daC962609b1cc5829e7f",
"ERC5115Form": "0xE7c419E8697863945498799445EedFb353D3aB7A",
"ERC5115To4626WrapperFactory": "0xC3d2303C2D7BD590786b2a161d16756459814A4F",
"ERC7540Form": "0x186504843d4F15A5e98E654484F5BC8EE1a9Cbd8",
"EmergencyQueue": "0x97757B4Fbe27844491cda3B766B2Af2C5FC3CdE5",
"HyperlaneImplementation": "0xA32C38a1F734D40d4293688f2B401A99eE34211c",
"LayerzeroImplementation": "0x05D2543d0b6b50e59f6eB548660289502f6095BE",
"LayerzeroV1Implementation": "0x44F11E68B595cb8f6789700BcF8814909093f553",
"LiFiValidator": "0xF279499555c1F70A1e4412b652c376C881Ad0B89",
"OneInchValidator": "0xf4F2b2d0036C5d9be3ddf86fa188B60C73170280",
"PayMaster": "0xcBB80F21cE80877EA652BceF97821D7883A219e9",
"PayloadHelper": "0x9Ff35E68409b615110DB0864bd632E9F9770C182",
"PaymentHelper": "0x5754BdbD9a19037961aa16d53aB6a97fFeC7c9d6",
"RewardsDistributor": "0xBee4aa07Dee132B76d195Bb00eeB7F7B360d2afd",
"SocketOneInchValidator": "0xB0F404e09F4D9660970bE7780Bb453ba4E161F96",
"SocketValidator": "0x0000000000000000000000000000000000000000",
"SuperPositions": "0x0000000000000000000000000000000000000000",
"SuperRBAC": "0x0000000000000000000000000000000000000000",
"SuperRegistry": "0x0000000000000000000000000000000000000000",
"SuperformFactory": "0x0000000000000000000000000000000000000000",
"SuperformRouter": "0x0000000000000000000000000000000000000000",
"SuperPositions": "0x24Bc1C19781a1Bbf5A37b0E1A5F79aac75AF6467",
"SuperRBAC": "0xAEb63A3199d2CB3B2812BBD1dc6Ef62f12182E5d",
"SuperRegistry": "0xD678fDdf21eA7b6722115cb9edBDDC8CF2BFb7d7",
"SuperformFactory": "0xC8E70Ef21FaB64B321E8Aea0Ed1fda4eC481Ea24",
"SuperformRouter": "0x229C2Cd1C67c1b7ab2D6A07718DC622b6EC3d408",
"SuperformRouterPlus": "0x0000000000000000000000000000000000000000",
"SuperformRouterPlusAsync": "0x0000000000000000000000000000000000000000",
"VaultClaimer": "0x0000000000000000000000000000000000000000",
"WormholeARImplementation": "0x0000000000000000000000000000000000000000",
"WormholeSRImplementation": "0x0000000000000000000000000000000000000000"
"VaultClaimer": "0x36B20e607eDC57da1bcd0475831150E475F58d70",
"WormholeARImplementation": "0x7E76F8602194811eA4E1d36d570b5c3c2C6dd3c2",
"WormholeSRImplementation": "0x802e93000D4F89A5B3c1D30b0D426bB7bCe3084C"
}
Loading

0 comments on commit 470c773

Please sign in to comment.