Skip to content

Conversation

@yiweichi
Copy link
Member

@yiweichi yiweichi commented Dec 3, 2025

Purpose or design rationale of this PR

Problem
When blob price stays very low (e.g., 1-2 wei), any tiny increase causes current > target, stopping batch submission unnecessarily.

Solution
Add blob_fee_tolerance config. Now we only skip submission when current > target + tolerance, avoiding delays due to negligible price differences.

The main changes are:

  • in rollup/internal/config/relayer.go we introduce a new config field BlobFeeTolerance uint64 json:"blob_fee_tolerance"`, which we can configurate the tolerance.
  • in rollup/internal/controller/relayer/l2_relayer.go, we check if current > target + tolerance.

PR title

Your PR title must follow conventional commits (as we are doing squash merge for each PR), so it must start with one of the following types:

  • build: Changes that affect the build system or external dependencies (example scopes: yarn, eslint, typescript)
  • ci: Changes to our CI configuration files and scripts (example scopes: vercel, github, cypress)
  • docs: Documentation-only changes
  • feat: A new feature
  • fix: A bug fix
  • perf: A code change that improves performance
  • refactor: A code change that doesn't fix a bug, or add a feature, or improves performance
  • style: Changes that do not affect the meaning of the code (white-space, formatting, missing semi-colons, etc)
  • test: Adding missing tests or correcting existing tests

Deployment tag versioning

Has tag in common/version.go been updated or have you added bump-version label to this PR?

  • No, this PR doesn't involve a new deployment, git tag, docker image tag
  • Yes

Breaking change label

Does this PR have the breaking-change label?

  • No, this PR is not a breaking change
  • Yes

Summary by CodeRabbit

  • New Features

    • Configurable blob fee tolerance added to relayer settings.
    • Submission logic updated to use an absolute tolerance when comparing current vs. target blob fee, allowing submissions to proceed if fees are within the configured tolerance.
  • Chores

    • Release version updated to v4.7.10.

✏️ Tip: You can customize this high-level summary in your review settings.

@coderabbitai
Copy link

coderabbitai bot commented Dec 3, 2025

Walkthrough

Adds an absolute blob fee tolerance to relayer batch submission: new blob_fee_tolerance config value, BatchSubmission.BlobFeeTolerance field, and updated skipSubmitByFee logic that computes threshold = target + tolerance and skips submission only when current > threshold within the timeout window.

Changes

Cohort / File(s) Summary
Configuration
rollup/conf/config.json
Added blob_fee_tolerance: 500000000 under l2_config.relayer_config.batch_submission; adjusted trailing comma to accommodate the new field.
Type Definition
rollup/internal/config/relayer.go
Added BlobFeeTolerance uint64 to BatchSubmission with JSON tag blob_fee_tolerance and comments explaining it is an absolute tolerance (wei) used when comparing blob fees.
Logic Implementation
rollup/internal/controller/relayer/l2_relayer.go
Modified skipSubmitByFee to compute threshold = target + tolerance, change skip condition to current > threshold within the timeout window, and update the log/error message to include current, target, tolerance, threshold, and age.
Version
common/version/version.go
Bumped static version tag from v4.7.9 to v4.7.10.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

  • Review focus:
    • Potential uint64 overflow when computing target + tolerance.
    • Correct parsing/defaulting of the new config field.
    • Accuracy and clarity of updated logs/error messages and metric implications.

Possibly related PRs

Suggested reviewers

  • jonastheis
  • Thegaram
  • georgehao

Poem

🐰 I hop through configs, adding just a tiny space,
A buffer for the blob-fee keeps batches soft in place,
When numbers barely jitter, I whisper “let it be,”
No needless jumps or hiccups — comfy hops for me,
A little tolerance, a steady, happy pace.

Pre-merge checks and finishing touches

✅ Passed checks (3 passed)
Check name Status Explanation
Title check ✅ Passed The PR title clearly and concisely summarizes the main change: adding blob fee tolerance to the rollup relayer. It follows conventional commits format (feat:) and directly relates to the core functionality changes.
Description check ✅ Passed The PR description comprehensively covers all required sections: it explains the problem, solution, and main changes. The author completed all template checkboxes appropriately (feat type selected, bump-version confirmed, no breaking change), and provided clear rationale for the changes.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch feat-add-blob-fee-tolerance

📜 Recent review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 066e861 and 7cbacbf.

📒 Files selected for processing (1)
  • common/version/version.go (1 hunks)
🧰 Additional context used
🧠 Learnings (1)
📓 Common learnings
Learnt from: Thegaram
Repo: scroll-tech/scroll PR: 1769
File: rollup/internal/config/relayer.go:112-114
Timestamp: 2025-11-27T18:50:44.578Z
Learning: In `rollup/internal/config/relayer.go`, the fields `L1BaseFeeLimit` and `L1BlobBaseFeeLimit` in `GasOracleConfig` should never be set to 0. Zero values would break the gas oracle fee enforcement logic in `l1_relayer.go` by capping all fees to 0.
Learnt from: Thegaram
Repo: scroll-tech/scroll PR: 1746
File: rollup/internal/controller/sender/sender.go:637-640
Timestamp: 2025-10-18T06:49:24.796Z
Learning: In the file `rollup/internal/controller/sender/sender.go`, the resubmission logic in `createReplacingTransaction` does not convert V0 blob sidecars to V1 when resubmitting transactions after the Fusaka upgrade. This is an accepted edge case because it's unlikely to occur, geth is expected to handle it gracefully, and manual recovery is available if needed.
🔇 Additional comments (1)
common/version/version.go (1)

8-8: Version bump applied correctly.

The version tag has been updated from v4.7.9 to v4.7.10. Please confirm that a patch-level increment aligns with your project's versioning policy for feature additions, as conventional semantic versioning typically reserves minor increments (e.g., v4.8.0) for new features.


Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 0

🧹 Nitpick comments (1)
rollup/internal/config/relayer.go (1)

51-55: Consider documenting zero-value behavior.

The implementation looks good. However, consider explicitly documenting what happens when BlobFeeTolerance is set to 0 (it would revert to no tolerance, matching the previous behavior). This would help operators understand the default/fallback behavior.

Optionally, you could add a note in the comment:

 // BlobFeeTolerance is the absolute tolerance (in wei) added to the target blob fee.
 // If the current fee is below target + tolerance, we proceed with submission.
 // This prevents skipping submission when the price difference is negligible (e.g., 1 wei).
+// Setting this to 0 disables the tolerance mechanism (strict target enforcement).
 // Recommended value: 10 gwei (10000000000 wei).
 BlobFeeTolerance uint64 `json:"blob_fee_tolerance"`
📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 22479a7 and 3bca492.

📒 Files selected for processing (3)
  • rollup/conf/config.json (1 hunks)
  • rollup/internal/config/relayer.go (1 hunks)
  • rollup/internal/controller/relayer/l2_relayer.go (1 hunks)
🧰 Additional context used
🧠 Learnings (3)
📓 Common learnings
Learnt from: Thegaram
Repo: scroll-tech/scroll PR: 1769
File: rollup/internal/config/relayer.go:112-114
Timestamp: 2025-11-27T18:50:44.578Z
Learning: In `rollup/internal/config/relayer.go`, the fields `L1BaseFeeLimit` and `L1BlobBaseFeeLimit` in `GasOracleConfig` should never be set to 0. Zero values would break the gas oracle fee enforcement logic in `l1_relayer.go` by capping all fees to 0.
Learnt from: Thegaram
Repo: scroll-tech/scroll PR: 1746
File: rollup/internal/controller/sender/sender.go:637-640
Timestamp: 2025-10-18T06:49:24.796Z
Learning: In the file `rollup/internal/controller/sender/sender.go`, the resubmission logic in `createReplacingTransaction` does not convert V0 blob sidecars to V1 when resubmitting transactions after the Fusaka upgrade. This is an accepted edge case because it's unlikely to occur, geth is expected to handle it gracefully, and manual recovery is available if needed.
📚 Learning: 2025-11-27T18:50:44.578Z
Learnt from: Thegaram
Repo: scroll-tech/scroll PR: 1769
File: rollup/internal/config/relayer.go:112-114
Timestamp: 2025-11-27T18:50:44.578Z
Learning: In `rollup/internal/config/relayer.go`, the fields `L1BaseFeeLimit` and `L1BlobBaseFeeLimit` in `GasOracleConfig` should never be set to 0. Zero values would break the gas oracle fee enforcement logic in `l1_relayer.go` by capping all fees to 0.

Applied to files:

  • rollup/internal/config/relayer.go
  • rollup/internal/controller/relayer/l2_relayer.go
  • rollup/conf/config.json
📚 Learning: 2025-10-18T06:49:24.796Z
Learnt from: Thegaram
Repo: scroll-tech/scroll PR: 1746
File: rollup/internal/controller/sender/sender.go:637-640
Timestamp: 2025-10-18T06:49:24.796Z
Learning: In the file `rollup/internal/controller/sender/sender.go`, the resubmission logic in `createReplacingTransaction` does not convert V0 blob sidecars to V1 when resubmitting transactions after the Fusaka upgrade. This is an accepted edge case because it's unlikely to occur, geth is expected to handle it gracefully, and manual recovery is available if needed.

Applied to files:

  • rollup/internal/config/relayer.go
  • rollup/internal/controller/relayer/l2_relayer.go
🧬 Code graph analysis (1)
rollup/internal/controller/relayer/l2_relayer.go (1)
rollup/internal/config/relayer.go (1)
  • BatchSubmission (42-56)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (3)
  • GitHub Check: check
  • GitHub Check: tests
  • GitHub Check: tests
🔇 Additional comments (3)
rollup/conf/config.json (1)

61-62: LGTM! Configuration value is appropriate.

The addition of blob_fee_tolerance with a value of 10 gwei (10000000000 wei) is reasonable for the stated use case of handling negligible blob fee fluctuations (1-2 wei). The JSON formatting with the trailing comma is correct.

rollup/internal/controller/relayer/l2_relayer.go (2)

1258-1261: LGTM! Tolerance calculation is correct.

The implementation correctly applies the absolute tolerance offset to the target blob fee. Using big.Int arithmetic ensures no overflow issues, and the calculation is straightforward: threshold = target + tolerance.


1268-1272: LGTM! Skip condition and error message are well-implemented.

The updated logic correctly checks current > threshold instead of current > target, which aligns with the PR objective. The error message provides comprehensive debugging information by including all relevant values (current, target, threshold, tolerance, and age). This will be helpful for operators monitoring batch submission behavior.

@yiweichi yiweichi added the bump-version Bump the version tag for deployment label Dec 3, 2025
@yiweichi yiweichi merged commit 27dd62e into develop Dec 3, 2025
1 check passed
@yiweichi yiweichi deleted the feat-add-blob-fee-tolerance branch December 3, 2025 13:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bump-version Bump the version tag for deployment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants