Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(forge): Add call tracing support #192

Merged
merged 40 commits into from
Dec 23, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
40 commits
Select commit Hold shift + click to select a range
b470925
first pass
brockelmore Dec 2, 2021
bfa42a8
fixes
brockelmore Dec 2, 2021
7106cd7
fmt
brockelmore Dec 2, 2021
f83b226
better fmting
brockelmore Dec 2, 2021
bf17ebb
updates
brockelmore Dec 2, 2021
23687c4
fmt
brockelmore Dec 2, 2021
f4671a9
updates
brockelmore Dec 11, 2021
e61cbda
Merge branch 'master' into brock/tracing
brockelmore Dec 11, 2021
f397646
fmt
brockelmore Dec 11, 2021
95cb702
fix after master merge
brockelmore Dec 11, 2021
0594faa
fix tests post master merge
brockelmore Dec 11, 2021
34f75e2
warning fixes
brockelmore Dec 11, 2021
62406e1
fmt
brockelmore Dec 11, 2021
79d210f
lots of fixes
brockelmore Dec 12, 2021
4b91be7
fmt
brockelmore Dec 12, 2021
3f8c2b7
fix
brockelmore Dec 12, 2021
cc7e2ed
cyan color
brockelmore Dec 12, 2021
f558e82
fixes
brockelmore Dec 12, 2021
ba514cb
prettier raw logs + parse setup contracts
brockelmore Dec 12, 2021
133685f
Merge branch 'master' into brock/tracing
brockelmore Dec 12, 2021
36b4cf6
update diff_score threshold
brockelmore Dec 12, 2021
c827d33
better printing
brockelmore Dec 16, 2021
58c6c1b
remove integration tests
brockelmore Dec 22, 2021
38ca049
Merge branch 'master' into brock/tracing
brockelmore Dec 22, 2021
1f759c0
improvements
brockelmore Dec 23, 2021
637c50a
improvements + fmt + clippy
brockelmore Dec 23, 2021
08ee0da
fixes
brockelmore Dec 23, 2021
6271684
more cleanup
brockelmore Dec 23, 2021
ee88892
cleanup and verbosity > 3 setup print
brockelmore Dec 23, 2021
dc10a70
refactor printing
brockelmore Dec 23, 2021
c93da0a
documentation + cleanup
brockelmore Dec 23, 2021
6c825a0
fix negative number printing
brockelmore Dec 23, 2021
54a975f
fix tests to match master and fix tracing_enabled
brockelmore Dec 23, 2021
06eafba
Merge branch 'master' into brock/tracing
brockelmore Dec 23, 2021
a918468
fix unnecessary trace_index set
brockelmore Dec 23, 2021
57affc9
Merge branch 'brock/tracing' of https://github.com/gakonst/foundry in…
brockelmore Dec 23, 2021
b2e9922
refactor runner tracing + tracing_enabled
brockelmore Dec 23, 2021
bb9a707
nits + value printing
brockelmore Dec 23, 2021
4660e3c
Merge branch 'master' into brock/tracing
brockelmore Dec 23, 2021
90d81d2
last nits
brockelmore Dec 23, 2021
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
1 change: 1 addition & 0 deletions Cargo.lock

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

40 changes: 38 additions & 2 deletions cli/src/cmd/test.rs
Original file line number Diff line number Diff line change
Expand Up @@ -158,8 +158,14 @@ impl Cmd for TestArgs {
let backend = Arc::new(backend);

let precompiles = PRECOMPILES_MAP.clone();
let evm =
Executor::new_with_cheatcodes(backend, env.gas_limit, &cfg, &precompiles, ffi);
let evm = Executor::new_with_cheatcodes(
backend,
env.gas_limit,
&cfg,
&precompiles,
ffi,
verbosity > 2,
);

test(builder, project, evm, pattern, json, verbosity, allow_failure)
}
Expand Down Expand Up @@ -318,6 +324,36 @@ fn test<A: ArtifactOutput + 'static, S: Clone, E: evm_adapters::Evm<S>>(
}

println!();

if verbosity > 2 {
if let (Some(traces), Some(identified_contracts)) =
(&result.traces, &result.identified_contracts)
{
let mut ident = identified_contracts.clone();
if verbosity > 3 {
// print setup calls as well
traces.iter().for_each(|trace| {
trace.pretty_print(
0,
&runner.known_contracts,
&mut ident,
&runner.evm,
"",
);
});
} else if !traces.is_empty() {
traces.last().expect("no last but not empty").pretty_print(
0,
&runner.known_contracts,
&mut ident,
&runner.evm,
"",
);
}

println!();
}
}
}
}
}
Expand Down
1 change: 1 addition & 0 deletions evm-adapters/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ futures = "0.3.17"
revm_precompiles = "0.1.0"
serde_json = "1.0.72"
serde = "1.0.130"
ansi_term = "0.12.1"

[dev-dependencies]
evmodin = { git = "https://github.com/vorot93/evmodin", features = ["util"] }
Expand Down