Skip to content

Commit

Permalink
apply da blocks refactor
Browse files Browse the repository at this point in the history
  • Loading branch information
srene committed Oct 2, 2024
1 parent becaafc commit 9af24fd
Showing 1 changed file with 10 additions and 3 deletions.
13 changes: 10 additions & 3 deletions block/retriever.go
Original file line number Diff line number Diff line change
Expand Up @@ -66,9 +66,17 @@ func (m *Manager) ProcessNextDABatch(daMetaData *da.DASubmitMetaData) error {
if batchResp.Code != da.StatusSuccess {
return batchResp.Error
}

err := m.applyDaBlocks(batchResp)
if err != nil {
return err
}
m.logger.Debug("retrieved batches", "n", len(batchResp.Batches), "daHeight", daMetaData.Height)

return nil
}

func (m *Manager) applyDaBlocks(batchResp da.ResultRetrieveBatch) error {

m.retrieverMu.Lock()
defer m.retrieverMu.Unlock()

Expand All @@ -83,7 +91,7 @@ func (m *Manager) ProcessNextDABatch(daMetaData *da.DASubmitMetaData) error {
continue
}

err := m.applyBlock(block, batch.Commits[i], types.BlockMetaData{Source: types.DA, DAHeight: daMetaData.Height})
err := m.applyBlock(block, batch.Commits[i], types.BlockMetaData{Source: types.DA, DAHeight: batchResp.CheckMetaData.Height})
if err != nil {
return fmt.Errorf("apply block: height: %d: %w", block.Header.Height, err)
}
Expand All @@ -97,7 +105,6 @@ func (m *Manager) ProcessNextDABatch(daMetaData *da.DASubmitMetaData) error {
}
types.LastReceivedDAHeightGauge.Set(lastAppliedHeight)

return nil
}

Check failure on line 108 in block/retriever.go

View workflow job for this annotation

GitHub Actions / golangci-lint

missing return (typecheck)

Check failure on line 108 in block/retriever.go

View workflow job for this annotation

GitHub Actions / golangci-lint

missing return) (typecheck)

Check failure on line 108 in block/retriever.go

View workflow job for this annotation

GitHub Actions / golangci-lint

missing return) (typecheck)

Check failure on line 108 in block/retriever.go

View workflow job for this annotation

GitHub Actions / Analyze

missing return

Check failure on line 108 in block/retriever.go

View workflow job for this annotation

GitHub Actions / build

missing return

func (m *Manager) fetchBatch(daMetaData *da.DASubmitMetaData) da.ResultRetrieveBatch {
Expand Down

0 comments on commit 9af24fd

Please sign in to comment.