@@ -433,7 +433,6 @@ func TestSyncLoopPersistState(t *testing.T) {
433433
434434 t .Log ("sync workers on instance1 completed" )
435435 require .Equal (t , myFutureDAHeight , syncerInst1 .GetDAHeight ())
436- lastStateDAHeight := syncerInst1 .GetLastState ().DAHeight
437436
438437 // wait for all events consumed
439438 require .NoError (t , cacheMgr .SaveToDisk ())
@@ -470,7 +469,6 @@ func TestSyncLoopPersistState(t *testing.T) {
470469 make (chan error , 1 ),
471470 )
472471 require .NoError (t , syncerInst2 .initializeState ())
473- require .Equal (t , lastStateDAHeight , syncerInst2 .GetDAHeight ())
474472
475473 ctx , cancel = context .WithCancel (t .Context ())
476474 t .Cleanup (cancel )
@@ -484,7 +482,7 @@ func TestSyncLoopPersistState(t *testing.T) {
484482 Run (func (arg mock.Arguments ) {
485483 cancel ()
486484 // retrieve last one again
487- assert .Equal (t , lastStateDAHeight , arg .Get (1 ).(uint64 ))
485+ assert .Equal (t , syncerInst2 . GetDAHeight () , arg .Get (1 ).(uint64 ))
488486 }).
489487 Return (nil , nil )
490488
@@ -589,6 +587,11 @@ func TestSyncer_InitializeState_CallsReplayer(t *testing.T) {
589587 // This test verifies that initializeState() invokes Replayer.
590588 // The detailed replay logic is tested in block/internal/common/replay_test.go
591589
590+ ds := dssync .MutexWrap (datastore .NewMapDatastore ())
591+ st := store .New (ds )
592+ cm , err := cache .NewManager (config .DefaultConfig (), st , zerolog .Nop ())
593+ require .NoError (t , err )
594+
592595 // Create mocks
593596 mockStore := testmocks .NewMockStore (t )
594597 mockExec := testmocks .NewMockHeightAwareExecutor (t )
@@ -627,17 +630,17 @@ func TestSyncer_InitializeState_CallsReplayer(t *testing.T) {
627630 daHeight : & atomic.Uint64 {},
628631 logger : zerolog .Nop (),
629632 ctx : context .Background (),
633+ cache : cm ,
630634 }
631635
632636 // Initialize state - this should call Replayer
633- err : = syncer .initializeState ()
637+ err = syncer .initializeState ()
634638 require .NoError (t , err )
635639
636640 // Verify state was initialized correctly
637641 state := syncer .GetLastState ()
638642 assert .Equal (t , storeHeight , state .LastBlockHeight )
639643 assert .Equal (t , gen .ChainID , state .ChainID )
640- assert .Equal (t , uint64 (5 ), syncer .GetDAHeight ())
641644
642645 // Verify that GetLatestHeight was called (proves Replayer was invoked)
643646 mockExec .AssertCalled (t , "GetLatestHeight" , mock .Anything )
0 commit comments