@@ -125,7 +125,7 @@ async fn test_l1_sync_batch_commit() -> eyre::Result<()> {
125125 let mut fixture = TestFixture :: builder ( )
126126 . followers ( 1 )
127127 . skip_l1_synced_notifications ( ) // Prevents automatic L1Synced, simulates initial sync
128- . with_anvil ( None , Some ( 22222222 ) , None )
128+ . with_anvil ( None , Some ( 22222222 ) , None , None )
129129 . build ( )
130130 . await ?;
131131
@@ -140,10 +140,9 @@ async fn test_l1_sync_batch_commit() -> eyre::Result<()> {
140140 let commit_batch_tx = read_test_transaction ( "commitBatch" , & i. to_string ( ) ) ?;
141141 fixture. anvil_inject_tx ( commit_batch_tx) . await ?;
142142 }
143- // fixture.anvil_mine_blocks(1).await?;
144-
145- // Allow time for L1 block processing
146- tokio:: time:: sleep ( tokio:: time:: Duration :: from_secs ( 3 ) ) . await ;
143+ for _ in 1 ..=6 {
144+ fixture. expect_event ( ) . batch_commit_indexed ( ) . await ?;
145+ }
147146
148147 // Step 3: Verify safe head hasn't moved - events should be buffered
149148 let status = fixture. get_status ( 0 ) . await ?;
@@ -194,7 +193,7 @@ async fn test_l1_sync_batch_finalized() -> eyre::Result<()> {
194193 let mut fixture = TestFixture :: builder ( )
195194 . followers ( 1 )
196195 . skip_l1_synced_notifications ( )
197- . with_anvil ( None , Some ( 22222222 ) , None )
196+ . with_anvil ( None , Some ( 22222222 ) , None , None )
198197 . build ( )
199198 . await ?;
200199
@@ -213,8 +212,9 @@ async fn test_l1_sync_batch_finalized() -> eyre::Result<()> {
213212 let commit_batch_tx = read_test_transaction ( "commitBatch" , & i. to_string ( ) ) ?;
214213 fixture. anvil_inject_tx ( commit_batch_tx) . await ?;
215214 }
216-
217- tokio:: time:: sleep ( tokio:: time:: Duration :: from_secs ( 3 ) ) . await ;
215+ for _ in 1 ..=6 {
216+ fixture. expect_event ( ) . batch_commit_indexed ( ) . await ?;
217+ }
218218
219219 // Step 3: Verify safe head hasn't changed (still syncing)
220220 let status = fixture. get_status ( 0 ) . await ?;
@@ -225,16 +225,15 @@ async fn test_l1_sync_batch_finalized() -> eyre::Result<()> {
225225 ) ;
226226
227227 // Step 4: Send BatchFinalized transactions (batches 1-3) while syncing
228- // Mine 64 blocks to ensure the BatchFinalized events are themselves finalized on L1
228+ // Mine blocks to ensure the BatchFinalized events are themselves finalized on L1
229229 // This should trigger all unprocessed BatchCommit events up to the finalized batch
230230 for i in 1 ..=3 {
231231 let finalize_batch_tx = read_test_transaction ( "finalizeBatch" , & i. to_string ( ) ) ?;
232232 fixture. anvil_inject_tx ( finalize_batch_tx) . await ?;
233233 }
234- fixture. anvil_mine_blocks ( 64 ) . await ?;
234+ fixture. anvil_mine_blocks ( 2 ) . await ?;
235235
236236 for _ in 1 ..=3 {
237- // fixture.expect_event().batch_finalized().await?;
238237 fixture. expect_event ( ) . batch_consolidated ( ) . await ?;
239238 }
240239
@@ -275,10 +274,11 @@ async fn test_l1_sync_batch_finalized() -> eyre::Result<()> {
275274 "Finalized head should not advance before BatchFinalized event are finalized on L1"
276275 ) ;
277276
278- fixture. anvil_mine_blocks ( 64 ) . await ?;
279277 for _ in 1 ..=3 {
280- fixture. expect_event ( ) . batch_finalized ( ) . await ?;
278+ fixture. expect_event ( ) . batch_finalize_indexed ( ) . await ?;
281279 }
280+ fixture. anvil_mine_blocks ( 2 ) . await ?;
281+ fixture. expect_event ( ) . l1_block_finalized ( ) . await ?;
282282
283283 // Step 8: Verify only finalized head advanced (safe head managed by BatchCommit)
284284 let batch_finalized_status = fixture. get_status ( 0 ) . await ?;
@@ -317,7 +317,7 @@ async fn test_l1_sync_batch_revert() -> eyre::Result<()> {
317317 let mut fixture = TestFixture :: builder ( )
318318 . followers ( 1 )
319319 . skip_l1_synced_notifications ( )
320- . with_anvil ( None , Some ( 22222222 ) , None )
320+ . with_anvil ( None , Some ( 22222222 ) , None , None )
321321 . build ( )
322322 . await ?;
323323
@@ -331,6 +331,9 @@ async fn test_l1_sync_batch_revert() -> eyre::Result<()> {
331331 let commit_batch_tx = read_test_transaction ( "commitBatch" , & i. to_string ( ) ) ?;
332332 fixture. anvil_inject_tx ( commit_batch_tx) . await ?;
333333 }
334+ for _ in 1 ..=6 {
335+ fixture. expect_event ( ) . batch_commit_indexed ( ) . await ?;
336+ }
334337
335338 // Step 3: Complete L1 sync
336339 fixture. l1 ( ) . sync ( ) . await ?;
@@ -391,7 +394,7 @@ async fn test_l1_reorg_batch_commit() -> eyre::Result<()> {
391394 let mut fixture = TestFixture :: builder ( )
392395 . followers ( 1 )
393396 . skip_l1_synced_notifications ( )
394- . with_anvil ( None , Some ( 22222222 ) , None )
397+ . with_anvil ( None , Some ( 22222222 ) , None , None )
395398 . build ( )
396399 . await ?;
397400
@@ -432,6 +435,7 @@ async fn test_l1_reorg_batch_commit() -> eyre::Result<()> {
432435
433436 // Step 4: Perform L1 reorg to remove batches 4-6 (reorg depth 3)
434437 fixture. anvil_reorg ( 3 ) . await ?;
438+ tokio:: time:: sleep ( tokio:: time:: Duration :: from_secs ( 3 ) ) . await ;
435439
436440 // Wait for reorg detection
437441 fixture. expect_event ( ) . l1_reorg ( ) . await ?;
@@ -474,7 +478,7 @@ async fn test_l1_reorg_batch_finalized() -> eyre::Result<()> {
474478 let mut fixture = TestFixture :: builder ( )
475479 . followers ( 1 )
476480 . skip_l1_synced_notifications ( )
477- . with_anvil ( None , Some ( 22222222 ) , None )
481+ . with_anvil ( None , Some ( 22222222 ) , None , None )
478482 . build ( )
479483 . await ?;
480484
@@ -496,7 +500,7 @@ async fn test_l1_reorg_batch_finalized() -> eyre::Result<()> {
496500 fixture. anvil_inject_tx ( finalize_batch_tx) . await ?;
497501 }
498502 for _ in 1 ..=2 {
499- fixture. expect_event ( ) . batch_finalized ( ) . await ?;
503+ fixture. expect_event ( ) . batch_finalize_indexed ( ) . await ?;
500504 }
501505
502506 // Record finalized head after finalization
@@ -553,7 +557,7 @@ async fn test_l1_reorg_batch_revert() -> eyre::Result<()> {
553557 let mut fixture = TestFixture :: builder ( )
554558 . followers ( 1 )
555559 . skip_l1_synced_notifications ( )
556- . with_anvil ( None , Some ( 22222222 ) , None )
560+ . with_anvil ( None , Some ( 22222222 ) , None , None )
557561 . build ( )
558562 . await ?;
559563
0 commit comments