Skip to content

fix(test-forks): keep base fee change gas within the parent gas limit - #3760

Merged
spencer-tb merged 1 commit into
ethereum:forks/bogotafrom
erkancamli:fix/base-fee-change-gas-limit
Oct 13, 2026
Merged

spencer-tb merged 1 commit into
ethereum:forks/bogotafrom
erkancamli:fix/base-fee-change-gas-limit

Conversation

@erkancamli

Copy link
Copy Markdown
Contributor

Description

base_fee_change_calculator (EIP-1559 fork helper) can return more gas than the parent gas limit when the parent base fee is below 8.

For an increase, the estimate assumes the proportional change parent_base_fee * (gas_used - target) / target / 8. Below a base fee of 8 that term rounds down to zero, and the spec's max(..., 1) in calculate_base_fee_per_gas raises the base fee by exactly 1 for any block above target. The estimate ignores that floor, so for the framework's default base fee of 7 and a 30M gas limit it returns 32,142,857 gas, and from a base fee of 1 it returns 135M. The final check only compares the resulting base fee, so the impossible value is returned silently.

This clamps the estimate to parent_gas_limit, where a full block reaches the increase. Results that already fit within the limit are unchanged, so no existing fixtures change. #3721 recently fixed rounding in the same helper; its tests use base fees of 20 and above, which is why this case was not covered.

test_base_fee_change_calculator_minimum_increase covers London and Amsterdam at parent base fees 1, 7 and 8: 4 cases fail on forks/bogota and all pass with the fix. The whole forks/tests suite passes (248 tests). ruff, ruff format, mypy and codespell are clean on the changed files.

Related Issues or PRs

Related to #3721.

Checklist

  • Ran fast static checks to avoid CI fails (ruff, ruff format, mypy, codespell on the changed files; just is not available in my environment)
  • PR title has the form <type>(<area>): <title>

@codecov

codecov Bot commented Oct 12, 2026 •

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 94.98%. Comparing base (dfd1c72) to head (aa3884f).

Additional details and impacted files
@@              Coverage Diff              @@
##           forks/bogota    #3760   +/-   ##
=============================================
  Coverage         94.98%   94.98%           
=============================================
  Files               673      673           
  Lines             40831    40831           
  Branches           3747     3747           
=============================================
  Hits              38785    38785           
  Misses             1429     1429           
  Partials            617      617           
Flag Coverage Δ
unittests 94.98% <ø> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

Co-authored-by: spencer-tb <spencer.tb@ethereum.org>
@spencer-tb
spencer-tb force-pushed the fix/base-fee-change-gas-limit branch from bfef8da to aa3884f Compare October 13, 2026 19:46
@spencer-tb

Copy link
Copy Markdown
Contributor

Thanks @erkancamli! Pushed a small follow-up so unreachable base fees fail instead of returning out-of-block gas.

@spencer-tb
spencer-tb merged commit 8e10f0b into ethereum:forks/bogota Oct 13, 2026
26 checks passed
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.

2 participants