@@ -372,6 +372,17 @@ func (s *State) internalProcessUnsignedTransactionV1(ctx context.Context, tx *ty
372
372
}
373
373
nonce := loadedNonce .Uint64 ()
374
374
375
+ var oldStateRoot common.Hash
376
+ previousL2BlockNumber := uint64 (0 )
377
+ if l2Block .NumberU64 () > 0 {
378
+ previousL2BlockNumber = l2Block .NumberU64 () - 1
379
+ }
380
+ previousL2Block , err := s .GetL2BlockByNumber (ctx , previousL2BlockNumber , dbTx )
381
+ if err != nil {
382
+ return nil , err
383
+ }
384
+ oldStateRoot = previousL2Block .Root ()
385
+
375
386
batchL2Data , err := EncodeUnsignedTransaction (* tx , s .cfg .ChainID , & nonce , forkID )
376
387
if err != nil {
377
388
log .Errorf ("error encoding unsigned transaction " , err )
@@ -382,7 +393,7 @@ func (s *State) internalProcessUnsignedTransactionV1(ctx context.Context, tx *ty
382
393
processBatchRequestV1 := & executor.ProcessBatchRequest {
383
394
From : senderAddress .String (),
384
395
OldBatchNum : batch .BatchNumber ,
385
- OldStateRoot : l2Block . Root () .Bytes (),
396
+ OldStateRoot : oldStateRoot .Bytes (),
386
397
OldAccInputHash : batch .AccInputHash .Bytes (),
387
398
ForkId : forkID ,
388
399
Coinbase : l2Block .Coinbase ().String (),
0 commit comments