@@ -42,6 +42,7 @@ type Sequencer struct {
4242 // Forced inclusion support
4343 fiRetriever block.ForcedInclusionRetriever
4444 daHeight atomic.Uint64
45+ daStartHeight atomic.Uint64
4546 checkpointStore * seqcommon.CheckpointStore
4647 checkpoint * seqcommon.Checkpoint
4748
@@ -70,6 +71,7 @@ func NewSequencer(
7071 genesis : genesis ,
7172 }
7273 s .SetDAHeight (genesis .DAStartHeight ) // default value, will be overridden by executor or submitter
74+ s .daStartHeight .Store (genesis .DAStartHeight )
7375
7476 loadCtx , cancel := context .WithTimeout (context .Background (), 10 * time .Second )
7577 defer cancel ()
@@ -104,21 +106,28 @@ func NewSequencer(
104106 Msg ("resuming from checkpoint within DA epoch" )
105107 }
106108
107- s .fiRetriever = block .NewForcedInclusionRetriever (daClient , logger , getInitialDAStartHeight (context .Background (), s . db ), genesis .DAEpochForcedInclusion )
109+ s .fiRetriever = block .NewForcedInclusionRetriever (daClient , logger , s . getInitialDAStartHeight (context .Background ()), genesis .DAEpochForcedInclusion )
108110 }
109111
110112 return s , nil
111113}
112114
113115// getInitialDAStartHeight retrieves the DA height of the first included chain height from store.
114- func getInitialDAStartHeight (ctx context.Context , db ds.Batching ) uint64 {
115- s := store .New (store .NewEvNodeKVStore (db ))
116+ func (c * Sequencer ) getInitialDAStartHeight (ctx context.Context ) uint64 {
117+ if daStartHeight := c .daStartHeight .Load (); daStartHeight != 0 {
118+ return daStartHeight
119+ }
120+
121+ s := store .New (store .NewEvNodeKVStore (c .db ))
116122 daIncludedHeightBytes , err := s .GetMetadata (ctx , store .GenesisDAHeightKey )
117123 if err != nil || len (daIncludedHeightBytes ) != 8 {
118124 return 0
119125 }
120126
121- return binary .LittleEndian .Uint64 (daIncludedHeightBytes )
127+ daStartHeight := binary .LittleEndian .Uint64 (daIncludedHeightBytes )
128+ c .daStartHeight .Store (daStartHeight )
129+
130+ return daStartHeight
122131}
123132
124133// SubmitBatchTxs implements sequencing.Sequencer.
@@ -166,7 +175,7 @@ func (c *Sequencer) GetNextBatch(ctx context.Context, req coresequencer.GetNextB
166175 TxIndex : 0 ,
167176 }
168177
169- c .fiRetriever = block .NewForcedInclusionRetriever (c .daClient , c .logger , getInitialDAStartHeight (ctx , c . db ), c .genesis .DAEpochForcedInclusion )
178+ c .fiRetriever = block .NewForcedInclusionRetriever (c .daClient , c .logger , c . getInitialDAStartHeight (ctx ), c .genesis .DAEpochForcedInclusion )
170179 }
171180
172181 // If we have no cached transactions or we've consumed all from the current cache,
0 commit comments