@@ -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,11 +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- batch , err := memStore .NewBatch (context .Background ())
162- require .NoError (t , err )
163- err = batch .SaveBlockData (pendingHeader , pendingData , & types.Signature {})
164- require .NoError (t , err )
165- err = batch .Commit ()
161+ err = exec1 .savePendingBlock (t .Context (), pendingHeader , pendingData )
166162 require .NoError (t , err )
167163
168164 // Stop first executor (simulating crash/restart)
@@ -199,7 +195,7 @@ func TestExecutor_RestartUsesPendingHeader(t *testing.T) {
199195 require .NoError (t , exec2 .initializeState ())
200196
201197 // Set up context for second executor
202- exec2 .ctx , exec2 .cancel = context .WithCancel (context . Background ())
198+ exec2 .ctx , exec2 .cancel = context .WithCancel (t . Context ())
203199 defer exec2 .cancel ()
204200
205201 // Verify that the state is at height 1 (pending block at height 2 wasn't committed)
@@ -221,12 +217,12 @@ func TestExecutor_RestartUsesPendingHeader(t *testing.T) {
221217 require .NoError (t , err )
222218
223219 // Verify height advanced to 2
224- h2 , err := memStore .Height (context . Background ())
220+ h2 , err := memStore .Height (t . Context ())
225221 require .NoError (t , err )
226222 assert .Equal (t , uint64 (2 ), h2 , "height should advance to 2 using pending block" )
227223
228224 // Verify the block at height 2 matches the pending block data
229- finalHeader , finalData , err := memStore .GetBlockData (context . Background (), 2 )
225+ finalHeader , finalData , err := memStore .GetBlockData (t . Context (), 2 )
230226 require .NoError (t , err )
231227 assert .Equal (t , 3 , len (finalData .Txs ), "should use pending block with 3 transactions" )
232228 assert .Equal (t , []byte ("pending_tx1" ), []byte (finalData .Txs [0 ]))
@@ -388,7 +384,7 @@ func TestExecutor_RestartNoPendingHeader(t *testing.T) {
388384 require .NoError (t , err )
389385
390386 // Verify normal operation
391- h , err := memStore .Height (context . Background ())
387+ h , err := memStore .Height (t . Context ())
392388 require .NoError (t , err )
393389 assert .Equal (t , uint64 (numBlocks + 1 ), h )
394390
0 commit comments