From 40ea6238978121f8c3c0b41cf0b70c80151af328 Mon Sep 17 00:00:00 2001 From: Oleksandr Zarudnyi Date: Wed, 4 Dec 2024 15:05:56 +0800 Subject: [PATCH 1/3] fix(evm): supports EVMLA PUSHSIZE --- Cargo.lock | 6 +++--- compiler_tester/Cargo.toml | 4 ++-- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 6ece9db6..8f503bae 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1072,7 +1072,7 @@ dependencies = [ [[package]] name = "era-compiler-solidity" version = "1.5.8" -source = "git+https://github.com/matter-labs/era-compiler-solidity?branch=main#c0cb2c6764f8ecbf209f75e518a4261375fb5eed" +source = "git+https://github.com/matter-labs/era-compiler-solidity?branch=az-support-evmla-pushsize#2b0da9ed28045642125af15f3d69d5dce8b070dc" dependencies = [ "anyhow", "clap", @@ -1122,7 +1122,7 @@ dependencies = [ [[package]] name = "era-solc" version = "1.5.8" -source = "git+https://github.com/matter-labs/era-compiler-solidity?branch=main#c0cb2c6764f8ecbf209f75e518a4261375fb5eed" +source = "git+https://github.com/matter-labs/era-compiler-solidity?branch=az-support-evmla-pushsize#2b0da9ed28045642125af15f3d69d5dce8b070dc" dependencies = [ "anyhow", "boolinator", @@ -1139,7 +1139,7 @@ dependencies = [ [[package]] name = "era-yul" version = "1.5.8" -source = "git+https://github.com/matter-labs/era-compiler-solidity?branch=main#c0cb2c6764f8ecbf209f75e518a4261375fb5eed" +source = "git+https://github.com/matter-labs/era-compiler-solidity?branch=az-support-evmla-pushsize#2b0da9ed28045642125af15f3d69d5dce8b070dc" dependencies = [ "anyhow", "regex", diff --git a/compiler_tester/Cargo.toml b/compiler_tester/Cargo.toml index 9fec6205..5b2a3c12 100644 --- a/compiler_tester/Cargo.toml +++ b/compiler_tester/Cargo.toml @@ -49,8 +49,8 @@ vm2 = { git = "https://github.com/matter-labs/vm2", optional = true, package = " era-compiler-common = { git = "https://github.com/matter-labs/era-compiler-common", branch = "main" } era-compiler-downloader = { git = "https://github.com/matter-labs/era-compiler-common", branch = "main" } era-compiler-llvm-context = { git = "https://github.com/matter-labs/era-compiler-llvm-context", branch = "main" } -era-compiler-solidity = { git = "https://github.com/matter-labs/era-compiler-solidity", branch = "main" } -era-solc = { git = "https://github.com/matter-labs/era-compiler-solidity", branch = "main" } +era-compiler-solidity = { git = "https://github.com/matter-labs/era-compiler-solidity", branch = "az-support-evmla-pushsize" } +era-solc = { git = "https://github.com/matter-labs/era-compiler-solidity", branch = "az-support-evmla-pushsize" } era-compiler-vyper = { git = "https://github.com/matter-labs/era-compiler-vyper", branch = "main" } solidity-adapter = { path = "../solidity_adapter" } From 63ecc8e5a4aaec3f20d414ee35e5c1e24b5ed5ab Mon Sep 17 00:00:00 2001 From: Oleksandr Zarudnyi Date: Wed, 4 Dec 2024 15:17:35 +0800 Subject: [PATCH 2/3] fix(evm): pass constructor arguments to REVM --- compiler_tester/src/test/case/input/deploy_evm.rs | 8 ++++++-- compiler_tester/src/vm/revm/init.rs | 4 ++-- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/compiler_tester/src/test/case/input/deploy_evm.rs b/compiler_tester/src/test/case/input/deploy_evm.rs index d667058c..ad894d3e 100644 --- a/compiler_tester/src/test/case/input/deploy_evm.rs +++ b/compiler_tester/src/test/case/input/deploy_evm.rs @@ -131,11 +131,15 @@ impl DeployEVM { contract_identifier: self.identifier.clone(), }, ); + let size = self.deploy_code.len(); + let calldata = self.calldata.inner.clone(); + let mut code = self.deploy_code; + code.extend(self.calldata.inner); let vm = vm.update_deploy_balance(&self.caller); let mut vm = - vm.fill_deploy_new_transaction(self.caller, self.value, evm_version, self.deploy_code); + vm.fill_deploy_new_transaction(self.caller, self.value, evm_version, code); let result = match vm.state.transact_commit() { Ok(res) => res, @@ -175,7 +179,7 @@ impl DeployEVM { } else if let Some(error) = error { Summary::invalid(summary, test, format!("{error:?}")); } else { - Summary::failed(summary, test, self.expected, output, self.calldata.inner); + Summary::failed(summary, test, self.expected, output, calldata); } vm diff --git a/compiler_tester/src/vm/revm/init.rs b/compiler_tester/src/vm/revm/init.rs index e452ceb9..4d95b39a 100644 --- a/compiler_tester/src/vm/revm/init.rs +++ b/compiler_tester/src/vm/revm/init.rs @@ -124,7 +124,7 @@ impl<'a> Revm<'a> { caller: web3::types::Address, value: Option, evm_version: Option, - deploy_code: Vec, + code: Vec, ) -> Self { let vm = self .state @@ -146,7 +146,7 @@ impl<'a> Revm<'a> { env.tx.gas_limit = evm_context.block_gas_limit; env.tx.access_list = vec![]; env.tx.caller = web3_address_to_revm_address(&caller); - env.tx.data = revm::primitives::Bytes::from(deploy_code); + env.tx.data = revm::primitives::Bytes::from(code); env.tx.value = revm::primitives::U256::from(value.unwrap_or_default()); env.tx.transact_to = TxKind::Create; }) From 780e68bedfba3b06ac974838cd69f337610514af Mon Sep 17 00:00:00 2001 From: Oleksandr Zarudnyi Date: Fri, 6 Dec 2024 13:39:51 +0800 Subject: [PATCH 3/3] update deps --- Cargo.lock | 6 +++--- benchmark_analyzer/src/lib.rs | 1 + compiler_tester/Cargo.toml | 4 ++-- compiler_tester/src/test/case/input/deploy_evm.rs | 5 ++--- 4 files changed, 8 insertions(+), 8 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 8f503bae..b40cf1ce 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1072,7 +1072,7 @@ dependencies = [ [[package]] name = "era-compiler-solidity" version = "1.5.8" -source = "git+https://github.com/matter-labs/era-compiler-solidity?branch=az-support-evmla-pushsize#2b0da9ed28045642125af15f3d69d5dce8b070dc" +source = "git+https://github.com/matter-labs/era-compiler-solidity?branch=main#cad69d46f008e96909282921ce79fca6d2fe9b5a" dependencies = [ "anyhow", "clap", @@ -1122,7 +1122,7 @@ dependencies = [ [[package]] name = "era-solc" version = "1.5.8" -source = "git+https://github.com/matter-labs/era-compiler-solidity?branch=az-support-evmla-pushsize#2b0da9ed28045642125af15f3d69d5dce8b070dc" +source = "git+https://github.com/matter-labs/era-compiler-solidity?branch=main#cad69d46f008e96909282921ce79fca6d2fe9b5a" dependencies = [ "anyhow", "boolinator", @@ -1139,7 +1139,7 @@ dependencies = [ [[package]] name = "era-yul" version = "1.5.8" -source = "git+https://github.com/matter-labs/era-compiler-solidity?branch=az-support-evmla-pushsize#2b0da9ed28045642125af15f3d69d5dce8b070dc" +source = "git+https://github.com/matter-labs/era-compiler-solidity?branch=main#cad69d46f008e96909282921ce79fca6d2fe9b5a" dependencies = [ "anyhow", "regex", diff --git a/benchmark_analyzer/src/lib.rs b/benchmark_analyzer/src/lib.rs index 88547fa1..f18b07de 100644 --- a/benchmark_analyzer/src/lib.rs +++ b/benchmark_analyzer/src/lib.rs @@ -12,6 +12,7 @@ pub use self::benchmark::group::element::Element as BenchmarkElement; pub use self::benchmark::group::Group as BenchmarkGroup; pub use self::benchmark::metadata::Metadata; pub use self::benchmark::Benchmark; + /// /// The all elements group name. /// diff --git a/compiler_tester/Cargo.toml b/compiler_tester/Cargo.toml index 5b2a3c12..9fec6205 100644 --- a/compiler_tester/Cargo.toml +++ b/compiler_tester/Cargo.toml @@ -49,8 +49,8 @@ vm2 = { git = "https://github.com/matter-labs/vm2", optional = true, package = " era-compiler-common = { git = "https://github.com/matter-labs/era-compiler-common", branch = "main" } era-compiler-downloader = { git = "https://github.com/matter-labs/era-compiler-common", branch = "main" } era-compiler-llvm-context = { git = "https://github.com/matter-labs/era-compiler-llvm-context", branch = "main" } -era-compiler-solidity = { git = "https://github.com/matter-labs/era-compiler-solidity", branch = "az-support-evmla-pushsize" } -era-solc = { git = "https://github.com/matter-labs/era-compiler-solidity", branch = "az-support-evmla-pushsize" } +era-compiler-solidity = { git = "https://github.com/matter-labs/era-compiler-solidity", branch = "main" } +era-solc = { git = "https://github.com/matter-labs/era-compiler-solidity", branch = "main" } era-compiler-vyper = { git = "https://github.com/matter-labs/era-compiler-vyper", branch = "main" } solidity-adapter = { path = "../solidity_adapter" } diff --git a/compiler_tester/src/test/case/input/deploy_evm.rs b/compiler_tester/src/test/case/input/deploy_evm.rs index ad894d3e..ebb9fdf6 100644 --- a/compiler_tester/src/test/case/input/deploy_evm.rs +++ b/compiler_tester/src/test/case/input/deploy_evm.rs @@ -131,15 +131,14 @@ impl DeployEVM { contract_identifier: self.identifier.clone(), }, ); - + let size = self.deploy_code.len(); let calldata = self.calldata.inner.clone(); let mut code = self.deploy_code; code.extend(self.calldata.inner); let vm = vm.update_deploy_balance(&self.caller); - let mut vm = - vm.fill_deploy_new_transaction(self.caller, self.value, evm_version, code); + let mut vm = vm.fill_deploy_new_transaction(self.caller, self.value, evm_version, code); let result = match vm.state.transact_commit() { Ok(res) => res,