@@ -369,26 +369,15 @@ func sequencingBatchStep(
369
369
return err
370
370
}
371
371
} else if ! batchState .isL1Recovery () {
372
-
373
- var allConditionsOK bool
374
372
var newTransactions []types.Transaction
375
373
var newIds []common.Hash
376
374
377
- newTransactions , newIds , allConditionsOK , err = getNextPoolTransactions (ctx , cfg , executionAt , batchState .forkId , batchState .yieldedTransactions )
375
+ newTransactions , newIds , _ , err = getNextPoolTransactions (ctx , cfg , executionAt , batchState .forkId , batchState .yieldedTransactions )
378
376
if err != nil {
379
377
return err
380
378
}
381
379
382
- if len (newTransactions ) == 0 {
383
- if allConditionsOK {
384
- log .Info (fmt .Sprintf ("[%s] Sleep for %v ms" , logPrefix , batchContext .cfg .zk .SequencerTimeoutOnEmptyTxPool .Milliseconds ()))
385
- time .Sleep (batchContext .cfg .zk .SequencerTimeoutOnEmptyTxPool )
386
-
387
- } else {
388
- log .Info (fmt .Sprintf ("[%s] Sleep for %v ms" , logPrefix , batchContext .cfg .zk .SequencerTimeoutOnEmptyTxPool .Milliseconds ()/ 5 ))
389
- time .Sleep (batchContext .cfg .zk .SequencerTimeoutOnEmptyTxPool / 5 ) // we do not need to sleep too long for txpool not ready
390
- }
391
- } else {
380
+ if len (newTransactions ) > 0 {
392
381
hashResults := make ([]common.Hash , len (newTransactions ))
393
382
var wg sync.WaitGroup
394
383
@@ -412,7 +401,12 @@ func sequencingBatchStep(
412
401
}
413
402
414
403
start := time .Now ()
415
-
404
+ if len (batchState .blockState .transactionsForInclusion ) == 0 {
405
+ log .Trace (fmt .Sprintf ("[%s] Sleep on SequencerTimeoutOnEmptyTxPool" , logPrefix ), "time in ms" , batchContext .cfg .zk .SequencerTimeoutOnEmptyTxPool .Milliseconds ())
406
+ time .Sleep (batchContext .cfg .zk .SequencerTimeoutOnEmptyTxPool )
407
+ } else {
408
+ log .Trace (fmt .Sprintf ("[%s] Yielded transactions from the pool" , logPrefix ), "txCount" , len (batchState .blockState .transactionsForInclusion ))
409
+ }
416
410
badTxHashes := make ([]common.Hash , 0 )
417
411
minedTxHashes := make ([]common.Hash , 0 )
418
412
@@ -432,6 +426,22 @@ func sequencingBatchStep(
432
426
}
433
427
434
428
txHash := transaction .Hash ()
429
+
430
+ if _ , ok := transaction .GetSender (); ! ok {
431
+ signer := types .MakeSigner (cfg .chainConfig , executionAt , 0 )
432
+ sender , err := signer .Sender (transaction )
433
+ if err != nil {
434
+ log .Warn ("[extractTransaction] Failed to recover sender from transaction, skipping and removing from pool" ,
435
+ "error" , err ,
436
+ "hash" , transaction .Hash ())
437
+ badTxHashes = append (badTxHashes , txHash )
438
+ batchState .blockState .transactionsToDiscard = append (batchState .blockState .transactionsToDiscard , batchState .blockState .transactionHashesToSlots [txHash ])
439
+ continue
440
+ }
441
+
442
+ transaction .SetSender (sender )
443
+ }
444
+
435
445
effectiveGas := batchState .blockState .getL1EffectiveGases (cfg , i )
436
446
437
447
// The copying of this structure is intentional
0 commit comments