feat(tracing): consolidate trace options - #15665
Conversation
…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
left a comment
There was a problem hiding this comment.
Thanks, this is much cleaner overall. I found two compatibility regressions that should be addressed before merge.
crates/config/src/lib.rs: the configured checks treat the presence of any[tracing]table as iftracing.verbositywas explicitly configured. With a config like top-levelverbosity = 4plus[tracing] disable_labels = true,normalize_tracing_settingscopies the default tracing verbosity (0) back intoself.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.
cast run -l <addr:label>no longer parses. FlatteningTracingArgskeeps--labelsand--label, but drops the previous#[arg(long, short)]labelfield fromRunArgs.
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
left a comment
There was a problem hiding this comment.
I confirm Matt's findings, and have two more.
# Conflicts: # crates/cast/src/cmd/run.rs # crates/config/src/providers/warnings.rs
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
# Conflicts: # crates/script/src/lib.rs # crates/script/src/simulate.rs
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.
Consolidates trace rendering options in shared
TracingArgsfor cast, forge, and script, with defaults under[tracing]. CLI overrides resolve into a cloned effectiveTracingConfig, which is passed through trace collection, decoder construction, and rendering. Legacy[labels]and profile-locallabelsremain supported with deprecation warnings that point to[tracing.labels]. This subsumes #15662 by including--compact-labelsin the shared trace options and threading it through decoding. Closes #3381. AI assistance was used for this change, per CONTRIBUTING.md.