From 2635d3ab23c76001f62bedc1a9cd5eac6612bf37 Mon Sep 17 00:00:00 2001 From: Vaclav Barta Date: Thu, 4 Apr 2024 13:54:13 +0200 Subject: [PATCH] using --block-count as relative to the actual start block (#81) --- state-reconstruct-fetcher/src/l1_fetcher.rs | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/state-reconstruct-fetcher/src/l1_fetcher.rs b/state-reconstruct-fetcher/src/l1_fetcher.rs index e691d27..d583e4a 100644 --- a/state-reconstruct-fetcher/src/l1_fetcher.rs +++ b/state-reconstruct-fetcher/src/l1_fetcher.rs @@ -115,7 +115,7 @@ impl L1Fetcher { let end_block = self .config .block_count - .map(|count| U64::from(self.config.start_block + count)); + .map(|count| (current_l1_block_number + count)); // Initialize metrics with last state, if it exists. { @@ -226,6 +226,10 @@ impl L1Fetcher { max_end_block: Option, disable_polling: bool, ) -> Result> { + if let Some(end_block_limit) = max_end_block { + assert!(current_l1_block_number <= end_block_limit); + } + let metrics = self.metrics.clone(); let event = self.contracts.v1.events_by_name("BlockCommit")?[0].clone(); let provider_clone = self.provider.clone();