@@ -328,8 +328,6 @@ func Test_publishBlock_EmptyBatch(t *testing.T) {
328328// is successfully created, applied, and published.
329329func Test_publishBlock_Success (t * testing.T ) {
330330 require := require .New (t )
331- ctx , cancel := context .WithCancel (context .Background ())
332- defer cancel ()
333331
334332 initialHeight := uint64 (5 )
335333 newHeight := initialHeight + 1
@@ -338,25 +336,25 @@ func Test_publishBlock_Success(t *testing.T) {
338336 manager , mockStore , mockExec , mockSeq , _ , headerCh , dataCh , _ := setupManagerForPublishBlockTest (t , true , initialHeight , 0 )
339337 manager .lastState .LastBlockHeight = initialHeight
340338
341- mockStore .On ("Height" , ctx ).Return (initialHeight , nil ).Once ()
339+ mockStore .On ("Height" , t . Context () ).Return (initialHeight , nil ).Once ()
342340 mockSignature := types .Signature ([]byte {1 , 2 , 3 })
343- mockStore .On ("GetSignature" , ctx , initialHeight ).Return (& mockSignature , nil ).Once ()
341+ mockStore .On ("GetSignature" , t . Context () , initialHeight ).Return (& mockSignature , nil ).Once ()
344342 lastHeader , lastData := types .GetRandomBlock (initialHeight , 5 , chainID )
345343 lastHeader .ProposerAddress = manager .genesis .ProposerAddress
346- mockStore .On ("GetBlockData" , ctx , initialHeight ).Return (lastHeader , lastData , nil ).Once ()
347- mockStore .On ("GetBlockData" , ctx , newHeight ).Return (nil , nil , errors .New ("not found" )).Once ()
348- mockStore .On ("SaveBlockData" , ctx , mock .AnythingOfType ("*types.SignedHeader" ), mock .AnythingOfType ("*types.Data" ), mock .AnythingOfType ("*types.Signature" )).Return (nil ).Once ()
349- mockStore .On ("SaveBlockData" , ctx , mock .AnythingOfType ("*types.SignedHeader" ), mock .AnythingOfType ("*types.Data" ), mock .AnythingOfType ("*types.Signature" )).Return (nil ).Once ()
350- mockStore .On ("SetHeight" , ctx , newHeight ).Return (nil ).Once ()
351- mockStore .On ("UpdateState" , ctx , mock .AnythingOfType ("types.State" )).Return (nil ).Once ()
352- mockStore .On ("SetMetadata" , ctx , LastBatchDataKey , mock .AnythingOfType ("[]uint8" )).Return (nil ).Once ()
344+ mockStore .On ("GetBlockData" , t . Context () , initialHeight ).Return (lastHeader , lastData , nil ).Once ()
345+ mockStore .On ("GetBlockData" , t . Context () , newHeight ).Return (nil , nil , errors .New ("not found" )).Once ()
346+ mockStore .On ("SaveBlockData" , t . Context () , mock .AnythingOfType ("*types.SignedHeader" ), mock .AnythingOfType ("*types.Data" ), mock .AnythingOfType ("*types.Signature" )).Return (nil ).Once ()
347+ mockStore .On ("SaveBlockData" , t . Context () , mock .AnythingOfType ("*types.SignedHeader" ), mock .AnythingOfType ("*types.Data" ), mock .AnythingOfType ("*types.Signature" )).Return (nil ).Once ()
348+ mockStore .On ("SetHeight" , t . Context () , newHeight ).Return (nil ).Once ()
349+ mockStore .On ("UpdateState" , t . Context () , mock .AnythingOfType ("types.State" )).Return (nil ).Once ()
350+ mockStore .On ("SetMetadata" , t . Context () , LastBatchDataKey , mock .AnythingOfType ("[]uint8" )).Return (nil ).Once ()
353351
354352 // --- Mock Executor ---
355353 sampleTxs := [][]byte {[]byte ("tx1" ), []byte ("tx2" )}
356354 // No longer mocking GetTxs since it's handled by reaper.go
357355 newAppHash := []byte ("newAppHash" )
358- mockExec .On ("ExecuteTxs" , ctx , mock .Anything , newHeight , mock .AnythingOfType ("time.Time" ), manager .lastState .AppHash ).Return (newAppHash , uint64 (100 ), nil ).Once ()
359- mockExec .On ("SetFinal" , ctx , newHeight ).Return (nil ).Once ()
356+ mockExec .On ("ExecuteTxs" , t . Context () , mock .Anything , newHeight , mock .AnythingOfType ("time.Time" ), manager .lastState .AppHash ).Return (newAppHash , uint64 (100 ), nil ).Once ()
357+ mockExec .On ("SetFinal" , t . Context () , newHeight ).Return (nil ).Once ()
360358
361359 // No longer mocking SubmitRollupBatchTxs since it's handled by reaper.go
362360 batchTimestamp := lastHeader .Time ().Add (1 * time .Second )
@@ -371,8 +369,8 @@ func Test_publishBlock_Success(t *testing.T) {
371369 batchReqMatcher := mock .MatchedBy (func (req coresequencer.GetNextBatchRequest ) bool {
372370 return string (req .RollupId ) == chainID
373371 })
374- mockSeq .On ("GetNextBatch" , ctx , batchReqMatcher ).Return (batchResponse , nil ).Once ()
375- err := manager .publishBlock (ctx )
372+ mockSeq .On ("GetNextBatch" , t . Context () , batchReqMatcher ).Return (batchResponse , nil ).Once ()
373+ err := manager .publishBlock (t . Context () )
376374 require .NoError (err , "publishBlock should succeed" )
377375
378376 select {
0 commit comments