diff --git a/consensus/clique/clique.go b/consensus/clique/clique.go index bbc90195092b..afc12326ec42 100644 --- a/consensus/clique/clique.go +++ b/consensus/clique/clique.go @@ -254,8 +254,10 @@ func (c *Clique) verifyHeader(chain consensus.ChainHeaderReader, header *types.H } number := header.Number.Uint64() - // Don't waste time checking blocks from the future - if header.Time > uint64(time.Now().Unix()) { + // Don't waste time checking blocks from the future. + // We add 100ms leeway since the scroll_worker internal timers might trigger early. + now := time.Now() + if header.Time > uint64(now.Unix()) && time.Unix(int64(header.Time), 0).Sub(now) > 100*time.Millisecond { return consensus.ErrFutureBlock } // Checkpoint blocks need to enforce zero beneficiary diff --git a/consensus/system_contract/consensus.go b/consensus/system_contract/consensus.go index 299577ac141f..66178d7a87cb 100644 --- a/consensus/system_contract/consensus.go +++ b/consensus/system_contract/consensus.go @@ -115,8 +115,10 @@ func (s *SystemContract) verifyHeader(chain consensus.ChainHeaderReader, header return errUnknownBlock } - // Don't waste time checking blocks from the future - if header.Time > uint64(time.Now().Unix()) { + // Don't waste time checking blocks from the future. + // We add 100ms leeway since the scroll_worker internal timers might trigger early. + now := time.Now() + if header.Time > uint64(now.Unix()) && time.Unix(int64(header.Time), 0).Sub(now) > 100*time.Millisecond { return consensus.ErrFutureBlock } // Ensure that the coinbase is zero diff --git a/miner/scroll_worker.go b/miner/scroll_worker.go index 2818abc761bc..3b2e05e8acb3 100644 --- a/miner/scroll_worker.go +++ b/miner/scroll_worker.go @@ -464,6 +464,7 @@ func (w *worker) collectPendingL1Messages(startIndex uint64) []types.L1MessageTx if len(l1MessagesV1) > 0 { // backdate the block to the parent block's timestamp -> not yet EuclidV2 // TODO: might need to re-run Prepare here + log.Warn("Back-labeling header timestamp to ensure it precedes the EuclidV2 transition", "blockNumber", w.current.header.Number, "oldTime", w.current.header.Time, "newTime", parent.Time) w.current.header.Time = parent.Time return l1MessagesV1 } @@ -541,6 +542,10 @@ func (w *worker) newWork(now time.Time, parentHash common.Hash, reorging bool, r // clique with relaxed period uses time.Now() as the header.Time, calculate the deadline deadline = time.Unix(int64(header.Time+w.chainConfig.Clique.Period), 0) } + if w.chainConfig.SystemContract != nil && w.chainConfig.SystemContract.RelaxedPeriod { + // system contract with relaxed period uses time.Now() as the header.Time, calculate the deadline + deadline = time.Unix(int64(header.Time+w.chainConfig.SystemContract.Period), 0) + } w.current = &work{ deadlineTimer: time.NewTimer(time.Until(deadline)), diff --git a/params/version.go b/params/version.go index 6ca0a4f92b34..7e953ffe6a8b 100644 --- a/params/version.go +++ b/params/version.go @@ -24,7 +24,7 @@ import ( const ( VersionMajor = 5 // Major version component of the current release VersionMinor = 8 // Minor version component of the current release - VersionPatch = 18 // Patch version component of the current release + VersionPatch = 19 // Patch version component of the current release VersionMeta = "mainnet" // Version metadata to append to the version string )