diff --git a/contracts/.env-sample b/contracts/.env-sample index e87d92745..3a1bea4ad 100644 --- a/contracts/.env-sample +++ b/contracts/.env-sample @@ -1,5 +1,4 @@ L1_RPC_URL="http://localhost:8545" L1_PRIV_KEY="0xac0974bec39a17e36ba4a6b4d238ff944bacb478cbed5efcae784d7bf4f2ff80" -EXECUTOR="0xE6841D92B0C345144506576eC13ECf5103aC7f49" # for the upgrade test, address that can call the upgrade executor -CONFIG_LOCATION="./scripts/files/mainnetConfig.json" -DEPLOYED_CONTRACTS_LOCATION="./scripts/files/mainnetDeployedContracts.json" +CONFIG_NETWORK_NAME="arb1" +DEPLOYED_CONTRACTS_DIR="./scripts/files/" diff --git a/contracts/scripts/common.ts b/contracts/scripts/common.ts index e10373c89..088739665 100644 --- a/contracts/scripts/common.ts +++ b/contracts/scripts/common.ts @@ -1,6 +1,9 @@ import { BigNumber, providers } from 'ethers' import { parseEther } from 'ethers/lib/utils' import fs from 'fs' + +import { configs } from './files/configs' + export interface DeployedContracts { bridge: string seqInbox: string @@ -26,11 +29,15 @@ export const getJsonFile = (fileLocation: string) => { } export const getConfig = async ( - configLocation: string, + configName: string, l1Rpc: providers.Provider ): Promise => { - const config = getJsonFile(configLocation) as RawConfig - return await validateConfig(config, l1Rpc) + const config = configs[configName as keyof typeof configs] + if (!config) { + throw new Error('config not found') + } + await validateConfig(config, l1Rpc) + return config } export interface Config { @@ -84,9 +91,9 @@ export type RawConfig = Omit & { } export const validateConfig = async ( - config: RawConfig, + config: Config, l1Rpc: providers.Provider -): Promise => { +) => { // check all the config.contracts exist if ((await l1Rpc.getCode(config.contracts.l1Timelock)).length <= 2) { throw new Error('l1Timelock address is not a contract') @@ -128,25 +135,25 @@ export const validateConfig = async ( } // check all the settings exist - if (config.settings.confirmPeriodBlocks == 0) { + if (config.settings.confirmPeriodBlocks === 0) { throw new Error('confirmPeriodBlocks is 0') } - if (config.settings.stakeToken.length == 0) { + if (config.settings.stakeToken.length === 0) { throw new Error('stakeToken address is empty') } - if (config.settings.chainId == 0) { + if (config.settings.chainId === 0) { throw new Error('chainId is 0') } - if (config.settings.blockLeafSize == 0) { + if (config.settings.blockLeafSize === 0) { throw new Error('blockLeafSize is 0') } - if (config.settings.bigStepLeafSize == 0) { + if (config.settings.bigStepLeafSize === 0) { throw new Error('bigStepLeafSize is 0') } - if (config.settings.smallStepLeafSize == 0) { + if (config.settings.smallStepLeafSize === 0) { throw new Error('smallStepLeafSize is 0') } - if (config.settings.numBigStepLevel == 0) { + if (config.settings.numBigStepLevel === 0) { throw new Error('numBigStepLevel is 0') } @@ -160,20 +167,8 @@ export const validateConfig = async ( if (miniStakeAmounts.length !== config.settings.numBigStepLevel + 2) { throw new Error('miniStakeAmts length is not numBigStepLevel + 2') } - if (miniStakeAmounts.some((amt) => amt.lt(parseEther('0.1')))) { - throw new Error('miniStakeAmt is less than 0.1 eth') - } - if (config.validators.length == 0) { + if (config.validators.length === 0) { throw new Error('no validators') } - - return { - ...config, - settings: { - ...config.settings, - stakeAmt: stakeAmount, - miniStakeAmounts, - }, - } } diff --git a/contracts/scripts/files/configs/arb1.ts b/contracts/scripts/files/configs/arb1.ts new file mode 100644 index 000000000..f58644c66 --- /dev/null +++ b/contracts/scripts/files/configs/arb1.ts @@ -0,0 +1,62 @@ +import { parseEther } from 'ethers/lib/utils' +import { Config } from '../../common' + +export const arb1: Config = { + contracts: { + // the l1Timelock does not actually need to be the timelock + // it is only used to set the excess stake receiver / loser stake escrow + // TODO: change this to a fee router before real deployment + l1Timelock: '0xE6841D92B0C345144506576eC13ECf5103aC7f49', + rollup: '0x5eF0D09d1E6204141B4d37530808eD19f60FBa35', + bridge: '0x8315177aB297bA92A06054cE80a67Ed4DBd7ed3a', + sequencerInbox: '0x1c479675ad559DC151F6Ec7ed3FbF8ceE79582B6', + rollupEventInbox: '0x57Bd336d579A51938619271a7Cc137a46D0501B1', + outbox: '0x0B9857ae2D4A3DBe74ffE1d7DF045bb7F96E4840', + inbox: '0x4Dbd4fc535Ac27206064B68FfCf827b0A60BAB3f', + upgradeExecutor: '0x3ffFbAdAF827559da092217e474760E2b2c3CeDd', + }, + proxyAdmins: { + outbox: '0x554723262467f125ac9e1cdfa9ce15cc53822dbd', + inbox: '0x554723262467f125ac9e1cdfa9ce15cc53822dbd', + bridge: '0x554723262467f125ac9e1cdfa9ce15cc53822dbd', + rei: '0x554723262467f125ac9e1cdfa9ce15cc53822dbd', + seqInbox: '0x554723262467f125ac9e1cdfa9ce15cc53822dbd', + }, + settings: { + challengeGracePeriodBlocks: 14400, // 2 days + confirmPeriodBlocks: 45818, // same as old rollup, ~6.4 days + challengePeriodBlocks: 45818, // same as confirm period + stakeToken: '0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2', // WETH + stakeAmt: parseEther('3600'), + miniStakeAmounts: [parseEther('0'), parseEther('555'), parseEther('79')], + chainId: 42161, + anyTrustFastConfirmer: '0x0000000000000000000000000000000000000000', + disableValidatorWhitelist: true, + blockLeafSize: 1048576, // todo below + bigStepLeafSize: 512, + smallStepLeafSize: 128, + numBigStepLevel: 1, + maxDataSize: 117964, + isDelayBufferable: true, + bufferConfig: { + max: 14400, + threshold: 300, + replenishRateInBasis: 500, + }, + }, + validators: [ + '0x0ff813f6bd577c3d1cdbe435bac0621be6ae34b4', + '0x54c0d3d6c101580db3be8763a2ae2c6bb9dc840c', + '0x56d83349c2b8dcf74d7e92d5b6b33d0badd52d78', + '0x610aa279989f440820e14248bd3879b148717974', + '0x6fb914de4653ec5592b7c15f4d9466cbd03f2104', + '0x758c6bb08b3ea5889b5cddbdef9a45b3a983c398', + '0x7cf3d537733f6ba4183a833c9b021265716ce9d0', + '0x83215480db2c6a7e56f9e99ef93ab9b36f8a3dd5', + '0xab1a39332e934300ebcc57b5f95ca90631a347ff', + '0xb0cb1384e3f4a9a9b2447e39b05e10631e1d34b0', + '0xddf2f71ab206c0138a8eceeb54386567d5abf01e', + '0xf59caf75e8a4bfba4e6e07ad86c7e498e4d2519b', + '0xf8d3e1cf58386c92b27710c6a0d8a54c76bc6ab5', + ], +} diff --git a/contracts/scripts/files/configs/index.ts b/contracts/scripts/files/configs/index.ts new file mode 100644 index 000000000..ecd864a6c --- /dev/null +++ b/contracts/scripts/files/configs/index.ts @@ -0,0 +1,11 @@ +import { arb1 } from './arb1' +import { nova } from './nova' +import { sepolia } from './sepolia' +import { local } from './local' + +export const configs = { + arb1, + nova, + sepolia, + local, +} diff --git a/contracts/scripts/files/configs/local.ts b/contracts/scripts/files/configs/local.ts new file mode 100644 index 000000000..fba1380cd --- /dev/null +++ b/contracts/scripts/files/configs/local.ts @@ -0,0 +1,52 @@ +import { parseEther } from 'ethers/lib/utils' +import { Config } from '../../common' + +export const local: Config = { + contracts: { + bridge: '0x5eCF728ffC5C5E802091875f96281B5aeECf6C49', + inbox: '0x9f8c1c641336A371031499e3c362e40d58d0f254', + outbox: '0x50143333b44Ea46255BEb67255C9Afd35551072F', + rollup: '0xC3124dD1FA0e5D6135c25279760DBF9d9286467B', + sequencerInbox: '0x18d19C5d3E685f5be5b9C86E097f0E439285D216', + rollupEventInbox: '0x0e73faf857e1ca53e700856fcf19f31f920a1e3c', + upgradeExecutor: '0x513d9f96d4d0563debae8a0dc307ea0e46b10ed7', + l1Timelock: '0xC3124dD1FA0e5D6135c25279760DBF9d9286467B', + }, + proxyAdmins: { + outbox: '0x2a1f38c9097e7883570e0b02bfbe6869cc25d8a3', + inbox: '0x2a1f38c9097e7883570e0b02bfbe6869cc25d8a3', + bridge: '0x2a1f38c9097e7883570e0b02bfbe6869cc25d8a3', + rei: '0x2a1f38c9097e7883570e0b02bfbe6869cc25d8a3', + seqInbox: '0x2a1f38c9097e7883570e0b02bfbe6869cc25d8a3', + }, + settings: { + challengeGracePeriodBlocks: 10, + confirmPeriodBlocks: 100, + challengePeriodBlocks: 110, + stakeToken: '0x408Da76E87511429485C32E4Ad647DD14823Fdc4', + stakeAmt: parseEther('1'), + miniStakeAmounts: [ + parseEther('6'), + parseEther('5'), + parseEther('4'), + parseEther('3'), + parseEther('2'), + parseEther('1'), + ], + chainId: 412346, + anyTrustFastConfirmer: '0x6d903f6003cca6255D85CcA4D3B5E5146dC33925', + disableValidatorWhitelist: true, + blockLeafSize: 1048576, + bigStepLeafSize: 512, + smallStepLeafSize: 128, + numBigStepLevel: 4, + maxDataSize: 117964, + isDelayBufferable: true, + bufferConfig: { + max: 14400, + threshold: 300, + replenishRateInBasis: 500, + }, + }, + validators: ['0xf10EF80c6eF4930A62C5F9661c91339Df4dBB173'], +} diff --git a/contracts/scripts/files/configs/nova.ts b/contracts/scripts/files/configs/nova.ts new file mode 100644 index 000000000..88bf7fc88 --- /dev/null +++ b/contracts/scripts/files/configs/nova.ts @@ -0,0 +1,56 @@ +import { parseEther } from 'ethers/lib/utils' +import { Config } from '../../common' + +export const nova: Config = { + contracts: { + l1Timelock: '0xE6841D92B0C345144506576eC13ECf5103aC7f49', + rollup: '0xFb209827c58283535b744575e11953DCC4bEAD88', + bridge: '0xC1Ebd02f738644983b6C4B2d440b8e77DdE276Bd', + sequencerInbox: '0x211E1c4c7f1bF5351Ac850Ed10FD68CFfCF6c21b', + rollupEventInbox: '0x304807A7ed6c1296df2128E6ff3836e477329CD2', + outbox: '0xD4B80C3D7240325D18E645B49e6535A3Bf95cc58', + inbox: '0xc4448b71118c9071Bcb9734A0EAc55D18A153949', + upgradeExecutor: '0x3ffFbAdAF827559da092217e474760E2b2c3CeDd', + }, + proxyAdmins: { + outbox: '0x71d78dc7ccc0e037e12de1e50f5470903ce37148', + inbox: '0x71d78dc7ccc0e037e12de1e50f5470903ce37148', + bridge: '0x71d78dc7ccc0e037e12de1e50f5470903ce37148', + rei: '0x71d78dc7ccc0e037e12de1e50f5470903ce37148', + seqInbox: '0x71d78dc7ccc0e037e12de1e50f5470903ce37148', + }, + settings: { + challengeGracePeriodBlocks: 14400, + confirmPeriodBlocks: 50400, + challengePeriodBlocks: 51600, + stakeToken: '0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2', + stakeAmt: parseEther('1'), + miniStakeAmounts: [ + parseEther('6'), + parseEther('5'), + parseEther('4'), + parseEther('3'), + parseEther('2'), + parseEther('1'), + ], + chainId: 42161, + anyTrustFastConfirmer: '0x0000000000000000000000000000000000000000', + disableValidatorWhitelist: false, + blockLeafSize: 1048576, + bigStepLeafSize: 512, + smallStepLeafSize: 128, + numBigStepLevel: 4, + maxDataSize: 117964, + isDelayBufferable: true, + bufferConfig: { + max: 14400, + threshold: 300, + replenishRateInBasis: 500, + }, + }, + validators: [ + '0xE27d4Ed355e5273A3D4855c8e11BC4a8d3e39b87', + '0x57004b440Cc4eb2FEd8c4d1865FaC907F9150C76', + '0x24ca61c31c7f9af3ab104db6b9a444f28e9071e3', + ], +} diff --git a/contracts/scripts/files/configs/sepolia.ts b/contracts/scripts/files/configs/sepolia.ts new file mode 100644 index 000000000..d2063cfb4 --- /dev/null +++ b/contracts/scripts/files/configs/sepolia.ts @@ -0,0 +1,56 @@ +import { parseEther } from 'ethers/lib/utils' +import { Config } from '../../common' + +export const sepolia: Config = { + contracts: { + l1Timelock: '0x6EC62D826aDc24AeA360be9cF2647c42b9Cdb19b', + rollup: '0xd80810638dbDF9081b72C1B33c65375e807281C8', + bridge: '0x38f918D0E9F1b721EDaA41302E399fa1B79333a9', + sequencerInbox: '0x6c97864CE4bEf387dE0b3310A44230f7E3F1be0D', + rollupEventInbox: '0xD5B196dd7EC4D823ff5F695536c61f7c8E642B94', + outbox: '0x65f07C7D521164a4d5DaC6eB8Fac8DA067A3B78F', + inbox: '0xaAe29B0366299461418F5324a79Afc425BE5ae21', + upgradeExecutor: '0x5FEe78FE9AD96c1d8557C6D6BB22Eb5A61eeD315', + }, + proxyAdmins: { + outbox: '0xdd63bcaa89d7c3199ef220c1dd59c49f821078b8', + inbox: '0xdd63bcaa89d7c3199ef220c1dd59c49f821078b8', + bridge: '0xdd63bcaa89d7c3199ef220c1dd59c49f821078b8', + rei: '0xdd63bcaa89d7c3199ef220c1dd59c49f821078b8', + seqInbox: '0xdd63bcaa89d7c3199ef220c1dd59c49f821078b8', + }, + settings: { + challengeGracePeriodBlocks: 14400, + confirmPeriodBlocks: 50400, + challengePeriodBlocks: 51600, + stakeToken: '0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2', + stakeAmt: parseEther('1'), + miniStakeAmounts: [ + parseEther('6'), + parseEther('5'), + parseEther('4'), + parseEther('3'), + parseEther('2'), + parseEther('1'), + ], + chainId: 42161, + anyTrustFastConfirmer: '0x0000000000000000000000000000000000000000', + disableValidatorWhitelist: false, + blockLeafSize: 1048576, + bigStepLeafSize: 512, + smallStepLeafSize: 128, + numBigStepLevel: 4, + maxDataSize: 117964, + isDelayBufferable: true, + bufferConfig: { + max: 14400, + threshold: 300, + replenishRateInBasis: 500, + }, + }, + validators: [ + '0x8a8f0a24d7e58a76FC8F77bb68C7c902b91e182e', + '0x87630025E63A30eCf9Ca9d580d9D95922Fea6aF0', + '0xC32B93e581db6EBc50C08ce381143A259B92f1ED', + ], +} diff --git a/contracts/scripts/files/localConfig.json b/contracts/scripts/files/localConfig.json deleted file mode 100644 index e434c3fed..000000000 --- a/contracts/scripts/files/localConfig.json +++ /dev/null @@ -1,51 +0,0 @@ -{ - "contracts": { - "bridge": "0x5eCF728ffC5C5E802091875f96281B5aeECf6C49", - "inbox": "0x9f8c1c641336A371031499e3c362e40d58d0f254", - "outbox": "0x50143333b44Ea46255BEb67255C9Afd35551072F", - "rollup": "0xC3124dD1FA0e5D6135c25279760DBF9d9286467B", - "sequencerInbox": "0x18d19C5d3E685f5be5b9C86E097f0E439285D216", - "rollupEventInbox": "0x0e73faf857e1ca53e700856fcf19f31f920a1e3c", - "upgradeExecutor": "0x513d9f96d4d0563debae8a0dc307ea0e46b10ed7", - "l1Timelock": "0xC3124dD1FA0e5D6135c25279760DBF9d9286467B" - }, - "proxyAdmins": { - "outbox": "0x2a1f38c9097e7883570e0b02bfbe6869cc25d8a3", - "inbox": "0x2a1f38c9097e7883570e0b02bfbe6869cc25d8a3", - "bridge": "0x2a1f38c9097e7883570e0b02bfbe6869cc25d8a3", - "rei": "0x2a1f38c9097e7883570e0b02bfbe6869cc25d8a3", - "seqInbox": "0x2a1f38c9097e7883570e0b02bfbe6869cc25d8a3" - }, - "settings": { - "challengeGracePeriodBlocks": 10, - "confirmPeriodBlocks": 100, - "challengePeriodBlocks": 110, - "stakeToken": "0x408Da76E87511429485C32E4Ad647DD14823Fdc4", - "stakeAmt": "100000000000000000000", - "miniStakeAmounts": [ - "6000000000000000000", - "5000000000000000000", - "4000000000000000000", - "3000000000000000000", - "2000000000000000000", - "1000000000000000000" - ], - "chainId": 412346, - "anyTrustFastConfirmer": "0x6d903f6003cca6255D85CcA4D3B5E5146dC33925", - "disableValidatorWhitelist": true, - "blockLeafSize": 1048576, - "bigStepLeafSize": 512, - "smallStepLeafSize": 128, - "numBigStepLevel": 4, - "maxDataSize": 117964, - "isDelayBufferable": true, - "bufferConfig": { - "max": 14400, - "threshold": 300, - "replenishRateInBasis": 500 - } - }, - "validators": [ - "0xf10EF80c6eF4930A62C5F9661c91339Df4dBB173" - ] -} \ No newline at end of file diff --git a/contracts/scripts/files/localDeployedContracts.json b/contracts/scripts/files/localDeployedContracts.json deleted file mode 100644 index 7a73a41bf..000000000 --- a/contracts/scripts/files/localDeployedContracts.json +++ /dev/null @@ -1,2 +0,0 @@ -{ -} \ No newline at end of file diff --git a/contracts/scripts/files/localNetwork.json b/contracts/scripts/files/localNetwork.json deleted file mode 100644 index 4b1c7d4b0..000000000 --- a/contracts/scripts/files/localNetwork.json +++ /dev/null @@ -1,53 +0,0 @@ -{ - "l1Network": { - "blockTime": 10, - "chainID": 1337, - "explorerUrl": "", - "isCustom": true, - "name": "EthLocal", - "partnerChainIDs": [ - 412346 - ], - "isArbitrum": false - }, - "l2Network": { - "chainID": 412346, - "confirmPeriodBlocks": 20, - "ethBridge": { - "bridge": "0x9B4477cAD544fB092B1Bc551d88465f7F13a443F", - "inbox": "0xa5d8d368c4Fc06D71724d91561d6F2a880FD4fD9", - "outbox": "0xbBaAB28Ad701e822148411376975cca7E02323d7", - "rollup": "0x9c14dfd8e5c262f9652e78f2b0a13389ee41d717", - "sequencerInbox": "0xD2B20a3B8C1d97A64eFA1120D3339d87841ccAE1" - }, - "explorerUrl": "", - "isArbitrum": true, - "isCustom": true, - "name": "ArbLocal", - "partnerChainID": 1337, - "retryableLifetimeSeconds": 604800, - "nitroGenesisBlock": 0, - "nitroGenesisL1Block": 0, - "depositTimeout": 900000, - "tokenBridge": { - "l1CustomGateway": "0x1c924636933ceDE03245f19756662e92F851293D", - "l1ERC20Gateway": "0xeBef8abC1DF5853345f319D5ACcba1d01AECCBD8", - "l1GatewayRouter": "0x932Af0F51E02a8b371d00E7448Eb6e91c013274d", - "l1MultiCall": "0x4De74F7B2a30a1Ee39b374f6F11859c334234A79", - "l1ProxyAdmin": "0xFFB9cE193d5FE12360f47a93A97d72da65c35019", - "l1Weth": "0x525c2aBA45F66987217323E8a05EA400C65D06DC", - "l1WethGateway": "0x1990703B7C717008F34d5088C2838c07B6C6e97b", - "l2CustomGateway": "0xD53b0E696c16520308186bB7c64E3dE85be45Ab9", - "l2ERC20Gateway": "0x7e6C3A78da71Ed7d6f9D3f155C5756fB1129E19c", - "l2GatewayRouter": "0x614234364127E3D5De331A9f2cBeFaE6869168eB", - "l2Multicall": "0x9815277063378fa7dE6E9a8159181b2fd44d7956", - "l2ProxyAdmin": "0x1bd440c4b2361ac11c20b5CB2409e64cB82DDb30", - "l2Weth": "0x9ffAd12EE17abF43a060760f3d93932a3DE5EB72", - "l2WethGateway": "0xf2Ec70e05fab34580B26890544dF2fF04dc63521" - }, - "partnerChainIDs": [], - "blockTime": 0.25 - }, - "l1TokenBridgeCreator": "0x3DF948c956e14175f43670407d5796b95Bb219D8", - "retryableSender": "0xF5FfD11A55AFD39377411Ab9856474D2a7Cb697e" -} \ No newline at end of file diff --git a/contracts/scripts/files/mainnetConfig.json b/contracts/scripts/files/mainnetConfig.json deleted file mode 100644 index adf845499..000000000 --- a/contracts/scripts/files/mainnetConfig.json +++ /dev/null @@ -1,63 +0,0 @@ -{ - "contracts": { - "l1Timelock": "0xE6841D92B0C345144506576eC13ECf5103aC7f49", - "rollup": "0x5eF0D09d1E6204141B4d37530808eD19f60FBa35", - "bridge": "0x8315177aB297bA92A06054cE80a67Ed4DBd7ed3a", - "sequencerInbox": "0x1c479675ad559DC151F6Ec7ed3FbF8ceE79582B6", - "rollupEventInbox": "0x57Bd336d579A51938619271a7Cc137a46D0501B1", - "outbox": "0x0B9857ae2D4A3DBe74ffE1d7DF045bb7F96E4840", - "inbox": "0x4Dbd4fc535Ac27206064B68FfCf827b0A60BAB3f", - "upgradeExecutor": "0x3ffFbAdAF827559da092217e474760E2b2c3CeDd" - }, - "proxyAdmins": { - "outbox": "0x554723262467f125ac9e1cdfa9ce15cc53822dbd", - "inbox": "0x554723262467f125ac9e1cdfa9ce15cc53822dbd", - "bridge": "0x554723262467f125ac9e1cdfa9ce15cc53822dbd", - "rei": "0x554723262467f125ac9e1cdfa9ce15cc53822dbd", - "seqInbox": "0x554723262467f125ac9e1cdfa9ce15cc53822dbd" - }, - "settings": { - "challengeGracePeriodBlocks": 14400, - "confirmPeriodBlocks": 50400, - "challengePeriodBlocks": 51600, - "stakeToken": "0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2", - "stakeAmt": "100000000000000000000", - "miniStakeAmounts": [ - "6000000000000000000", - "5000000000000000000", - "4000000000000000000", - "3000000000000000000", - "2000000000000000000", - "1000000000000000000" - ], - "chainId": 42161, - "anyTrustFastConfirmer": "0x0000000000000000000000000000000000000000", - "disableValidatorWhitelist": false, - "blockLeafSize": 1048576, - "bigStepLeafSize": 512, - "smallStepLeafSize": 128, - "numBigStepLevel": 4, - "maxDataSize": 117964, - "isDelayBufferable": true, - "bufferConfig": { - "max": 14400, - "threshold": 300, - "replenishRateInBasis": 500 - } - }, - "validators": [ - "0x0ff813f6bd577c3d1cdbe435bac0621be6ae34b4", - "0x54c0d3d6c101580db3be8763a2ae2c6bb9dc840c", - "0x56d83349c2b8dcf74d7e92d5b6b33d0badd52d78", - "0x610aa279989f440820e14248bd3879b148717974", - "0x6fb914de4653ec5592b7c15f4d9466cbd03f2104", - "0x758c6bb08b3ea5889b5cddbdef9a45b3a983c398", - "0x7cf3d537733f6ba4183a833c9b021265716ce9d0", - "0x83215480db2c6a7e56f9e99ef93ab9b36f8a3dd5", - "0xab1a39332e934300ebcc57b5f95ca90631a347ff", - "0xb0cb1384e3f4a9a9b2447e39b05e10631e1d34b0", - "0xddf2f71ab206c0138a8eceeb54386567d5abf01e", - "0xf59caf75e8a4bfba4e6e07ad86c7e498e4d2519b", - "0xf8d3e1cf58386c92b27710c6a0d8a54c76bc6ab5" - ] -} diff --git a/contracts/scripts/files/mainnetDeployedContracts.json b/contracts/scripts/files/mainnetDeployedContracts.json deleted file mode 100644 index 9e26dfeeb..000000000 --- a/contracts/scripts/files/mainnetDeployedContracts.json +++ /dev/null @@ -1 +0,0 @@ -{} \ No newline at end of file diff --git a/contracts/scripts/files/novaConfig.json b/contracts/scripts/files/novaConfig.json deleted file mode 100644 index 5da09910a..000000000 --- a/contracts/scripts/files/novaConfig.json +++ /dev/null @@ -1,53 +0,0 @@ -{ - "contracts": { - "l1Timelock": "0xE6841D92B0C345144506576eC13ECf5103aC7f49", - "rollup": "0xFb209827c58283535b744575e11953DCC4bEAD88", - "bridge": "0xC1Ebd02f738644983b6C4B2d440b8e77DdE276Bd", - "sequencerInbox": "0x211E1c4c7f1bF5351Ac850Ed10FD68CFfCF6c21b", - "rollupEventInbox": "0x304807A7ed6c1296df2128E6ff3836e477329CD2", - "outbox": "0xD4B80C3D7240325D18E645B49e6535A3Bf95cc58", - "inbox": "0xc4448b71118c9071Bcb9734A0EAc55D18A153949", - "upgradeExecutor": "0x3ffFbAdAF827559da092217e474760E2b2c3CeDd" - }, - "proxyAdmins": { - "outbox": "0x71d78dc7ccc0e037e12de1e50f5470903ce37148", - "inbox": "0x71d78dc7ccc0e037e12de1e50f5470903ce37148", - "bridge": "0x71d78dc7ccc0e037e12de1e50f5470903ce37148", - "rei": "0x71d78dc7ccc0e037e12de1e50f5470903ce37148", - "seqInbox": "0x71d78dc7ccc0e037e12de1e50f5470903ce37148" - }, - "settings": { - "challengeGracePeriodBlocks": 14400, - "confirmPeriodBlocks": 50400, - "challengePeriodBlocks": 51600, - "stakeToken": "0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2", - "stakeAmt": "100000000000000000000", - "miniStakeAmounts": [ - "6000000000000000000", - "5000000000000000000", - "4000000000000000000", - "3000000000000000000", - "2000000000000000000", - "1000000000000000000" - ], - "chainId": 42161, - "anyTrustFastConfirmer": "0x0000000000000000000000000000000000000000", - "disableValidatorWhitelist": false, - "blockLeafSize": 1048576, - "bigStepLeafSize": 512, - "smallStepLeafSize": 128, - "numBigStepLevel": 4, - "maxDataSize": 117964, - "isDelayBufferable": true, - "bufferConfig": { - "max": 14400, - "threshold": 300, - "replenishRateInBasis": 500 - } - }, - "validators": [ - "0xE27d4Ed355e5273A3D4855c8e11BC4a8d3e39b87", - "0x57004b440Cc4eb2FEd8c4d1865FaC907F9150C76", - "0x24ca61c31c7f9af3ab104db6b9a444f28e9071e3" - ] -} diff --git a/contracts/scripts/files/novaDeployedContracts.json b/contracts/scripts/files/novaDeployedContracts.json deleted file mode 100644 index 9e26dfeeb..000000000 --- a/contracts/scripts/files/novaDeployedContracts.json +++ /dev/null @@ -1 +0,0 @@ -{} \ No newline at end of file diff --git a/contracts/scripts/files/sepoliaConfig.json b/contracts/scripts/files/sepoliaConfig.json deleted file mode 100644 index 22b97aeb4..000000000 --- a/contracts/scripts/files/sepoliaConfig.json +++ /dev/null @@ -1,53 +0,0 @@ -{ - "contracts": { - "l1Timelock": "0x6EC62D826aDc24AeA360be9cF2647c42b9Cdb19b", - "rollup": "0xd80810638dbDF9081b72C1B33c65375e807281C8", - "bridge": "0x38f918D0E9F1b721EDaA41302E399fa1B79333a9", - "sequencerInbox": "0x6c97864CE4bEf387dE0b3310A44230f7E3F1be0D", - "rollupEventInbox": "0xD5B196dd7EC4D823ff5F695536c61f7c8E642B94", - "outbox": "0x65f07C7D521164a4d5DaC6eB8Fac8DA067A3B78F", - "inbox": "0xaAe29B0366299461418F5324a79Afc425BE5ae21", - "upgradeExecutor": "0x5FEe78FE9AD96c1d8557C6D6BB22Eb5A61eeD315" - }, - "proxyAdmins": { - "outbox": "0xdd63bcaa89d7c3199ef220c1dd59c49f821078b8", - "inbox": "0xdd63bcaa89d7c3199ef220c1dd59c49f821078b8", - "bridge": "0xdd63bcaa89d7c3199ef220c1dd59c49f821078b8", - "rei": "0xdd63bcaa89d7c3199ef220c1dd59c49f821078b8", - "seqInbox": "0xdd63bcaa89d7c3199ef220c1dd59c49f821078b8" - }, - "settings": { - "challengeGracePeriodBlocks": 14400, - "confirmPeriodBlocks": 50400, - "challengePeriodBlocks": 51600, - "stakeToken": "0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2", - "stakeAmt": "100000000000000000000", - "miniStakeAmounts": [ - "6000000000000000000", - "5000000000000000000", - "4000000000000000000", - "3000000000000000000", - "2000000000000000000", - "1000000000000000000" - ], - "chainId": 42161, - "anyTrustFastConfirmer": "0x0000000000000000000000000000000000000000", - "disableValidatorWhitelist": false, - "blockLeafSize": 1048576, - "bigStepLeafSize": 512, - "smallStepLeafSize": 128, - "numBigStepLevel": 4, - "maxDataSize": 117964, - "isDelayBufferable": true, - "bufferConfig": { - "max": 14400, - "threshold": 300, - "replenishRateInBasis": 500 - } - }, - "validators": [ - "0x8a8f0a24d7e58a76FC8F77bb68C7c902b91e182e", - "0x87630025E63A30eCf9Ca9d580d9D95922Fea6aF0", - "0xC32B93e581db6EBc50C08ce381143A259B92f1ED" - ] -} diff --git a/contracts/scripts/files/sepoliaDeployedContracts.json b/contracts/scripts/files/sepoliaDeployedContracts.json deleted file mode 100644 index 9e26dfeeb..000000000 --- a/contracts/scripts/files/sepoliaDeployedContracts.json +++ /dev/null @@ -1 +0,0 @@ -{} \ No newline at end of file diff --git a/contracts/scripts/populateLookup.ts b/contracts/scripts/populateLookup.ts index 615d14c83..c13015d16 100644 --- a/contracts/scripts/populateLookup.ts +++ b/contracts/scripts/populateLookup.ts @@ -2,6 +2,7 @@ import { ethers, Wallet } from 'ethers' import { DeployedContracts, getConfig, getJsonFile } from './common' import { populateLookup } from './boldUpgradeFunctions' import dotenv from 'dotenv' +import path from 'path' dotenv.config() @@ -18,22 +19,26 @@ async function main() { } const wallet = new Wallet(l1PrivKey, l1Rpc) - const configLocation = process.env.CONFIG_LOCATION - if (!configLocation) { - throw new Error('CONFIG_LOCATION env variable not set') + const configNetworkName = process.env.CONFIG_NETWORK_NAME + if (!configNetworkName) { + throw new Error('CONFIG_NETWORK_NAME env variable not set') } - const config = await getConfig(configLocation, l1Rpc) + const config = await getConfig(configNetworkName, l1Rpc) - const deployedContractsLocation = process.env.DEPLOYED_CONTRACTS_LOCATION - if (!deployedContractsLocation) { - throw new Error('DEPLOYED_CONTRACTS_LOCATION env variable not set') + const deployedContractsDir = process.env.DEPLOYED_CONTRACTS_DIR + if (!deployedContractsDir) { + throw new Error('DEPLOYED_CONTRACTS_DIR env variable not set') } + const deployedContractsLocation = path.join( + deployedContractsDir, + configNetworkName + 'DeployedContracts.json' + ) const deployedContracts = getJsonFile( deployedContractsLocation ) as DeployedContracts if (!deployedContracts?.preImageHashLookup) { throw new Error( - 'preImageHashLookup not found in DEPLOYED_CONTRACTS_LOCATION' + 'preImageHashLookup not found in ' + deployedContractsLocation ) } diff --git a/contracts/scripts/prepareBoldUpgrade.ts b/contracts/scripts/prepareBoldUpgrade.ts index 51171d63d..4477ed846 100644 --- a/contracts/scripts/prepareBoldUpgrade.ts +++ b/contracts/scripts/prepareBoldUpgrade.ts @@ -7,6 +7,7 @@ import { } from './common' import { deployBoldUpgrade } from './boldUpgradeFunctions' import dotenv from 'dotenv' +import path from 'path' dotenv.config() @@ -23,16 +24,20 @@ async function main() { } const wallet = new Wallet(l1PrivKey, l1Rpc) - const configLocation = process.env.CONFIG_LOCATION - if (!configLocation) { - throw new Error('CONFIG_LOCATION env variable not set') + const configNetworkName = process.env.CONFIG_NETWORK_NAME + if (!configNetworkName) { + throw new Error('CONFIG_NETWORK_NAME env variable not set') } - const config = await getConfig(configLocation, l1Rpc) + const config = await getConfig(configNetworkName, l1Rpc) - const deployedContractsLocation = process.env.DEPLOYED_CONTRACTS_LOCATION - if (!deployedContractsLocation) { - throw new Error('DEPLOYED_CONTRACTS_LOCATION env variable not set') + const deployedContractsDir = process.env.DEPLOYED_CONTRACTS_DIR + if (!deployedContractsDir) { + throw new Error('DEPLOYED_CONTRACTS_DIR env variable not set') } + const deployedContractsLocation = path.join( + deployedContractsDir, + configNetworkName + 'DeployedContracts.json' + ) // if the deployed contracts exists then we load it and combine // if not, then we just use the newly created item diff --git a/contracts/scripts/testLocalExecuteBoldUpgrade.ts b/contracts/scripts/testLocalExecuteBoldUpgrade.ts index bea4d8250..24c5aab7a 100644 --- a/contracts/scripts/testLocalExecuteBoldUpgrade.ts +++ b/contracts/scripts/testLocalExecuteBoldUpgrade.ts @@ -19,6 +19,7 @@ import { RollupMigratedEvent } from '../build/types/src/rollup/BOLDUpgradeAction import { abi as OldRollupAbi } from './files/OldRollupUserLogic.json' import { JsonRpcProvider } from '@ethersproject/providers' import { getAddress } from 'ethers/lib/utils' +import path from 'path' dotenv.config() @@ -32,6 +33,13 @@ type VerificationParams = { receipt: ContractReceipt } +const executors: {[key: string]: string} = { + // DAO L1 Timelocks + arb1: '0xE6841D92B0C345144506576eC13ECf5103aC7f49', + nova: '0xE6841D92B0C345144506576eC13ECf5103aC7f49', + sepolia: '0x6EC62D826aDc24AeA360be9cF2647c42b9Cdb19b' +} + async function getPreUpgradeState(l1Rpc: JsonRpcProvider, config: Config) { const oldRollupContract = new Contract( config.contracts.rollup, @@ -64,9 +72,9 @@ async function perform( config: Config, deployedContracts: DeployedContracts ) { - const executor = process.env.EXECUTOR + const executor = executors[process.env.CONFIG_NETWORK_NAME!] if (!executor) { - throw new Error('EXECUTOR env variable not set') + throw new Error('no executor found for CONFIG_NETWORK_NAME or CONFIG_NETWORK_NAME not set') } await l1Rpc.send('hardhat_impersonateAccount', [executor]) @@ -593,15 +601,20 @@ async function main() { l1RpcVal ) as JsonRpcProvider - const deployedContractsLocation = process.env.DEPLOYED_CONTRACTS_LOCATION - if (!deployedContractsLocation) { - throw new Error('DEPLOYED_CONTRACTS_LOCATION env variable not set') + const configNetworkName = process.env.CONFIG_NETWORK_NAME + if (!configNetworkName) { + throw new Error('CONFIG_NETWORK_NAME env variable not set') } - const configLocation = process.env.CONFIG_LOCATION - if (!configLocation) { - throw new Error('CONFIG_LOCATION env variable not set') + const config = await getConfig(configNetworkName, l1Rpc) + + const deployedContractsDir = process.env.DEPLOYED_CONTRACTS_DIR + if (!deployedContractsDir) { + throw new Error('DEPLOYED_CONTRACTS_DIR env variable not set') } - const config = await getConfig(configLocation, l1Rpc) + const deployedContractsLocation = path.join( + deployedContractsDir, + configNetworkName + 'DeployedContracts.json' + ) const deployedContracts = getJsonFile( deployedContractsLocation