Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

patch to mtsitrin/324: inline sl submit useless wrapper func #832

Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

the created batch can be lower than endHeightInclusive

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ahh sorry I misread the code I didnt see this line

batch.EndHeight = height - 1

that explains a lot

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
Loading