Skip to content

feat(tracing): consolidate trace options - #15665

Merged
DaniPopes merged 28 commits into
masterfrom
dani/tracing-options
Jul 21, 2026
Merged

feat(tracing): consolidate trace options#15665
DaniPopes merged 28 commits into
masterfrom
dani/tracing-options

Conversation

@DaniPopes

@DaniPopes DaniPopes commented Jul 9, 2026

Copy link
Copy Markdown
Member

Consolidates trace rendering options in shared TracingArgs for cast, forge, and script, with defaults under [tracing]. CLI overrides resolve into a cloned effective TracingConfig, which is passed through trace collection, decoder construction, and rendering. Legacy [labels] and profile-local labels remain supported with deprecation warnings that point to [tracing.labels]. This subsumes #15662 by including --compact-labels in the shared trace options and threading it through decoding. Closes #3381. AI assistance was used for this change, per CONTRIBUTING.md.

DaniPopes and others added 3 commits July 9, 2026 21:26
…el is available

When an address appears as a parameter in a decoded trace and has a
label, it currently renders as `LabelName: [0xAddr]`. The new
`--compact-labels` flag shows only the label name, making traces
more readable when addresses are already identified.

Available in `cast run`, `cast call`, `forge test`, and `forge script`.

Closes #3381

@mattsse mattsse left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks, this is much cleaner overall. I found two compatibility regressions that should be addressed before merge.

  1. crates/config/src/lib.rs: the configured checks treat the presence of any [tracing] table as if tracing.verbosity was explicitly configured. With a config like top-level verbosity = 4 plus [tracing] disable_labels = true, normalize_tracing_settings copies the default tracing verbosity (0) back into self.verbosity, suppressing verbose trace output.

Suggested fix: make the verbosity checks leaf-key only in both from_figment_inner and merge_inline_provider, e.g. figment_value_is_configured(&figment, "tracing.verbosity") / provider.contains("tracing.verbosity"), and add a regression test where [tracing] contains a non-verbosity option while top-level verbosity remains set.

  1. cast run -l <addr:label> no longer parses. Flattening TracingArgs keeps --labels and --label, but drops the previous #[arg(long, short)] label field from RunArgs.

Suggested fix: avoid adding short = 'l' to shared TracingArgs globally because forge test -l is already --list. Instead, keep a command-specific hidden #[arg(short = 'l', value_name = "ADDRESS:LABEL")] Vec on RunArgs, merge it into self.tracing.labels before resolve, and add a parse test for cast run -l ....

@mablr mablr left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I confirm Matt's findings, and have two more.

Comment thread crates/script/src/lib.rs
Comment thread crates/forge/tests/cli/config.rs
@DaniPopes
DaniPopes requested review from mablr and mattsse July 10, 2026 13:13
Comment thread crates/config/src/lib.rs Outdated
Comment thread crates/config/src/lib.rs Outdated
Comment thread crates/cli/src/opts/tracing.rs
Comment thread crates/script/src/simulate.rs
@DaniPopes
DaniPopes requested a review from mablr July 11, 2026 12:15
@DaniPopes
DaniPopes enabled auto-merge (squash) July 16, 2026 23:38
@DaniPopes
DaniPopes requested review from mablr and mattsse July 16, 2026 23:39
Comment thread crates/evm/traces/src/decoder/mod.rs
Comment thread crates/config/src/lib.rs Outdated
Keep canonical tracing labels available to cheatcodes while retaining direct legacy Config callers. Preserve malformed canonical values so configuration errors are not masked by the compatibility provider.
# Conflicts:
#	crates/forge/tests/cli/script.rs

@mattsse mattsse left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

One remaining issue.

Comment thread crates/script/src/lib.rs Outdated
mattsse
mattsse previously approved these changes Jul 17, 2026

@mattsse mattsse left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

# Conflicts:
#	crates/script/src/lib.rs
#	crates/script/src/simulate.rs
Comment thread crates/cast/src/cmd/call.rs
Comment thread crates/cast/src/cmd/call.rs Outdated
Disable internal decoding for RPC call-tracer responses and emit configuration migration warnings from cast trace commands. Normalize inherited label aliases before merging to preserve source precedence and collision detection.
Normalize standalone tracing within each inherited source before coalescing so aliases and profile-qualified settings preserve local precedence and participate in collision detection.
@DaniPopes
DaniPopes requested a review from mablr July 21, 2026 16:59
@DaniPopes
DaniPopes merged commit a742e76 into master Jul 21, 2026
20 checks passed
@DaniPopes
DaniPopes deleted the dani/tracing-options branch July 21, 2026 20:13
@github-project-automation github-project-automation Bot moved this to Done in Foundry Jul 21, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

feat(tracing): add flag to hide address when label is available

5 participants