Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: factory l2 erc20 removal #1762

Merged
merged 3 commits into from
Apr 22, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 1 addition & 4 deletions core/bin/external_node/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -206,10 +206,7 @@ async fn run_core(

let (persistence, miniblock_sealer) = StateKeeperPersistence::new(
connection_pool.clone(),
config
.remote
.l2_shared_bridge_addr
.unwrap_or_else(|| config.remote.l2_erc20_bridge_addr.unwrap()),
config.remote.l2_shared_bridge_addr.unwrap(),
config.optional.miniblock_seal_queue_capacity,
);
task_handles.push(tokio::spawn(miniblock_sealer.run()));
Expand Down
10 changes: 9 additions & 1 deletion core/lib/env_config/src/contracts.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,15 @@ use crate::{envy_load, FromEnv};

impl FromEnv for ContractsConfig {
fn from_env() -> anyhow::Result<Self> {
envy_load("contracts", "CONTRACTS_")
let mut contracts: ContractsConfig = envy_load("contracts", "CONTRACTS_")?;
// Note: we are renaming the bridge, the address remains the same
contracts.l2_erc20_bridge_addr = contracts
.l2_erc20_bridge_addr
.or(contracts.l2_shared_bridge_addr);
contracts.l2_shared_bridge_addr = contracts
.l2_shared_bridge_addr
.or(contracts.l2_erc20_bridge_addr);
Ok(contracts)
}
}

Expand Down
4 changes: 1 addition & 3 deletions core/lib/zksync_core/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -853,9 +853,7 @@ async fn add_state_keeper_to_task_futures(
.context("failed to build miniblock_sealer_pool")?;
let (persistence, miniblock_sealer) = StateKeeperPersistence::new(
miniblock_sealer_pool,
contracts_config
.l2_shared_bridge_addr
.unwrap_or_else(|| contracts_config.l2_erc20_bridge_addr.unwrap()),
contracts_config.l2_shared_bridge_addr.unwrap(),
state_keeper_config.l2_block_seal_queue_capacity,
);
task_futures.push(tokio::spawn(miniblock_sealer.run()));
Expand Down
10 changes: 5 additions & 5 deletions core/lib/zksync_core/src/state_keeper/io/persistence.rs
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ struct Completable<T> {
#[derive(Debug)]
pub struct StateKeeperPersistence {
pool: ConnectionPool<Core>,
l2_erc20_bridge_addr: Address,
l2_shared_bridge_addr: Address,
pre_insert_txs: bool,
insert_protective_reads: bool,
commands_sender: mpsc::Sender<Completable<L2BlockSealCommand>>,
Expand All @@ -42,7 +42,7 @@ impl StateKeeperPersistence {
/// `command_capacity` for unprocessed sealing commands.
pub fn new(
pool: ConnectionPool<Core>,
l2_erc20_bridge_addr: Address,
l2_shared_bridge_addr: Address,
mut command_capacity: usize,
) -> (Self, L2BlockSealerTask) {
let is_sync = command_capacity == 0;
Expand All @@ -57,7 +57,7 @@ impl StateKeeperPersistence {
};
let this = Self {
pool,
l2_erc20_bridge_addr,
l2_shared_bridge_addr,
pre_insert_txs: false,
insert_protective_reads: true,
commands_sender,
Expand Down Expand Up @@ -150,7 +150,7 @@ impl StateKeeperPersistence {
impl StateKeeperOutputHandler for StateKeeperPersistence {
async fn handle_l2_block(&mut self, updates_manager: &UpdatesManager) -> anyhow::Result<()> {
let command =
updates_manager.seal_l2_block_command(self.l2_erc20_bridge_addr, self.pre_insert_txs);
updates_manager.seal_l2_block_command(self.l2_shared_bridge_addr, self.pre_insert_txs);
self.submit_l2_block(command).await;
Ok(())
}
Expand All @@ -165,7 +165,7 @@ impl StateKeeperOutputHandler for StateKeeperPersistence {
updates_manager
.seal_l1_batch(
&mut storage,
self.l2_erc20_bridge_addr,
self.l2_shared_bridge_addr,
self.insert_protective_reads,
)
.await
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -86,9 +86,7 @@ impl WiringLayer for MempoolIOLayer {
.get_singleton()
.await
.context("Get master pool")?,
self.contracts_config
.l2_shared_bridge_addr
.unwrap_or_else(|| self.contracts_config.l2_erc20_bridge_addr.unwrap()),
self.contracts_config.l2_shared_bridge_addr.unwrap(),
self.state_keeper_config.l2_block_seal_queue_capacity,
);
let output_handler = OutputHandler::new(Box::new(persistence));
Expand Down
2 changes: 2 additions & 0 deletions infrastructure/protocol-upgrade/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -146,6 +146,8 @@ You can generate calldata using the Complex Upgrader contract.
`delegatedCalldata` field of the L2Upgrade file.
- `use-contract-deployer`: Using this parameter, the tool will prepare calldata using the ContractDeployer contract.
This skips the delegation step of the Complex Upgrader contract. This is mostly needed for the very first upgrade.
- `--system-contracts-with-constructor`: Using this parameter and passing some system contract addresses, the
constructor to the list of the provided system contracts will be called.

```bash
$ zk f yarn start l2-transaction complex-upgrader-calldata \
Expand Down
Loading