@@ -24,8 +24,8 @@ const (
2424// daRetriever encapsulates DA retrieval with pending events management
2525type daRetriever struct {
2626 manager * Manager
27+ mutex sync.RWMutex // mutex for pendingEvents
2728 pendingEvents map [uint64 ][]pendingDAEvent
28- mutex sync.RWMutex
2929}
3030
3131// pendingDAEvent represents a DA event waiting for processing
@@ -200,7 +200,7 @@ func (m *Manager) tryDecodeHeader(bz []byte, daHeight uint64) *types.SignedHeade
200200 }
201201
202202 // early validation to reject junk headers
203- if ok , err := m .isUsingExpectedSingleSequencer (header .ProposerAddress ); ! ok {
203+ if err := m .assertUsingExpectedSingleSequencer (header .ProposerAddress ); err != nil {
204204 m .logger .Debug ().
205205 Uint64 ("headerHeight" , header .Height ()).
206206 Str ("headerHash" , header .Hash ().String ()).
@@ -253,9 +253,8 @@ func (m *Manager) tryDecodeData(bz []byte, daHeight uint64) *types.Data {
253253 return & signedData .Data
254254}
255255
256- // isAtHeight checks if a height is available without blocking
257- // waitForHeightNonBlocking checks if a height is available without blocking
258- func (m * Manager ) waitForHeightNonBlocking (ctx context.Context , height uint64 ) error {
256+ // isAtHeight checks if a height is available.
257+ func (m * Manager ) isAtHeight (ctx context.Context , height uint64 ) error {
259258 currentHeight , err := m .GetStoreHeight (ctx )
260259 if err != nil {
261260 return err
@@ -282,8 +281,8 @@ func (dr *daRetriever) sendHeightEventIfValid(ctx context.Context, header *types
282281 return
283282 }
284283
285- // Check if we can validate this height immediately (non-blocking check)
286- if err := dr .manager .waitForHeightNonBlocking (ctx , header .Height ()- 1 ); err != nil {
284+ // Check if we can validate this height immediately
285+ if err := dr .manager .isAtHeight (ctx , header .Height ()- 1 ); err != nil {
287286 // Queue this event for later processing when the prerequisite height is available
288287 dr .queuePendingEvent (header , data , daHeight )
289288 return
@@ -316,7 +315,7 @@ func (dr *daRetriever) queuePendingEvent(header *types.SignedHeader, data *types
316315func (dr * daRetriever ) processEvent (ctx context.Context , header * types.SignedHeader , data * types.Data , daHeight uint64 ) {
317316 headerHash := header .Hash ().String ()
318317
319- // Validate header with its data - this requires previous height to be stored
318+ // Validate header with its data - some execution environment may require previous height to be stored
320319 if err := header .ValidateBasicWithData (data ); err != nil {
321320 dr .manager .logger .Debug ().Uint64 ("height" , header .Height ()).Err (err ).Msg ("header validation with data failed" )
322321 return
@@ -365,7 +364,7 @@ func (dr *daRetriever) processPendingEvents(ctx context.Context) {
365364 defer dr .mutex .Unlock ()
366365
367366 for height , events := range dr .pendingEvents {
368- if height - 1 <= currentHeight {
367+ if height <= currentHeight + 1 {
369368 for _ , event := range events {
370369 dr .manager .logger .Debug ().
371370 Uint64 ("height" , height ).
0 commit comments