From 28f25b0061fb76b3f2fcec481a992ce15834bac8 Mon Sep 17 00:00:00 2001 From: Danil Date: Fri, 5 Apr 2024 18:46:08 +0200 Subject: [PATCH] fix(genesis): remove set-chain-id Signed-off-by: Danil --- core/bin/zksync_server/src/main.rs | 25 +++++++--------- etc/env/l1-inits/.init.env | 46 +++++++++++++++--------------- infrastructure/zk/src/init.ts | 3 +- infrastructure/zk/src/server.ts | 5 ++-- 4 files changed, 36 insertions(+), 43 deletions(-) diff --git a/core/bin/zksync_server/src/main.rs b/core/bin/zksync_server/src/main.rs index b581a7b95ef4..1e22bc12fc0f 100644 --- a/core/bin/zksync_server/src/main.rs +++ b/core/bin/zksync_server/src/main.rs @@ -38,9 +38,6 @@ struct Cli { /// Generate genesis block for the first contract deployment using temporary DB. #[arg(long)] genesis: bool, - /// Set chain id (temporary will be moved to genesis config) - #[arg(long)] - set_chain_id: bool, /// Rebuild tree. #[arg(long)] rebuild_tree: bool, @@ -177,19 +174,17 @@ async fn main() -> anyhow::Result<()> { .await .context("genesis_init")?; - if opt.set_chain_id { - let eth_client = configs.eth.as_ref().context("eth config")?; + let eth_client = configs.eth.as_ref().context("eth config")?; - if let Some(shared_bridge) = &genesis.shared_bridge { - genesis::save_set_chain_id_tx( - ð_client.web3_url, - contracts_config.diamond_proxy_addr, - shared_bridge.state_transition_proxy_addr, - &postgres_config, - ) - .await - .context("Failed to save SetChainId upgrade transaction")?; - } + if let Some(shared_bridge) = &genesis.shared_bridge { + genesis::save_set_chain_id_tx( + ð_client.web3_url, + contracts_config.diamond_proxy_addr, + shared_bridge.state_transition_proxy_addr, + &postgres_config, + ) + .await + .context("Failed to save SetChainId upgrade transaction")?; } if opt.genesis { diff --git a/etc/env/l1-inits/.init.env b/etc/env/l1-inits/.init.env index 5909f27b0422..9d7d2069926d 100644 --- a/etc/env/l1-inits/.init.env +++ b/etc/env/l1-inits/.init.env @@ -1,24 +1,24 @@ CONTRACTS_LATEST_PROTOCOL_VERSION=22 -CONTRACTS_CREATE2_FACTORY_ADDR=0x6ddE6E65B3f25Bc88AD344332D7f13208300730F -CONTRACTS_VERIFIER_ADDR=0x5b94C59840AcD21ED2CE7Df35A81189E3C46FE50 -CONTRACTS_L1_MULTICALL3_ADDR=0x2acBf641b5E263A6018f900e45Ae33347dcd2029 -CONTRACTS_L1_WETH_TOKEN_ADDR=0x2057c1216106DAAF708F384a23Ff1637d7756C45 -CONTRACTS_DEFAULT_UPGRADE_ADDR=0x62384B3A33Ae9540b28e4d6187257268C282B8B6 -CONTRACTS_GENESIS_UPGRADE_ADDR=0x0f0b6028dA4b805490594bea552eD708A21Cc248 -CONTRACTS_BRIDGEHUB_PROXY_ADDR=0xfb46A1758362f0ce318C8f767A10a0a18ea3970D -CONTRACTS_BRIDGEHUB_IMPL_ADDR=0x2386356B6BCbA77541c955eca797651ecc858f42 -CONTRACTS_STATE_TRANSITION_PROXY_ADDR=0xf533a4172edbcaa477Cb07BD667500591C8b2CB7 -CONTRACTS_STATE_TRANSITION_IMPL_ADDR=0xa63DC7FE6016aaf43f5a8465E51e9B7Cd4506001 -CONTRACTS_ADMIN_FACET_ADDR=0xE6fe8377a51ffB8e88e14aE87Bf487C0f94bEc2D -CONTRACTS_DIAMOND_INIT_ADDR=0x0C0681Fe2a5502cc18b014f16d120Fe510A7CCcA -CONTRACTS_GOVERNANCE_ADDR=0x75B428a71b306d4405D9afd6B9699411befBae26 -CONTRACTS_MAILBOX_FACET_ADDR=0xC7810bFB8dFc17B31eff3B008eD00a6600136f5A -CONTRACTS_EXECUTOR_FACET_ADDR=0x8A2A3838Cb04674dbD830B0e473b8c5EbF38aED4 -CONTRACTS_GETTERS_FACET_ADDR=0x3fA0DBDeA06a47e05227FCA41ae50df51832462a -CONTRACTS_VALIDATOR_TIMELOCK_ADDR=0xE830937648C8d7b05b0F2CD9F5e9ef452C060AE5 -CONTRACTS_TRANSPARENT_PROXY_ADMIN_ADDR=0x8019210b553EB8eB07258CFEB7fb0837DE815a9f -CONTRACTS_L1_SHARED_BRIDGE_IMPL_ADDR=0x90C4A04701cf120a400e4376996f3724EA67c0Dd -CONTRACTS_L1_ERC20_BRIDGE_PROXY_ADDR=0xEBA6a1Ea4BC3B28f694d440cacA2ef26de63ca6E -CONTRACTS_BLOB_VERSIONED_HASH_RETRIEVER_ADDR=0x9862BA6DcB30d565AeF392A125F2f1A9A8558Bad -CONTRACTS_L1_SHARED_BRIDGE_PROXY_ADDR=0x2A3C0bEdAa2CB19561f9e230792F6F50798F66b8 -CONTRACTS_L1_ERC20_BRIDGE_IMPL_ADDR=0x716A981818816C43a0Da100A1E08A152290f031a \ No newline at end of file +CONTRACTS_CREATE2_FACTORY_ADDR=0x68E57022bD00eae44De005524caeF8A238ad0124 +CONTRACTS_VERIFIER_ADDR=0x01629Cd731BEF9F25381232b318C2f84F5392bAe +CONTRACTS_L1_MULTICALL3_ADDR=0x5Ecc0aD5E551BdE0fdACc2B1696256F4b35A1E7c +CONTRACTS_L1_WETH_TOKEN_ADDR=0x476c0A9CC8cEd6CAD85f175A8bB7C2Af4Abf53b7 +CONTRACTS_DEFAULT_UPGRADE_ADDR=0x578C1CEe001dD530Cba049231BF614d148357147 +CONTRACTS_GENESIS_UPGRADE_ADDR=0xAee937AD192954109afE3f62fe9FAf0C8eAa1B8f +CONTRACTS_BRIDGEHUB_PROXY_ADDR=0x88a4C20aE29453B28C47EAe6678Bdc76cEeE1d02 +CONTRACTS_BRIDGEHUB_IMPL_ADDR=0xc78682ab1a6D2E98f3D96aFc98cC1F43a1E2eb81 +CONTRACTS_STATE_TRANSITION_PROXY_ADDR=0xC94bea9D704039898B0E8995B3465AF0E6817be4 +CONTRACTS_STATE_TRANSITION_IMPL_ADDR=0x7122B97A457e430DBF860938Bd31ac3f68d2f30E +CONTRACTS_ADMIN_FACET_ADDR=0x50Fb92107c90CD876dF24B8b1c9E92fab80dFfF4 +CONTRACTS_DIAMOND_INIT_ADDR=0xe520B5DF3FFB840Cfb8AC344b18A5f261E5ef323 +CONTRACTS_GOVERNANCE_ADDR=0x1508f838A039E659d71b24AcD034Cc8DE67DcA3B +CONTRACTS_MAILBOX_FACET_ADDR=0x8DDdD31F9B6E906d4cbeDC6577433D18C1A8BF2E +CONTRACTS_EXECUTOR_FACET_ADDR=0x957E216f86D4AC88b38Fe7b67CA66fF5a186985E +CONTRACTS_GETTERS_FACET_ADDR=0x6d367f81D870aA5d71c44b0d8021a5de1dED6f0A +CONTRACTS_VALIDATOR_TIMELOCK_ADDR=0xc8AdA976A58a273F9e9f95A5dde9c9B10FBf705c +CONTRACTS_TRANSPARENT_PROXY_ADMIN_ADDR=0x65924160770041BAF5188840Ed2e8Da4219800D1 +CONTRACTS_L1_SHARED_BRIDGE_IMPL_ADDR=0x0F91E1204a99BD3A6B6C7B5611Cc27A5Aa131a8d +CONTRACTS_L1_ERC20_BRIDGE_PROXY_ADDR=0x6A0AF1992A648Ce6c8497080Df12aA08f5B5163f +CONTRACTS_BLOB_VERSIONED_HASH_RETRIEVER_ADDR=0xD8905ffadD6C96a9e8109A54C6e62af2E4e2BEF4 +CONTRACTS_L1_SHARED_BRIDGE_PROXY_ADDR=0x64Fa9715d88eb114851530fE83c86B346AAfdd4C +CONTRACTS_L1_ERC20_BRIDGE_IMPL_ADDR=0x21CcAc72Bd8EB9658C28B682f21aBDe43D4A9E77 \ No newline at end of file diff --git a/infrastructure/zk/src/init.ts b/infrastructure/zk/src/init.ts index a0b0b7d8f6ef..4d8f33e7fc94 100644 --- a/infrastructure/zk/src/init.ts +++ b/infrastructure/zk/src/init.ts @@ -95,7 +95,6 @@ const deployTestTokens = async (options?: DeployTestTokensOptions) => { // Deploys and verifies L1 contracts and initializes governance const initBridgehubStateTransition = async () => { - await announced('Running server genesis setup', server.genesisFromSources({ setChainId: false })); await announced('Deploying L1 contracts', contract.deployL1([''])); await announced('Verifying L1 contracts', contract.verifyL1Contracts()); await announced('Initializing governance', contract.initializeGovernance()); @@ -106,7 +105,7 @@ const initBridgehubStateTransition = async () => { type InitHyperchainOptions = { includePaymaster: boolean; baseTokenName?: string }; const initHyperchain = async ({ includePaymaster, baseTokenName }: InitHyperchainOptions): Promise => { await announced('Registering Hyperchain', contract.registerHyperchain({ baseTokenName })); - await announced('Running server genesis setup', server.genesisFromSources({ setChainId: true })); + await announced('Running server genesis setup', server.genesisFromSources()); await announced('Deploying L2 contracts', contract.deployL2ThroughL1({ includePaymaster })); }; diff --git a/infrastructure/zk/src/server.ts b/infrastructure/zk/src/server.ts index 4ea28632b218..653906774f8a 100644 --- a/infrastructure/zk/src/server.ts +++ b/infrastructure/zk/src/server.ts @@ -63,10 +63,9 @@ async function create_genesis(cmd: string) { fs.copyFileSync('genesis.log', `logs/${label}/genesis.log`); } -export async function genesisFromSources(options?: { setChainId: boolean }) { - const args = [options?.setChainId ? '--set-chain-id' : '']; +export async function genesisFromSources() { // we fix chainId as we need all chains to have the same chainId at genesis - await create_genesis('cargo run --bin zksync_server --release -- --genesis ' + args.join(' ')); + await create_genesis('cargo run --bin zksync_server --release -- --genesis '); } export async function genesisFromBinary() {