diff --git a/Cargo.lock b/Cargo.lock index 68e8b2770607..a6c3689c8a4c 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -7494,7 +7494,9 @@ dependencies = [ "once_cell", "serde", "serde_json", + "zksync_config", "zksync_contracts", + "zksync_env_config", "zksync_multivm", "zksync_types", "zksync_utils", @@ -9813,6 +9815,7 @@ dependencies = [ "zksync_config", "zksync_contracts", "zksync_dal", + "zksync_env_config", "zksync_eth_client", "zksync_l1_contract_interface", "zksync_node_fee_model", @@ -10159,7 +10162,9 @@ dependencies = [ "zk_evm 0.140.0", "zk_evm 0.141.0", "zk_evm 0.150.5", + "zksync_config", "zksync_contracts", + "zksync_env_config", "zksync_eth_signer", "zksync_state", "zksync_system_constants", @@ -10910,6 +10915,7 @@ dependencies = [ "zksync_config", "zksync_contracts", "zksync_crypto_primitives", + "zksync_env_config", "zksync_mini_merkle_tree", "zksync_protobuf", "zksync_protobuf_build", diff --git a/contracts b/contracts index 2edbd6912c6a..bce4b2d0f34b 160000 --- a/contracts +++ b/contracts @@ -1 +1 @@ -Subproject commit 2edbd6912c6a73b120377f5e53fe1cc5343407fc +Subproject commit bce4b2d0f34bd87f1aaadd291772935afb1c3bd6 diff --git a/core/bin/system-constants-generator/Cargo.toml b/core/bin/system-constants-generator/Cargo.toml index 7177d29ca743..39f4b458817d 100644 --- a/core/bin/system-constants-generator/Cargo.toml +++ b/core/bin/system-constants-generator/Cargo.toml @@ -15,6 +15,8 @@ zksync_types.workspace = true zksync_utils.workspace = true zksync_contracts.workspace = true zksync_multivm.workspace = true +zksync_config.workspace = true +zksync_env_config.workspace = true codegen.workspace = true serde.workspace = true diff --git a/core/bin/system-constants-generator/src/utils.rs b/core/bin/system-constants-generator/src/utils.rs index 32b4d04506d1..ac4d66185e33 100644 --- a/core/bin/system-constants-generator/src/utils.rs +++ b/core/bin/system-constants-generator/src/utils.rs @@ -1,10 +1,12 @@ -use std::{cell::RefCell, rc::Rc}; +use std::{cell::RefCell, rc::Rc, str::FromStr}; use once_cell::sync::Lazy; +use zksync_config::configs::use_evm_simulator; use zksync_contracts::{ load_sys_contract, read_bootloader_code, read_bytecode_from_path, read_sys_contract_bytecode, BaseSystemContracts, ContractLanguage, SystemContractCode, }; +use zksync_env_config::FromEnv; use zksync_multivm::{ interface::{ storage::{InMemoryStorage, StorageView, WriteStorage}, @@ -24,8 +26,9 @@ use zksync_types::{ block::L2BlockHasher, ethabi::Token, fee::Fee, fee_model::BatchFeeInput, l1::L1Tx, l2::L2Tx, utils::storage_key_for_eth_balance, AccountTreeId, Address, Execute, K256PrivateKey, L1BatchNumber, L1TxCommonData, L2BlockNumber, L2ChainId, Nonce, ProtocolVersionId, StorageKey, - Transaction, BOOTLOADER_ADDRESS, SYSTEM_CONTEXT_ADDRESS, SYSTEM_CONTEXT_GAS_PRICE_POSITION, - SYSTEM_CONTEXT_TX_ORIGIN_POSITION, U256, ZKPORTER_IS_AVAILABLE, + Transaction, BOOTLOADER_ADDRESS, H256, SYSTEM_CONTEXT_ADDRESS, + SYSTEM_CONTEXT_GAS_PRICE_POSITION, SYSTEM_CONTEXT_TX_ORIGIN_POSITION, U256, + ZKPORTER_IS_AVAILABLE, }; use zksync_utils::{bytecode::hash_bytecode, bytes_to_be_words, u256_to_h256}; @@ -71,9 +74,21 @@ pub static GAS_TEST_SYSTEM_CONTRACTS: Lazy = Lazy::new(|| { let bytecode = read_sys_contract_bytecode("", "DefaultAccount", ContractLanguage::Sol); let hash = hash_bytecode(&bytecode); - let evm_simulator_bytecode = - read_sys_contract_bytecode("", "EvmInterpreter", ContractLanguage::Yul); - let evm_simulator_hash = hash_bytecode(&evm_simulator_bytecode); + + let mut evm_simulator_bytecode = bytecode.clone(); + let mut evm_simulator_hash = + H256::from_str("0x01000563374c277a2c1e34659a2a1e87371bb6d852ce142022d497bfb50b9e32") + .unwrap(); + + if use_evm_simulator::UseEvmSimulator::from_env() + .unwrap() + .use_evm_simulator + { + evm_simulator_bytecode = + read_sys_contract_bytecode("", "EvmInterpreter", ContractLanguage::Yul); + evm_simulator_hash = hash_bytecode(&evm_simulator_bytecode.clone()); + } + BaseSystemContracts { default_aa: SystemContractCode { code: bytes_to_be_words(bytecode), diff --git a/core/lib/config/src/configs/mod.rs b/core/lib/config/src/configs/mod.rs index 1ad503e0687f..456749e05a5e 100644 --- a/core/lib/config/src/configs/mod.rs +++ b/core/lib/config/src/configs/mod.rs @@ -65,6 +65,7 @@ pub mod pruning; pub mod secrets; pub mod snapshot_recovery; pub mod snapshots_creator; +pub mod use_evm_simulator; pub mod utils; pub mod vm_runner; pub mod wallets; diff --git a/core/lib/config/src/configs/use_evm_simulator.rs b/core/lib/config/src/configs/use_evm_simulator.rs new file mode 100644 index 000000000000..76113613a17d --- /dev/null +++ b/core/lib/config/src/configs/use_evm_simulator.rs @@ -0,0 +1,7 @@ +use serde::Deserialize; + +/// Configuration for the use evm simulator +#[derive(Debug, Deserialize, Clone, PartialEq)] +pub struct UseEvmSimulator { + pub use_evm_simulator: bool, +} diff --git a/core/lib/contracts/src/lib.rs b/core/lib/contracts/src/lib.rs index 0d3a2a853f0d..5f86f546c767 100644 --- a/core/lib/contracts/src/lib.rs +++ b/core/lib/contracts/src/lib.rs @@ -8,6 +8,7 @@ use std::{ fs::{self, File}, io::BufReader, path::{Path, PathBuf}, + str::FromStr, }; use ethabi::{ @@ -16,6 +17,8 @@ use ethabi::{ }; use once_cell::sync::Lazy; use serde::{Deserialize, Serialize}; +use zksync_config::configs::use_evm_simulator::{self}; +use zksync_env_config::FromEnv; use zksync_utils::{bytecode::hash_bytecode, bytes_to_be_words, env::Workspace}; pub mod test_contracts; @@ -338,13 +341,24 @@ impl BaseSystemContracts { let hash = hash_bytecode(&bytecode); let default_aa = SystemContractCode { - code: bytes_to_be_words(bytecode), + code: bytes_to_be_words(bytecode.clone()), hash, }; - let evm_simulator_bytecode = - read_sys_contract_bytecode("", "EvmInterpreter", ContractLanguage::Yul); - let evm_simulator_hash = hash_bytecode(&evm_simulator_bytecode); + // If evm simulator is not enabled, use the default account bytecode and hash. + let mut evm_simulator_bytecode = bytecode; + let mut evm_simulator_hash = + H256::from_str("0x01000563374c277a2c1e34659a2a1e87371bb6d852ce142022d497bfb50b9e32") + .unwrap(); + + if use_evm_simulator::UseEvmSimulator::from_env() + .unwrap() + .use_evm_simulator + { + evm_simulator_bytecode = + read_sys_contract_bytecode("", "EvmInterpreter", ContractLanguage::Yul); + evm_simulator_hash = hash_bytecode(&evm_simulator_bytecode); + } let evm_simulator = SystemContractCode { code: bytes_to_be_words(evm_simulator_bytecode), diff --git a/core/lib/env_config/src/lib.rs b/core/lib/env_config/src/lib.rs index b72c2c5d5b94..701817522d37 100644 --- a/core/lib/env_config/src/lib.rs +++ b/core/lib/env_config/src/lib.rs @@ -29,6 +29,7 @@ mod genesis; mod prover_job_monitor; #[cfg(test)] mod test_utils; +mod use_evm_simulator; mod vm_runner; mod wallets; diff --git a/core/lib/env_config/src/use_evm_simulator.rs b/core/lib/env_config/src/use_evm_simulator.rs new file mode 100644 index 000000000000..c2a58387e62f --- /dev/null +++ b/core/lib/env_config/src/use_evm_simulator.rs @@ -0,0 +1,9 @@ +use zksync_config::configs::use_evm_simulator::UseEvmSimulator; + +use crate::{envy_load, FromEnv}; + +impl FromEnv for UseEvmSimulator { + fn from_env() -> anyhow::Result { + envy_load("use_evm_simulator", "USE_EVM_SIMULATOR_") + } +} diff --git a/core/lib/multivm/Cargo.toml b/core/lib/multivm/Cargo.toml index 6156c1138890..86e19637b2b6 100644 --- a/core/lib/multivm/Cargo.toml +++ b/core/lib/multivm/Cargo.toml @@ -25,6 +25,8 @@ circuit_sequencer_api_1_4_2.workspace = true circuit_sequencer_api_1_5_0.workspace = true zksync_types.workspace = true +zksync_config.workspace = true +zksync_env_config.workspace = true zksync_contracts.workspace = true zksync_utils.workspace = true zksync_system_constants.workspace = true diff --git a/core/lib/multivm/src/versions/vm_latest/tracers/default_tracers.rs b/core/lib/multivm/src/versions/vm_latest/tracers/default_tracers.rs index f7def2a66106..5b61b5174e19 100755 --- a/core/lib/multivm/src/versions/vm_latest/tracers/default_tracers.rs +++ b/core/lib/multivm/src/versions/vm_latest/tracers/default_tracers.rs @@ -12,6 +12,8 @@ use zk_evm_1_5_0::{ witness_trace::DummyTracer, zkevm_opcode_defs::{decoding::EncodingModeProduction, Opcode, RetOpcode}, }; +use zksync_config::configs::use_evm_simulator::{self}; +use zksync_env_config::FromEnv; use super::{EvmDeployTracer, PubdataTracer}; use crate::{ @@ -64,7 +66,7 @@ pub struct DefaultExecutionTracer { // take into account e.g circuits produced by the initial bootloader memory commitment. pub(crate) circuits_tracer: CircuitsTracer, // This tracer is responsible for handling EVM deployments and providing the data to the code decommitter. - pub(crate) evm_deploy_tracer: EvmDeployTracer, + pub(crate) evm_deploy_tracer: Option>, subversion: MultiVMSubversion, storage: StoragePtr, _phantom: PhantomData, @@ -80,6 +82,9 @@ impl DefaultExecutionTracer { pubdata_tracer: Option>, subversion: MultiVMSubversion, ) -> Self { + let active_evm = use_evm_simulator::UseEvmSimulator::from_env() + .unwrap() + .use_evm_simulator; Self { tx_has_been_processed: false, execution_mode, @@ -94,7 +99,11 @@ impl DefaultExecutionTracer { pubdata_tracer, ret_from_the_bootloader: None, circuits_tracer: CircuitsTracer::new(), - evm_deploy_tracer: EvmDeployTracer::new(), + evm_deploy_tracer: if active_evm { + Some(EvmDeployTracer::new()) + } else { + None + }, storage, _phantom: PhantomData, } @@ -175,7 +184,9 @@ macro_rules! dispatch_tracers { tracer.$function($( $params ),*); } $self.circuits_tracer.$function($( $params ),*); - $self.evm_deploy_tracer.$function($( $params ),*); + if let Some(tracer) = &mut $self.evm_deploy_tracer { + tracer.$function($( $params ),*); + } }; } @@ -293,10 +304,11 @@ impl DefaultExecutionTracer { .finish_cycle(state, bootloader_state) .stricter(&result); - result = self - .evm_deploy_tracer - .finish_cycle(state, bootloader_state) - .stricter(&result); + if let Some(evm_deploy_tracer) = &mut self.evm_deploy_tracer { + result = evm_deploy_tracer + .finish_cycle(state, bootloader_state) + .stricter(&result); + } result.stricter(&self.should_stop_execution()) } diff --git a/core/lib/types/Cargo.toml b/core/lib/types/Cargo.toml index 54c38384a7ad..f976c26b71c1 100644 --- a/core/lib/types/Cargo.toml +++ b/core/lib/types/Cargo.toml @@ -17,6 +17,7 @@ zksync_basic_types.workspace = true zksync_contracts.workspace = true zksync_mini_merkle_tree.workspace = true zksync_config.workspace = true +zksync_env_config.workspace = true zksync_protobuf.workspace = true zksync_crypto_primitives.workspace = true diff --git a/core/lib/types/src/system_contracts.rs b/core/lib/types/src/system_contracts.rs index 57ca0150f7f4..f88e24e21ca7 100644 --- a/core/lib/types/src/system_contracts.rs +++ b/core/lib/types/src/system_contracts.rs @@ -1,8 +1,10 @@ -use std::path::PathBuf; +use std::{path::PathBuf, str::FromStr}; use once_cell::sync::Lazy; use zksync_basic_types::{AccountTreeId, Address, H256, U256}; +use zksync_config::configs::use_evm_simulator; use zksync_contracts::{read_sys_contract_bytecode, ContractLanguage, SystemContractsRepo}; +use zksync_env_config::FromEnv; use zksync_system_constants::{ BOOTLOADER_UTILITIES_ADDRESS, CODE_ORACLE_ADDRESS, COMPRESSOR_ADDRESS, CREATE2_FACTORY_ADDRESS, EVENT_WRITER_ADDRESS, EVM_GAS_MANAGER_ADDRESS, P256VERIFY_PRECOMPILE_ADDRESS, @@ -179,11 +181,19 @@ static SYSTEM_CONTRACT_LIST: [(&str, &str, Address, ContractLanguage); 26] = [ ]; static EVM_SIMULATOR_HASH: Lazy = Lazy::new(|| { - hash_bytecode(&read_sys_contract_bytecode( - "", - "EvmInterpreter", - ContractLanguage::Yul, - )) + if use_evm_simulator::UseEvmSimulator::from_env() + .unwrap() + .use_evm_simulator + { + hash_bytecode(&read_sys_contract_bytecode( + "", + "EvmInterpreter", + ContractLanguage::Yul, + )) + } else { + H256::from_str("0x01000563374c277a2c1e34659a2a1e87371bb6d852ce142022d497bfb50b9e32") + .unwrap() + } }); pub fn get_evm_simulator_hash() -> H256 { @@ -191,11 +201,21 @@ pub fn get_evm_simulator_hash() -> H256 { } static SYSTEM_CONTRACTS: Lazy> = Lazy::new(|| { + let evm_simulator_is_used = use_evm_simulator::UseEvmSimulator::from_env() + .unwrap() + .use_evm_simulator; SYSTEM_CONTRACT_LIST .iter() - .map(|(path, name, address, contract_lang)| DeployedContract { - account_id: AccountTreeId::new(*address), - bytecode: read_sys_contract_bytecode(path, name, contract_lang.clone()), + .filter_map(|(path, name, address, contract_lang)| { + let result = if *name == "EvmGasManager" && !evm_simulator_is_used { + None + } else { + Some(DeployedContract { + account_id: AccountTreeId::new(*address), + bytecode: read_sys_contract_bytecode(path, name, contract_lang.clone()), + }) + }; + result }) .collect::>() }); @@ -207,12 +227,22 @@ pub fn get_system_smart_contracts() -> Vec { /// Loads system contracts from a given directory. pub fn get_system_smart_contracts_from_dir(path: PathBuf) -> Vec { + let evm_simulator_is_used = use_evm_simulator::UseEvmSimulator::from_env() + .unwrap() + .use_evm_simulator; let repo = SystemContractsRepo { root: path }; SYSTEM_CONTRACT_LIST .iter() - .map(|(path, name, address, contract_lang)| DeployedContract { - account_id: AccountTreeId::new(*address), - bytecode: repo.read_sys_contract_bytecode(path, name, contract_lang.clone()), + .filter_map(|(path, name, address, contract_lang)| { + let result = if *name == "EvmGasManager" && !evm_simulator_is_used { + None + } else { + Some(DeployedContract { + account_id: AccountTreeId::new(*address), + bytecode: repo.read_sys_contract_bytecode(path, name, contract_lang.clone()), + }) + }; + result }) .collect::>() } diff --git a/core/node/eth_sender/Cargo.toml b/core/node/eth_sender/Cargo.toml index a7aa88c3550e..d58c7488262d 100644 --- a/core/node/eth_sender/Cargo.toml +++ b/core/node/eth_sender/Cargo.toml @@ -15,6 +15,7 @@ vise.workspace = true zksync_types.workspace = true zksync_dal.workspace = true zksync_config.workspace = true +zksync_env_config.workspace = true zksync_contracts.workspace = true zksync_eth_client.workspace = true zksync_utils.workspace = true diff --git a/core/node/eth_sender/src/eth_tx_aggregator.rs b/core/node/eth_sender/src/eth_tx_aggregator.rs index f07cecb0dfa4..49a108231b2a 100644 --- a/core/node/eth_sender/src/eth_tx_aggregator.rs +++ b/core/node/eth_sender/src/eth_tx_aggregator.rs @@ -1,7 +1,13 @@ +use std::str::FromStr; + use tokio::sync::watch; -use zksync_config::configs::eth_sender::SenderConfig; +use zksync_config::configs::{ + eth_sender::SenderConfig, + use_evm_simulator::{self}, +}; use zksync_contracts::BaseSystemContractsHashes; use zksync_dal::{Connection, ConnectionPool, Core, CoreDal}; +use zksync_env_config::FromEnv; use zksync_eth_client::{BoundEthInterface, CallFunctionArgs}; use zksync_l1_contract_interface::{ i_executor::{ @@ -186,12 +192,17 @@ impl EthTxAggregator { let get_l2_evm_simulator_hash_input = self .functions .get_evm_simulator_bytecode_hash - .encode_input(&[]) - .unwrap(); - let get_evm_simulator_hash_call = Multicall3Call { - target: self.state_transition_chain_contract, - allow_failure: ALLOW_FAILURE, - calldata: get_l2_evm_simulator_hash_input, + .as_ref() + .and_then(|f| f.encode_input(&[]).ok()); + + let get_evm_simulator_hash_call = if let Some(input) = get_l2_evm_simulator_hash_input { + Some(Multicall3Call { + target: self.state_transition_chain_contract, + allow_failure: ALLOW_FAILURE, + calldata: input, + }) + } else { + None }; // Third zksync contract call @@ -226,15 +237,19 @@ impl EthTxAggregator { calldata: get_protocol_version_input, }; - // Convert structs into tokens and return vector with them - vec![ + let mut token_vec = vec![ get_bootloader_hash_call.into_token(), get_default_aa_hash_call.into_token(), - get_evm_simulator_hash_call.into_token(), get_verifier_params_call.into_token(), get_verifier_call.into_token(), get_protocol_version_call.into_token(), - ] + ]; + + if let Some(call) = get_evm_simulator_hash_call { + token_vec.push(call.into_token()); + } + + token_vec } // The role of the method below is to de-tokenize multicall call's result, which is actually a token. @@ -250,8 +265,12 @@ impl EthTxAggregator { }; if let Token::Array(call_results) = token { + let use_evm_simulator = use_evm_simulator::UseEvmSimulator::from_env() + .unwrap() + .use_evm_simulator; + let number_of_calls = if use_evm_simulator { 6 } else { 5 }; // 5 calls are aggregated in multicall - if call_results.len() != 6 { + if call_results.len() != number_of_calls { return parse_error(&call_results); } let mut call_results_iterator = call_results.into_iter(); @@ -280,17 +299,26 @@ impl EthTxAggregator { ))); } let default_aa = H256::from_slice(&multicall3_default_aa); - let multicall3_evm_simulator = - Multicall3Result::from_token(call_results_iterator.next().unwrap())?.return_data; - if multicall3_evm_simulator.len() != 32 { - return Err(EthSenderError::Parse(Web3ContractError::InvalidOutputType( - format!( - "multicall3 evm simulator hash data is not of the len of 32: {:?}", - multicall3_evm_simulator - ), - ))); + + let mut evm_simulator = H256::from_str( + "0x01000563374c277a2c1e34659a2a1e87371bb6d852ce142022d497bfb50b9e32", + ) + .unwrap(); + + if use_evm_simulator { + let multicall3_evm_simulator = + Multicall3Result::from_token(call_results_iterator.next().unwrap())? + .return_data; + if multicall3_evm_simulator.len() != 32 { + return Err(EthSenderError::Parse(Web3ContractError::InvalidOutputType( + format!( + "multicall3 evm simulator hash data is not of the len of 32: {:?}", + multicall3_evm_simulator + ), + ))); + } + evm_simulator = H256::from_slice(&multicall3_evm_simulator); } - let evm_simulator = H256::from_slice(&multicall3_evm_simulator); let base_system_contracts_hashes = BaseSystemContractsHashes { bootloader, diff --git a/core/node/eth_sender/src/zksync_functions.rs b/core/node/eth_sender/src/zksync_functions.rs index 577c18277da0..6779ac24836c 100644 --- a/core/node/eth_sender/src/zksync_functions.rs +++ b/core/node/eth_sender/src/zksync_functions.rs @@ -12,7 +12,7 @@ pub(super) struct ZkSyncFunctions { pub(super) get_l2_bootloader_bytecode_hash: Function, pub(super) get_l2_default_account_bytecode_hash: Function, pub(super) get_verifier: Function, - pub(super) get_evm_simulator_bytecode_hash: Function, + pub(super) get_evm_simulator_bytecode_hash: Option, pub(super) get_verifier_params: Function, pub(super) get_protocol_version: Function, @@ -61,7 +61,7 @@ impl Default for ZkSyncFunctions { let get_l2_default_account_bytecode_hash = get_function(&zksync_contract, "getL2DefaultAccountBytecodeHash"); let get_evm_simulator_bytecode_hash = - get_function(&zksync_contract, "getL2EvmSimulatorBytecodeHash"); + get_optional_function(&zksync_contract, "getL2EvmSimulatorBytecodeHash"); let get_verifier = get_function(&zksync_contract, "getVerifier"); let get_verifier_params = get_function(&zksync_contract, "getVerifierParams"); let get_protocol_version = get_function(&zksync_contract, "getProtocolVersion"); diff --git a/etc/env/base/chain.toml b/etc/env/base/chain.toml index 5bdb08e3f952..15b14c9f2cc1 100644 --- a/etc/env/base/chain.toml +++ b/etc/env/base/chain.toml @@ -90,9 +90,9 @@ fee_model_version = "V2" validation_computational_gas_limit = 300000 save_call_traces = true -bootloader_hash = "0x010008bbde6fc402ea3a3d6cb15cb97e70245d3d4e48fb74362d4961b74c16b1" -default_aa_hash = "0x0100058de8a8fda78449f14bece247271bdbba5dc73fc96135c35a17ee4dd090" -evm_simulator_hash = "0x01000cdf5bb7dd8a97faf231a5e1e20f2fe308d6f200c3295c6e3629547cc4a4" +bootloader_hash = "0x010008e742608b21bf7eb23c1a9d0602047e3618b464c9b59c0fba3b3d7ab66e" +default_aa_hash = "0x01000563374c277a2c1e34659a2a1e87371bb6d852ce142022d497bfb50b9e32" +evm_simulator_hash = "0x01000563374c277a2c1e34659a2a1e87371bb6d852ce142022d497bfb50b9e32" protective_reads_persistence_enabled = false diff --git a/etc/env/base/contracts.toml b/etc/env/base/contracts.toml index 69bcbf6dabec..daa317a8bc90 100644 --- a/etc/env/base/contracts.toml +++ b/etc/env/base/contracts.toml @@ -26,11 +26,11 @@ RECURSION_NODE_LEVEL_VK_HASH = "0x1186ec268d49f1905f8d9c1e9d39fc33e98c74f91d91a2 RECURSION_LEAF_LEVEL_VK_HASH = "0x101e08b00193e529145ee09823378ef51a3bc8966504064f1f6ba3f1ba863210" RECURSION_CIRCUITS_SET_VKS_HASH = "0x18c1639094f58177409186e8c48d9f577c9410901d2f1d486b3e7d6cf553ae4c" GENESIS_TX_HASH = "0xb99ebfea46cbe05a21cd80fe5597d97b204befc52a16303f579c607dc1ac2e2e" -GENESIS_ROOT = "0x79679719d4932b95d89e1ad1faeccb4982bed5ca79f738d3d72d3cfcea6f3722" -GENESIS_BATCH_COMMITMENT = "0xb793269d781342f2980720a9da3009d91cfebb5187977b69807fea8444c5cb2f" +GENESIS_ROOT = "0xabdb766b18a479a5c783a4b80e12686bc8ea3cc2d8a3050491b701d72370ebb5" +GENESIS_BATCH_COMMITMENT = "0x2d00e5f8d77afcebf58a6b82ae56ba967566fe7dfbcb6760319fb0d215d18ffd" PRIORITY_TX_MAX_GAS_LIMIT = 72000000 DEPLOY_L2_BRIDGE_COUNTERPART_GAS_LIMIT = 10000000 -GENESIS_ROLLUP_LEAF_INDEX = "56" +GENESIS_ROLLUP_LEAF_INDEX = "54" GENESIS_PROTOCOL_VERSION = "24" GENESIS_PROTOCOL_SEMANTIC_VERSION = "0.24.2" L1_WETH_BRIDGE_IMPL_ADDR = "0x5E6D086F5eC079ADFF4FB3774CDf3e8D6a34F7E9" diff --git a/etc/env/base/use_evm_simulator.toml b/etc/env/base/use_evm_simulator.toml new file mode 100644 index 000000000000..0db670361f16 --- /dev/null +++ b/etc/env/base/use_evm_simulator.toml @@ -0,0 +1,2 @@ +[use_evm_simulator] +use_evm_simulator = false diff --git a/prover/Cargo.lock b/prover/Cargo.lock index 5624403d7853..57d160560b0d 100644 --- a/prover/Cargo.lock +++ b/prover/Cargo.lock @@ -355,6 +355,18 @@ dependencies = [ "tracing", ] +[[package]] +name = "backon" +version = "0.4.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d67782c3f868daa71d3533538e98a8e13713231969def7536e8039606fc46bf0" +dependencies = [ + "fastrand", + "futures-core", + "pin-project", + "tokio", +] + [[package]] name = "backtrace" version = "0.3.72" @@ -460,6 +472,27 @@ dependencies = [ "which", ] +[[package]] +name = "bindgen" +version = "0.65.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cfdf7b466f9a4903edc73f95d6d2bcd5baf8ae620638762244d3f60143643cc5" +dependencies = [ + "bitflags 1.3.2", + "cexpr", + "clang-sys", + "lazy_static", + "lazycell", + "peeking_take_while", + "prettyplease", + "proc-macro2 1.0.85", + "quote 1.0.36", + "regex", + "rustc-hash", + "shlex", + "syn 2.0.66", +] + [[package]] name = "bindgen" version = "0.69.4" @@ -731,6 +764,12 @@ dependencies = [ "syn 1.0.109", ] +[[package]] +name = "bytecount" +version = "0.6.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5ce89b21cab1437276d2650d57e971f9d548a2d9037cc231abdc0562b97498ce" + [[package]] name = "byteorder" version = "1.5.0" @@ -743,6 +782,48 @@ version = "1.6.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "514de17de45fdb8dc022b1a7975556c53c86f9f0aa5f534b98977b171857c2c9" +[[package]] +name = "bzip2-sys" +version = "0.1.11+1.0.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "736a955f3fa7875102d57c82b8cac37ec45224a07fd32d58f9f7a186b6cd4cdc" +dependencies = [ + "cc", + "libc", + "pkg-config", +] + +[[package]] +name = "camino" +version = "1.1.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8b96ec4966b5813e2c0507c1f86115c8c5abaadc3980879c3424042a02fd1ad3" +dependencies = [ + "serde", +] + +[[package]] +name = "cargo-platform" +version = "0.1.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "24b1f0365a6c6bb4020cd05806fd0d33c44d38046b8bd7f0e40814b9763cabfc" +dependencies = [ + "serde", +] + +[[package]] +name = "cargo_metadata" +version = "0.14.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4acbb09d9ee8e23699b9634375c72795d095bf268439da88562cf9b501f181fa" +dependencies = [ + "camino", + "cargo-platform", + "semver", + "serde", + "serde_json", +] + [[package]] name = "cc" version = "1.1.14" @@ -1360,6 +1441,19 @@ dependencies = [ "syn 1.0.109", ] +[[package]] +name = "dashmap" +version = "5.5.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "978747c1d849a7d2ee5e8adc0159961c48fb7e5db2f06af6723b80123bb53856" +dependencies = [ + "cfg-if", + "hashbrown 0.14.5", + "lock_api", + "once_cell", + "parking_lot_core", +] + [[package]] name = "debugid" version = "0.8.0" @@ -1718,6 +1812,15 @@ dependencies = [ "windows-sys 0.52.0", ] +[[package]] +name = "error-chain" +version = "0.12.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2d2f06b9cac1506ece98fe3231e3cc9c4410ec3d5b1f24ae1c8946f0742cdefc" +dependencies = [ + "version_check", +] + [[package]] name = "etcetera" version = "0.8.0" @@ -3064,6 +3167,22 @@ version = "0.2.8" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "4ec2a862134d2a7d32d7983ddcdd1c4923530833c9f2ea1a44fc5fa473989058" +[[package]] +name = "librocksdb-sys" +version = "0.11.0+8.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d3386f101bcb4bd252d8e9d2fb41ec3b0862a15a62b478c355b2982efa469e3e" +dependencies = [ + "bindgen 0.65.1", + "bzip2-sys", + "cc", + "glob", + "libc", + "libz-sys", + "lz4-sys", + "zstd-sys", +] + [[package]] name = "libsqlite3-sys" version = "0.30.1" @@ -3075,6 +3194,17 @@ dependencies = [ "vcpkg", ] +[[package]] +name = "libz-sys" +version = "1.1.20" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d2d16453e800a8cf6dd2fc3eb4bc99b786a9b90c663b8559a5b1a041bf89e472" +dependencies = [ + "cc", + "pkg-config", + "vcpkg", +] + [[package]] name = "linux-raw-sys" version = "0.4.14" @@ -3141,6 +3271,16 @@ dependencies = [ "logos-codegen", ] +[[package]] +name = "lz4-sys" +version = "1.11.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fcb44a01837a858d47e5a630d2ccf304c8efcc4b83b8f9f75b7a9ee4fcc6e57d" +dependencies = [ + "cc", + "libc", +] + [[package]] name = "match_cfg" version = "0.1.0" @@ -3223,6 +3363,21 @@ dependencies = [ "unicase", ] +[[package]] +name = "mini-moka" +version = "0.10.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c325dfab65f261f386debee8b0969da215b3fa0037e74c8a1234db7ba986d803" +dependencies = [ + "crossbeam-channel", + "crossbeam-utils", + "dashmap", + "skeptic", + "smallvec", + "tagptr", + "triomphe", +] + [[package]] name = "minimal-lexical" version = "0.2.1" @@ -4282,6 +4437,17 @@ dependencies = [ "syn 1.0.109", ] +[[package]] +name = "pulldown-cmark" +version = "0.9.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "57206b407293d2bcd3af849ce869d52068623f19e1b5ff8e8778e3309439682b" +dependencies = [ + "bitflags 2.6.0", + "memchr", + "unicase", +] + [[package]] name = "quick-error" version = "1.2.3" @@ -4690,6 +4856,16 @@ dependencies = [ "rustc-hex", ] +[[package]] +name = "rocksdb" +version = "0.21.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bb6f170a4041d50a0ce04b0d2e14916d6ca863ea2e422689a5b694395d299ffe" +dependencies = [ + "libc", + "librocksdb-sys", +] + [[package]] name = "rsa" version = "0.9.6" @@ -4997,6 +5173,9 @@ name = "semver" version = "1.0.23" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "61697e0a1c7e512e84a621326239844a24d8207b4669b41bc18b32ea5cbf988b" +dependencies = [ + "serde", +] [[package]] name = "send_wrapper" @@ -5385,6 +5564,21 @@ dependencies = [ "time", ] +[[package]] +name = "skeptic" +version = "0.13.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "16d23b015676c90a0f01c197bfdc786c20342c73a0afdda9025adb0bc42940a8" +dependencies = [ + "bytecount", + "cargo_metadata", + "error-chain", + "glob", + "pulldown-cmark", + "tempfile", + "walkdir", +] + [[package]] name = "slab" version = "0.4.9" @@ -5864,6 +6058,12 @@ dependencies = [ "libc", ] +[[package]] +name = "tagptr" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7b2093cf4c8eb1e67749a6762251bc9cd836b6fc171623bd0a9d324d37af2417" + [[package]] name = "tap" version = "1.0.1" @@ -6313,6 +6513,12 @@ dependencies = [ "tracing-serde", ] +[[package]] +name = "triomphe" +version = "0.1.13" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e6631e42e10b40c0690bf92f404ebcfe6e1fdb480391d15f17cc8e96eeed5369" + [[package]] name = "try-lock" version = "0.2.5" @@ -7485,6 +7691,8 @@ dependencies = [ "once_cell", "serde", "serde_json", + "zksync_config", + "zksync_env_config", "zksync_utils", ] @@ -7681,6 +7889,7 @@ dependencies = [ "circuit_sequencer_api 0.141.2", "circuit_sequencer_api 0.142.2", "circuit_sequencer_api 0.150.5", + "ethabi", "hex", "itertools 0.10.5", "once_cell", @@ -7693,7 +7902,10 @@ dependencies = [ "zk_evm 0.140.0", "zk_evm 0.141.0", "zk_evm 0.150.5", + "zksync_config", "zksync_contracts", + "zksync_env_config", + "zksync_state", "zksync_system_constants", "zksync_types", "zksync_utils", @@ -7995,6 +8207,51 @@ dependencies = [ "zksync_utils", ] +[[package]] +name = "zksync_shared_metrics" +version = "0.1.0" +dependencies = [ + "rustc_version", + "tracing", + "vise", + "zksync_dal", + "zksync_types", +] + +[[package]] +name = "zksync_state" +version = "0.1.0" +dependencies = [ + "anyhow", + "async-trait", + "backon", + "chrono", + "itertools 0.10.5", + "mini-moka", + "once_cell", + "tokio", + "tracing", + "vise", + "zksync_dal", + "zksync_shared_metrics", + "zksync_storage", + "zksync_types", + "zksync_utils", + "zksync_vm_interface", +] + +[[package]] +name = "zksync_storage" +version = "0.1.0" +dependencies = [ + "num_cpus", + "once_cell", + "rocksdb", + "thread_local", + "tracing", + "vise", +] + [[package]] name = "zksync_system_constants" version = "0.1.0" @@ -8031,6 +8288,7 @@ dependencies = [ "zksync_config", "zksync_contracts", "zksync_crypto_primitives", + "zksync_env_config", "zksync_mini_merkle_tree", "zksync_protobuf", "zksync_protobuf_build", @@ -8137,6 +8395,7 @@ dependencies = [ "zksync_contracts", "zksync_system_constants", "zksync_types", + "zksync_utils", ] [[package]] @@ -8223,3 +8482,13 @@ dependencies = [ "zksync_utils", "zksync_vlog", ] + +[[package]] +name = "zstd-sys" +version = "2.0.13+zstd.1.5.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "38ff0f21cfee8f97d94cef41359e0c89aa6113028ab0291aa8ca0038995a95aa" +dependencies = [ + "cc", + "pkg-config", +]