Skip to content

feat(gas-oracle): make L1 base/blob fee caps configurable via env#1017

Open
curryxbo wants to merge 1 commit into
mainfrom
fix/gas-oracle-configurable-fee-caps
Open

feat(gas-oracle): make L1 base/blob fee caps configurable via env#1017
curryxbo wants to merge 1 commit into
mainfrom
fix/gas-oracle-configurable-fee-caps

Conversation

@curryxbo

@curryxbo curryxbo commented Jul 13, 2026

Copy link
Copy Markdown
Contributor

What

The upper caps applied to the fetched L1 base fee and blob base fee in gas-oracle were hardcoded:

const MAX_BASE_FEE: u128 = 1000 * 10i32.pow(9) as u128;      // 1000 Gwei
const MAX_BLOB_BASE_FEE: u128 = 100 * 10i32.pow(9) as u128;  // 100 Gwei

During sustained L1 fee spikes these caps silently clamp the value pushed on-chain, and there is no way to tune them without a rebuild/redeploy.

Change

  • Move both caps into Config, read from env GAS_ORACLE_MAX_L1_BASE_FEE / GAS_ORACLE_MAX_L1_BLOB_BASE_FEE.
  • Defaults equal the previous constants (1000 Gwei / 100 Gwei), so behavior is unchanged unless explicitly overridden.
  • Thread the two values through BaseFeeUpdater::new, mirroring the existing gas_threshold / *_buffer config pattern.

Two files, no public API change beyond the internal constructor (its only caller is updated).

Context

Surfaced by morph-l2/morph-ideas idea #5 (hardcoded fee-cap tech debt): https://github.com/morph-l2/morph-ideas/blob/main/idea-005.html

🤖 Generated with Claude Code

Summary by CodeRabbit

  • New Features

    • Added configurable maximum limits for L1 base fees and L1 blob fees.
    • Operators can set these limits through environment variables, with safe defaults when values are not provided.
  • Bug Fixes

    • L1 fee calculations are now capped according to the configured limits, helping prevent unexpectedly high fee values.

The upper caps applied to the fetched L1 base fee and blob base fee were hardcoded (1000 Gwei / 100 Gwei). During sustained L1 fee spikes this silently clamps the value pushed on-chain with no way to tune it without a rebuild. Move both into Config, read from GAS_ORACLE_MAX_L1_BASE_FEE / GAS_ORACLE_MAX_L1_BLOB_BASE_FEE with defaults equal to the previous constants, so behavior is unchanged unless explicitly overridden.

Context: morph-l2/morph-ideas idea #5.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@curryxbo curryxbo requested a review from a team as a code owner July 13, 2026 07:17
@curryxbo curryxbo requested review from SecurityLife and removed request for a team July 13, 2026 07:17

@claude claude Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Claude Code Review

Claude Code Review is paused for this repository. To reconnect it, an admin of this repository's GitHub organization (or the account owner, for personal repositories) who can also manage your Claude organization's Code Review settings needs to re-link GitHub in Code Review settings. This is a one-time step.

Tip: disable this comment in your organization's Code Review settings.

@coderabbitai

coderabbitai Bot commented Jul 13, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 58a66e3c-d1ad-4828-868c-db5a7bdf345e

📥 Commits

Reviewing files that changed from the base of the PR and between 21d05b9 and 276c676.

📒 Files selected for processing (2)
  • gas-oracle/app/src/gas_price_oracle.rs
  • gas-oracle/app/src/l1_base_fee.rs

📝 Walkthrough

Walkthrough

The gas price oracle now reads configurable L1 base fee and blob base fee caps from environment variables, passes them to BaseFeeUpdater, and uses them when clamping computed fees.

Changes

Configurable L1 fee caps

Layer / File(s) Summary
Configurable updater clamping
gas-oracle/app/src/l1_base_fee.rs
BaseFeeUpdater stores configurable fee maxima and uses them instead of fixed constants during fee clamping.
Oracle configuration wiring
gas-oracle/app/src/gas_price_oracle.rs
Configuration loads the two fee caps from environment variables with defaults and passes them to BaseFeeUpdater.

Estimated code review effort: 2 (Simple) | ~10 minutes

Sequence Diagram(s)

sequenceDiagram
  participant Environment
  participant Config
  participant prepare_updater
  participant BaseFeeUpdater
  Environment->>Config: Provide L1 fee cap values
  Config->>prepare_updater: Expose configured caps
  prepare_updater->>BaseFeeUpdater: Pass cap parameters
  BaseFeeUpdater->>BaseFeeUpdater: Clamp computed fees
Loading

Suggested reviewers: securitylife

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately summarizes the main change: making L1 base and blob fee caps configurable through environment variables.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch fix/gas-oracle-configurable-fee-caps

Warning

Billing warning: we have not been able to collect payment for this subscription for more than 72 hours. Please update the payment method or pay any pending invoices in Billing to avoid service interruption.


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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant