feat(cast): Run Arbitrary Bytecode#945
feat(cast): Run Arbitrary Bytecode#945refcell wants to merge 8 commits intofoundry-rs:masterfrom refcell:ab/forge_run_bytecode
Conversation
|
I like this directionally. It can be very powerful with forked mode. One idea:
This would allow us to print traces when simulating transactions, which would be quite useful for people doing on-chain forensics and whatnot, given that ethtx.info does not exist for other chains, and people end up using e.g. Tenderly's tracer/flamegraph |
|
Open to making it a subcommand in |
|
Ah yes, but imagine that someone doing operations against mainnet wouldn't be using forge, they'd be using cast right? So if the exec bytecode use case is in the context of doing ops, it makes sense to bundle it in cast? So I'd err towards putting it there, and reconsider if we see the binary bloating (altho couple megabytes added should be fine)? |
mattsse
left a comment
There was a problem hiding this comment.
looking god so far.
on cast/forge, since both live in the same crate, we can use commands in both cast and forge, perhaps we can restructure the cmd mod into
mod shared; mod forge; mod cast
cli/src/cmd/exec.rs
Outdated
|
|
||
| #[derive(Debug, Clone, Parser)] | ||
| pub struct ExecArgs { | ||
| #[clap(help = "the bytecode to execute")] |
There was a problem hiding this comment.
add note about expected format, hex
I'm a big fan of this idea, would prefer to use local + scriptable tooling over tenderly. I think one gotcha would be that if a tx hash is passed, then all previous txs in the block would need to be fetched and executed first in case a previous tx in the block altered the same state that the passed tx touches |
Yea good call, this is how I think we should follow a similar pattern, and since there's a lot of overlap in the various seth/hevm commands, my proposal to clean up the API would be:
|
|
Tackling as part of https://github.com/gakonst/foundry/pull/1020 |
Overview
This PR introduces a new subcommand for cast:
run.Motivation
Execute arbitrary bytecode using cast like the
hevm execcommand.Solution Checklist