@@ -315,7 +315,8 @@ func TestDAFollower_InlineProcessing(t *testing.T) {
315315 }
316316
317317 daRetriever .On ("ProcessBlobs" , mock .Anything , blobs , uint64 (10 )).Return (expectedEvents ).Once ()
318- daRetriever .On ("RetrieveFromDA" , mock .Anything , uint64 (10 )).Return (expectedEvents , nil ).Maybe ()
318+ // Mock RetrieveFromDA for height 10 in case background catch-up fires before HandleEvent.
319+ daRetriever .On ("RetrieveFromDA" , mock .Anything , uint64 (10 )).Return (nil , datypes .ErrHeightFromFuture ).Maybe ()
319320
320321 // Simulate catchup loop to verify it advances naturally
321322 require .NoError (t , follower .Start (t .Context ()))
@@ -367,7 +368,7 @@ func TestDAFollower_InlineProcessing(t *testing.T) {
367368
368369 pipeEvent := func (_ context.Context , _ common.DAHeightEvent ) error { return nil }
369370
370- daClient , _ := setupMockDAClient (t )
371+ daClient , eventCh := setupMockDAClient (t )
371372 follower := NewDAFollower (DAFollowerConfig {
372373 Client : daClient ,
373374 Retriever : daRetriever ,
@@ -377,15 +378,23 @@ func TestDAFollower_InlineProcessing(t *testing.T) {
377378 StartDAHeight : 10 ,
378379 DABlockTime : 500 * time .Millisecond ,
379380 }).(* daFollower )
381+
382+ // Mock RetrieveFromDA because falling through inline processing triggers catchup.
383+ daRetriever .On ("RetrieveFromDA" , mock .Anything , uint64 (10 )).Return (nil , datypes .ErrHeightFromFuture ).Maybe ()
384+ require .NoError (t , follower .Start (t .Context ()))
385+
380386 // HandleEvent at current height but no blobs — should fall through
381387 // Subscriber.HandleEvent updates highest internally even if not processed.
382- follower . HandleEvent ( t . Context (), datypes.SubscriptionEvent {
388+ eventCh <- datypes.SubscriptionEvent {
383389 Height : 10 ,
384390 Blobs : nil ,
385- }, true )
391+ }
386392
387393 // ProcessBlobs should NOT have been called
388394 daRetriever .AssertNotCalled (t , "ProcessBlobs" , mock .Anything , mock .Anything , mock .Anything )
395+ require .Eventually (t , func () bool {
396+ return follower .subscriber .LocalDAHeight () == 10 && follower .subscriber .HighestSeenDAHeight () == 10
397+ }, 100 * time .Millisecond , 2 * time .Millisecond )
389398 assert .Equal (t , uint64 (10 ), follower .subscriber .LocalDAHeight (), "localDAHeight should not change" )
390399 assert .Equal (t , uint64 (10 ), follower .subscriber .HighestSeenDAHeight (), "highestSeen should be updated" )
391400 })
0 commit comments