Skip to content

Commit

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

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

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

Expand All @@ -158,17 +157,6 @@ 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) ValidateBatch(batch *types.Batch) error {
syncTarget := m.SyncTarget.Load()
if batch.StartHeight != syncTarget+1 {
Expand Down

0 comments on commit f41c2ce

Please sign in to comment.