Skip to content

Commit

Permalink
skew fix
Browse files Browse the repository at this point in the history
  • Loading branch information
srene committed Nov 5, 2024
1 parent 7e07813 commit c2bef84
Showing 1 changed file with 7 additions and 6 deletions.
13 changes: 7 additions & 6 deletions block/submit.go
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,6 @@ func SubmitLoopInner(
if err != nil {
return err
}
fmt.Println("skew time", skewTime)

types.RollappPendingSubmissionsSkewTimeHours.Set(float64(skewTime.Hours()))

Expand Down Expand Up @@ -108,21 +107,24 @@ func SubmitLoopInner(
}
pending := pendingBytes.Load()

skewTime, err := skewTime()
skew, err := skewTime()
if err != nil {
return err
}
fmt.Println("skew time", skewTime)
types.RollappPendingSubmissionsSkewBytes.Set(float64(pending))
types.RollappPendingSubmissionsSkewBlocks.Set(float64(unsubmittedBlocksNum()))
types.RollappPendingSubmissionsSkewTimeHours.Set(float64(skewTime.Hours()))
types.RollappPendingSubmissionsSkewTimeHours.Set(float64(skew.Hours()))

// while there are accumulated blocks, create and submit batches!!
for {
done := ctx.Err() != nil
nothingToSubmit := pending == 0

lastSubmissionIsRecent := skewTime < maxBatchTime
skew, err = skewTime()
if err != nil {
return err
}
lastSubmissionIsRecent := skew < maxBatchTime
maxDataNotExceeded := pending <= maxBatchBytes
if done || nothingToSubmit || (lastSubmissionIsRecent && maxDataNotExceeded) {
break
Expand Down Expand Up @@ -342,7 +344,6 @@ func (m *Manager) GetSkewTime() (time.Duration, error) {
if err != nil {
return time.Duration(0), err
}
fmt.Println(lastSettlementBlockTime, m.State.GetLastBlockTime())

return m.State.GetLastBlockTime().Sub(lastSettlementBlockTime), nil
}

0 comments on commit c2bef84

Please sign in to comment.