Skip to content

Commit 889f5c8

Browse files
authored
Merge branch 'main' into feat/dummy-da-header-support
2 parents 63d6506 + 86b01ad commit 889f5c8

File tree

3 files changed

+16
-7
lines changed

3 files changed

+16
-7
lines changed

block/internal/submitting/submitter.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -264,7 +264,7 @@ func (s *Submitter) processDAInclusionLoop() {
264264
}
265265

266266
// setFinalWithRetry sets the final height in executor with retry logic.
267-
// NOTE: the function retries the execution client call regardless of the error. Some execution clients errors are irrecoverable, and will eventually halt the node, as expected.
267+
// NOTE: the function retries the execution client call regardless of the error. Some execution client errors are irrecoverable, and will eventually halt the node, as expected.
268268
func (s *Submitter) setFinalWithRetry(nextHeight uint64) error {
269269
for attempt := 1; attempt <= common.MaxRetriesBeforeHalt; attempt++ {
270270
if err := s.exec.SetFinal(s.ctx, nextHeight); err != nil {

sequencers/single/sequencer.go

Lines changed: 14 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -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,

types/signed_header.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -185,7 +185,7 @@ func (sh *SignedHeader) ValidateBasic() error {
185185
return ErrSignatureVerificationFailed
186186
}
187187

188-
// ValidateBasicWithData performs basic validator of a signed header, granted data for syncing node.
188+
// ValidateBasicWithData performs basic validation of a signed header, given data for syncing node.
189189
func (sh *SignedHeader) ValidateBasicWithData(data *Data) error {
190190
if err := sh.Header.ValidateBasic(); err != nil {
191191
return err

0 commit comments

Comments
 (0)