@@ -66,10 +66,6 @@ type Sequencer struct {
6666 currentDAEndTime time.Time
6767 // currentEpochTxCount is the total number of txs in the current DA epoch (used for timestamp jitter)
6868 currentEpochTxCount uint64
69- // lastCatchUpTimestamp is the floor for catch-up timestamps to guarantee
70- // monotonicity after a restart. Initialised from the last block time in
71- // the store when catch-up mode is entered.
72- lastCatchUpTimestamp time.Time
7369}
7470
7571// NewSequencer creates a new Single Sequencer
@@ -363,7 +359,6 @@ func (c *Sequencer) GetNextBatch(ctx context.Context, req coresequencer.GetNextB
363359 if c .catchUpState .Load () == catchUpInProgress || currentBatchHasForcedTxs {
364360 epochStart := c .currentDAEndTime .Add (- time .Duration (c .currentEpochTxCount ) * time .Millisecond )
365361 timestamp = epochStart .Add (time .Duration (txIndexForTimestamp ) * time .Millisecond )
366- c .lastCatchUpTimestamp = timestamp
367362 }
368363
369364 // In catch up modes, only produce blocks for force included txs.
@@ -549,22 +544,23 @@ func (c *Sequencer) updateCatchUpState(ctx context.Context) {
549544 }
550545
551546 // At least one epoch behind - enter catch-up mode.
547+ c .catchUpState .Store (catchUpInProgress )
548+
552549 // Read the last block time from the store so that catch-up timestamps
553550 // are guaranteed to be strictly after any previously produced block.
551+ // While unlikely, if this happens, this means all catch up blocks will differ from their based sequencer equivalent blocks.
554552 s := store .New (store .NewEvNodeKVStore (c .db ))
555553 state , err := s .GetState (ctx )
556554 if err == nil && ! state .LastBlockTime .IsZero () {
557- c .lastCatchUpTimestamp = state .LastBlockTime
555+ if state .LastBlockTime .After (c .currentDAEndTime ) {
556+ c .currentDAEndTime = state .LastBlockTime
557+ }
558+
558559 c .logger .Debug ().
559560 Time ("last_block_time" , state .LastBlockTime ).
560561 Msg ("initialized catch-up timestamp floor from last block time" )
561562 }
562563
563- if c .lastCatchUpTimestamp .After (c .currentDAEndTime ) {
564- c .currentDAEndTime = c .lastCatchUpTimestamp
565- }
566-
567- c .catchUpState .Store (catchUpInProgress )
568564 c .logger .Warn ().
569565 Uint64 ("checkpoint_da_height" , currentDAHeight ).
570566 Uint64 ("latest_da_height" , latestDAHeight ).
0 commit comments