Skip to content

Commit 732eae8

Browse files
committed
nit
1 parent 5b2a8ca commit 732eae8

File tree

3 files changed

+8
-9
lines changed

3 files changed

+8
-9
lines changed

consensus/ethash/consensus.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -580,7 +580,7 @@ func (ethash *Ethash) verifySeal(chain consensus.ChainHeaderReader, header *type
580580
}
581581

582582
func (ue *Ethash) CalcTimestamp(parent *types.Header) uint64 {
583-
panic("Called CalcTimestamp in Ethash, not implemented")
583+
panic("Called CalcTimestamp on Ethash, not implemented")
584584
}
585585

586586
// Prepare implements consensus.Engine, initializing the difficulty field of a

consensus/wrapper/consensus.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -152,7 +152,7 @@ func (ue *UpgradableEngine) VerifyHeaders(chain consensus.ChainHeaderReader, hea
152152
}
153153

154154
func (ue *UpgradableEngine) CalcTimestamp(parent *types.Header) uint64 {
155-
panic("Called CalcTimestamp in UpgradableEngine, not implemented")
155+
panic("Called CalcTimestamp on UpgradableEngine, not implemented")
156156
}
157157

158158
// Prepare prepares a block header for sealing.

miner/scroll_worker.go

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -447,8 +447,6 @@ func (w *worker) updateSnapshot() {
447447
// collectPendingL1Messages reads pending L1 messages from the database.
448448
// It returns a list of L1 messages that can be included in the block. Depending on the current
449449
// 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.
452450
func (w *worker) collectPendingL1Messages(startIndex uint64) []types.L1MessageTx {
453451
maxCount := w.chainConfig.Scroll.L1Config.NumL1MessagesPerBlock
454452

@@ -509,22 +507,23 @@ func (w *worker) newWork(now time.Time, parentHash common.Hash, reorging bool, r
509507
header.Nonce = types.BlockNonce{}
510508
} else {
511509
prepareStart := time.Now()
510+
// Note: this call will set header.Time, among other fields.
512511
if err := w.engine.Prepare(w.chain, header, nil); err != nil {
513512
return fmt.Errorf("failed to prepare header for mining: %w", err)
514513
}
515514
prepareTimer.UpdateSince(prepareStart)
516515

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.
520516
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.
521520
l1MessagesV1 := rawdb.ReadL1MessagesV1From(w.eth.ChainDb(), nextL1MsgIndex, 1)
522521
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
524523
parentTime := parent.Time()
525524
log.Warn("Backdating header timestamp to ensure it precedes the EuclidV2 transition", "blockNumber", header.Number, "oldTime", header.Time, "newTime", parentTime)
526525

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
528527
prepareStart := time.Now()
529528
if err := w.engine.Prepare(w.chain, header, &parentTime); err != nil {
530529
return fmt.Errorf("failed to prepare header for mining: %w", err)

0 commit comments

Comments
 (0)