Skip to content

Commit

Permalink
feat: run benchmarks on Yul impl of EVM interpreter
Browse files Browse the repository at this point in the history
  • Loading branch information
hedgar2017 committed May 1, 2024
1 parent 1c82972 commit 1438777
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 17 deletions.
2 changes: 1 addition & 1 deletion .gitmodules
Original file line number Diff line number Diff line change
Expand Up @@ -9,4 +9,4 @@
[submodule "era-contracts"]
path = era-contracts
url = https://github.com/matter-labs/era-contracts
branch = sb-1-5-0-evm-eq-integration
branch = evm-equivalence-yul
26 changes: 11 additions & 15 deletions compiler_tester/src/vm/eravm/system_contracts.rs
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ impl SystemContracts {

/// The EVM interpreter system contract implementation path.
const PATH_EVM_INTERPRETER: &'static str =
"era-contracts/system-contracts/contracts/EvmInterpreter.sol:EvmInterpreter";
"era-contracts/system-contracts/contracts/EvmInterpreterPreprocessed.yul";

/// The `keccak256` system contract implementation path.
const PATH_KECCAK256: &'static str =
Expand Down Expand Up @@ -252,21 +252,17 @@ impl SystemContracts {
];

let mut yul_file_paths = Vec::with_capacity(yul_system_contracts.len() + 1);
for (_, path) in yul_system_contracts.iter() {
let file_path = path.split(':').next().expect("Always valid");
yul_file_paths.push(file_path.to_owned());
for (_, path) in yul_system_contracts.into_iter() {
yul_file_paths.push(path.to_owned());
}
yul_file_paths.push(Self::PATH_EVM_INTERPRETER.to_owned());
let yul_optimizer_settings =
era_compiler_llvm_context::OptimizerSettings::evm_interpreter();
let yul_mode = YulMode::new(yul_optimizer_settings, true).into();
let mut builds =
Self::compile(YulCompiler, &yul_mode, yul_file_paths, debug_config.clone())?;

let mut solidity_file_paths = Vec::with_capacity(solidity_system_contracts.len() + 1);
for (_, path) in solidity_system_contracts.iter() {
let file_path = path.split(':').next().expect("Always valid");
solidity_file_paths.push(file_path.to_owned());
}
for pattern in [
"era-contracts/system-contracts/**/*.sol",
"tests/solidity/complex/interpreter/*.sol",
Expand Down Expand Up @@ -298,6 +294,13 @@ impl SystemContracts {
debug_config,
)?);

let default_aa = builds.remove(Self::PATH_DEFAULT_AA).ok_or_else(|| {
anyhow::anyhow!("The default AA code not found in the compiler build artifacts")
})?;
let evm_interpreter = builds.remove(Self::PATH_EVM_INTERPRETER).ok_or_else(|| {
anyhow::anyhow!("The EVM interpreter code not found in the compiler build artifacts")
})?;

let mut system_contracts =
Vec::with_capacity(solidity_system_contracts.len() + yul_system_contracts.len());
system_contracts.extend(solidity_system_contracts);
Expand All @@ -311,13 +314,6 @@ impl SystemContracts {
deployed_contracts.push((address, build));
}

let default_aa = builds.remove(Self::PATH_DEFAULT_AA).ok_or_else(|| {
anyhow::anyhow!("The default AA code not found in the compiler build artifacts")
})?;
let evm_interpreter = builds.remove(Self::PATH_EVM_INTERPRETER).ok_or_else(|| {
anyhow::anyhow!("The EVM interpreter code not found in the compiler build artifacts")
})?;

println!(
" {} building system contracts in {}.{:03}s",
"Finished".bright_green().bold(),
Expand Down
Binary file modified system-contracts-stable-build
Binary file not shown.

0 comments on commit 1438777

Please sign in to comment.