From a12b6b4718dde57affea86d5c46fdcb90135c601 Mon Sep 17 00:00:00 2001 From: Maxim Andreev Date: Sat, 26 Oct 2024 10:59:55 +0000 Subject: [PATCH] split trace feature --- Cargo.toml | 5 ++++- dev.sh | 2 +- src/arguments/mod.rs | 4 ++-- src/selectors/mod.rs | 2 +- src/state_mutability/mod.rs | 4 ++-- 5 files changed, 10 insertions(+), 7 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index 7280bce..32b34bf 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -21,7 +21,10 @@ python = ["dep:pyo3"] javascript = ["dep:wasm-bindgen"] # for dev -trace = [] +trace_selectors = [] +trace_arguments = [] +trace_mutability = [] +trace = ["trace_selectors", "trace_arguments", "trace_mutability"] [lib] crate-type = ["cdylib", "lib"] diff --git a/dev.sh b/dev.sh index f4079f2..ac0b01f 100755 --- a/dev.sh +++ b/dev.sh @@ -9,7 +9,7 @@ ln -s `pwd` ${BDIR}/providers/evmole-rs/rust 2>/dev/null || true case ${NOTRACE+x} in x) FEAT='' ;; - *) FEAT='--features evmole/trace' ;; + *) FEAT="--features evmole/trace_${MODE}" ;; esac cargo run \ diff --git a/src/arguments/mod.rs b/src/arguments/mod.rs index 1fc17da..d2f110e 100644 --- a/src/arguments/mod.rs +++ b/src/arguments/mod.rs @@ -555,7 +555,7 @@ pub fn function_arguments_alloy( selector: &Selector, gas_limit: u32, ) -> Vec { - if cfg!(feature = "trace") { + if cfg!(feature = "trace_arguments") { println!( "Processing selector {:02x}{:02x}{:02x}{:02x}", selector[0], selector[1], selector[2], selector[3] @@ -582,7 +582,7 @@ pub fn function_arguments_alloy( } while !vm.stopped { - if cfg!(feature = "trace") { + if cfg!(feature = "trace_arguments") { println!("args: {:?}", args); println!("not_bool: {:?}", args.not_bool); println!("{:#?}", args.data); diff --git a/src/selectors/mod.rs b/src/selectors/mod.rs index b426249..676341a 100644 --- a/src/selectors/mod.rs +++ b/src/selectors/mod.rs @@ -115,7 +115,7 @@ fn process( ) -> u32 { let mut gas_used = 0; while !vm.stopped { - if cfg!(feature = "trace") { + if cfg!(feature = "trace_selectors") { println!( "selectors: {:?}", selectors diff --git a/src/state_mutability/mod.rs b/src/state_mutability/mod.rs index ce3d43f..345dcaa 100644 --- a/src/state_mutability/mod.rs +++ b/src/state_mutability/mod.rs @@ -70,7 +70,7 @@ fn analyze_payable( let mut last_jumpi_callvalue = false; while !vm.stopped { - if cfg!(feature = "trace") { + if cfg!(feature = "trace_mutability") { println!("{:?}\n", vm); } let ret = match vm.step() { @@ -145,7 +145,7 @@ fn analyze_view_pure_internal( } while !vm.stopped && vpr.view { - if cfg!(feature = "trace") { + if cfg!(feature = "trace_mutability") { println!("{:?}\n", vm); } let ret = match vm.step() {