@@ -447,8 +447,6 @@ func (w *worker) updateSnapshot() {
447
447
// collectPendingL1Messages reads pending L1 messages from the database.
448
448
// It returns a list of L1 messages that can be included in the block. Depending on the current
449
449
// block time, it reads L1 messages from either L1MessageQueueV1 or L1MessageQueueV2.
450
- // It also makes sure that all L1 messages V1 are consumed before we activate EuclidV2 fork by backdating the block's time
451
- // to the parent block's timestamp.
452
450
func (w * worker ) collectPendingL1Messages (startIndex uint64 ) []types.L1MessageTx {
453
451
maxCount := w .chainConfig .Scroll .L1Config .NumL1MessagesPerBlock
454
452
@@ -509,22 +507,23 @@ func (w *worker) newWork(now time.Time, parentHash common.Hash, reorging bool, r
509
507
header .Nonce = types.BlockNonce {}
510
508
} else {
511
509
prepareStart := time .Now ()
510
+ // Note: this call will set header.Time, among other fields.
512
511
if err := w .engine .Prepare (w .chain , header , nil ); err != nil {
513
512
return fmt .Errorf ("failed to prepare header for mining: %w" , err )
514
513
}
515
514
prepareTimer .UpdateSince (prepareStart )
516
515
517
- // We found a potential EuclidV2 transition block.
518
- // We need to make sure that all the L1 messages V1 are consumed before we activate EuclidV2
519
- // as with EuclidV2 only L1 messages V2 are allowed.
520
516
if w .chainConfig .IsEuclidV2 (header .Time ) && ! w .chainConfig .IsEuclidV2 (parent .Time ()) {
517
+ // We found a potential EuclidV2 transition block.
518
+ // We need to make sure that all the L1 messages V1 are consumed before we activate EuclidV2,
519
+ // since we can only include MessageQueueV2 messages after EuclidV2.
521
520
l1MessagesV1 := rawdb .ReadL1MessagesV1From (w .eth .ChainDb (), nextL1MsgIndex , 1 )
522
521
if len (l1MessagesV1 ) > 0 {
523
- // backdate the block to the parent block's timestamp -> not yet EuclidV2
522
+ // Backdate the block to the parent block's timestamp -> not yet EuclidV2
524
523
parentTime := parent .Time ()
525
524
log .Warn ("Backdating header timestamp to ensure it precedes the EuclidV2 transition" , "blockNumber" , header .Number , "oldTime" , header .Time , "newTime" , parentTime )
526
525
527
- // run-prepare again, this time it will use Clique
526
+ // Run Prepare again, this time we provide a timestamp override, so it will use Clique
528
527
prepareStart := time .Now ()
529
528
if err := w .engine .Prepare (w .chain , header , & parentTime ); err != nil {
530
529
return fmt .Errorf ("failed to prepare header for mining: %w" , err )
0 commit comments