Skip to content

Commit 81736fb

Browse files
committed
fix(dump): rpc sanity check for trace_replayBlockTransactions before dump
1 parent 25913c3 commit 81736fb

File tree

2 files changed

+11
-2
lines changed

2 files changed

+11
-2
lines changed

Diff for: crates/dump/src/core/mod.rs

+9
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,15 @@ pub async fn dump(args: DumpArgs) -> Result<HashMap<FixedBytes<32>, FixedBytes<3
3333
let block_count = block_range.end() - block_range.start() + 1;
3434
debug!("dumping storage from block range: {:?}", block_range);
3535

36+
// a quick check to see if the rpc supports trace_ namespace
37+
// TODO: dump support via `debug_traceBlockByNumber` w/ prestateTracer as another option
38+
let _ = get_block_state_diff(
39+
(*block_range.start()).try_into().expect("block number overflow"),
40+
&args.rpc_url,
41+
)
42+
.await
43+
.map_err(|_| eyre!("failed to `trace_replayBlockTransactions`. does your rpc support it?"))?;
44+
3645
// create a semaphore with the correct number of permits
3746
let semaphore = Arc::new(Semaphore::new(args.threads));
3847
let handles = block_range.map(|block_number| {

Diff for: crates/dump/src/interfaces/args.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -27,11 +27,11 @@ pub struct DumpArgs {
2727
pub threads: usize,
2828

2929
/// The block number to start dumping from.
30-
#[clap(long, default_value = "0", hide_default_value = true)]
30+
#[clap(long, short, default_value = "0", hide_default_value = true, alias = "start_block")]
3131
pub from_block: u128,
3232

3333
/// The block number to stop dumping at.
34-
#[clap(long)]
34+
#[clap(long, short, alias = "end_block")]
3535
pub to_block: Option<u128>,
3636

3737
/// The name for the output file

0 commit comments

Comments
 (0)