@@ -429,13 +429,14 @@ where
429429 /// Handles the batch commits events.
430430 #[ tracing:: instrument( skip_all) ]
431431 async fn handle_batch_commits ( & self , logs : & [ Log ] ) -> L1WatcherResult < Vec < L1Notification > > {
432- // filter commit logs.
432+ // filter commit logs and skip genesis batch (batch_index == 0) .
433433 let mut commit_logs_with_tx = logs
434434 . iter ( )
435435 . map ( |l| ( l, l. transaction_hash ) )
436436 . filter_map ( |( log, tx_hash) | {
437437 let tx_hash = tx_hash?;
438438 try_decode_log :: < CommitBatch > ( & log. inner )
439+ . filter ( |decoded| !decoded. data . batch_index . is_zero ( ) )
439440 . map ( |decoded| ( log, decoded. data , tx_hash) )
440441 } )
441442 . collect :: < Vec < _ > > ( ) ;
@@ -509,11 +510,13 @@ where
509510 & self ,
510511 logs : & [ Log ] ,
511512 ) -> L1WatcherResult < Vec < L1Notification > > {
512- // filter finalize logs.
513+ // filter finalize logs and skip genesis batch (batch_index == 0) .
513514 logs. iter ( )
514515 . map ( |l| ( l, l. block_number ) )
515516 . filter_map ( |( log, bn) | {
516- try_decode_log :: < FinalizeBatch > ( & log. inner ) . map ( |decoded| ( decoded. data , bn) )
517+ try_decode_log :: < FinalizeBatch > ( & log. inner )
518+ . filter ( |decoded| !decoded. data . batch_index . is_zero ( ) )
519+ . map ( |decoded| ( decoded. data , bn) )
517520 } )
518521 . map ( |( decoded_log, maybe_block_number) | {
519522 // fetch the finalize transaction.
0 commit comments