diff --git a/Cargo.lock b/Cargo.lock index 8a0f6fb6..fd625a72 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1262,9 +1262,9 @@ dependencies = [ [[package]] name = "lock_api" -version = "0.4.11" +version = "0.4.12" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3c168f8615b12bc01f9c17e2eb0cc07dcae1940121185446edc3744920e8ef45" +checksum = "07af8b9cdd281b7915f413fa73f29ebd5d55d0d3f0155584dade1ff18cea1b17" dependencies = [ "autocfg", "scopeguard", @@ -1490,9 +1490,9 @@ dependencies = [ [[package]] name = "parking_lot" -version = "0.12.1" +version = "0.12.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3742b2c103b9f06bc9fff0a37ff4912935851bee6d36f3c02bcc755bcfec228f" +checksum = "7e4af0ca4f6caed20e900d564c242b8e5d4903fdacf31d3daf527b66fe6f42fb" dependencies = [ "lock_api", "parking_lot_core", @@ -1500,15 +1500,15 @@ dependencies = [ [[package]] name = "parking_lot_core" -version = "0.9.9" +version = "0.9.10" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4c42a9226546d68acdd9c0a280d17ce19bfe27a46bf68784e4066115788d008e" +checksum = "1e401f977ab385c9e4e3ab30627d6f26d00e2c73eef317493c4ec6d468726cf8" dependencies = [ "cfg-if", "libc", "redox_syscall", "smallvec", - "windows-targets 0.48.5", + "windows-targets 0.52.5", ] [[package]] @@ -1778,11 +1778,11 @@ dependencies = [ [[package]] name = "redox_syscall" -version = "0.4.1" +version = "0.5.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4722d768eff46b75989dd134e5c353f0d6296e5aaa3132e776cbdb56be7731aa" +checksum = "469052894dcb553421e483e4209ee581a45100d31b4018de03e5a7ad86374a7e" dependencies = [ - "bitflags 1.3.2", + "bitflags 2.5.0", ] [[package]] @@ -1944,9 +1944,9 @@ dependencies = [ [[package]] name = "rustls" -version = "0.21.11" +version = "0.21.12" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7fecbfb7b1444f477b345853b1fce097a2c6fb637b2bfb87e6bc5db0f043fae4" +checksum = "3f56a14d1f48b391359b22f731fd4bd7e43c97f3c50eee276f3aa09c94784d3e" dependencies = [ "log", "ring", @@ -2591,7 +2591,7 @@ checksum = "2266fcb904c50fb17fda4c9a751a1715629ecf8b21f4c9d78b4890fb71525d71" [[package]] name = "vm2" version = "0.1.0" -source = "git+https://github.com/matter-labs/vm2#f38b8f536168a24c5fb38b0d56f309b228cf3c58" +source = "git+https://github.com/matter-labs/vm2#1bc69da6137757ec22ccf8c3d477a1510150bc65" dependencies = [ "enum_dispatch", "primitive-types", @@ -2758,9 +2758,9 @@ checksum = "ac3b87c63620426dd9b991e5ce0329eff545bccbbb34f3be09ff6fb6ab51b7b6" [[package]] name = "winapi-util" -version = "0.1.7" +version = "0.1.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "134306a13c5647ad6453e8deaec55d3a44d6021970129e6188735e74bf546697" +checksum = "4d4cc384e1e73b93bafa6fb4f1df8c41695c8a91cf9c4c64358067d15a7b6c6b" dependencies = [ "windows-sys 0.52.0", ] @@ -2947,7 +2947,7 @@ checksum = "525b4ec142c6b68a2d10f01f7bbf6755599ca3f81ea53b8431b7dd348f5fdb2d" [[package]] name = "zk_evm" version = "1.5.0" -source = "git+https://github.com/matter-labs/zk_evm?branch=v1.5.0#54fd09c8777b2c3b06ab088f96bbd6bd968f6737" +source = "git+https://github.com/matter-labs/era-zk_evm?branch=v1.5.0#6119ce908ab714f2f99804794e725b97298a6b11" dependencies = [ "anyhow", "lazy_static", @@ -3008,9 +3008,10 @@ dependencies = [ [[package]] name = "zkevm_tester" version = "1.5.0" -source = "git+https://github.com/matter-labs/era-zkevm_tester?branch=v1.5.0#6097d4bdc67474747e437b023354cc06bba767d5" +source = "git+https://github.com/matter-labs/era-zkevm_tester?branch=v1.5.0#488ca0782fea1eb9af7ff82d252d54af3471f33e" dependencies = [ "anyhow", + "ethabi", "futures", "hex", "num-bigint", diff --git a/compiler_tester/Cargo.toml b/compiler_tester/Cargo.toml index 3a7d82df..2a46b6a4 100644 --- a/compiler_tester/Cargo.toml +++ b/compiler_tester/Cargo.toml @@ -43,6 +43,7 @@ evm = { git = "https://github.com/rust-ethereum/evm", branch = "master" } zkevm-assembly = { git = "https://github.com/matter-labs/era-zkEVM-assembly", branch = "v1.5.0" } zkevm_opcode_defs = { git = "https://github.com/matter-labs/era-zkevm_opcode_defs", branch = "v1.5.0" } zkevm_tester = { git = "https://github.com/matter-labs/era-zkevm_tester", branch = "v1.5.0" } + vm2 = { git = "https://github.com/matter-labs/vm2", optional = true } era-compiler-common = { git = "https://github.com/matter-labs/era-compiler-common", branch = "main" } diff --git a/compiler_tester/src/vm/eravm/mod.rs b/compiler_tester/src/vm/eravm/mod.rs index 2972015f..5d3df9d4 100644 --- a/compiler_tester/src/vm/eravm/mod.rs +++ b/compiler_tester/src/vm/eravm/mod.rs @@ -39,6 +39,8 @@ pub struct EraVM { evm_interpreter_code_hash: web3::types::U256, /// The deployed contracts. deployed_contracts: HashMap, + /// The published EVM bytecodes + published_evm_bytecodes: HashMap>, /// The storage state. storage: HashMap, } @@ -104,6 +106,7 @@ impl EraVM { evm_interpreter_code_hash: system_contracts.evm_interpreter.bytecode_hash, deployed_contracts: HashMap::new(), storage, + published_evm_bytecodes: HashMap::new(), }; vm.add_known_contract( @@ -234,6 +237,7 @@ impl EraVM { vm_launch_option, usize::MAX, self.known_contracts.clone(), + self.published_evm_bytecodes.clone(), self.default_aa_code_hash, self.evm_interpreter_code_hash, )?; @@ -246,6 +250,15 @@ impl EraVM { self.deployed_contracts .insert(*address, assembly.to_owned()); } + + for (hash, preimage) in snapshot.published_sha256_blobs.iter() { + if self.published_evm_bytecodes.contains_key(&hash) { + continue; + } + + self.published_evm_bytecodes.insert(*hash, preimage.clone()); + } + self.storage = snapshot.storage.clone(); Ok(snapshot.into()) diff --git a/compiler_tester/src/vm/eravm/system_contracts.rs b/compiler_tester/src/vm/eravm/system_contracts.rs index d296c290..17847cf5 100644 --- a/compiler_tester/src/vm/eravm/system_contracts.rs +++ b/compiler_tester/src/vm/eravm/system_contracts.rs @@ -101,6 +101,10 @@ impl SystemContracts { const PATH_EVENT_WRITER: &'static str = "era-contracts/system-contracts/contracts/EventWriter.yul"; + /// The code oracle system contract implementation path. + const PATH_CODE_ORACLE: &'static str = + "era-contracts/system-contracts/contracts/precompiles/CodeOracle.yul"; + /// The ETH token system contract implementation path. const PATH_ETH_TOKEN: &'static str = "era-contracts/system-contracts/contracts/L2EthToken.sol:L2EthToken"; @@ -179,6 +183,10 @@ impl SystemContracts { ), Self::PATH_EVENT_WRITER, ), + ( + web3::types::Address::from_low_u64_be(0x8012), + Self::PATH_CODE_ORACLE, + ), ]; let solidity_system_contracts = vec![ @@ -234,7 +242,7 @@ impl SystemContracts { Self::PATH_ETH_TOKEN, ), ( - web3::types::Address::from_low_u64_be(0x8012), + web3::types::Address::from_low_u64_be(0x8013), Self::PATH_EVM_GAS_MANAGER, ), ( diff --git a/system-contracts-stable-build b/system-contracts-stable-build index 02c38858..efaedc08 100644 Binary files a/system-contracts-stable-build and b/system-contracts-stable-build differ