Skip to content

Dynamic Target Gas for stable prices#2085

Merged
lucca30 merged 11 commits intodevelopfrom
lmartins/dynamic-target-gas
Mar 4, 2026
Merged

Dynamic Target Gas for stable prices#2085
lucca30 merged 11 commits intodevelopfrom
lmartins/dynamic-target-gas

Conversation

@lucca30
Copy link
Copy Markdown
Contributor

@lucca30 lucca30 commented Feb 24, 2026

Description

This PR introduces dynamic EIP-1559 target gas percentage adjustment (post-Lisovo) to reduce artificial scarcity and mitigate priority fee spikes during short demand bursts, while keeping base fee behavior predictable.

Why

Priority fee is pure market bidding and can spike aggressively when blocks are full. Our current “dynamic gas limit” approach reduces real capacity even when we could safely provide more, increasing the chance of 100% utilization and triggering sharp priority-fee bidding. Instead, we keep capacity and adjust gas target directly (since target is currently derived from gas limit) to reduce priority fee spike frequency/severity.

New CLI flags (Sealer)

  • --miner.enableDynamicTargetGas
    Enables dynamic target gas adjustment based on the parent block base fee (post-Lisovo). Mutually exclusive with enableDynamicGasLimit.
  • --miner.targetGasMin
    Minimum target gas percentage (1–100) used when base fee is below the configured lower bound.
  • --miner.targetGasMax
    Maximum target gas percentage (1–100) used when base fee is above the configured upper bound.

Behavior

Adds BorConfig.GetDynamicTargetGasPercentage(parentBaseFee, number):

  • If pre-Lisovo, feature disabled, pre-London (parentBaseFee == nil), or config incomplete (TargetBaseFee == nil) → fallback to existing GetTargetGasPercentage(number).
  • Computes bounds around TargetBaseFee using optional BaseFeeBuffer:
    • upper = desired + buffer
    • lower = max(desired - buffer, 0) (underflow-safe)
  • If parentBaseFee > upper → return TargetGasMax (valid 1–100), otherwise fallback to static.
  • If parentBaseFee < lower → return TargetGasMin (valid 1–100), otherwise fallback to static.
  • If within buffer → return static GetTargetGasPercentage(number) (no change).

Changes

  • Bugfix (non-breaking change that solves an issue)
  • Hotfix (change that solves an urgent issue, and requires immediate attention)
  • New feature (non-breaking change that adds functionality)
  • Breaking change (change that is not backwards-compatible and/or changes current functionality)
  • Changes only for a subset of nodes

Breaking changes

No breaking changes, is compatible with post-Lisovo blocks.

@codecov
Copy link
Copy Markdown

codecov bot commented Feb 24, 2026

Codecov Report

❌ Patch coverage is 99.10714% with 1 line in your changes missing coverage. Please review.
✅ Project coverage is 51.32%. Comparing base (a1278ef) to head (dfd0d4a).
⚠️ Report is 2 commits behind head on develop.

Files with missing lines Patch % Lines
params/config.go 97.87% 1 Missing ⚠️
Additional details and impacted files

Impacted file tree graph

@@             Coverage Diff             @@
##           develop    #2085      +/-   ##
===========================================
+ Coverage    51.25%   51.32%   +0.06%     
===========================================
  Files          878      878              
  Lines       152551   152660     +109     
===========================================
+ Hits         78185    78346     +161     
+ Misses       69268    69225      -43     
+ Partials      5098     5089       -9     
Files with missing lines Coverage Δ
consensus/misc/eip1559/eip1559.go 97.41% <100.00%> (ø)
internal/cli/server/config.go 64.99% <100.00%> (+1.24%) ⬆️
internal/cli/server/flags.go 100.00% <100.00%> (ø)
params/config.go 37.11% <97.87%> (+5.00%) ⬆️

... and 16 files with indirect coverage changes

Files with missing lines Coverage Δ
consensus/misc/eip1559/eip1559.go 97.41% <100.00%> (ø)
internal/cli/server/config.go 64.99% <100.00%> (+1.24%) ⬆️
internal/cli/server/flags.go 100.00% <100.00%> (ø)
params/config.go 37.11% <97.87%> (+5.00%) ⬆️

... and 16 files with indirect coverage changes

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@lucca30 lucca30 requested a review from a team February 25, 2026 17:43
@kamuikatsurgi
Copy link
Copy Markdown
Member

This adds new flags, once you're done with the PR, can you merge develop and run make docs?

@sonarqubecloud
Copy link
Copy Markdown

sonarqubecloud bot commented Mar 4, 2026

@lucca30 lucca30 merged commit e220fcf into develop Mar 4, 2026
20 checks passed
lucca30 added a commit that referenced this pull request Mar 5, 2026
* dynamic target gas for fee spikes

* set default values

* address lint

* increase coverage

* address comments

* make docs

* address reports

(cherry picked from commit e220fcf)
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.

3 participants