@@ -79,7 +79,7 @@ func TestExecutor_RestartUsesPendingHeader(t *testing.T) {
7979 require .NoError (t , exec1 .initializeState ())
8080
8181 // Set up context for first executor
82- exec1 .ctx , exec1 .cancel = context .WithCancel (context . Background ())
82+ exec1 .ctx , exec1 .cancel = context .WithCancel (t . Context ())
8383
8484 // First executor produces a block normally
8585 mockSeq1 .EXPECT ().GetNextBatch (mock .Anything , mock .AnythingOfType ("sequencer.GetNextBatchRequest" )).
@@ -101,12 +101,12 @@ func TestExecutor_RestartUsesPendingHeader(t *testing.T) {
101101 require .NoError (t , err )
102102
103103 // Verify first block was produced
104- h1 , err := memStore .Height (context . Background ())
104+ h1 , err := memStore .Height (t . Context ())
105105 require .NoError (t , err )
106106 assert .Equal (t , uint64 (1 ), h1 )
107107
108108 // Store the produced block data for later verification
109- originalHeader , originalData , err := memStore .GetBlockData (context . Background (), 1 )
109+ originalHeader , originalData , err := memStore .GetBlockData (t . Context (), 1 )
110110 require .NoError (t , err )
111111 assert .Equal (t , 2 , len (originalData .Txs ), "first block should have 2 transactions" )
112112
@@ -158,8 +158,7 @@ func TestExecutor_RestartUsesPendingHeader(t *testing.T) {
158158 pendingHeader .DataHash = pendingData .DACommitment ()
159159
160160 // Save pending block data (this is what would happen during a crash)
161- // We use savePendingBlock directly which writes to the metadata keys expected by the executor on restart
162- err = exec1 .savePendingBlock (context .Background (), pendingHeader , pendingData )
161+ err = exec1 .savePendingBlock (t .Context (), pendingHeader , pendingData )
163162 require .NoError (t , err )
164163
165164 // Stop first executor (simulating crash/restart)
@@ -196,7 +195,7 @@ func TestExecutor_RestartUsesPendingHeader(t *testing.T) {
196195 require .NoError (t , exec2 .initializeState ())
197196
198197 // Set up context for second executor
199- exec2 .ctx , exec2 .cancel = context .WithCancel (context . Background ())
198+ exec2 .ctx , exec2 .cancel = context .WithCancel (t . Context ())
200199 defer exec2 .cancel ()
201200
202201 // Verify that the state is at height 1 (pending block at height 2 wasn't committed)
@@ -218,12 +217,12 @@ func TestExecutor_RestartUsesPendingHeader(t *testing.T) {
218217 require .NoError (t , err )
219218
220219 // Verify height advanced to 2
221- h2 , err := memStore .Height (context . Background ())
220+ h2 , err := memStore .Height (t . Context ())
222221 require .NoError (t , err )
223222 assert .Equal (t , uint64 (2 ), h2 , "height should advance to 2 using pending block" )
224223
225224 // Verify the block at height 2 matches the pending block data
226- finalHeader , finalData , err := memStore .GetBlockData (context . Background (), 2 )
225+ finalHeader , finalData , err := memStore .GetBlockData (t . Context (), 2 )
227226 require .NoError (t , err )
228227 assert .Equal (t , 3 , len (finalData .Txs ), "should use pending block with 3 transactions" )
229228 assert .Equal (t , []byte ("pending_tx1" ), []byte (finalData .Txs [0 ]))
@@ -385,7 +384,7 @@ func TestExecutor_RestartNoPendingHeader(t *testing.T) {
385384 require .NoError (t , err )
386385
387386 // Verify normal operation
388- h , err := memStore .Height (context . Background ())
387+ h , err := memStore .Height (t . Context ())
389388 require .NoError (t , err )
390389 assert .Equal (t , uint64 (numBlocks + 1 ), h )
391390
0 commit comments