From 46a7936c54827f9a1741decd4160f7ce49b3d964 Mon Sep 17 00:00:00 2001 From: protolambda Date: Sun, 30 Oct 2022 01:00:22 +0300 Subject: [PATCH] op-node: catch up L2 sequencing based on time, not L1 origins --- op-node/rollup/driver/state.go | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/op-node/rollup/driver/state.go b/op-node/rollup/driver/state.go index ed46fe02fc7..2bc32402959 100644 --- a/op-node/rollup/driver/state.go +++ b/op-node/rollup/driver/state.go @@ -279,8 +279,9 @@ func (s *Driver) eventLoop() { // requesting a new block ASAP instead of waiting for the next tick. // We don't request a block if the confirmation depth is not met. l2Head := s.derivation.UnsafeL2Head() - if l1Head.Number > l2Head.L1Origin.Number+s.driverConfig.SequencerConfDepth { - s.log.Trace("Building another L2 block asap to catch up with L1 head", "l2_unsafe", l2Head, "l2_unsafe_l1_origin", l2Head.L1Origin, "l1_head", l1Head) + if wallClock := uint64(time.Now().Unix()); l2Head.Time+s.config.BlockTime <= wallClock { + s.log.Trace("Building another L2 block asap to catch up with wallclock", + "l2_unsafe", l2Head, "l2_unsafe_time", l2Head.Time, "wallclock", wallClock) // But not too quickly to minimize busy-waiting for new blocks time.AfterFunc(time.Millisecond*10, reqL2BlockCreation) }