Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion bin/withdrawal-finalizer/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -269,7 +269,7 @@ async fn main() -> Result<()> {
we_tx_wrapped,
));

let watcher_handle = tokio::spawn(watcher.run(blocks_rx, we_rx, from_l2_block));
let watcher_handle = tokio::spawn(watcher.run(blocks_rx, we_rx, from_l2_block, sl_chain_id));

let block_events_handle = tokio::spawn(event_mux.run_with_reconnects(
config.diamond_proxy_addr,
Expand Down
2 changes: 1 addition & 1 deletion chain-events/src/block_events.rs
Original file line number Diff line number Diff line change
Expand Up @@ -156,7 +156,7 @@ impl BlockEvents {

let past_filter = Filter::new()
.from_block(from_block)
.to_block(latest_block)
.to_block(latest_block - 1)
.address(diamond_proxy_addr)
.topic0(vec![
BlockCommitFilter::signature(),
Expand Down
10 changes: 8 additions & 2 deletions watcher/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,7 @@ where
block_events: BE,
withdrawal_events: WE,
from_l2_block: u64,
sl_chain_id: u32,
) -> Result<()>
where
BE: Stream<Item = BlockEvent> + Send + 'static,
Expand Down Expand Up @@ -90,6 +91,7 @@ where
pgpool.clone(),
block_events,
l2_provider,
sl_chain_id,
));
let l2_loop_handler = tokio::spawn(async move {
run_l2_events_loop(
Expand Down Expand Up @@ -346,7 +348,12 @@ async fn process_withdrawals_in_block(
Ok(())
}

async fn run_l1_events_loop<BE, M2>(pool: PgPool, be: BE, l2_middleware: M2) -> Result<()>
async fn run_l1_events_loop<BE, M2>(
pool: PgPool,
be: BE,
l2_middleware: M2,
chain_id: u32,
) -> Result<()>
where
BE: Stream<Item = BlockEvent>,
M2: ZksyncMiddleware,
Expand All @@ -357,7 +364,6 @@ where
let mut batch_begin = Instant::now();
let batch_backoff = Duration::from_secs(5);
let batch_size = 1024;
let chain_id = l2_middleware.get_chain_id().await?;
while let Some(event) = be.next().await {
tracing::debug!("block event {event}");
block_event_batch.push(event);
Expand Down
Loading