Skip to content

Commit 0d8b00c

Browse files
authored
fix(gas-oracle): nil pointer error and allow update gas price when no diff (#1657)
1 parent 826357a commit 0d8b00c

File tree

2 files changed

+9
-3
lines changed

2 files changed

+9
-3
lines changed

common/version/version.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ import (
55
"runtime/debug"
66
)
77

8-
var tag = "v4.5.8"
8+
var tag = "v4.5.9"
99

1010
var commit = func() string {
1111
if info, ok := debug.ReadBuildInfo(); ok {

rollup/internal/controller/relayer/l1_relayer.go

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -251,7 +251,11 @@ func (r *Layer1Relayer) shouldUpdateGasOracle(baseFee uint64, blobBaseFee uint64
251251
return true
252252
}
253253

254-
expectedBaseFeeDelta := r.lastBaseFee*r.gasPriceDiff/gasPriceDiffPrecision + 1
254+
expectedBaseFeeDelta := r.lastBaseFee * r.gasPriceDiff / gasPriceDiffPrecision
255+
// Allowing a minimum of 0 wei if the gas price diff config is 0, this will be used to let the gas oracle send transactions continuously.
256+
if r.gasPriceDiff > 0 {
257+
expectedBaseFeeDelta += 1
258+
}
255259
if baseFee >= r.minGasPrice && math.Abs(float64(baseFee)-float64(r.lastBaseFee)) >= float64(expectedBaseFeeDelta) {
256260
return true
257261
}
@@ -279,5 +283,7 @@ func (r *Layer1Relayer) commitBatchReachTimeout() (bool, error) {
279283
}
280284
// len(batches) == 0 probably shouldn't ever happen, but need to check this
281285
// Also, we should check if it's a genesis batch. If so, skip the timeout check.
282-
return len(batches) == 0 || (batches[0].Index != 0 && utils.NowUTC().Sub(*batches[0].CommittedAt) > time.Duration(r.cfg.GasOracleConfig.CheckCommittedBatchesWindowMinutes)*time.Minute), nil
286+
// If finalizing/finalized status is updated before committed status, skip the timeout check of this round.
287+
// Because batches[0].CommittedAt is nil in this case, this will only continue for a short time window.
288+
return len(batches) == 0 || (batches[0].Index != 0 && batches[0].CommittedAt != nil && utils.NowUTC().Sub(*batches[0].CommittedAt) > time.Duration(r.cfg.GasOracleConfig.CheckCommittedBatchesWindowMinutes)*time.Minute), nil
283289
}

0 commit comments

Comments
 (0)