diff --git a/core/bin/zksync_server/src/main.rs b/core/bin/zksync_server/src/main.rs index 51e7b409c9a0..52c4602040da 100644 --- a/core/bin/zksync_server/src/main.rs +++ b/core/bin/zksync_server/src/main.rs @@ -10,6 +10,7 @@ use zksync_config::{ StateKeeperConfig, TimestampAsserterConfig, }, fri_prover_group::FriProverGroupConfig, + gateway::GatewayChainConfig, house_keeper::HouseKeeperConfig, BasicWitnessInputProducerConfig, ContractsConfig, DataAvailabilitySecrets, DatabaseSecrets, ExperimentalVmConfig, ExternalPriceApiClientConfig, FriProofCompressorConfig, @@ -25,7 +26,7 @@ use zksync_core_leftovers::{ temp_config_store::{read_yaml_repr, TempConfigStore}, Component, Components, }; -use zksync_env_config::FromEnv; +use zksync_env_config::{FromEnv, FromEnvVariant}; use crate::node_builder::MainNodeBuilder; @@ -56,6 +57,9 @@ struct Cli { /// Path to the yaml with contracts. If set, it will be used instead of env vars. #[arg(long)] contracts_config_path: Option, + /// Path to the yaml with contracts. If set, it will be used instead of env vars. + #[arg(long)] + gateway_contracts_config_path: Option, /// Path to the wallets config. If set, it will be used instead of env vars. #[arg(long)] wallets_path: Option, @@ -126,6 +130,33 @@ fn main() -> anyhow::Result<()> { .context("failed decoding contracts YAML config")?, }; + let gateway_contracts_config: Option = match opt + .gateway_contracts_config_path + { + None => { + let gateway_chain_id = std::env::var("GATEWAY_CONTRACTS_GATEWAY_CHAIN_ID") + .ok() + .and_then(|x| x.parse::().ok()); + let contracts = ContractsConfig::from_env_variant("GATEWAY_".to_string()).ok(); + match (gateway_chain_id, contracts) { + (Some(gateway_chain_id), Some(contracts)) => { + Some(GatewayChainConfig::from_contracts_and_chain_id( + contracts, + gateway_chain_id.into(), + )) + } + _ => None, + } + } + Some(path) => { + let result = + read_yaml_repr::(&path) + .context("failed decoding contracts YAML config")?; + + Some(result) + } + }; + let genesis = match opt.genesis_path { None => GenesisConfig::from_env().context("Genesis config")?, Some(path) => read_yaml_repr::(&path) @@ -136,7 +167,14 @@ fn main() -> anyhow::Result<()> { .clone() .context("observability config")?; - let node = MainNodeBuilder::new(configs, wallets, genesis, contracts_config, secrets)?; + let node = MainNodeBuilder::new( + configs, + wallets, + genesis, + contracts_config, + gateway_contracts_config, + secrets, + )?; let observability_guard = { // Observability initialization should be performed within tokio context. diff --git a/core/bin/zksync_server/src/node_builder.rs b/core/bin/zksync_server/src/node_builder.rs index d74928e8fbc7..940e368b3c3b 100644 --- a/core/bin/zksync_server/src/node_builder.rs +++ b/core/bin/zksync_server/src/node_builder.rs @@ -6,8 +6,8 @@ use std::time::Duration; use anyhow::{bail, Context}; use zksync_config::{ configs::{ - da_client::DAClientConfig, secrets::DataAvailabilitySecrets, wallets::Wallets, - GeneralConfig, Secrets, + da_client::DAClientConfig, gateway::GatewayChainConfig, secrets::DataAvailabilitySecrets, + wallets::Wallets, GeneralConfig, Secrets, }, ContractsConfig, GenesisConfig, }; @@ -72,7 +72,10 @@ use zksync_node_framework::{ service::{ZkStackService, ZkStackServiceBuilder}, }; use zksync_types::{ - pubdata_da::PubdataSendingMode, settlement::SettlementMode, SHARED_BRIDGE_ETHER_TOKEN_ADDRESS, + commitment::{L1BatchCommitmentMode, PubdataType}, + pubdata_da::PubdataSendingMode, + settlement::SettlementMode, + SHARED_BRIDGE_ETHER_TOKEN_ADDRESS, }; use zksync_vlog::prometheus::PrometheusExporterConfig; @@ -90,6 +93,7 @@ pub struct MainNodeBuilder { wallets: Wallets, genesis_config: GenesisConfig, contracts_config: ContractsConfig, + gateway_contracts_config: Option, secrets: Secrets, } @@ -99,6 +103,7 @@ impl MainNodeBuilder { wallets: Wallets, genesis_config: GenesisConfig, contracts_config: ContractsConfig, + gateway_contracts_config: Option, secrets: Secrets, ) -> anyhow::Result { Ok(Self { @@ -107,6 +112,7 @@ impl MainNodeBuilder { wallets, genesis_config, contracts_config, + gateway_contracts_config, secrets, }) } @@ -115,6 +121,24 @@ impl MainNodeBuilder { self.node.runtime_handle() } + pub fn get_pubdata_type(&self) -> PubdataType { + if self.genesis_config.l1_batch_commit_data_generator_mode == L1BatchCommitmentMode::Rollup + { + return PubdataType::Rollup; + } + + let Some(da_client_config) = self.configs.da_client_config.clone() else { + return PubdataType::NoDA; + }; + + match da_client_config { + DAClientConfig::Avail(_) => PubdataType::Avail, + DAClientConfig::Celestia(_) => PubdataType::Celestia, + DAClientConfig::Eigen(_) => PubdataType::Eigen, + DAClientConfig::ObjectStore(_) => PubdataType::ObjectStore, + } + } + fn add_sigint_handler_layer(mut self) -> anyhow::Result { self.node.add_layer(SigintHandlerLayer); Ok(self) @@ -149,7 +173,7 @@ impl MainNodeBuilder { self.node.add_layer(PKSigningEthClientLayer::new( eth_config, self.contracts_config.clone(), - self.genesis_config.settlement_layer_id(), + self.gateway_contracts_config.clone(), wallets, )); Ok(self) @@ -159,8 +183,11 @@ impl MainNodeBuilder { let genesis = self.genesis_config.clone(); let eth_config = try_load_config!(self.secrets.l1); let query_eth_client_layer = QueryEthClientLayer::new( - genesis.settlement_layer_id(), + genesis.l1_chain_id, eth_config.l1_rpc_url, + self.gateway_contracts_config + .as_ref() + .map(|c| c.gateway_chain_id), eth_config.gateway_rpc_url, ); self.node.add_layer(query_eth_client_layer); @@ -246,7 +273,7 @@ impl MainNodeBuilder { try_load_config!(self.configs.mempool_config), try_load_config!(wallets.state_keeper), self.contracts_config.l2_da_validator_addr, - self.genesis_config.l1_batch_commit_data_generator_mode, + self.get_pubdata_type(), ); let db_config = try_load_config!(self.configs.db_config); let experimental_vm_config = self @@ -279,6 +306,12 @@ impl MainNodeBuilder { self.node.add_layer(EthWatchLayer::new( try_load_config!(eth_config.watcher), self.contracts_config.clone(), + self.gateway_contracts_config.clone(), + self.configs + .eth + .as_ref() + .and_then(|x| Some(x.gas_adjuster?.settlement_mode)) + .unwrap_or(SettlementMode::SettlesToL1), self.genesis_config.l2_chain_id, )); Ok(self) @@ -453,10 +486,10 @@ impl MainNodeBuilder { fn add_eth_tx_aggregator_layer(mut self) -> anyhow::Result { let eth_sender_config = try_load_config!(self.configs.eth); - self.node.add_layer(EthTxAggregatorLayer::new( eth_sender_config, self.contracts_config.clone(), + self.gateway_contracts_config.clone(), self.genesis_config.l2_chain_id, self.genesis_config.l1_batch_commit_data_generator_mode, self.configs diff --git a/core/lib/basic_types/src/commitment.rs b/core/lib/basic_types/src/commitment.rs index 0eed46aad782..c43a55bab4a9 100644 --- a/core/lib/basic_types/src/commitment.rs +++ b/core/lib/basic_types/src/commitment.rs @@ -58,8 +58,35 @@ impl FromStr for L1BatchCommitmentMode { } } +#[derive(Default, Copy, Debug, Clone, PartialEq, Serialize, Deserialize, Display)] +pub enum PubdataType { + #[default] + Rollup, + NoDA, + Avail, + Celestia, + Eigen, + ObjectStore, +} + +impl FromStr for PubdataType { + type Err = &'static str; + + fn from_str(s: &str) -> Result { + match s { + "Rollup" => Ok(Self::Rollup), + "NoDA" => Ok(Self::NoDA), + "Avail" => Ok(Self::Avail), + "Celestia" => Ok(Self::Celestia), + "Eigen" => Ok(Self::Eigen), + "ObjectStore" => Ok(Self::ObjectStore), + _ => Err("Incorrect DA client type; expected one of `Rollup`, `NoDA`, `Avail`, `Celestia`, `Eigen`, `ObjectStore`"), + } + } +} + #[derive(Default, Copy, Debug, Clone, PartialEq, Serialize, Deserialize)] pub struct PubdataParams { pub l2_da_validator_address: Address, - pub pubdata_type: L1BatchCommitmentMode, + pub pubdata_type: PubdataType, } diff --git a/core/lib/basic_types/src/lib.rs b/core/lib/basic_types/src/lib.rs index 8b8e24af4339..cee2939db1a7 100644 --- a/core/lib/basic_types/src/lib.rs +++ b/core/lib/basic_types/src/lib.rs @@ -122,7 +122,7 @@ impl TryFrom for AccountTreeId { /// ChainId in the ZKsync network. #[derive(Copy, Clone, Debug, Serialize, PartialEq, Eq, PartialOrd, Ord, Hash)] -pub struct L2ChainId(u64); +pub struct L2ChainId(pub u64); impl<'de> Deserialize<'de> for L2ChainId { fn deserialize(deserializer: D) -> Result diff --git a/core/lib/basic_types/src/protocol_version.rs b/core/lib/basic_types/src/protocol_version.rs index ebecfaa1b872..fc1261169464 100644 --- a/core/lib/basic_types/src/protocol_version.rs +++ b/core/lib/basic_types/src/protocol_version.rs @@ -74,11 +74,11 @@ pub enum ProtocolVersionId { impl ProtocolVersionId { pub const fn latest() -> Self { - Self::Version25 + Self::Version26 } pub const fn next() -> Self { - Self::Version26 + Self::Version27 } pub fn try_from_packed_semver(packed_semver: U256) -> Result { @@ -122,7 +122,7 @@ impl ProtocolVersionId { ProtocolVersionId::Version23 => VmVersion::Vm1_5_0SmallBootloaderMemory, ProtocolVersionId::Version24 => VmVersion::Vm1_5_0IncreasedBootloaderMemory, ProtocolVersionId::Version25 => VmVersion::Vm1_5_0IncreasedBootloaderMemory, - ProtocolVersionId::Version26 => VmVersion::Vm1_5_0IncreasedBootloaderMemory, + ProtocolVersionId::Version26 => VmVersion::VmGateway, ProtocolVersionId::Version27 => VmVersion::VmGateway, } } @@ -142,7 +142,11 @@ impl ProtocolVersionId { } pub fn is_pre_gateway(&self) -> bool { - self <= &Self::Version26 + self < &Self::gateway_upgrade() + } + + pub fn is_post_gateway(&self) -> bool { + self >= &Self::gateway_upgrade() } pub fn is_1_4_0(&self) -> bool { @@ -180,6 +184,10 @@ impl ProtocolVersionId { pub fn is_post_1_5_0(&self) -> bool { self >= &ProtocolVersionId::Version23 } + + pub const fn gateway_upgrade() -> Self { + ProtocolVersionId::Version26 + } } impl Default for ProtocolVersionId { @@ -283,7 +291,7 @@ impl From for VmVersion { ProtocolVersionId::Version23 => VmVersion::Vm1_5_0SmallBootloaderMemory, ProtocolVersionId::Version24 => VmVersion::Vm1_5_0IncreasedBootloaderMemory, ProtocolVersionId::Version25 => VmVersion::Vm1_5_0IncreasedBootloaderMemory, - ProtocolVersionId::Version26 => VmVersion::Vm1_5_0IncreasedBootloaderMemory, + ProtocolVersionId::Version26 => VmVersion::VmGateway, ProtocolVersionId::Version27 => VmVersion::VmGateway, } } diff --git a/core/lib/config/src/configs/contracts.rs b/core/lib/config/src/configs/contracts.rs index 38576833fa3e..da84945583e7 100644 --- a/core/lib/config/src/configs/contracts.rs +++ b/core/lib/config/src/configs/contracts.rs @@ -1,13 +1,14 @@ // External uses use serde::{Deserialize, Serialize}; // Workspace uses -use zksync_basic_types::Address; +use zksync_basic_types::{Address, H256}; #[derive(Debug, Serialize, Deserialize, Clone, PartialEq)] pub struct EcosystemContracts { pub bridgehub_proxy_addr: Address, pub state_transition_proxy_addr: Address, pub transparent_proxy_admin_addr: Address, + pub l1_bytecodes_supplier_addr: Option
, } impl EcosystemContracts { @@ -16,6 +17,7 @@ impl EcosystemContracts { bridgehub_proxy_addr: Address::repeat_byte(0x14), state_transition_proxy_addr: Address::repeat_byte(0x15), transparent_proxy_admin_addr: Address::repeat_byte(0x15), + l1_bytecodes_supplier_addr: Some(Address::repeat_byte(0x16)), } } } @@ -46,6 +48,10 @@ pub struct ContractsConfig { pub ecosystem_contracts: Option, // Used by the RPC API and by the node builder in wiring the BaseTokenRatioProvider layer. pub base_token_addr: Option
, + pub base_token_asset_id: Option, + + pub predeployed_l2_wrapped_base_token_address: Option
, + pub chain_admin_addr: Option
, pub l2_da_validator_addr: Option
, } @@ -69,6 +75,8 @@ impl ContractsConfig { l2_timestamp_asserter_addr: Some(Address::repeat_byte(0x19)), governance_addr: Address::repeat_byte(0x13), base_token_addr: Some(Address::repeat_byte(0x14)), + base_token_asset_id: Some(H256::repeat_byte(0x15)), + predeployed_l2_wrapped_base_token_address: Some(Address::repeat_byte(0x1b)), ecosystem_contracts: Some(EcosystemContracts::for_tests()), chain_admin_addr: Some(Address::repeat_byte(0x18)), l2_da_validator_addr: Some(Address::repeat_byte(0x1a)), diff --git a/core/lib/config/src/configs/da_client/avail.rs b/core/lib/config/src/configs/da_client/avail.rs index 3993656d667a..48aaf5b0e61e 100644 --- a/core/lib/config/src/configs/da_client/avail.rs +++ b/core/lib/config/src/configs/da_client/avail.rs @@ -1,17 +1,17 @@ -use serde::Deserialize; +use serde::{Deserialize, Serialize}; use zksync_basic_types::secrets::{APIKey, SeedPhrase}; pub const AVAIL_GAS_RELAY_CLIENT_NAME: &str = "GasRelay"; pub const AVAIL_FULL_CLIENT_NAME: &str = "FullClient"; -#[derive(Clone, Debug, PartialEq, Deserialize)] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] #[serde(tag = "avail_client")] pub enum AvailClientConfig { FullClient(AvailDefaultConfig), GasRelay(AvailGasRelayConfig), } -#[derive(Clone, Debug, PartialEq, Deserialize)] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] pub struct AvailConfig { pub bridge_api_url: String, pub timeout_ms: usize, @@ -19,13 +19,13 @@ pub struct AvailConfig { pub config: AvailClientConfig, } -#[derive(Clone, Debug, PartialEq, Deserialize)] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] pub struct AvailDefaultConfig { pub api_node_url: String, pub app_id: u32, } -#[derive(Clone, Debug, PartialEq, Deserialize)] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] pub struct AvailGasRelayConfig { pub gas_relay_api_url: String, pub max_retries: usize, diff --git a/core/lib/config/src/configs/da_client/mod.rs b/core/lib/config/src/configs/da_client/mod.rs index 322c4a20aac8..f82fd134edb5 100644 --- a/core/lib/config/src/configs/da_client/mod.rs +++ b/core/lib/config/src/configs/da_client/mod.rs @@ -16,3 +16,9 @@ pub enum DAClientConfig { Eigen(EigenConfig), ObjectStore(ObjectStoreConfig), } + +impl From for DAClientConfig { + fn from(config: AvailConfig) -> Self { + Self::Avail(config) + } +} diff --git a/core/lib/config/src/configs/en_config.rs b/core/lib/config/src/configs/en_config.rs index 13a0e1f2c99d..5c8875eb4b4a 100644 --- a/core/lib/config/src/configs/en_config.rs +++ b/core/lib/config/src/configs/en_config.rs @@ -10,7 +10,6 @@ use zksync_basic_types::{ pub struct ENConfig { // Genesis pub l2_chain_id: L2ChainId, - pub sl_chain_id: Option, pub l1_chain_id: L1ChainId, pub l1_batch_commit_data_generator_mode: L1BatchCommitmentMode, @@ -19,4 +18,6 @@ pub struct ENConfig { pub main_node_rate_limit_rps: Option, pub bridge_addresses_refresh_interval_sec: Option, + + pub gateway_chain_id: Option, } diff --git a/core/lib/config/src/configs/eth_sender.rs b/core/lib/config/src/configs/eth_sender.rs index be2f5b532a3e..223dd1281838 100644 --- a/core/lib/config/src/configs/eth_sender.rs +++ b/core/lib/config/src/configs/eth_sender.rs @@ -41,6 +41,7 @@ impl EthConfig { pubdata_sending_mode: PubdataSendingMode::Calldata, tx_aggregation_paused: false, tx_aggregation_only_prove_and_execute: false, + priority_tree_start_index: Some(0), time_in_mempool_in_l1_blocks_cap: 1800, }), gas_adjuster: Some(GasAdjusterConfig { @@ -92,7 +93,7 @@ pub struct SenderConfig { pub max_txs_in_flight: u64, /// The mode in which proofs are sent. pub proof_sending_mode: ProofSendingMode, - + /// Note, that it is used only for L1 transactions pub max_aggregated_tx_gas: u32, pub max_eth_tx_data_size: usize, pub max_aggregated_blocks_to_commit: u32, @@ -117,7 +118,8 @@ pub struct SenderConfig { /// special mode specifically for gateway migration to decrease number of non-executed batches #[serde(default = "SenderConfig::default_tx_aggregation_only_prove_and_execute")] pub tx_aggregation_only_prove_and_execute: bool, - + /// Index of the priority operation to start building the `PriorityMerkleTree` from. + pub priority_tree_start_index: Option, /// Cap of time in mempool for price calculations #[serde(default = "SenderConfig::default_time_in_mempool_in_l1_blocks_cap")] pub time_in_mempool_in_l1_blocks_cap: u32, @@ -156,6 +158,14 @@ impl SenderConfig { .map(|pk| pk.parse().unwrap()) } + // Don't load gateway private key, if it's not required + #[deprecated] + pub fn private_key_gateway(&self) -> Option { + std::env::var("ETH_SENDER_SENDER_OPERATOR_GATEWAY_PRIVATE_KEY") + .ok() + .map(|pk| pk.parse().unwrap()) + } + const fn default_tx_aggregation_paused() -> bool { false } @@ -183,9 +193,13 @@ pub struct GasAdjusterConfig { /// Parameter of the transaction base_fee_per_gas pricing formula #[serde(default = "GasAdjusterConfig::default_pricing_formula_parameter_b")] pub pricing_formula_parameter_b: f64, - /// Parameter by which the base fee will be multiplied for internal purposes + /// Parameter by which the base fee will be multiplied for internal purposes. + /// TODO(EVM-920): Note, that while the name says "L1", this same parameter is actually used for + /// any settlement layer. pub internal_l1_pricing_multiplier: f64, - /// If equal to Some(x), then it will always provide `x` as the L1 gas price + /// If equal to Some(x), then it will always provide `x` as the L1 gas price. + /// TODO(EVM-920): Note, that while the name says "L1", this same parameter is actually used for + /// any settlement layer. pub internal_enforced_l1_gas_price: Option, /// If equal to Some(x), then it will always provide `x` as the pubdata price pub internal_enforced_pubdata_price: Option, diff --git a/core/lib/config/src/configs/gateway.rs b/core/lib/config/src/configs/gateway.rs new file mode 100644 index 000000000000..6501c5efadb2 --- /dev/null +++ b/core/lib/config/src/configs/gateway.rs @@ -0,0 +1,73 @@ +use zksync_basic_types::{web3::Bytes, Address, SLChainId}; + +use super::ContractsConfig; + +/// Config that is only stored for the gateway chain. +#[derive(serde::Serialize, serde::Deserialize, Debug, Clone, PartialEq)] +pub struct GatewayConfig { + pub state_transition_proxy_addr: Address, + pub state_transition_implementation_addr: Address, + pub verifier_addr: Address, + pub validator_timelock_addr: Address, + pub admin_facet_addr: Address, + pub mailbox_facet_addr: Address, + pub executor_facet_addr: Address, + pub getters_facet_addr: Address, + pub diamond_init_addr: Address, + pub genesis_upgrade_addr: Address, + pub default_upgrade_addr: Address, + pub multicall3_addr: Address, + pub relayed_sl_da_validator: Address, + pub validium_da_validator: Address, + pub diamond_cut_data: Bytes, +} + +#[derive(serde::Serialize, serde::Deserialize, Debug, Clone, PartialEq)] +pub struct GatewayChainConfig { + pub state_transition_proxy_addr: Address, + pub validator_timelock_addr: Address, + pub multicall3_addr: Address, + pub diamond_proxy_addr: Address, + // TODO: there is no "governace" for a chain, only an admin, we + // need to figure out what we mean here + pub chain_admin_addr: Option
, + pub governance_addr: Address, + pub gateway_chain_id: SLChainId, +} + +impl GatewayChainConfig { + pub fn from_gateway_and_chain_data( + gateway_config: &GatewayConfig, + diamond_proxy_addr: Address, + l2_chain_admin_addr: Address, + gateway_chain_id: SLChainId, + ) -> Self { + Self { + state_transition_proxy_addr: gateway_config.state_transition_proxy_addr, + validator_timelock_addr: gateway_config.validator_timelock_addr, + multicall3_addr: gateway_config.multicall3_addr, + diamond_proxy_addr, + chain_admin_addr: Some(l2_chain_admin_addr), + governance_addr: l2_chain_admin_addr, + gateway_chain_id, + } + } + + pub fn from_contracts_and_chain_id( + contracts: ContractsConfig, + gateway_chain_id: SLChainId, + ) -> Self { + Self { + state_transition_proxy_addr: contracts + .ecosystem_contracts + .unwrap() + .state_transition_proxy_addr, + validator_timelock_addr: contracts.validator_timelock_addr, + multicall3_addr: contracts.l1_multicall3_addr, + diamond_proxy_addr: contracts.diamond_proxy_addr, + chain_admin_addr: contracts.chain_admin_addr, + governance_addr: contracts.governance_addr, + gateway_chain_id, + } + } +} diff --git a/core/lib/config/src/configs/mod.rs b/core/lib/config/src/configs/mod.rs index 5bf9a49e0acf..f4af71de38ad 100644 --- a/core/lib/config/src/configs/mod.rs +++ b/core/lib/config/src/configs/mod.rs @@ -18,6 +18,7 @@ pub use self::{ fri_prover_gateway::FriProverGatewayConfig, fri_witness_generator::FriWitnessGeneratorConfig, fri_witness_vector_generator::FriWitnessVectorGeneratorConfig, + gateway::{GatewayChainConfig, GatewayConfig}, general::GeneralConfig, genesis::GenesisConfig, object_store::ObjectStoreConfig, @@ -54,6 +55,7 @@ pub mod fri_prover_gateway; pub mod fri_prover_group; pub mod fri_witness_generator; pub mod fri_witness_vector_generator; +pub mod gateway; mod general; pub mod genesis; pub mod house_keeper; diff --git a/core/lib/config/src/configs/wallets.rs b/core/lib/config/src/configs/wallets.rs index 4cb5358c8f30..90ddd90faedf 100644 --- a/core/lib/config/src/configs/wallets.rs +++ b/core/lib/config/src/configs/wallets.rs @@ -62,6 +62,7 @@ impl Wallet { pub struct EthSender { pub operator: Wallet, pub blob_operator: Option, + pub gateway: Option, } #[derive(Debug, Clone, PartialEq)] @@ -89,6 +90,7 @@ impl Wallets { blob_operator: Some( Wallet::from_private_key_bytes(H256::repeat_byte(0x2), None).unwrap(), ), + gateway: None, }), state_keeper: Some(StateKeeper { fee_account: AddressWallet::from_address(H160::repeat_byte(0x3)), diff --git a/core/lib/config/src/testonly.rs b/core/lib/config/src/testonly.rs index b026aabc6111..3c2535aeae8f 100644 --- a/core/lib/config/src/testonly.rs +++ b/core/lib/config/src/testonly.rs @@ -10,7 +10,7 @@ use zksync_basic_types::{ pubdata_da::PubdataSendingMode, secrets::{APIKey, SeedPhrase}, vm::FastVmMode, - L1BatchNumber, L1ChainId, L2ChainId, + L1BatchNumber, L1ChainId, L2ChainId, SLChainId, }; use zksync_consensus_utils::EncodeDist; use zksync_crypto_primitives::K256PrivateKey; @@ -267,6 +267,8 @@ impl Distribution for EncodeDist { l1_multicall3_addr: rng.gen(), ecosystem_contracts: self.sample(rng), base_token_addr: self.sample_opt(|| rng.gen()), + base_token_asset_id: self.sample_opt(|| rng.gen()), + predeployed_l2_wrapped_base_token_address: self.sample_opt(|| rng.gen()), chain_admin_addr: self.sample_opt(|| rng.gen()), l2_da_validator_addr: self.sample_opt(|| rng.gen()), } @@ -417,6 +419,7 @@ impl Distribution for EncodeDist { pubdata_sending_mode: PubdataSendingMode::Calldata, tx_aggregation_paused: false, tx_aggregation_only_prove_and_execute: false, + priority_tree_start_index: self.sample(rng), time_in_mempool_in_l1_blocks_cap: self.sample(rng), } } @@ -738,7 +741,6 @@ impl Distribution for EncodeDist { evm_emulator_hash: Some(rng.gen()), fee_account: rng.gen(), l1_chain_id: L1ChainId(self.sample(rng)), - sl_chain_id: None, l2_chain_id: L2ChainId::default(), snark_wrapper_vk_hash: rng.gen(), dummy_verifier: rng.gen(), @@ -757,6 +759,7 @@ impl Distribution for EncodeDist { bridgehub_proxy_addr: rng.gen(), state_transition_proxy_addr: rng.gen(), transparent_proxy_admin_addr: rng.gen(), + l1_bytecodes_supplier_addr: rng.gen(), } } } @@ -905,6 +908,7 @@ impl Distribution for EncodeDist { configs::wallets::EthSender { operator: self.sample(rng), blob_operator: self.sample_opt(|| self.sample(rng)), + gateway: None, } } } @@ -932,7 +936,6 @@ impl Distribution for EncodeDist { configs::en_config::ENConfig { l2_chain_id: L2ChainId::default(), l1_chain_id: L1ChainId(rng.gen()), - sl_chain_id: None, main_node_url: format!("localhost:{}", rng.gen::()).parse().unwrap(), l1_batch_commit_data_generator_mode: match rng.gen_range(0..2) { 0 => L1BatchCommitmentMode::Rollup, @@ -940,6 +943,7 @@ impl Distribution for EncodeDist { }, main_node_rate_limit_rps: self.sample_opt(|| rng.gen()), bridge_addresses_refresh_interval_sec: self.sample_opt(|| rng.gen()), + gateway_chain_id: self.sample_opt(|| SLChainId(rng.gen())), } } } diff --git a/core/lib/constants/src/contracts.rs b/core/lib/constants/src/contracts.rs index 6e402c117bfe..09c1095b7721 100644 --- a/core/lib/constants/src/contracts.rs +++ b/core/lib/constants/src/contracts.rs @@ -166,6 +166,14 @@ pub const L2_MESSAGE_ROOT_ADDRESS: Address = H160([ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x05, ]); +pub const SLOAD_CONTRACT_ADDRESS: Address = H160([ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x01, 0x00, 0x06, +]); +pub const L2_WRAPPED_BASE_TOKEN_IMPL: Address = H160([ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x01, 0x00, 0x07, +]); pub const ERC20_TRANSFER_TOPIC: H256 = H256([ 221, 242, 82, 173, 27, 226, 200, 155, 105, 194, 176, 104, 252, 55, 141, 170, 149, 43, 167, 241, diff --git a/core/lib/constants/src/crypto.rs b/core/lib/constants/src/crypto.rs index ead2cc318370..0260ee578c88 100644 --- a/core/lib/constants/src/crypto.rs +++ b/core/lib/constants/src/crypto.rs @@ -3,8 +3,6 @@ pub const ZKPORTER_IS_AVAILABLE: bool = false; /// Depth of the account tree. pub const ROOT_TREE_DEPTH: usize = 256; -pub const MAX_NEW_FACTORY_DEPS: usize = 32; - /// To avoid DDoS we limit the size of the transactions size. /// TODO(X): remove this as a constant and introduce a config. pub const MAX_ENCODED_TX_SIZE: usize = 1 << 24; diff --git a/core/lib/constants/src/message_root.rs b/core/lib/constants/src/message_root.rs index 9bb8764cd667..adabd90c5874 100644 --- a/core/lib/constants/src/message_root.rs +++ b/core/lib/constants/src/message_root.rs @@ -1,14 +1,14 @@ /// Position of `chainCount` in `MessageRoot`'s storage layout. -pub const CHAIN_COUNT_KEY: usize = 0; +pub const CHAIN_COUNT_KEY: usize = 1; /// Position of `chainIndexToId` in `MessageRoot`'s storage layout. -pub const CHAIN_INDEX_TO_ID_KEY: usize = 2; +pub const CHAIN_INDEX_TO_ID_KEY: usize = 3; /// Position of `FullTree::_height` in `MessageRoot`'s storage layout. -pub const AGG_TREE_HEIGHT_KEY: usize = 3; +pub const AGG_TREE_HEIGHT_KEY: usize = 4; /// Position of `FullTree::nodes` in `MessageRoot`'s storage layout. -pub const AGG_TREE_NODES_KEY: usize = 5; +pub const AGG_TREE_NODES_KEY: usize = 6; /// Position of `chainTree` in `MessageRoot`'s storage layout. -pub const CHAIN_TREE_KEY: usize = 7; +pub const CHAIN_TREE_KEY: usize = 8;