Skip to content

Commit

Permalink
Revert "inlines submit to sl func"
Browse files Browse the repository at this point in the history
This reverts commit ddc094f.
  • Loading branch information
danwt committed May 9, 2024
1 parent ddc094f commit 000cc9f
Showing 1 changed file with 15 additions and 3 deletions.
18 changes: 15 additions & 3 deletions block/submit.go
Original file line number Diff line number Diff line change
Expand Up @@ -131,12 +131,13 @@ func (m *Manager) HandleSubmissionTrigger() error {
return fmt.Errorf("submit next batch to da: %w", err)
}

err = m.SLClient.SubmitBatch(nextBatch, m.DAClient.GetClientType(), resultSubmitToDA)
syncHeight, err := m.submitNextBatchToSL(nextBatch, resultSubmitToDA)
if err != nil {
return fmt.Errorf("sl client submit batch: start height: %d: inclusive end height: %d: %w", startHeight, endHeightInclusive, err)
return fmt.Errorf("submit pending batch to sl: %w", err)
}

m.UpdateSyncParams(endHeightInclusive)
// Update the syncTarget to the height of the last block in the last batch as seen by this node.
m.UpdateSyncParams(syncHeight)
return nil
}

Expand All @@ -153,6 +154,17 @@ func (m *Manager) submitNextBatchToDA(nextBatch *types.Batch) (*da.ResultSubmitB
return &resultSubmitToDA, nil
}

func (m *Manager) submitNextBatchToSL(batch *types.Batch, daResult *da.ResultSubmitBatch) (uint64, error) {
startHeight := batch.StartHeight
actualEndHeight := batch.EndHeight
err := m.SLClient.SubmitBatch(batch, m.DAClient.GetClientType(), daResult)
if err != nil {
return 0, fmt.Errorf("sl client submit batch: startheight: %d: actual end height: %d: %w", startHeight, actualEndHeight, err)
}

return actualEndHeight, nil
}

func (m *Manager) CreateNextBatchToSubmit(startHeight uint64, endHeightInclusive uint64) (*types.Batch, error) {
var height uint64
// Create the batch
Expand Down

0 comments on commit 000cc9f

Please sign in to comment.