-
Notifications
You must be signed in to change notification settings - Fork 2.3k
feat(traces): add a -d | --depth flag for verbose traces, like tree #12643
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
base: master
Are you sure you want to change the base?
Changes from 2 commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -41,7 +41,7 @@ use foundry_config::{ | |||||||||||||||||||||||||
| use foundry_debugger::Debugger; | ||||||||||||||||||||||||||
| use foundry_evm::{ | ||||||||||||||||||||||||||
| opts::EvmOpts, | ||||||||||||||||||||||||||
| traces::{backtrace::BacktraceBuilder, identifier::TraceIdentifiers}, | ||||||||||||||||||||||||||
| traces::{backtrace::BacktraceBuilder, identifier::TraceIdentifiers, prune_trace_depth}, | ||||||||||||||||||||||||||
| }; | ||||||||||||||||||||||||||
| use regex::Regex; | ||||||||||||||||||||||||||
| use std::{ | ||||||||||||||||||||||||||
|
|
@@ -136,6 +136,10 @@ pub struct TestArgs { | |||||||||||||||||||||||||
| #[arg(long, short, env = "FORGE_SUPPRESS_SUCCESSFUL_TRACES", help_heading = "Display options")] | ||||||||||||||||||||||||||
| suppress_successful_traces: bool, | ||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||
| /// Defines the depth of a trace | ||||||||||||||||||||||||||
| #[arg(long, short)] | ||||||||||||||||||||||||||
| depth: Option<usize>, | ||||||||||||||||||||||||||
|
||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||
| /// Output test results as JUnit XML report. | ||||||||||||||||||||||||||
| #[arg(long, conflicts_with_all = ["quiet", "json", "gas_report", "summary", "list", "show_progress"], help_heading = "Display options")] | ||||||||||||||||||||||||||
| pub junit: bool, | ||||||||||||||||||||||||||
|
|
@@ -652,6 +656,11 @@ impl TestArgs { | |||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||
| if should_include { | ||||||||||||||||||||||||||
| decode_trace_arena(arena, &decoder).await; | ||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||
| if let Some(depth) = self.depth { | ||||||||||||||||||||||||||
| prune_trace_depth(arena, depth); | ||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||
| decoded_traces.push(render_trace_arena_inner(arena, false, verbosity > 4)); | ||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||
|
|
@@ -1037,6 +1046,12 @@ mod tests { | |||||||||||||||||||||||||
| assert!(args.fuzz_seed.is_some()); | ||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||
| #[test] | ||||||||||||||||||||||||||
| fn depth_trace() { | ||||||||||||||||||||||||||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. please apply the new option in similar test as with foundry/crates/forge/tests/cli/test_cmd/trace.rs Lines 199 to 210 in 6063717
|
||||||||||||||||||||||||||
| let args: TestArgs = TestArgs::parse_from(["foundry-cli", "--depth", "2"]); | ||||||||||||||||||||||||||
| assert!(args.depth.is_some()); | ||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||
| // <https://github.com/foundry-rs/foundry/issues/5913> | ||||||||||||||||||||||||||
| #[test] | ||||||||||||||||||||||||||
| fn fuzz_seed_exists() { | ||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: can be
node.ordering.clear();