From 829c9dcee7fc45955c9f32c0958c50c87b49382d Mon Sep 17 00:00:00 2001 From: Stanislav Breadless Date: Fri, 11 Oct 2024 13:22:56 +0200 Subject: [PATCH 1/9] fix correct l2 bridge address --- .../deploy_l2_contracts/input.rs | 17 ++++++++++------- .../src/commands/chain/deploy_l2_contracts.rs | 2 +- 2 files changed, 11 insertions(+), 8 deletions(-) diff --git a/zk_toolbox/crates/config/src/forge_interface/deploy_l2_contracts/input.rs b/zk_toolbox/crates/config/src/forge_interface/deploy_l2_contracts/input.rs index b20b58f99c58..c2632f2cf742 100644 --- a/zk_toolbox/crates/config/src/forge_interface/deploy_l2_contracts/input.rs +++ b/zk_toolbox/crates/config/src/forge_interface/deploy_l2_contracts/input.rs @@ -2,7 +2,7 @@ use ethers::types::Address; use serde::{Deserialize, Serialize}; use zksync_basic_types::L2ChainId; -use crate::{traits::ZkToolboxConfig, ChainConfig}; +use crate::{traits::ZkToolboxConfig, ChainConfig, EcosystemConfig}; impl ZkToolboxConfig for DeployL2ContractsInput {} @@ -20,17 +20,20 @@ pub struct DeployL2ContractsInput { } impl DeployL2ContractsInput { - pub fn new(chain_config: &ChainConfig, era_chain_id: L2ChainId) -> anyhow::Result { - let contracts = chain_config.get_contracts_config()?; - let wallets = chain_config.get_wallets_config()?; + pub fn new( + ecosystem_config: &EcosystemConfig, + chain_config: &ChainConfig, + ) -> anyhow::Result { + let contracts = ecosystem_config.get_contracts_config()?; Ok(Self { - era_chain_id, + era_chain_id: ecosystem_config.era_chain_id, chain_id: chain_config.chain_id, l1_shared_bridge: contracts.bridges.shared.l1_address, bridgehub: contracts.ecosystem_contracts.bridgehub_proxy_addr, - governance: wallets.governor.address, + governance: contracts.l1.governance_addr, erc20_bridge: contracts.bridges.erc20.l1_address, - consensus_registry_owner: wallets.governor.address, + // FIXME: check whether it should be aliased. + consensus_registry_owner: contracts.l1.governance_addr, }) } } diff --git a/zk_toolbox/crates/zk_inception/src/commands/chain/deploy_l2_contracts.rs b/zk_toolbox/crates/zk_inception/src/commands/chain/deploy_l2_contracts.rs index 26a1d0bb3251..330c05686bdc 100644 --- a/zk_toolbox/crates/zk_inception/src/commands/chain/deploy_l2_contracts.rs +++ b/zk_toolbox/crates/zk_inception/src/commands/chain/deploy_l2_contracts.rs @@ -220,7 +220,7 @@ async fn call_forge( forge_args: ForgeScriptArgs, signature: Option<&str>, ) -> anyhow::Result<()> { - let input = DeployL2ContractsInput::new(chain_config, ecosystem_config.era_chain_id)?; + let input = DeployL2ContractsInput::new(ecosystem_config, chain_config)?; let foundry_contracts_path = chain_config.path_to_foundry(); let secrets = chain_config.get_secrets_config()?; input.save( From 44db9c195d4bdf92fae7d4fc8a00b3e25768eca4 Mon Sep 17 00:00:00 2001 From: Stanislav Breadless Date: Mon, 14 Oct 2024 15:55:24 +0200 Subject: [PATCH 2/9] fix toolbox --- .../config/src/forge_interface/deploy_ecosystem/input.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/zk_toolbox/crates/config/src/forge_interface/deploy_ecosystem/input.rs b/zk_toolbox/crates/config/src/forge_interface/deploy_ecosystem/input.rs index 30ec0eeb9c48..90a31e652691 100644 --- a/zk_toolbox/crates/config/src/forge_interface/deploy_ecosystem/input.rs +++ b/zk_toolbox/crates/config/src/forge_interface/deploy_ecosystem/input.rs @@ -9,7 +9,7 @@ use serde::{Deserialize, Serialize}; use zksync_basic_types::L2ChainId; use crate::{ - consts::INITIAL_DEPLOYMENT_FILE, + consts::INITIAL_DEPLOYMENT_FILE, ERC20_DEPLOYMENT_FILE, traits::{FileConfigWithDefaultName, ZkToolboxConfig}, ContractsConfig, GenesisConfig, WalletsConfig, }; @@ -69,7 +69,7 @@ pub struct Erc20DeploymentConfig { } impl FileConfigWithDefaultName for Erc20DeploymentConfig { - const FILE_NAME: &'static str = INITIAL_DEPLOYMENT_FILE; + const FILE_NAME: &'static str = ERC20_DEPLOYMENT_FILE; } impl ZkToolboxConfig for Erc20DeploymentConfig {} From a5e87f47abcfcafc09c534c47d3a7e06a4980d6c Mon Sep 17 00:00:00 2001 From: Stanislav Breadless Date: Mon, 25 Nov 2024 12:30:34 +0100 Subject: [PATCH 3/9] latest contracts --- contracts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/contracts b/contracts index 9fb1264fce8c..46d75088e7dd 160000 --- a/contracts +++ b/contracts @@ -1 +1 @@ -Subproject commit 9fb1264fce8c0ebeefe8bf1846e89876027161d2 +Subproject commit 46d75088e7ddb534101874c3ec15b877da1cb417 From 062058a14ec3b6f0436271a7ab3acce89b727c98 Mon Sep 17 00:00:00 2001 From: Stanislav Breadless Date: Mon, 25 Nov 2024 12:32:32 +0100 Subject: [PATCH 4/9] fmt --- .../config/src/forge_interface/deploy_ecosystem/input.rs | 4 ++-- .../config/src/forge_interface/deploy_l2_contracts/input.rs | 6 +++--- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/zkstack_cli/crates/config/src/forge_interface/deploy_ecosystem/input.rs b/zkstack_cli/crates/config/src/forge_interface/deploy_ecosystem/input.rs index 982c9776e556..b42feac1c345 100644 --- a/zkstack_cli/crates/config/src/forge_interface/deploy_ecosystem/input.rs +++ b/zkstack_cli/crates/config/src/forge_interface/deploy_ecosystem/input.rs @@ -9,9 +9,9 @@ use serde::{Deserialize, Serialize}; use zksync_basic_types::L2ChainId; use crate::{ - consts::INITIAL_DEPLOYMENT_FILE, ERC20_DEPLOYMENT_FILE, + consts::INITIAL_DEPLOYMENT_FILE, traits::{FileConfigWithDefaultName, ZkToolboxConfig}, - ContractsConfig, GenesisConfig, WalletsConfig, + ContractsConfig, GenesisConfig, WalletsConfig, ERC20_DEPLOYMENT_FILE, }; #[derive(Debug, Deserialize, Serialize, Clone)] diff --git a/zkstack_cli/crates/config/src/forge_interface/deploy_l2_contracts/input.rs b/zkstack_cli/crates/config/src/forge_interface/deploy_l2_contracts/input.rs index a01a0e5b141a..9b5dc38950e6 100644 --- a/zkstack_cli/crates/config/src/forge_interface/deploy_l2_contracts/input.rs +++ b/zkstack_cli/crates/config/src/forge_interface/deploy_l2_contracts/input.rs @@ -21,9 +21,9 @@ pub struct DeployL2ContractsInput { impl DeployL2ContractsInput { pub fn new( - ecosystem_config: &EcosystemConfig, - chain_config: &ChainConfig, - ) -> anyhow::Result { + ecosystem_config: &EcosystemConfig, + chain_config: &ChainConfig, + ) -> anyhow::Result { let contracts = ecosystem_config.get_contracts_config()?; Ok(Self { era_chain_id: ecosystem_config.era_chain_id, From 493c15aa65ee99435e5a75189af345539bcec567 Mon Sep 17 00:00:00 2001 From: Stanislav Breadless Date: Mon, 25 Nov 2024 12:37:21 +0100 Subject: [PATCH 5/9] fmt --- .../config/src/forge_interface/deploy_l2_contracts/input.rs | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/zkstack_cli/crates/config/src/forge_interface/deploy_l2_contracts/input.rs b/zkstack_cli/crates/config/src/forge_interface/deploy_l2_contracts/input.rs index 9b5dc38950e6..906f15a2454b 100644 --- a/zkstack_cli/crates/config/src/forge_interface/deploy_l2_contracts/input.rs +++ b/zkstack_cli/crates/config/src/forge_interface/deploy_l2_contracts/input.rs @@ -32,8 +32,7 @@ impl DeployL2ContractsInput { bridgehub: contracts.ecosystem_contracts.bridgehub_proxy_addr, governance: contracts.l1.governance_addr, erc20_bridge: contracts.bridges.erc20.l1_address, - // FIXME: check whether it should be aliased. - consensus_registry_owner: contracts.l1.governance_addr, + consensus_registry_owner: wallets.governor.address, }) } } From 601666fde845cec31407cd93d3e5568b1f9602ad Mon Sep 17 00:00:00 2001 From: Stanislav Breadless Date: Mon, 25 Nov 2024 12:45:23 +0100 Subject: [PATCH 6/9] fix fmt --- .../crates/config/src/forge_interface/deploy_ecosystem/input.rs | 2 +- .../config/src/forge_interface/deploy_l2_contracts/input.rs | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/zkstack_cli/crates/config/src/forge_interface/deploy_ecosystem/input.rs b/zkstack_cli/crates/config/src/forge_interface/deploy_ecosystem/input.rs index b42feac1c345..17b2bac38a3f 100644 --- a/zkstack_cli/crates/config/src/forge_interface/deploy_ecosystem/input.rs +++ b/zkstack_cli/crates/config/src/forge_interface/deploy_ecosystem/input.rs @@ -10,7 +10,7 @@ use zksync_basic_types::L2ChainId; use crate::{ consts::INITIAL_DEPLOYMENT_FILE, - traits::{FileConfigWithDefaultName, ZkToolboxConfig}, + traits::{FileConfigWithDefaultName, ZkStackConfig}, ContractsConfig, GenesisConfig, WalletsConfig, ERC20_DEPLOYMENT_FILE, }; diff --git a/zkstack_cli/crates/config/src/forge_interface/deploy_l2_contracts/input.rs b/zkstack_cli/crates/config/src/forge_interface/deploy_l2_contracts/input.rs index 906f15a2454b..fff2d1f1fb82 100644 --- a/zkstack_cli/crates/config/src/forge_interface/deploy_l2_contracts/input.rs +++ b/zkstack_cli/crates/config/src/forge_interface/deploy_l2_contracts/input.rs @@ -25,6 +25,7 @@ impl DeployL2ContractsInput { chain_config: &ChainConfig, ) -> anyhow::Result { let contracts = ecosystem_config.get_contracts_config()?; + let wallets = chain_config.get_wallets_config()?; Ok(Self { era_chain_id: ecosystem_config.era_chain_id, chain_id: chain_config.chain_id, From cb5f8f0243ca1fe7db9584c40c716e7b847803e5 Mon Sep 17 00:00:00 2001 From: Stanislav Breadless Date: Fri, 29 Nov 2024 10:51:51 +0100 Subject: [PATCH 7/9] respond to comments --- .../forge_interface/deploy_l2_contracts/input.rs | 15 ++++++++------- .../src/commands/chain/deploy_l2_contracts.rs | 6 +++++- 2 files changed, 13 insertions(+), 8 deletions(-) diff --git a/zkstack_cli/crates/config/src/forge_interface/deploy_l2_contracts/input.rs b/zkstack_cli/crates/config/src/forge_interface/deploy_l2_contracts/input.rs index fff2d1f1fb82..9d56440ea981 100644 --- a/zkstack_cli/crates/config/src/forge_interface/deploy_l2_contracts/input.rs +++ b/zkstack_cli/crates/config/src/forge_interface/deploy_l2_contracts/input.rs @@ -21,18 +21,19 @@ pub struct DeployL2ContractsInput { impl DeployL2ContractsInput { pub fn new( - ecosystem_config: &EcosystemConfig, + ecosystem_govenor_addr: Address, + era_chain_id: L2ChainId, chain_config: &ChainConfig, ) -> anyhow::Result { - let contracts = ecosystem_config.get_contracts_config()?; + let chain_contracts = chain_config.get_contracts_config()?; let wallets = chain_config.get_wallets_config()?; Ok(Self { - era_chain_id: ecosystem_config.era_chain_id, + era_chain_id: era_chain_id, chain_id: chain_config.chain_id, - l1_shared_bridge: contracts.bridges.shared.l1_address, - bridgehub: contracts.ecosystem_contracts.bridgehub_proxy_addr, - governance: contracts.l1.governance_addr, - erc20_bridge: contracts.bridges.erc20.l1_address, + l1_shared_bridge: chain_contracts.bridges.shared.l1_address, + bridgehub: chain_contracts.ecosystem_contracts.bridgehub_proxy_addr, + governance: ecosystem_govenor_addr, + erc20_bridge: chain_contracts.bridges.erc20.l1_address, consensus_registry_owner: wallets.governor.address, }) } diff --git a/zkstack_cli/crates/zkstack/src/commands/chain/deploy_l2_contracts.rs b/zkstack_cli/crates/zkstack/src/commands/chain/deploy_l2_contracts.rs index 1312a915c2f2..6c8df4b12ec6 100644 --- a/zkstack_cli/crates/zkstack/src/commands/chain/deploy_l2_contracts.rs +++ b/zkstack_cli/crates/zkstack/src/commands/chain/deploy_l2_contracts.rs @@ -283,7 +283,11 @@ async fn call_forge( forge_args: ForgeScriptArgs, signature: Option<&str>, ) -> anyhow::Result<()> { - let input = DeployL2ContractsInput::new(ecosystem_config, chain_config)?; + let input = DeployL2ContractsInput::new( + ecosystem_config.get_contracts_config().context("ecosystem contracts mmissing")?.l1.governance_addr, + ecosystem_config.era_chain_id, + chain_config + )?; let foundry_contracts_path = chain_config.path_to_foundry(); let secrets = chain_config.get_secrets_config()?; input.save( From 03e6c7bb9215839abe22c2e5578d7105a1043edb Mon Sep 17 00:00:00 2001 From: Stanislav Breadless Date: Fri, 29 Nov 2024 10:53:28 +0100 Subject: [PATCH 8/9] fmt --- .../zkstack/src/commands/chain/deploy_l2_contracts.rs | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/zkstack_cli/crates/zkstack/src/commands/chain/deploy_l2_contracts.rs b/zkstack_cli/crates/zkstack/src/commands/chain/deploy_l2_contracts.rs index 58d4f7bccc4b..4cdcf271b9b9 100644 --- a/zkstack_cli/crates/zkstack/src/commands/chain/deploy_l2_contracts.rs +++ b/zkstack_cli/crates/zkstack/src/commands/chain/deploy_l2_contracts.rs @@ -284,9 +284,13 @@ async fn call_forge( signature: Option<&str>, ) -> anyhow::Result<()> { let input = DeployL2ContractsInput::new( - ecosystem_config.get_contracts_config().context("ecosystem contracts mmissing")?.l1.governance_addr, - ecosystem_config.era_chain_id, - chain_config + ecosystem_config + .get_contracts_config() + .context("ecosystem contracts mmissing")? + .l1 + .governance_addr, + ecosystem_config.era_chain_id, + chain_config, )?; let foundry_contracts_path = chain_config.path_to_foundry(); let secrets = chain_config.get_secrets_config()?; From b7fa1721941001c1dafb32bb435341806526f75c Mon Sep 17 00:00:00 2001 From: Stanislav Breadless Date: Tue, 3 Dec 2024 13:56:48 +0100 Subject: [PATCH 9/9] test --- core/tests/ts-integration/tests/ether.test.ts | 4 ++-- core/tests/ts-integration/tests/l1.test.ts | 4 +--- 2 files changed, 3 insertions(+), 5 deletions(-) diff --git a/core/tests/ts-integration/tests/ether.test.ts b/core/tests/ts-integration/tests/ether.test.ts index 4e6b2eb0ef3d..afd8aec81972 100644 --- a/core/tests/ts-integration/tests/ether.test.ts +++ b/core/tests/ts-integration/tests/ether.test.ts @@ -60,7 +60,7 @@ describe('ETH token checks', () => { const l2GasLimit = await zksync.utils.estimateDefaultBridgeDepositL2Gas( alice.providerL1!, alice.provider, - zksync.utils.ETH_ADDRESS, + zksync.utils.ETH_ADDRESS_IN_CONTRACTS, amount, alice.address, alice.address, @@ -73,7 +73,7 @@ describe('ETH token checks', () => { }); const depositOp = alice.deposit({ - token: zksync.utils.ETH_ADDRESS, + token: zksync.utils.ETH_ADDRESS_IN_CONTRACTS, amount, gasPerPubdataByte, l2GasLimit, diff --git a/core/tests/ts-integration/tests/l1.test.ts b/core/tests/ts-integration/tests/l1.test.ts index 0f8466ec463b..2ceeb926d47d 100644 --- a/core/tests/ts-integration/tests/l1.test.ts +++ b/core/tests/ts-integration/tests/l1.test.ts @@ -144,9 +144,7 @@ describe('Tests for L1 behavior', () => { expect(msgProof).toBeTruthy(); // Ensure that received proof matches the provided root hash. - const { id, proof, root } = msgProof!; - const accumulatedRoot = calculateAccumulatedRoot(alice.address, message, receipt.l1BatchTxIndex!, id, proof); - expect(accumulatedRoot).toBe(root); + const { id, proof } = msgProof!; // Ensure that provided proof is accepted by the main ZKsync contract. const chainContract = await alice.getMainContract();