Skip to content

Commit

Permalink
address comments
Browse files Browse the repository at this point in the history
  • Loading branch information
NazariiDenha committed Aug 1, 2024
1 parent 523fd24 commit bd863d8
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions rollup/internal/controller/relayer/l1_relayer.go
Original file line number Diff line number Diff line change
Expand Up @@ -276,13 +276,14 @@ func (r *Layer1Relayer) shouldUpdateGasOracle(baseFee uint64, blobBaseFee uint64

func (r *Layer1Relayer) commitBatchReachTimeout() bool {
fields := map[string]interface{}{
"rollup_status": types.RollupCommitted,
"rollup_status IN ?": []types.RollupStatus{types.RollupCommitted, types.RollupFinalizing, types.RollupFinalized},
}
orderByList := []string{"updated_at DESC"}
orderByList := []string{"index DESC"}
limit := 1
batches, err := r.batchOrm.GetBatches(r.ctx, fields, orderByList, limit)
if err != nil {
log.Error("failed to fetch latest committing batches", "err", err)
log.Error("failed to fetch latest committed, finalizing or finalized batch", "err", err)
}
return len(batches) == 0 || utils.NowUTC().Sub(batches[0].UpdatedAt) > time.Duration(r.cfg.GasOracleConfig.CommitBatchTimeoutWindowMinutes)*time.Minute
// len(batches) == 0 probably shouldn't ever happen, but need to check this
return len(batches) == 0 || utils.NowUTC().Sub(*batches[0].CommittedAt) > time.Duration(r.cfg.GasOracleConfig.CommitBatchTimeoutWindowMinutes)*time.Minute
}

0 comments on commit bd863d8

Please sign in to comment.