Skip to content

Commit 27dd62e

Browse files
authored
feat(rollup-relayer): add blob fee tolerance (#1773)
1 parent 22479a7 commit 27dd62e

File tree

4 files changed

+15
-6
lines changed

4 files changed

+15
-6
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.7.9"
8+
var tag = "v4.7.10"
99

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

rollup/conf/config.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,8 @@
5858
"min_batches": 1,
5959
"max_batches": 6,
6060
"timeout": 7200,
61-
"backlog_max": 75
61+
"backlog_max": 75,
62+
"blob_fee_tolerance": 500000000
6263
},
6364
"gas_oracle_config": {
6465
"min_gas_price": 0,

rollup/internal/config/relayer.go

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,10 @@ type BatchSubmission struct {
4848
TimeoutSec int64 `json:"timeout"`
4949
// The maximum number of pending batches to keep in the backlog.
5050
BacklogMax int64 `json:"backlog_max"`
51+
// BlobFeeTolerance is the absolute tolerance (in wei) added to the target blob fee.
52+
// If the current fee is below target + tolerance, we proceed with submission.
53+
// This prevents skipping submission when the price difference is negligible.
54+
BlobFeeTolerance uint64 `json:"blob_fee_tolerance"`
5155
}
5256

5357
// ChainMonitor this config is used to get batch status from chain_monitor API.

rollup/internal/controller/relayer/l2_relayer.go

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1255,16 +1255,20 @@ func (r *Layer2Relayer) skipSubmitByFee(oldest time.Time, metrics *l2RelayerMetr
12551255
target := calculateTargetPrice(windowSec, r.batchStrategy, oldest, hist)
12561256
current := hist[len(hist)-1]
12571257

1258+
// apply absolute tolerance offset to target
1259+
tolerance := new(big.Int).SetUint64(r.cfg.BatchSubmission.BlobFeeTolerance)
1260+
threshold := new(big.Int).Add(target, tolerance)
1261+
12581262
currentFloat, _ := current.Float64()
12591263
targetFloat, _ := target.Float64()
12601264
metrics.rollupL2RelayerCurrentBlobPrice.Set(currentFloat)
12611265
metrics.rollupL2RelayerTargetBlobPrice.Set(targetFloat)
12621266

1263-
// if current fee > target and still inside the timeout window, skip
1264-
if current.Cmp(target) > 0 && time.Since(oldest) < time.Duration(windowSec)*time.Second {
1267+
// if current fee > threshold (target + tolerance) and still inside the timeout window, skip
1268+
if current.Cmp(threshold) > 0 && time.Since(oldest) < time.Duration(windowSec)*time.Second {
12651269
return true, fmt.Errorf(
1266-
"blob-fee above target & window not yet passed; current=%s target=%s age=%s",
1267-
current.String(), target.String(), time.Since(oldest),
1270+
"blob-fee above threshold & window not yet passed; current=%s target=%s threshold=%s tolerance=%s age=%s",
1271+
current.String(), target.String(), threshold.String(), tolerance.String(), time.Since(oldest),
12681272
)
12691273
}
12701274

0 commit comments

Comments
 (0)