From 7abcfe1c0c9dea7450aed22c5f4f17d44e525633 Mon Sep 17 00:00:00 2001 From: Oleksandr Zarudnyi Date: Fri, 26 Apr 2024 13:56:32 +0700 Subject: [PATCH] feat: add the lld llvm-config request --- Cargo.lock | 12 ++++++------ compiler_tester/Cargo.toml | 8 ++++---- compiler_tester/src/compilers/llvm.rs | 5 ++--- compiler_tester/src/vm/evm/input/build.rs | 9 +++------ compiler_tester/src/vm/evm/mod.rs | 4 ++-- fuzzer/Cargo.toml | 4 ++-- solidity | 2 +- 7 files changed, 20 insertions(+), 24 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 563e43cd..e65fb9f1 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -502,7 +502,7 @@ dependencies = [ [[package]] name = "era-compiler-llvm-context" version = "1.4.1" -source = "git+https://github.com/matter-labs/era-compiler-llvm-context?branch=main#94d110f5061e8ef9b14db964ed32ee974cceacb2" +source = "git+https://github.com/matter-labs/era-compiler-llvm-context?branch=az-cpr-1664-support-linking-deploy-and-runtime-code#a69572aebd84d05c02a0e1b9076eca6fbd20939b" dependencies = [ "anyhow", "era-compiler-common", @@ -524,7 +524,7 @@ dependencies = [ [[package]] name = "era-compiler-solidity" version = "1.4.1" -source = "git+https://github.com/matter-labs/era-compiler-solidity?branch=main#fab586681524407644c155dd22e36cd65b9fdee2" +source = "git+https://github.com/matter-labs/era-compiler-solidity?branch=az-cpr-1664-support-linking-deploy-and-runtime-code#9d68410b376284cec67c34d8e35fc7924463eec3" dependencies = [ "anyhow", "colored", @@ -553,7 +553,7 @@ dependencies = [ [[package]] name = "era-compiler-vyper" version = "1.4.1" -source = "git+https://github.com/matter-labs/era-compiler-vyper?branch=main#8fc8c76e4592f7b16619ab9b76a8f38521f54e4b" +source = "git+https://github.com/matter-labs/era-compiler-vyper?branch=az-cpr-1664-support-linking-deploy-and-runtime-code#f36982cf74ae7306e040efb3fdb270e145fbb2f9" dependencies = [ "anyhow", "colored", @@ -1083,7 +1083,7 @@ dependencies = [ [[package]] name = "inkwell" version = "0.4.0" -source = "git+https://github.com/matter-labs-forks/inkwell?branch=llvm-17#c0821d7234b867b79baf29b87a3fb0c751eccad2" +source = "git+https://github.com/matter-labs-forks/inkwell?branch=az-cpr-1664-support-linking-deploy-and-runtime-code#d15077482dc344bfb38037b304b58d1c79b132da" dependencies = [ "either", "inkwell_internals", @@ -1098,7 +1098,7 @@ dependencies = [ [[package]] name = "inkwell_internals" version = "0.9.0" -source = "git+https://github.com/matter-labs-forks/inkwell?branch=llvm-17#c0821d7234b867b79baf29b87a3fb0c751eccad2" +source = "git+https://github.com/matter-labs-forks/inkwell?branch=az-cpr-1664-support-linking-deploy-and-runtime-code#d15077482dc344bfb38037b304b58d1c79b132da" dependencies = [ "proc-macro2", "quote", @@ -1233,7 +1233,7 @@ checksum = "01cda141df6706de531b6c46c3a33ecca755538219bd484262fa09410c13539c" [[package]] name = "llvm-sys" version = "170.0.1" -source = "git+https://github.com/matter-labs-forks/llvm-sys.rs?branch=llvm-17.0#d165991787fe71259076aeabe25019f2e94c2a4b" +source = "git+https://github.com/matter-labs-forks/llvm-sys.rs?branch=az-cpr-1664-support-linking-deploy-and-runtime-code#d26f2ce4190126ffb25e96008f129ccd99937b2b" dependencies = [ "anyhow", "cc", diff --git a/compiler_tester/Cargo.toml b/compiler_tester/Cargo.toml index d012ac35..6daecd19 100644 --- a/compiler_tester/Cargo.toml +++ b/compiler_tester/Cargo.toml @@ -43,9 +43,9 @@ zkevm_opcode_defs = { git = "https://github.com/matter-labs/era-zkevm_opcode_def zkevm_tester = { git = "https://github.com/matter-labs/era-zkevm_tester", branch = "v1.4.1" } era-compiler-common = { 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-compiler-vyper = { git = "https://github.com/matter-labs/era-compiler-vyper", branch = "main" } +era-compiler-llvm-context = { git = "https://github.com/matter-labs/era-compiler-llvm-context", branch = "az-cpr-1664-support-linking-deploy-and-runtime-code" } +era-compiler-solidity = { git = "https://github.com/matter-labs/era-compiler-solidity", branch = "az-cpr-1664-support-linking-deploy-and-runtime-code" } +era-compiler-vyper = { git = "https://github.com/matter-labs/era-compiler-vyper", branch = "az-cpr-1664-support-linking-deploy-and-runtime-code" } # era-compiler-common = { path = "../../era-compiler-common" } # era-compiler-llvm-context = { path = "../../era-compiler-llvm-context" } @@ -67,6 +67,6 @@ features = ["blocking"] [dependencies.inkwell] git = "https://github.com/matter-labs-forks/inkwell" -branch = "llvm-17" +branch = "az-cpr-1664-support-linking-deploy-and-runtime-code" default-features = false features = ["llvm17-0", "no-libffi-linking", "target-eravm", "target-evm"] diff --git a/compiler_tester/src/compilers/llvm.rs b/compiler_tester/src/compilers/llvm.rs index 94ad2a85..892e7c9c 100644 --- a/compiler_tester/src/compilers/llvm.rs +++ b/compiler_tester/src/compilers/llvm.rs @@ -120,7 +120,6 @@ impl Compiler for LLVMCompiler { .map_err(|error| anyhow::anyhow!(error.to_string()))?; let optimizer = era_compiler_llvm_context::Optimizer::new(mode.llvm_optimizer_settings.clone()); - let source_hash = sha3::Keccak256::digest(source.as_bytes()).into(); let context = era_compiler_llvm_context::EVMContext::< era_compiler_llvm_context::EVMDummyDependency, @@ -133,8 +132,8 @@ impl Compiler for LLVMCompiler { true, debug_config.clone(), ); - let build = context.build(path, Some(source_hash))?; - let build = EVMBuild::new(era_compiler_llvm_context::EVMBuild::default(), build); + let build = context.build(path, None)?; + let build = EVMBuild::new(build.as_slice().to_vec(), vec![]); Ok((path.to_owned(), build)) }) diff --git a/compiler_tester/src/vm/evm/input/build.rs b/compiler_tester/src/vm/evm/input/build.rs index 8579fa2d..3c9aa198 100644 --- a/compiler_tester/src/vm/evm/input/build.rs +++ b/compiler_tester/src/vm/evm/input/build.rs @@ -8,19 +8,16 @@ #[derive(Debug, Clone)] pub struct Build { /// The contract deploy build. - pub deploy_build: era_compiler_llvm_context::EVMBuild, + pub deploy_build: Vec, /// The contract runtime build. - pub runtime_build: era_compiler_llvm_context::EVMBuild, + pub runtime_build: Vec, } impl Build { /// /// A shortcut constructor. /// - pub fn new( - deploy_build: era_compiler_llvm_context::EVMBuild, - runtime_build: era_compiler_llvm_context::EVMBuild, - ) -> Self { + pub fn new(deploy_build: Vec, runtime_build: Vec) -> Self { Self { deploy_build, runtime_build, diff --git a/compiler_tester/src/vm/evm/mod.rs b/compiler_tester/src/vm/evm/mod.rs index ee0f5c26..9b64ab7a 100644 --- a/compiler_tester/src/vm/evm/mod.rs +++ b/compiler_tester/src/vm/evm/mod.rs @@ -89,9 +89,9 @@ impl<'evm> EVM<'evm> { constructor_args: Vec, ) -> anyhow::Result { let bytecode = self.known_contracts.values().next().unwrap(); - let mut deploy_code = bytecode.deploy_build.bytecode.to_owned(); + let mut deploy_code = bytecode.deploy_build.to_owned(); deploy_code.extend(constructor_args); - let runtime_code = bytecode.runtime_build.bytecode.to_owned(); + let runtime_code = bytecode.runtime_build.to_owned(); self.runtime .balances diff --git a/fuzzer/Cargo.toml b/fuzzer/Cargo.toml index 3f095ef8..0c636927 100644 --- a/fuzzer/Cargo.toml +++ b/fuzzer/Cargo.toml @@ -30,8 +30,8 @@ libfuzzer-sys = "0.4" zkevm-assembly = { git = "https://github.com/matter-labs/era-zkEVM-assembly", branch = "v1.4.1" } zkevm_tester = { git = "https://github.com/matter-labs/era-zkevm_tester", branch = "v1.4.1" } -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-compiler-llvm-context = { git = "https://github.com/matter-labs/era-compiler-llvm-context", branch = "az-cpr-1664-support-linking-deploy-and-runtime-code" } +era-compiler-solidity = { git = "https://github.com/matter-labs/era-compiler-solidity", branch = "az-cpr-1664-support-linking-deploy-and-runtime-code" } compiler-tester = { path = "../compiler_tester" } solidity-adapter = { path = "../solidity_adapter" } diff --git a/solidity b/solidity index 30d78788..24e3c308 160000 --- a/solidity +++ b/solidity @@ -1 +1 @@ -Subproject commit 30d78788941b5f891c96fe8a1c7b924c32a1478c +Subproject commit 24e3c3088f80287e7c7c880215d8cdd9dd3e287c