Skip to content

Commit

Permalink
fix(cast): set --block value as fork_block_number while tracing (#8009)
Browse files Browse the repository at this point in the history
fix(cast): set --block value as fork_block_number while Tracing
  • Loading branch information
yash-atreya authored May 29, 2024
1 parent 25b2455 commit 5494c33
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions crates/cast/bin/cmd/call.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
use crate::tx::CastTxBuilder;
use alloy_primitives::{TxKind, U256};
use alloy_rpc_types::BlockId;
use alloy_rpc_types::{BlockId, BlockNumberOrTag};
use cast::Cast;
use clap::Parser;
use eyre::Result;
Expand Down Expand Up @@ -114,7 +114,7 @@ impl CallArgs {
sig = Some(data);
}

let config = Config::from(&eth);
let mut config = Config::from(&eth);
let provider = utils::get_provider(&config)?;
let sender = eth.wallet.sender().await;

Expand Down Expand Up @@ -153,6 +153,11 @@ impl CallArgs {
let figment =
Config::figment_with_root(find_project_root_path(None).unwrap()).merge(eth.rpc);
let evm_opts = figment.extract::<EvmOpts>()?;
if let Some(BlockId::Number(BlockNumberOrTag::Number(block_number))) = self.block {
// Override Config `fork_block_number` (if set) with CLI value.
config.fork_block_number = Some(block_number);
}

let (env, fork, chain) = TracingExecutor::get_fork_material(&config, evm_opts).await?;
let mut executor = TracingExecutor::new(env, fork, evm_version, debug);

Expand Down

0 comments on commit 5494c33

Please sign in to comment.