-
Notifications
You must be signed in to change notification settings - Fork 2k
fix cast call --trace
when --block
parameter is passed
#6673
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
fix cast call --trace
when --block
parameter is passed
#6673
Conversation
let evm_opts = figment.extract::<EvmOpts>()?; | ||
|
||
config.fork_block_number = derive_fork_block_number(&provider, block).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.
I'm not exactly sure about this,
I believe this should be set to evm_opts instead.
sorry this entire command is a bit messy...
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.
foundry/crates/evm/evm/src/executors/tracing.rs
Lines 36 to 39 in 67ab870
evm_opts.fork_url = Some(config.get_rpc_url_or_localhost_http()?.into_owned()); | |
evm_opts.fork_block_number = config.fork_block_number; | |
let env = evm_opts.evm_env().await?; |
The fact is, inside get_fork_material()
, evm_opts.fork_block_number
is overridden with config.fork_block_number
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.
ping for this @mattsse
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.
if it's overriden with the config block number then I think it's fine for now
ping |
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.
needs clippy/fmt
let evm_opts = figment.extract::<EvmOpts>()?; | ||
|
||
config.fork_block_number = derive_fork_block_number(&provider, block).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.
if it's overriden with the config block number then I think it's fine for now
Hi @tonyke-bot, thanks for your PR! Would you be interested in updating it to use Alloy? Would be great to get this fix in. |
@zerosnacks ack! |
Superseded by #8009 |
Motivation
When running
cast call --trace --block <block-number> <tx-hash>
, theblock
parameter doesn't work as expected. Latest block number is always used when sending RPC requests to pulling related information for local fork.This bug is confirmed by running the command with
RUST_LOG=trace
to see the requests sent to RPC provider.Solution
Use the given
block
parameter to modify theconfig.fork_block_number
. Whenblock
is not a block number, convert to block number first.