Skip to content

Commit

Permalink
feat(interpreter): Unify instruction fn signature (#283)
Browse files Browse the repository at this point in the history
* feat(interpreter): Unify instraction fucntion signature

* rm ruint patch

* cleanup, nits, fix build

* cargo update and clippy

* clippy
  • Loading branch information
rakita committed Dec 9, 2022
1 parent 9ced528 commit 90fe01e
Show file tree
Hide file tree
Showing 24 changed files with 864 additions and 884 deletions.
49 changes: 29 additions & 20 deletions Cargo.lock

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

7 changes: 2 additions & 5 deletions Cargo.toml
Expand Up @@ -8,13 +8,10 @@ members = [
default-members = ["crates/revm"]

[profile.release]
# debug = true
debug = true
lto = true
codegen-units = 1

[profile.ethtests]
inherits = "test"
opt-level = 3

[patch.crates-io]
ruint = { git = "https://github.com/recmo/uint" }
opt-level = 3
1 change: 1 addition & 0 deletions bins/revm-test/Cargo.toml
Expand Up @@ -8,6 +8,7 @@ edition = "2021"
bytes = "1.1"
hex = "0.4"
revm = { path = "../../crates/revm", version = "2.3.1" }
microbench = "0.5"

[[bin]]
name = "analysis"
Expand Down
1 change: 0 additions & 1 deletion bins/revm-test/src/bin/analysis.rs
Expand Up @@ -2,7 +2,6 @@ use std::time::Instant;

use bytes::Bytes;
use revm::{db::BenchmarkDB, Bytecode, TransactTo};

extern crate alloc;

fn main() {
Expand Down
21 changes: 6 additions & 15 deletions bins/revm-test/src/bin/snailtracer.rs
@@ -1,4 +1,4 @@
use std::time::Instant;
use std::time::Duration;

use bytes::Bytes;
use revm::{db::BenchmarkDB, Bytecode, TransactTo};
Expand All @@ -23,21 +23,12 @@ pub fn simple_example() {
);
evm.env.tx.data = Bytes::from(hex::decode("30627b7c").unwrap());

let mut elapsed = std::time::Duration::ZERO;
let mut times = Vec::new();
for _ in 0..30 {
let timer = Instant::now();
// Microbenchmark
let bench_options = microbench::Options::default().time(Duration::from_secs(3));

microbench::bench(&bench_options, "Snailtracer benchmark", || {
let (_, _) = evm.transact();
let i = timer.elapsed();
times.push(i);
elapsed += i;
}
println!("elapsed: {:?}", elapsed / 30);
let mut times = times[5..].to_vec();
times.sort();
for (i, time) in times.iter().rev().enumerate() {
println!("{i}: {time:?}");
}
});
}

fn main() {
Expand Down
2 changes: 1 addition & 1 deletion bins/revme/src/statetest/runner.rs
Expand Up @@ -277,7 +277,7 @@ pub fn execute_test_suit(path: &Path, elapsed: &Arc<Mutex<Duration>>) -> Result<
let db = evm.db().unwrap();
println!("{path:?} UNIT_TEST:{name}\n");
println!(
"failed reason: {exit_reason:?} {path:?} UNIT_TEST:{name}\n gas:{gas_used:?} ({gas_refunded:?} refunded)"
"failed reason: {exit_reason:?} {path:?} UNIT_TEST:{name}\n gas:{gas_used:?} ({gas_refunded:?} refunded)",
);
println!("\nApplied state:{db:?}\n");
println!("\nStateroot: {state_root:?}\n");
Expand Down
1 change: 1 addition & 0 deletions crates/revm/src/db/web3db.rs
Expand Up @@ -98,6 +98,7 @@ impl Database for Web3DB {
}

fn block_hash(&mut self, number: U256) -> Result<B256, Self::Error> {
// saturate usize
if number > U256::from(u64::MAX) {
return Ok(KECCAK_EMPTY);
}
Expand Down
1 change: 0 additions & 1 deletion crates/revm/src/evm.rs
Expand Up @@ -23,7 +23,6 @@ use revm_precompiles::Precompiles;
/// want to update anything on it. It enabled `transact_ref` and `inspect_ref` functions
/// * Database+DatabaseCommit allow directly committing changes of transaction. it enabled `transact_commit`
/// and `inspect_commit`

#[derive(Clone)]
pub struct EVM<DB> {
pub env: Env,
Expand Down

0 comments on commit 90fe01e

Please sign in to comment.