Skip to content

Conversation

@figtracer
Copy link

@figtracer figtracer commented Dec 10, 2025

Motivation

adds support for #12783

Solution

  • adds CastSubCommand::Trace and run_command implementation

we can input the tx json with any trace type (https://reth.rs/jsonrpc/trace)

cast trace '{"type":"0x2","chainId":"0x1","nonce":"0x15","gas":"0x5a3c","maxFeePerGas":"0x18701a80","maxPriorityFeePerGas":"0x4b571c0","to":"0x8dde80a55d95647e419f0c8da19a53a8b62b5109","value":"0x10fc6d9c991b48","accessList":[],"input":"0x","r":"0x521e2aa4952078661311a8323d89ee9d350b6aa4b69f812e42b586c3d12d934d","s":"0x179efd11ff1dea53336c00f009949852c645482b11a50d23bc52c4f01043cabf","yParity":"0x0","v":"0x0","hash":"0x7332384d63de1a06e4b27e667933960a67b4a2469cba0aadc1c5fe93135de9bc","blockHash":"0x8650ef8deef20fc848582ab68f33c8020db73220dea0d0bb65168cb1904b8478","blockNumber":"0x16dea3c","transactionIndex":"0x10c","from":"0x9e7c924b09427b94be16d191719c4654c6f5ea6f","gasPrice":"0xe99a42a"}' --raw (--trace/--vm-trace/--state-diff)

with the raw trasaction

cast trace 0x02f87101158404b571c08418701a80825a3c948dde80a55d95647e419f0c8da19a53a8b62b51098710fc6d9c991b4880c080a0521e2aa4952078661311a8323d89ee9d350b6aa4b69f812e42b586c3d12d934da0179efd11ff1dea53336c00f009949852c645482b11a50d23bc52c4f01043cabf --raw (--trace/--vm-trace/--state-diff)

or using the tx hash

cast trace 0x7332384d63de1a06e4b27e667933960a67b4a2469cba0aadc1c5fe93135de9bc

PR Checklist

  • Added Tests
  • Added Documentation
  • Breaking changes

trace record: record a trace file
    $ trace record myworkload
        [... Ctrl-C to stop ...]
    $ trace record myworkload --Logging:enable-logs --end-after-duration 5s
    $ trace record myworkload --plan profile --omit Symbolication
    $ trace record myworkload --end-on-notification stop-myworkload-trace
        [... elsewhere `notifyutil -p stop-myworkload-trace` ...]
    $ trace record /tmp/trace-path.atrc --compress

trace amend: add data to a file
    $ trace amend myworkload-003.atrc --add Symbolication

trace trim: trim a file based on kdebug event times
    $ trace trim myworkload-002.atrc --from +1s --to +2s

trace providers: print information about Logging, Symbolication, etc.

trace plans: print detailed information about tracing approaches

See `man trace` for more information. and instead error
@figtracer figtracer marked this pull request as ready for review December 10, 2025 14:49
command: Erc20Subcommand,
},
#[command(name = "trace")]
Trace {
Copy link
Member

Choose a reason for hiding this comment

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

I believe trace_rawTransaction also supports a blockid argument, so we should add this here as well

Copy link
Author

Choose a reason for hiding this comment

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

Comment on lines 793 to 806
let trace_types: Vec<&str> =
[(trace, "trace"), (vm_trace, "vmTrace"), (state_diff, "stateDiff")]
.into_iter()
.filter_map(|(enabled, name)| enabled.then_some(name))
.collect();

if trace_types.is_empty() {
eyre::bail!(
"No trace type specified. Use --trace, --vm-trace, or --state-diff"
);
}

let params = serde_json::json!([out, trace_types]);
Cast::new(&provider).rpc("trace_rawTransaction", params).await?
Copy link
Member

Choose a reason for hiding this comment

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

we can use the TraceApiExt for provider, migh require enabling the feature

Copy link
Author

Choose a reason for hiding this comment

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

oh nice, might be better to just create a new file trace.rs with everything in there

@figtracer figtracer requested a review from mattsse December 10, 2025 15:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: No status

Development

Successfully merging this pull request may close these issues.

2 participants