Skip to content

Commit e6c5d04

Browse files
committed
updates
1 parent 8dae4cc commit e6c5d04

3 files changed

Lines changed: 10 additions & 26 deletions

File tree

pkg/sequencers/based/sequencer.go

Lines changed: 1 addition & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -40,10 +40,6 @@ type BasedSequencer struct {
4040
currentDAEndTime time.Time
4141
// Total number of transactions in the current DA epoch (used for timestamp jitter)
4242
currentEpochTxCount uint64
43-
// lastTimestamp is the floor for timestamps to guarantee monotonicity
44-
// after a restart on a node that already had blocks produced with wall-clock time.
45-
// Initialised from the last block time in the store at construction.
46-
lastTimestamp time.Time
4743
}
4844

4945
// NewBasedSequencer creates a new based sequencer instance
@@ -68,15 +64,8 @@ func NewBasedSequencer(
6864
s := store.New(store.NewEvNodeKVStore(db))
6965
daStartHeight := genesis.DAStartHeight
7066
if state, err := s.GetState(initCtx); err == nil {
71-
if !state.LastBlockTime.IsZero() {
72-
bs.lastTimestamp = state.LastBlockTime
73-
bs.logger.Debug().
74-
Time("last_block_time", state.LastBlockTime).
75-
Msg("initialized timestamp floor from last block time")
76-
}
7767
if state.DAHeight > 0 {
78-
// skip already processed epochs
79-
daStartHeight = state.DAHeight
68+
daStartHeight = state.DAHeight // skip already processed epochs
8069
}
8170
}
8271
bs.SetDAHeight(daStartHeight)
@@ -210,7 +199,6 @@ doneProcessing:
210199
// the next epoch starts at nextDaEndTime - N*1ms >= prevDaEndTime.
211200
epochStart := s.currentDAEndTime.Add(-time.Duration(s.currentEpochTxCount) * time.Millisecond)
212201
timestamp := epochStart.Add(time.Duration(txIndexForTimestamp) * time.Millisecond)
213-
s.lastTimestamp = timestamp
214202

215203
if len(validTxs) == 0 {
216204
return nil, block.ErrNoBatch

pkg/sequencers/single/sequencer.go

Lines changed: 7 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -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).

test/e2e/evm_force_inclusion_e2e_test.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -601,7 +601,7 @@ func TestEvmSequencerCatchUpBasedSequencerE2E(t *testing.T) {
601601
t.Log("Phase 1: Setup - Start Sequencer and Sync Node")
602602

603603
dockerClient, networkID := tastoradocker.Setup(t)
604-
env := setupCommonEVMEnv(t, sut, dockerClient, networkID, WithFullNode())
604+
env := SetupCommonEVMEnv(t, sut, dockerClient, networkID, WithFullNode())
605605

606606
// Create passphrase and JWT secret files for sequencer
607607
seqPassphraseFile := createPassphraseFile(t, sequencerHome)
@@ -1020,7 +1020,7 @@ func TestEvmBasedSequencerBaselineE2E(t *testing.T) {
10201020
t.Log("Setting up fresh based sequencer from genesis")
10211021

10221022
dockerClient, networkID := tastoradocker.Setup(t)
1023-
env := setupCommonEVMEnv(t, sut, dockerClient, networkID, WithFullNode())
1023+
env := SetupCommonEVMEnv(t, sut, dockerClient, networkID, WithFullNode())
10241024

10251025
// Create passphrase and JWT secret files
10261026
passphraseFile := createPassphraseFile(t, basedSeqHome)

0 commit comments

Comments
 (0)