Skip to content

Commit

Permalink
split trace feature
Browse files Browse the repository at this point in the history
  • Loading branch information
cdump committed Oct 28, 2024
1 parent f5fa2f7 commit a12b6b4
Show file tree
Hide file tree
Showing 5 changed files with 10 additions and 7 deletions.
5 changes: 4 additions & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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"]
2 changes: 1 addition & 1 deletion dev.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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 \
Expand Down
4 changes: 2 additions & 2 deletions src/arguments/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -555,7 +555,7 @@ pub fn function_arguments_alloy(
selector: &Selector,
gas_limit: u32,
) -> Vec<DynSolType> {
if cfg!(feature = "trace") {
if cfg!(feature = "trace_arguments") {
println!(
"Processing selector {:02x}{:02x}{:02x}{:02x}",
selector[0], selector[1], selector[2], selector[3]
Expand All @@ -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);
Expand Down
2 changes: 1 addition & 1 deletion src/selectors/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 2 additions & 2 deletions src/state_mutability/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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() {
Expand Down Expand Up @@ -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() {
Expand Down

0 comments on commit a12b6b4

Please sign in to comment.