-
Notifications
You must be signed in to change notification settings - Fork 2.3k
feat(cast): add trace_transaction and trace_rawTransaction #12788
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?
Conversation
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
crates/cast/src/opts.rs
Outdated
| command: Erc20Subcommand, | ||
| }, | ||
| #[command(name = "trace")] | ||
| Trace { |
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.
I believe trace_rawTransaction also supports a blockid argument, so we should add this here as well
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.
crates/cast/src/args.rs
Outdated
| 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? |
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.
we can use the TraceApiExt for provider, migh require enabling the feature
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.
oh nice, might be better to just create a new file trace.rs with everything in there
Motivation
adds support for #12783
Solution
CastSubCommand::Traceandrun_commandimplementationwe 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
or using the tx hash
PR Checklist