Skip to content

Commit

Permalink
feat(evm): support library linking (#135)
Browse files Browse the repository at this point in the history
  • Loading branch information
hedgar2017 authored Jan 26, 2025
1 parent 20c838d commit 4ac605d
Show file tree
Hide file tree
Showing 36 changed files with 318 additions and 935 deletions.
115 changes: 21 additions & 94 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 0 additions & 1 deletion compiler_tester/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,6 @@ lazy_static = "=1.5.0"
bincode = "=1.3.3"
chrono = "=0.4.38"

evm = { git = "https://github.com/rust-ethereum/evm", rev = "f7a23df6c478ca6a151af5f60e62944800529a61" }
revm = { git = "https://github.com/bluealloy/revm", rev = "fa5650ee8a4d802f4f3557014dd157adfb074460" }

zkevm_opcode_defs = "=0.150.6"
Expand Down
2 changes: 1 addition & 1 deletion compiler_tester/src/compiler_tester/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -211,7 +211,7 @@ fn main_inner(arguments: Arguments) -> anyhow::Result<()> {
)
}
compiler_tester::Environment::REVM => {
compiler_tester::EVM::download(executable_download_config_paths)?;
compiler_tester::REVM::download(executable_download_config_paths)?;
compiler_tester.run_revm(toolchain)
}
}?;
Expand Down
2 changes: 1 addition & 1 deletion compiler_tester/src/compilers/eravm/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ use era_solc::CollectableError;
use crate::compilers::mode::Mode;
use crate::compilers::Compiler;
use crate::vm::eravm::input::Input as EraVMInput;
use crate::vm::evm::input::Input as EVMInput;
use crate::vm::revm::input::Input as EVMInput;

use self::mode::Mode as EraVMMode;

Expand Down
5 changes: 2 additions & 3 deletions compiler_tester/src/compilers/llvm/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@ use era_solc::CollectableError;
use crate::compilers::mode::Mode;
use crate::compilers::Compiler;
use crate::vm::eravm::input::Input as EraVMInput;
use crate::vm::evm::input::build::Build as EVMBuild;
use crate::vm::evm::input::Input as EVMInput;
use crate::vm::revm::input::build::Build as EVMBuild;
use crate::vm::revm::input::Input as EVMInput;

use self::mode::Mode as LLVMMode;

Expand Down Expand Up @@ -116,7 +116,6 @@ impl Compiler for LLVMCompiler {
era_compiler_common::HashType::Ipfs,
mode.llvm_optimizer_settings.to_owned(),
llvm_options,
None,
debug_config.clone(),
)?;
build.check_errors()?;
Expand Down
2 changes: 1 addition & 1 deletion compiler_tester/src/compilers/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ pub mod vyper;
pub mod yul;

use crate::vm::eravm::input::Input as EraVMInput;
use crate::vm::evm::input::Input as EVMInput;
use crate::vm::revm::input::Input as EVMInput;

use self::mode::Mode;

Expand Down
9 changes: 6 additions & 3 deletions compiler_tester/src/compilers/solidity/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,8 @@ use crate::compilers::cache::Cache;
use crate::compilers::mode::Mode;
use crate::compilers::Compiler;
use crate::vm::eravm::input::Input as EraVMInput;
use crate::vm::evm::input::build::Build as EVMBuild;
use crate::vm::evm::input::Input as EVMInput;
use crate::vm::revm::input::build::Build as EVMBuild;
use crate::vm::revm::input::Input as EVMInput;

use self::cache_key::CacheKey;
use self::mode::Mode as SolidityMode;
Expand Down Expand Up @@ -426,6 +426,8 @@ impl Compiler for SolidityCompiler {

let solc_compiler = SolidityCompiler::executable(&mode.solc_version)?;

let linker_symbols = libraries.as_linker_symbols()?;

let project = era_compiler_solidity::Project::try_from_solc_output(
libraries,
mode.solc_codegen,
Expand All @@ -439,10 +441,11 @@ impl Compiler for SolidityCompiler {
era_compiler_common::HashType::Ipfs,
mode.llvm_optimizer_settings.to_owned(),
llvm_options,
None,
debug_config,
)?;
build.check_errors()?;
let build = build.link(linker_symbols);
build.check_errors()?;
let builds: HashMap<String, EVMBuild> = build
.results
.into_iter()
Expand Down
4 changes: 2 additions & 2 deletions compiler_tester/src/compilers/solidity/upstream/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,8 @@ use crate::compilers::yul::mode_upstream::Mode as YulUpstreamMode;
use crate::compilers::Compiler;
use crate::toolchain::Toolchain;
use crate::vm::eravm::input::Input as EraVMInput;
use crate::vm::evm::input::build::Build as EVMBuild;
use crate::vm::evm::input::Input as EVMInput;
use crate::vm::revm::input::build::Build as EVMBuild;
use crate::vm::revm::input::Input as EVMInput;

use self::mode::Mode as SolidityUpstreamMode;
use self::solc::standard_json::input::language::Language as SolcStandardJsonInputLanguage;
Expand Down
3 changes: 2 additions & 1 deletion compiler_tester/src/compilers/vyper/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ use crate::compilers::cache::Cache;
use crate::compilers::mode::Mode;
use crate::compilers::Compiler;
use crate::vm::eravm::input::Input as EraVMInput;
use crate::vm::revm::input::Input as EVMInput;

use self::cache_key::CacheKey;
use self::mode::Mode as VyperMode;
Expand Down Expand Up @@ -267,7 +268,7 @@ impl Compiler for VyperCompiler {
_test_params: Option<&solidity_adapter::Params>,
_llvm_options: Vec<String>,
_debug_config: Option<era_compiler_llvm_context::DebugConfig>,
) -> anyhow::Result<crate::vm::evm::input::Input> {
) -> anyhow::Result<EVMInput> {
todo!()
}

Expand Down
4 changes: 2 additions & 2 deletions compiler_tester/src/compilers/yul/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,8 @@ use crate::compilers::solidity::SolidityCompiler;
use crate::compilers::Compiler;
use crate::toolchain::Toolchain;
use crate::vm::eravm::input::Input as EraVMInput;
use crate::vm::evm::input::build::Build as EVMBuild;
use crate::vm::evm::input::Input as EVMInput;
use crate::vm::revm::input::build::Build as EVMBuild;
use crate::vm::revm::input::Input as EVMInput;

use self::mode::Mode as YulMode;

Expand Down
Loading

0 comments on commit 4ac605d

Please sign in to comment.