Skip to content

Commit

Permalink
Merge pull request #17 from Ion-Protocol/carson/deploy-testing
Browse files Browse the repository at this point in the history
Integration Test
  • Loading branch information
CarsonCase authored Sep 6, 2024
2 parents ec346bb + d0580a3 commit 884446f
Show file tree
Hide file tree
Showing 16 changed files with 965 additions and 376 deletions.
9 changes: 9 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
include .env

checkL1:
@echo "Setting environment variable LIVE_DEPLOY_READ_FILE_NAME to $(file)"
@export LIVE_DEPLOY_READ_FILE_NAME=$(file) && forge test --mp test/LiveDeploy.t.sol --fork-url=${L1_RPC_URL}

checkL2:
@echo "Setting environment variable LIVE_DEPLOY_READ_FILE_NAME to $(file)"
@export LIVE_DEPLOY_READ_FILE_NAME=$(file) && forge test --mp test/LiveDeploy.t.sol --fork-url=${L2_RPC_URL}
121 changes: 55 additions & 66 deletions deployment-config/exampleL1.json
Original file line number Diff line number Diff line change
@@ -1,69 +1,58 @@
{
"protocolAdmin": "0xC2d99d76bb9D46BF8Ec9449E4DfAE48C30CF0839",

"boringVault":{
"boringVaultSalt": "0x1ddd634c506ad203da17ff00000000000000000000000000000000000000000a",
"boringVaultName": "Nucleus Vault",
"boringVaultSymbol": "NV",

"address": "0x0000000000E7Ab44153eEBEF2343ba5289F65dAC"
"protocolAdmin": "0xC2d99d76bb9D46BF8Ec9449E4DfAE48C30CF0839",
"boringVault": {
"boringVaultSalt": "0x1ddd634c506ad203da17ff00000000000000000000000000000000000000000e",
"boringVaultName": "Nucleus Vault",
"boringVaultSymbol": "NV",
"address": "0x0000000000E7Ab44153eEBEF2343ba5289F65dAC"
},
"manager": {
"managerSalt": "0x30432d4b4ec00003b4a25000000000000000000000000000000000000000000e",
"address": "0x0000000000fAd6Db23abdC1a85621B97bd1Dc82f"
},
"accountant": {
"accountantSalt": "0x6a184dbea6f3cc0318679f00000000000000000000000000000000000000000e",
"payoutAddress": "0x0000000000417626Ef34D62C4DC189b021603f2F",
"base": "0x5f207d42F869fd1c71d7f0f81a2A67Fc20FF7323",
"allowedExchangeRateChangeUpper": "10003",
"allowedExchangeRateChangeLower": "9998",
"minimumUpdateDelayInSeconds": "3600",
"managementFee": "2000",
"address": "0x00000000004F96C07B83e86600D86F9479bB43fa"
},
"teller": {
"tellerSalt": "0x51f8968749a56d01202c9100000000000000000000000000000000000000000e",
"maxGasForPeer": 100000,
"minGasForPeer": 0,
"peerEid": 30280,
"tellerContractName": "MultiChainLayerZeroTellerWithMultiAssetSupport",
"assets": [
"0xCd5fE23C85820F7B72D0926FC9b05b43E359b7ee",
"0xbf5495Efe5DB9ce00f80364C8B423567e58d2110"
],
"dvnIfNoDefault": {
"required": [
"0x589dEDbD617e0CBcB916A9223F4d1300c294236b"
],
"optional": [
"0x380275805876Ff19055EA900CDb2B46a94ecF20D",
"0x8FafAE7Dd957044088b3d0F67359C327c6200d18",
"0xa59BA433ac34D2927232918Ef5B2eaAfcF130BA5",
"0xe552485d02EDd3067FE7FCbD4dd56BB1D3A998D2"
],
"blockConfirmationsRequiredIfNoDefault": 15,
"optionalThreshold": 1
},

"manager":{
"managerSalt": "0x30432d4b4ec00003b4a25000000000000000000000000000000000000000000a",

"address": "0x0000000000fAd6Db23abdC1a85621B97bd1Dc82f"
},

"accountant":{
"accountantSalt": "0x6a184dbea6f3cc0318679f00000000000000000000000000000000000000000a",
"payoutAddress": "0x0000000000417626Ef34D62C4DC189b021603f2F",
"base": "0x5f207d42F869fd1c71d7f0f81a2A67Fc20FF7323",
"allowedExchangeRateChangeUpper": "10003",
"allowedExchangeRateChangeLower": "9998",
"minimumUpdateDelayInSeconds": "3600",
"managementFee": "2000",

"address": "0x00000000004F96C07B83e86600D86F9479bB43fa"
},

"teller": {
"tellerSalt": "0x51f8968749a56d01202c9100000000000000000000000000000000000000000a",
"maxGasForPeer": 100000,
"minGasForPeer": 0,
"peerEid": 30280,
"tellerContractName": "MultiChainLayerZeroTellerWithMultiAssetSupport",
"assets": [
"0xCd5fE23C85820F7B72D0926FC9b05b43E359b7ee",
"0xbf5495Efe5DB9ce00f80364C8B423567e58d2110"
],
"dvnIfNoDefault":{
"required":["0x589dEDbD617e0CBcB916A9223F4d1300c294236b"],
"optional":[
"0x380275805876Ff19055EA900CDb2B46a94ecF20D",
"0x8FafAE7Dd957044088b3d0F67359C327c6200d18",
"0xa59BA433ac34D2927232918Ef5B2eaAfcF130BA5",
"0xe552485d02EDd3067FE7FCbD4dd56BB1D3A998D2"
],
"blockConfirmationsRequiredIfNoDefault": 15,
"optionalThreshold": 1
},

"address": "0x00000000004F96C07B83e86600D86F0000000000"
},

"rolesAuthority": {
"rolesAuthoritySalt": "0x66bbc3b3b3000b01466a3a00000000000000000000000000000000000000000a",
"strategist": "0xC2d99d76bb9D46BF8Ec9449E4DfAE48C30CF0839",
"exchangeRateBot": "0x00000000004F96C07B83e86600D86F0000000000",

"address": "0x00000000004F96C07B83e86600D86F0000000000"
},

"decoder": {
"decoderSalt": "0x48b53893da2e0b0248268c00000000000000000000000000000000000000000a",

"address": "0x00000000004F96C07B83e86600D86F0000000000"
}

"address": "0x00000000004F96C07B83e86600D86F0000000000"
},
"rolesAuthority": {
"rolesAuthoritySalt": "0x66bbc3b3b3000b01466a3a00000000000000000000000000000000000000000e",
"strategist": "0xC2d99d76bb9D46BF8Ec9449E4DfAE48C30CF0839",
"exchangeRateBot": "0x00000000004F96C07B83e86600D86F0000000000",
"address": "0x00000000004F96C07B83e86600D86F0000000000"
},
"decoder": {
"decoderSalt": "0x48b53893da2e0b0248268c00000000000000000000000000000000000000000e",
"address": "0x00000000004F96C07B83e86600D86F0000000000"
}
}
116 changes: 52 additions & 64 deletions deployment-config/exampleL2.json
Original file line number Diff line number Diff line change
@@ -1,67 +1,55 @@
{
"protocolAdmin": "0xF2dE1311C5b2C1BD94de996DA13F80010453e505",

"boringVault":{
"boringVaultSalt": "0x1ddd634c506ad203da17ff00000000000000000000000000000000000000000a",
"boringVaultName": "Nucleus Vault",
"boringVaultSymbol": "NV",

"address": "0x0000000000E7Ab44153eEBEF2343ba5289F65dAC"
"protocolAdmin": "0xF2dE1311C5b2C1BD94de996DA13F80010453e505",
"boringVault": {
"boringVaultSalt": "0x1ddd634c506ad203da17ff00000000000000000000000000000000000000000e",
"boringVaultName": "Nucleus Vault",
"boringVaultSymbol": "NV",
"address": "0x0000000000E7Ab44153eEBEF2343ba5289F65dAC"
},
"manager": {
"managerSalt": "0x30432d4b4ec00003b4a25000000000000000000000000000000000000000000e",
"address": "0x0000000000fAd6Db23abdC1a85621B97bd1Dc82f"
},
"accountant": {
"accountantSalt": "0x6a184dbea6f3cc0318679f00000000000000000000000000000000000000000e",
"payoutAddress": "0x0000000000417626Ef34D62C4DC189b021603f2F",
"base": "0x5f207d42F869fd1c71d7f0f81a2A67Fc20FF7323",
"allowedExchangeRateChangeUpper": "10003",
"allowedExchangeRateChangeLower": "9998",
"minimumUpdateDelayInSeconds": "3600",
"managementFee": "2000",
"address": "0x00000000004F96C07B83e86600D86F9479bB43fa"
},
"teller": {
"tellerSalt": "0x51f8968749a56d01202c9100000000000000000000000000000000000000000e",
"maxGasForPeer": 100000,
"minGasForPeer": 0,
"peerEid": 30280,
"tellerContractName": "MultiChainLayerZeroTellerWithMultiAssetSupport",
"assets": [],
"dvnIfNoDefault": {
"required": [
"0x6788f52439aca6bff597d3eec2dc9a44b8fee842"
],
"optional": [
"0x1feb08b1a53a9710afce82d380b8c2833c69a37e",
"0x87048402c32632b7c4d0a892d82bc1160e8b2393",
"0xd24972c11f91c1bb9eaee97ec96bb9c33cf7af24",
"0xbd00c87850416db0995ef8030b104f875e1bdd15"
],
"blockConfirmationsRequiredIfNoDefault": 15,
"optionalThreshold": 1
},

"manager":{
"managerSalt": "0x30432d4b4ec00003b4a25000000000000000000000000000000000000000000a",

"address": "0x0000000000fAd6Db23abdC1a85621B97bd1Dc82f"
},

"accountant":{
"accountantSalt": "0x6a184dbea6f3cc0318679f00000000000000000000000000000000000000000a",
"payoutAddress": "0x0000000000417626Ef34D62C4DC189b021603f2F",
"base": "0x5f207d42F869fd1c71d7f0f81a2A67Fc20FF7323",
"allowedExchangeRateChangeUpper": "10003",
"allowedExchangeRateChangeLower": "9998",
"minimumUpdateDelayInSeconds": "3600",
"managementFee": "2000",

"address": "0x00000000004F96C07B83e86600D86F9479bB43fa"
},

"teller": {
"tellerSalt": "0x51f8968749a56d01202c9100000000000000000000000000000000000000000a",
"maxGasForPeer": 100000,
"minGasForPeer": 0,
"peerEid": 30280,
"tellerContractName": "MultiChainLayerZeroTellerWithMultiAssetSupport",
"assets": [
],
"dvnIfNoDefault":{
"required":["0x6788f52439aca6bff597d3eec2dc9a44b8fee842"],
"optional":[
"0x1feb08b1a53a9710afce82d380b8c2833c69a37e",
"0x87048402c32632b7c4d0a892d82bc1160e8b2393",
"0xd24972c11f91c1bb9eaee97ec96bb9c33cf7af24",
"0xbd00c87850416db0995ef8030b104f875e1bdd15"
],
"blockConfirmationsRequiredIfNoDefault": 15,
"optionalThreshold": 1
},

"address": "0x00000000004F96C07B83e86600D86F0000000000"
},

"rolesAuthority": {
"rolesAuthoritySalt": "0x66bbc3b3b3000b01466a3a00000000000000000000000000000000000000000a",
"strategist": "0xC2d99d76bb9D46BF8Ec9449E4DfAE48C30CF0839",
"exchangeRateBot": "0x00000000004F96C07B83e86600D86F0000000000",

"address": "0x00000000004F96C07B83e86600D86F0000000000"
},

"decoder": {
"decoderSalt": "0x48b53893da2e0b0248268c00000000000000000000000000000000000000000a",

"address": "0x00000000004F96C07B83e86600D86F0000000000"
}

"address": "0x00000000004F96C07B83e86600D86F0000000000"
},
"rolesAuthority": {
"rolesAuthoritySalt": "0x66bbc3b3b3000b01466a3a00000000000000000000000000000000000000000e",
"strategist": "0xC2d99d76bb9D46BF8Ec9449E4DfAE48C30CF0839",
"exchangeRateBot": "0x00000000004F96C07B83e86600D86F0000000000",
"address": "0x00000000004F96C07B83e86600D86F0000000000"
},
"decoder": {
"decoderSalt": "0x48b53893da2e0b0248268c00000000000000000000000000000000000000000e",
"address": "0x00000000004F96C07B83e86600D86F0000000000"
}
}
57 changes: 57 additions & 0 deletions deployment-config/form-lst-testnet-l1-08-30-24.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
{
"base": "0xee44150250AfF3E6aC25539765F056EDb7F85D7B",
"protocolAdmin": "0x0000000000417626Ef34D62C4DC189b021603f2F",
"boringVaultAndBaseDecimals": "18",
"boringVault": {
"boringVaultSalt": "0x1ddd634c506ad203da17ff000000000000000000000000000000000000000013",
"boringVaultName": "Form LST",
"boringVaultSymbol": "FLST",
"address": "0x0000000000000000000000000000000000000000"
},
"manager": {
"managerSalt": "0x30432d4b4ec00003b4a250000000000000000000000000000000000000000013",
"address": "0x0000000000000000000000000000000000000000"
},
"accountant": {
"accountantSalt": "0x6a184dbea6f3cc0318679f000000000000000000000000000000000000000013",
"payoutAddress": "0x0000000000417626Ef34D62C4DC189b021603f2F",
"allowedExchangeRateChangeUpper": "10003",
"allowedExchangeRateChangeLower": "9998",
"minimumUpdateDelayInSeconds": "3600",
"managementFee": "0",
"address": "0x0000000000000000000000000000000000000000"
},
"teller": {
"tellerSalt": "0x51f8968749a56d01202c91000000000000000000000000000000000000000013",
"maxGasForPeer": 100000,
"minGasForPeer": 0,
"peerEid": 40270,
"tellerContractName": "TellerWithMultiAssetSupport",
"opMessenger": "0x58Cc85b8D04EA49cC6DBd3CbFFd00B4B8D6cb3ef",
"assets": [],
"dvnIfNoDefault": {
"required": [
"0x589dEDbD617e0CBcB916A9223F4d1300c294236b"
],
"optional": [
"0x380275805876Ff19055EA900CDb2B46a94ecF20D",
"0x8FafAE7Dd957044088b3d0F67359C327c6200d18",
"0xa59BA433ac34D2927232918Ef5B2eaAfcF130BA5",
"0xe552485d02EDd3067FE7FCbD4dd56BB1D3A998D2"
],
"blockConfirmationsRequiredIfNoDefault": 15,
"optionalThreshold": 1
},
"address": "0x0000000000000000000000000000000000000000"
},
"rolesAuthority": {
"rolesAuthoritySalt": "0x66bbc3b3b3000b01466a3a000000000000000000000000000000000000000013",
"strategist": "0x0000000000417626Ef34D62C4DC189b021603f2F",
"exchangeRateBot": "0x0000000000417626Ef34D62C4DC189b021603f2F",
"address": "0x0000000000000000000000000000000000000000"
},
"decoder": {
"decoderSalt": "0x48b53893da2e0b0248268c000000000000000000000000000000000000000013",
"address": "0x0000000000000000000000000000000000000000"
}
}
46 changes: 46 additions & 0 deletions incrementSalt.cjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
const fs = require('fs');


const args = process.argv.slice(2);
if (args.length < 1) {
console.error("Usage: node incrementSalt.cjs <fileName>");
process.exit(1);
}

const [fileName] = args;
const filePath = 'deployment-config/'+fileName;

fs.readFile(filePath, 'utf8', (err, data) => {
if (err) {
console.error('Error reading file:', err);
return;
}

let jsonData = JSON.parse(data);

const incrementHex = (hex) => {
let num = BigInt(hex);
num += 1n;
return '0x' + num.toString(16);
};

const incrementSalts = (obj) => {
for (let key in obj) {
if (typeof obj[key] === 'string' && obj[key].startsWith('0x') && key.toLowerCase().includes('salt')) {
obj[key] = incrementHex(obj[key]);
} else if (typeof obj[key] === 'object') {
incrementSalts(obj[key]);
}
}
};

incrementSalts(jsonData);

fs.writeFile(filePath, JSON.stringify(jsonData, null, 2), 'utf8', (err) => {
if (err) {
console.error('Error writing file:', err);
return;
}
console.log('File successfully updated');
});
});
2 changes: 1 addition & 1 deletion lzConfigCheck.cjs
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@ async function main() {

const chain2 = findings2.findings[0].chain;
for (const finding of findings2.findings) {
assert(providers1.includes(finding.provider), "Provider: "+finding.provider+" does not havea matching provider in the first config");
assert(providers1.includes(finding.provider), "Provider: "+finding.provider+" does not have a matching provider in the first config");
assert(finding.chain == chain2, "Networks do not match for: "+finding);
}

Expand Down
4 changes: 3 additions & 1 deletion script/Base.s.sol
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ abstract contract BaseScript is Script {
string constant CONFIG_CHAIN_ROOT = "./deployment-config/chains/";

/// Custom base params
ICreateX CREATEX = ICreateX(0xD7d6e6C50507d278b9F43f62Bc7b9310ECeff2C5);
ICreateX immutable CREATEX;

/// @dev Included to enable compilation of the script without a $MNEMONIC environment variable.
string internal constant TEST_MNEMONIC = "test test test test test test test test test test test junk";
Expand All @@ -45,6 +45,7 @@ abstract contract BaseScript is Script {
///
/// The use case for $ETH_FROM is to specify the broadcaster key and its address via the command line.
constructor() {
CREATEX = ICreateX(vm.envAddress("CREATEX"));
deployCreate2 = vm.envOr({ name: "CREATE2", defaultValue: true });
address from = vm.envOr({ name: "ETH_FROM", defaultValue: address(0) });
if (from != address(0)) {
Expand All @@ -56,6 +57,7 @@ abstract contract BaseScript is Script {

// if this chain doesn't have a CREATEX deployment, deploy it ourselves
if (address(CREATEX).code.length == 0) {
console.log("Current Chain ID: ", block.chainid);
revert("CREATEX Not Deployed on this chain. Use the DeployCustomCreatex script to deploy it");
}
}
Expand Down
Loading

0 comments on commit 884446f

Please sign in to comment.