From 27db474cbe9c22913f963d534eae9ec298520653 Mon Sep 17 00:00:00 2001 From: Oleksandr Zarudnyi Date: Sun, 13 Oct 2024 14:30:07 +0800 Subject: [PATCH] feat: test solc v0.8.28 (#111) --- .github/workflows/sanitizers.yml | 4 +- Cargo.lock | 28 ++++-- compiler_tester/src/compiler_tester/main.rs | 2 +- .../src/test/case/input/balance.rs | 22 ++++- .../src/test/case/input/deploy_eravm.rs | 2 +- .../src/test/case/input/deploy_evm.rs | 6 +- compiler_tester/src/test/case/input/mod.rs | 10 +- .../src/test/case/input/runtime.rs | 3 +- compiler_tester/src/test/case/mod.rs | 3 +- configs/solc-bin-default.json | 6 ++ configs/solc-bin-upstream.json | 6 ++ ethereum.yaml | 92 +++++++++++++++++++ solidity | 2 +- tests | 2 +- 14 files changed, 159 insertions(+), 29 deletions(-) diff --git a/.github/workflows/sanitizers.yml b/.github/workflows/sanitizers.yml index 1dd6eac6..82496c7e 100644 --- a/.github/workflows/sanitizers.yml +++ b/.github/workflows/sanitizers.yml @@ -30,8 +30,8 @@ on: mode: required: false type: string - default: 'Y+M3B3 0.8.27' - description: 'Mode filter for the era-compiler-tester. For example: Y+M3B3 0.8.27' + default: 'Y+M3B3 0.8.28' + description: 'Mode filter for the era-compiler-tester. For example: Y+M3B3 0.8.28' target: required: false type: string diff --git a/Cargo.lock b/Cargo.lock index 91f9f649..aa0a6527 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -949,7 +949,7 @@ checksum = "5443807d6dff69373d433ab9ef5378ad8df50ca6298caf15de6e52e24aaf54d5" [[package]] name = "era-compiler-common" version = "1.5.0" -source = "git+https://github.com/matter-labs/era-compiler-common?branch=main#3207c451486e49df6e241167d8c6577222ecbd8e" +source = "git+https://github.com/matter-labs/era-compiler-common?branch=main#ce91855778bd5e1821f9b46751f92bafafd88435" dependencies = [ "anyhow", "base58", @@ -978,7 +978,7 @@ dependencies = [ [[package]] name = "era-compiler-llvm-context" version = "1.5.0" -source = "git+https://github.com/matter-labs/era-compiler-llvm-context?branch=main#736a2011b8de90887b429ded48556dd49333d365" +source = "git+https://github.com/matter-labs/era-compiler-llvm-context?branch=main#000c36938519192e5b52fceffb729bbf3f4287c7" dependencies = [ "anyhow", "era-compiler-common", @@ -987,13 +987,13 @@ dependencies = [ "num", "semver 1.0.23", "serde", - "zkevm_opcode_defs 0.150.0 (git+https://github.com/matter-labs/era-zkevm_opcode_defs?branch=v1.5.0)", + "zkevm_opcode_defs 0.150.5", ] [[package]] name = "era-compiler-solidity" version = "1.5.5" -source = "git+https://github.com/matter-labs/era-compiler-solidity?branch=main#2de7a1a6d8f6c766a785d022fecb12b67fa2142e" +source = "git+https://github.com/matter-labs/era-compiler-solidity?branch=main#ffcbcec20c7d358a87396422db25c3cbca6362a6" dependencies = [ "anyhow", "era-compiler-common", @@ -1017,7 +1017,7 @@ dependencies = [ "structopt", "thiserror", "which", - "zkevm_opcode_defs 0.150.0 (git+https://github.com/matter-labs/era-zkevm_opcode_defs?branch=v1.5.0)", + "zkevm_opcode_defs 0.150.5", ] [[package]] @@ -1046,7 +1046,7 @@ dependencies = [ [[package]] name = "era-yul" version = "1.5.5" -source = "git+https://github.com/matter-labs/era-compiler-solidity?branch=main#2de7a1a6d8f6c766a785d022fecb12b67fa2142e" +source = "git+https://github.com/matter-labs/era-compiler-solidity?branch=main#ffcbcec20c7d358a87396422db25c3cbca6362a6" dependencies = [ "anyhow", "regex", @@ -4088,6 +4088,22 @@ dependencies = [ "sha3 0.10.8", ] +[[package]] +name = "zkevm_opcode_defs" +version = "0.150.5" +source = "git+https://github.com/matter-labs/zksync-protocol#9bf5cf839f76a19f7c21981d8c56a7f8bbe03d7e" +dependencies = [ + "bitflags 2.6.0", + "blake2", + "ethereum-types", + "k256", + "lazy_static", + "p256", + "serde", + "sha2 0.10.8", + "sha3 0.10.8", +] + [[package]] name = "zkevm_tester" version = "1.5.0" diff --git a/compiler_tester/src/compiler_tester/main.rs b/compiler_tester/src/compiler_tester/main.rs index a8452cc3..b69e227f 100644 --- a/compiler_tester/src/compiler_tester/main.rs +++ b/compiler_tester/src/compiler_tester/main.rs @@ -242,7 +242,7 @@ mod tests { verbosity: false, quiet: false, debug: false, - modes: vec!["Y+M3B3 0.8.27".to_owned()], + modes: vec!["Y+M3B3 0.8.28".to_owned()], paths: vec!["tests/solidity/simple/default.sol".to_owned()], groups: vec![], benchmark: None, diff --git a/compiler_tester/src/test/case/input/balance.rs b/compiler_tester/src/test/case/input/balance.rs index 9da934c6..c0f9ac97 100644 --- a/compiler_tester/src/test/case/input/balance.rs +++ b/compiler_tester/src/test/case/input/balance.rs @@ -5,10 +5,9 @@ use std::sync::Arc; use std::sync::Mutex; -use web3::types::U256; - use crate::compilers::mode::Mode; use crate::summary::Summary; +use crate::vm::eravm::system_context::SystemContext; use crate::vm::eravm::EraVM; use crate::vm::evm::EVM; use crate::vm::revm::revm_type_conversions::web3_address_to_revm_address; @@ -41,13 +40,26 @@ impl Balance { pub fn run_eravm( self, summary: Arc>, - vm: &EraVM, + vm: &mut EraVM, mode: Mode, test_group: Option, name_prefix: String, index: usize, ) { let name = format!("{name_prefix}[#balance_check:{index}]"); + + let rich_addresses = SystemContext::get_rich_addresses(); + if rich_addresses.contains(&self.address) { + vm.mint_ether( + self.address, + web3::types::U256::from_str_radix( + "10000000000000000000000000", + era_compiler_common::BASE_HEXADECIMAL, + ) + .expect("Always valid"), + ); + } + let found = vm.get_balance(self.address); if found == self.balance { Summary::passed_special(summary, mode, name, test_group); @@ -98,7 +110,7 @@ impl Balance { .balance(web3_address_to_revm_address(&self.address)); match found { Ok(found) => { - let u256_found = U256::from(found.data.to_be_bytes()); + let u256_found = web3::types::U256::from(found.data.to_be_bytes()); if u256_found == self.balance { Summary::passed_special(summary, mode, name, test_group); } else { @@ -118,7 +130,7 @@ impl Balance { mode, name, self.balance.into(), - U256::zero().into(), + web3::types::U256::zero().into(), self.address.to_fixed_bytes().to_vec(), ); } diff --git a/compiler_tester/src/test/case/input/deploy_eravm.rs b/compiler_tester/src/test/case/input/deploy_eravm.rs index 6e0493c4..b6ef0a26 100644 --- a/compiler_tester/src/test/case/input/deploy_eravm.rs +++ b/compiler_tester/src/test/case/input/deploy_eravm.rs @@ -74,7 +74,7 @@ impl DeployEraVM { ) where D: EraVMDeployer, { - let name = format!("{}[#deployer:{}]", name_prefix, self.path); + let name = format!("{name_prefix}[#deployer:{}]", self.path); vm.populate_storage(self.storage.inner); let result = match deployer.deploy_eravm::( diff --git a/compiler_tester/src/test/case/input/deploy_evm.rs b/compiler_tester/src/test/case/input/deploy_evm.rs index 45f56422..a5b6b7bd 100644 --- a/compiler_tester/src/test/case/input/deploy_evm.rs +++ b/compiler_tester/src/test/case/input/deploy_evm.rs @@ -121,15 +121,15 @@ impl DeployEVM { /// /// Runs the deploy transaction on native REVM. /// - pub fn run_revm<'a>( + pub fn run_revm( self, summary: Arc>, - vm: Revm<'a>, + vm: Revm, mode: Mode, test_group: Option, name_prefix: String, evm_version: Option, - ) -> Revm<'a> { + ) -> Revm { let name = format!("{}[#deployer:{}]", name_prefix, self.identifier); let size = self.deploy_code.len(); diff --git a/compiler_tester/src/test/case/input/mod.rs b/compiler_tester/src/test/case/input/mod.rs index f1f6764d..e0750819 100644 --- a/compiler_tester/src/test/case/input/mod.rs +++ b/compiler_tester/src/test/case/input/mod.rs @@ -17,8 +17,6 @@ use std::str::FromStr; use std::sync::Arc; use std::sync::Mutex; -use solidity_adapter::EVMVersion; - use crate::compilers::mode::Mode; use crate::directories::matter_labs::test::metadata::case::input::Input as MatterLabsTestInput; use crate::summary::Summary; @@ -433,16 +431,16 @@ impl Input { /// /// Runs the input on REVM. /// - pub fn run_revm<'a>( + pub fn run_revm( self, summary: Arc>, - mut vm: Revm<'a>, + mut vm: Revm, mode: Mode, test_group: Option, name_prefix: String, index: usize, - evm_version: Option, - ) -> Revm<'a> { + evm_version: Option, + ) -> Revm { match self { Self::DeployEraVM { .. } => panic!("EraVM deploy transaction cannot be run on REVM"), Self::DeployEVM(deploy) => { diff --git a/compiler_tester/src/test/case/input/runtime.rs b/compiler_tester/src/test/case/input/runtime.rs index 2c04493e..398a3672 100644 --- a/compiler_tester/src/test/case/input/runtime.rs +++ b/compiler_tester/src/test/case/input/runtime.rs @@ -81,8 +81,9 @@ impl Runtime { name_prefix: String, index: usize, ) { - let name = format!("{}[{}:{}]", name_prefix, self.name, index); + let name = format!("{name_prefix}[{}:{index}]", self.name); vm.populate_storage(self.storage.inner); + let vm_function = match test_group.as_deref() { Some(benchmark_analyzer::Benchmark::EVM_INTERPRETER_GROUP_NAME) => { EraVM::execute_evm_interpreter:: diff --git a/compiler_tester/src/test/case/mod.rs b/compiler_tester/src/test/case/mod.rs index 6f8f58ad..8f9d0ba4 100644 --- a/compiler_tester/src/test/case/mod.rs +++ b/compiler_tester/src/test/case/mod.rs @@ -4,7 +4,6 @@ pub mod input; -use solidity_adapter::test::params::evm_version; use std::collections::BTreeMap; use std::sync::Arc; use std::sync::Mutex; @@ -164,7 +163,7 @@ impl Case { mode: &Mode, test_name: String, test_group: Option, - evm_version: Option, + evm_version: Option, ) { let name = if let Some(case_name) = self.name { format!("{test_name}::{case_name}") diff --git a/configs/solc-bin-default.json b/configs/solc-bin-default.json index 6f52210b..e07047a8 100644 --- a/configs/solc-bin-default.json +++ b/configs/solc-bin-default.json @@ -481,6 +481,12 @@ "destination": "./solc-bin/solc-${VERSION}" }, "0.8.27": { + "is_enabled": false, + "protocol": "https", + "source": "https://github.com/matter-labs/era-solidity/releases/download/${VERSION}-1.0.1/solc-${PLATFORM}-${VERSION}-1.0.1", + "destination": "./solc-bin/solc-${VERSION}" + }, + "0.8.28": { "is_enabled": true, "protocol": "https", "source": "https://github.com/matter-labs/era-solidity/releases/download/${VERSION}-1.0.1/solc-${PLATFORM}-${VERSION}-1.0.1", diff --git a/configs/solc-bin-upstream.json b/configs/solc-bin-upstream.json index f523e737..df4e1bf6 100644 --- a/configs/solc-bin-upstream.json +++ b/configs/solc-bin-upstream.json @@ -481,6 +481,12 @@ "destination": "./solc-bin-upstream/solc-${VERSION}" }, "0.8.27": { + "is_enabled": false, + "protocol": "compiler-bin-list", + "source": "https://raw.githubusercontent.com/ethereum/solc-bin/gh-pages/${PLATFORM}/list.json", + "destination": "./solc-bin-upstream/solc-${VERSION}" + }, + "0.8.28": { "is_enabled": true, "protocol": "compiler-bin-list", "source": "https://raw.githubusercontent.com/ethereum/solc-bin/gh-pages/${PLATFORM}/list.json", diff --git a/ethereum.yaml b/ethereum.yaml index 970b006e..aed98eaa 100644 --- a/ethereum.yaml +++ b/ethereum.yaml @@ -2149,6 +2149,10 @@ entries: modes: - Y+ version: '>=0.4.12' + transient_state_variable_initialization.sol: + hash: '0x702b8ca960d8a816c995de79c5d8134c' + enabled: true + version: '>=0.8.28' constructor_inheritance_init_order.sol: hash: '0x732e47de4aeaedcef778c08b21b2b210' enabled: true @@ -3617,6 +3621,14 @@ entries: - E - I version: '>=0.7.0' + transient_value_types.sol: + hash: '0xb1e434bbc71f843cd4d678eaf26be538' + enabled: true + version: '>=0.8.28' + transient_value_types_multi_frame_call.sol: + hash: '0xb5bdfeb2071e62c3505275035131f306' + enabled: true + version: '>=0.8.28' value_types.sol: hash: '0xba12d166de3a7cf7e09fb51f7bb45240' enabled: true @@ -3807,6 +3819,14 @@ entries: hash: '0xd7e21a5b8052338d07f212197e327a3b' enabled: true version: '>=0.4.12' + transient_storage_state_variable.sol: + hash: '0xf343442238f0126ff68e34b9428e86ed' + enabled: true + version: '>=0.8.28' + transient_storage_state_variable_abstract_contract.sol: + hash: '0x48bd4cb65538a1f033d0ffff71046daf' + enabled: true + version: '>=0.8.28' value_for_constructor.sol: hash: '0xfc70977e16cd72eb8121fffb33ce2abd' enabled: true @@ -3994,6 +4014,10 @@ entries: hash: '0x04cc5fce661ac43a24ff58258ddbdc00' enabled: true version: '>=0.4.12' + inline_assembly_transient_storage_access_inside_function.sol: + hash: '0x9a81fdaadd4790381c2ce5f0efdf6ae7' + enabled: true + version: '>=0.8.28' inline_assembly_write_to_stack.sol: hash: '0xfef6d721eb252e69d0f9b2d50938ba14' enabled: true @@ -4890,6 +4914,10 @@ entries: - E - I version: '>=0.4.14' + transient_state_variable_value_type.sol: + hash: '0x5c021cca1a4512a8730f227c6b36d1e2' + enabled: true + version: '>=0.8.28' multiSource: enabled: true entries: @@ -4960,6 +4988,10 @@ entries: hash: '0x1b5e6e137084de716e0d9d8446564dc7' enabled: true version: '>=0.4.12' + compound_assign_transient_storage.sol: + hash: '0xbd0c4b63b99f5d44ffb9a89f531f6192' + enabled: true + version: '>=0.8.28' shifts: enabled: true entries: @@ -5135,6 +5167,10 @@ entries: hash: '0x4e8524a65fb68db9368603447805c15a' enabled: true version: '>=0.4.21' + transient_storage_variable_increment_decrement.sol: + hash: '0x5d0aa44215d67a5009bec972dd3e44e6' + enabled: true + version: '>=0.8.28' userDefined: enabled: true entries: @@ -6616,6 +6652,14 @@ entries: hash: '0x03f114444079f9008d577cb44bca08f1' enabled: true version: '>=0.4.12' + delete_transient_state_variable.sol: + hash: '0x807c0ba2ce1f5c24a5353d93a1f957e5' + enabled: true + version: '>=0.8.28' + delete_transient_state_variable_non_zero_offset.sol: + hash: '0xc9979162f04813bc1e517a39fc4a3600' + enabled: true + version: '>=0.8.28' mapping_local_assignment.sol: hash: '0x6e2c8c62d5b866f8b2058c2fac97b584' enabled: true @@ -6652,6 +6696,46 @@ entries: hash: '0xae0630569bf5603ed696749ab21c00bc' enabled: true version: '>=0.4.21' + transient_function_type_state_variable.sol: + hash: '0x85b3b01bd9a867454ff3b3a0210afccf' + enabled: true + version: '>=0.8.28' + transient_state_address_variable_members.sol: + hash: '0xbb703fd9fdd2d7edd8f291abc690d643' + enabled: true + version: '>=0.8.28' + transient_state_enum_variable.sol: + hash: '0x901a1be1942a9f1cd22fa6be99fc8808' + enabled: true + version: '>=0.8.28' + transient_state_variable.sol: + hash: '0xe0e4957bc6b30a1aa0711c069d89626f' + enabled: true + version: '>=0.8.28' + transient_state_variable_cleanup_assignment.sol: + hash: '0xe6873be855417289eed3758ee10c1623' + enabled: true + version: '>=0.8.28' + transient_state_variable_cleanup_tstore.sol: + hash: '0x07a01321e9066c7d538ef425f4a35f23' + enabled: true + version: '>=0.8.28' + transient_state_variable_slot_inline_assembly.sol: + hash: '0x7ba508b71048e6d2cb26d03422fcac1c' + enabled: true + version: '>=0.8.28' + transient_state_variable_slots_and_offsets.sol: + hash: '0x3efe44053d16de0f8abd9bfc12e8adb0' + enabled: true + version: '>=0.8.28' + transient_state_variable_tuple_assignment.sol: + hash: '0x10686230bd53840bc3593c731b0f6e23' + enabled: true + version: '>=0.8.28' + transient_state_variable_udvt.sol: + hash: '0x239da4e075afd9b12c2c717e51d5b274' + enabled: true + version: '>=0.8.28' various: enabled: true entries: @@ -6757,6 +6841,10 @@ entries: hash: '0xfc575b0ea2e377c487c4baf0f21f8cb9' enabled: true version: '>=0.4.12' + different_call_type_transient.sol: + hash: '0x53e563a335d8bb3a02b8a021dabe6af5' + enabled: true + version: '>=0.8.28' empty_name_return_parameter.sol: hash: '0x5f095962f4ae9a08b908384aa3be701d' enabled: true @@ -6942,6 +7030,10 @@ entries: hash: '0x4051de6e556f6a42d4486dadce1e24bd' enabled: true version: '>=0.5.0' + transient_storage_reentrancy_lock.sol: + hash: '0x7974f3e336b300ecde5071cf652e2109' + enabled: true + version: '>=0.8.28' tuples.sol: hash: '0xbd8afa8671e0a31c4726453fde7251ca' enabled: true diff --git a/solidity b/solidity index 40a35a09..7893614a 160000 --- a/solidity +++ b/solidity @@ -1 +1 @@ -Subproject commit 40a35a097cb1e03550c7ce415f2b46ad81e882a6 +Subproject commit 7893614a31fbeacd1966994e310ed4f760772658 diff --git a/tests b/tests index 21b0bf0e..22539413 160000 --- a/tests +++ b/tests @@ -1 +1 @@ -Subproject commit 21b0bf0e044ee6b136fb3065aaf33ab7cd985d24 +Subproject commit 2253941334797eb2a997941845fb9eb0d436558b