Skip to content

Commit

Permalink
Merge branch 'main' into jms-transient-fail
Browse files Browse the repository at this point in the history
  • Loading branch information
joonazan authored May 23, 2024
2 parents 52a76b0 + d89a149 commit f1ece2e
Show file tree
Hide file tree
Showing 9 changed files with 36 additions and 22 deletions.
17 changes: 11 additions & 6 deletions benchmark_analyzer/src/benchmark/group/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,11 @@ impl Group {
let mut ergs_total_candidate: u64 = 0;

for (path, reference) in reference.elements.iter() {
if path.contains("tests/solidity/complex/interpreter/test.json")
&& path.contains("#deployer")
{
continue;
}
let candidate = match candidate.elements.get(path.as_str()) {
Some(candidate) => candidate,
None => continue,
Expand Down Expand Up @@ -156,19 +161,19 @@ impl Group {
/// Returns the EVM interpreter ergs/gas ratio.
///
pub fn evm_interpreter_ratios(&self) -> Vec<(String, f64)> {
#[allow(clippy::unnecessary_to_owned)]
let elements: Vec<(String, Element)> = self.elements.to_owned().into_iter().collect();
let mut results = Vec::with_capacity(Benchmark::EVM_OPCODES.len());
for evm_opcode in Benchmark::EVM_OPCODES.into_iter() {
let name_substring = format!("test.json::{evm_opcode}[");
let mut template_and_full: Vec<(String, Element)> = elements
let [full, template]: [Element; 2] = self
.elements
.iter()
.filter(|element| element.0.contains(name_substring.as_str()))
.rev()
.take(2)
.cloned()
.collect();
let (full, template) = (template_and_full.remove(0).1, template_and_full.remove(0).1);
.map(|element| (element.1.to_owned()))
.collect::<Vec<Element>>()
.try_into()
.expect("Always valid");

let ergs_difference = full.ergs - template.ergs;
let gas_difference = full.gas - template.gas;
Expand Down
13 changes: 6 additions & 7 deletions benchmark_analyzer/src/benchmark/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,8 @@ impl Benchmark {
/// The EVM interpreter group identifier.
pub const EVM_INTERPRETER_GROUP_NAME: &'static str = "EVMInterpreter";

/// The EVM interpreter group identifier prefix.
pub const EVM_INTERPRETER_GROUP_PREFIX: &'static str = "EVMInterpreter M3B3";
/// The EVM interpreter cycles group identifier.
pub const EVM_INTERPRETER_GROUP_NAME_CYCLES: &'static str = "EVMInterpreter M3B3";

/// The EVM opcodes to test.
pub const EVM_OPCODES: [&'static str; 135] = [
Expand Down Expand Up @@ -159,12 +159,12 @@ impl Benchmark {
"SWAP14",
"SWAP15",
"SWAP16",
"CREATE",
"CALL",
"RETURN",
"DELEGATECALL",
"STATICCALL",
"DELEGATECALL",
"CREATE",
"CREATE2",
"RETURN",
"REVERT",
];

Expand All @@ -181,8 +181,7 @@ impl Benchmark {
};

let mut group_results = Group::compare(reference_group, candidate_group);
println!("group geomin {}", group_results.ergs_mean);
if group_name.starts_with(Self::EVM_INTERPRETER_GROUP_PREFIX) {
if group_name.starts_with(Self::EVM_INTERPRETER_GROUP_NAME_CYCLES) {
if let (Some(reference_ratios), Some(candidate_ratios)) = (
reference
.groups
Expand Down
6 changes: 3 additions & 3 deletions benchmark_analyzer/src/benchmark_analyzer/arguments.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,19 +13,19 @@ use structopt::StructOpt;
#[structopt(name = "benchmark-analyzer", about = "The zkEVM benchmark analyzer")]
pub struct Arguments {
/// The reference build benchmark.
#[structopt(long = "reference")]
#[structopt(long = "reference", default_value = "reference.json")]
pub reference: PathBuf,

/// The candidate build benchmark.
#[structopt(long = "candidate")]
#[structopt(long = "candidate", default_value = "candidate.json")]
pub candidate: PathBuf,

/// The output file. If unset, the result is printed to `stdout`.
#[structopt(short = "o", long = "output-file")]
pub output_path: Option<PathBuf>,

/// Maximum number of results displayed in a group.
#[structopt(short = "gm", long = "group-max", default_value = "100")]
#[structopt(long = "group-max", default_value = "100")]
pub group_max: usize,
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,9 @@ pub struct EVMContract {
}

impl EVMContract {
/// The number of pattern reruns to provide more accurate benchmarks.
pub const RUNTIME_CODE_REPEATS: usize = 32;

///
/// Returns the init code.
///
Expand All @@ -36,7 +39,13 @@ impl EVMContract {
///
/// Returns the runtime code.
///
pub fn runtime_code(&self) -> String {
format!("{}00", self.runtime_code)
pub fn runtime_code(&self, instruction_name: &str) -> String {
let repeats = match instruction_name {
"RETURNDATASIZE" | "RETURNDATACOPY" | "EXTCODESIZE" | "EXTCODEHASH" | "EXTCODECOPY"
| "CALL" | "STATICCALL" | "DELEGATECALL" | "CREATE" | "CREATE2" => 1,
_ => Self::RUNTIME_CODE_REPEATS,
};

format!("{}00", self.runtime_code.repeat(repeats))
}
}
3 changes: 2 additions & 1 deletion compiler_tester/src/directories/matter_labs/test/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -280,7 +280,8 @@ impl MatterLabsTest {
let mut instances = BTreeMap::new();

for (instance, evm_contract) in self.metadata.evm_contracts.iter() {
let runtime_code = evm_contract.runtime_code();
let instruction_name = instance.split('_').next().expect("Always exists");
let runtime_code = evm_contract.runtime_code(instruction_name);
let mut bytecode = evm_contract.init_code(runtime_code.len());
bytecode.push_str(runtime_code.as_str());

Expand Down
2 changes: 1 addition & 1 deletion compiler_tester/src/vm/eravm/system_contracts.rs
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ impl SystemContracts {

/// The base token system contract implementation path.
const PATH_BASE_TOKEN: &'static str =
"era-contracts/system-contracts/contracts/L2BaseToken.sol:L2BaseToken";
"era-contracts/system-contracts/contracts/L2EthToken.sol:L2EthToken";

/// The EVM gas manager system contract implementation path.
const PATH_EVM_GAS_MANAGER: &'static str =
Expand Down
2 changes: 1 addition & 1 deletion era-contracts
Submodule era-contracts updated 462 files
2 changes: 1 addition & 1 deletion solidity
Submodule solidity updated 50 files
+5 −2 Changelog.md
+176 −45 cmake/templates/license.h.in
+1 −4 docs/installing-solidity.rst
+1 −0 liblangutil/Token.h
+40 −2 libsolidity/codegen/YulUtilFunctions.cpp
+1 −37 scripts/check_style.sh
+0 −11 scripts/create_source_tarball.sh
+1 −1 scripts/deps-ppa/static_z3.sh
+3 −2 scripts/release_ppa.sh
+4 −0 test/cmdlineTests/require_with_error_ir/output
+4 −0 test/cmdlineTests/require_with_string_ir/output
+45 −0 test/libsolidity/semanticTests/errors/errors_by_parameter_type.sol
+22 −0 test/libsolidity/semanticTests/errors/small_error_optimization.sol
+11 −12 test/tools/afl_fuzzer.cpp
+21 −22 test/tools/fuzzer_common.cpp
+60 −61 test/tools/isoltest.cpp
+5 −6 test/tools/ossfuzz/AbiV2IsabelleFuzzer.cpp
+3 −4 test/tools/ossfuzz/SolidityCustomMutatorInterface.cpp
+9 −10 test/tools/ossfuzz/SolidityEvmoneInterface.cpp
+26 −27 test/tools/ossfuzz/SolidityGenerator.cpp
+11 −12 test/tools/ossfuzz/StackReuseCodegenFuzzer.cpp
+6 −7 test/tools/ossfuzz/abiV2ProtoFuzzer.cpp
+1 −3 test/tools/ossfuzz/const_opt_ossfuzz.cpp
+160 −161 test/tools/ossfuzz/protoToAbiV2.cpp
+29 −30 test/tools/ossfuzz/protoToSol.cpp
+75 −76 test/tools/ossfuzz/protoToYul.cpp
+4 −5 test/tools/ossfuzz/protomutators/YulProtoMutator.cpp
+7 −8 test/tools/ossfuzz/solProtoFuzzer.cpp
+4 −5 test/tools/ossfuzz/solc_ossfuzz.cpp
+2 −3 test/tools/ossfuzz/strictasm_assembly_ossfuzz.cpp
+4 −5 test/tools/ossfuzz/strictasm_diff_ossfuzz.cpp
+2 −3 test/tools/ossfuzz/strictasm_opt_ossfuzz.cpp
+2 −3 test/tools/ossfuzz/yulFuzzerCommon.cpp
+5 −6 test/tools/ossfuzz/yulProtoFuzzer.cpp
+9 −10 test/tools/ossfuzz/yulProto_diff_ossfuzz.cpp
+46 −47 test/tools/yulopti.cpp
+15 −16 test/tools/yulrun.cpp
+20 −21 tools/yulPhaser/AlgorithmRunner.cpp
+12 −13 tools/yulPhaser/Chromosome.cpp
+7 −8 tools/yulPhaser/Common.cpp
+4 −5 tools/yulPhaser/FitnessMetrics.cpp
+6 −7 tools/yulPhaser/GeneticAlgorithms.cpp
+32 −33 tools/yulPhaser/Mutations.cpp
+11 −12 tools/yulPhaser/PairSelections.cpp
+97 −98 tools/yulPhaser/Phaser.cpp
+26 −27 tools/yulPhaser/Population.cpp
+31 −32 tools/yulPhaser/Program.cpp
+14 −15 tools/yulPhaser/ProgramCache.cpp
+13 −14 tools/yulPhaser/Selections.cpp
+2 −3 tools/yulPhaser/SimulationRNG.cpp
Binary file modified system-contracts-stable-build
Binary file not shown.

0 comments on commit f1ece2e

Please sign in to comment.