Skip to content

fix(revm): correct Amsterdam gas accounting for sponsored reservoir and batch access lists - #427

Merged
tac0turtle merged 3 commits into
mainfrom
fix/amsterdam-supply-and-access-list-gas
Oct 27, 2026
Merged

tac0turtle merged 3 commits into
mainfrom
fix/amsterdam-supply-and-access-list-gas

Conversation

@damiannolan

Copy link
Copy Markdown
Contributor

Description

Two independent gas-accounting corrections in the evnode batch/sponsor paths,
both scoped to behavior that only differs once the Amsterdam (EIP-8037 / EIP-7981)
rules are active. They are no-ops on the current chain and leave every existing
test unchanged.

1. Reimburse the sponsor for unused reservoir gas

The sponsored reimburse_caller override returned only remaining + refunded
gas, omitting the EIP-8037 reservoir. The reservoir is charged upfront like the
rest of the gas, so unused reservoir must be returned too — this is what revm's
own reimburse_caller does. With a non-zero reservoir the sponsor was
under-reimbursed while the base-fee redirect already accounted for the reservoir,
so value was not conserved. Includes gas.reservoir() in the reimbursement.

2. Price batch access lists from gas params and the floor

validate_batch_initial_tx_gas priced access-list entries with fixed
ACCESS_LIST_ADDRESS / ACCESS_LIST_STORAGE_KEY constants and left them out of
the EIP-7623/7981 gas floor entirely. It now prices the execution cost from
cfg.gas_params() and adds the access-list floor contribution, matching revm's
initial_tx_gas. Before Amsterdam the gas-params values equal the old constants
and the access-list floor multiplier is zero, so this changes nothing there.

Testing

  • cargo test -p ev-revm (55 tests) ‚Äî all pass.
  • New regression test for the sponsor reservoir reimbursement (asserts the
    reservoir is returned; 0 without the fix).
  • New regression test comparing a batch with vs. without an access list under
    Amsterdam (isolates the access-list execution cost and floor contribution;
    the floor delta is 0 without the fix).
  • cargo clippy and cargo +nightly fmt --check clean.

Type of Change

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • Documentation update
  • Performance improvement
  • Refactoring

Related Issues

Fixes #(issue)

Checklist

  • I have performed a self-review of my code
  • I have commented my code, particularly in hard-to-understand areas
  • I have made corresponding changes to the documentation
  • My changes generate no new warnings
  • I have added tests that prove my fix is effective or that my feature works
  • New and existing unit tests pass locally with my changes
  • Any dependent changes have been merged and published

Testing

Additional Notes

The sponsored reimburse_caller override returned only remaining + refunded
gas, omitting the EIP-8037 reservoir, which is charged upfront and must be
returned like any unused gas. Under Amsterdam (non-zero reservoir) this
under-reimbursed the sponsor and broke supply conservation, since the
base-fee redirect already accounts for the reservoir. Include it, matching
revm's reimburse_caller.

Adds a regression test asserting the reservoir is reimbursed.
validate_batch_initial_tx_gas priced access-list entries with fixed
ACCESS_LIST_ADDRESS / ACCESS_LIST_STORAGE_KEY constants and left them out
of the EIP-7623/7981 floor entirely. Use cfg.gas_params() for the
execution cost and add the access-list floor contribution, matching
revm's initial_tx_gas. Both are no-ops before Amsterdam, where the gas
params and the access-list floor multiplier differ from zero/constants.

Adds a regression test comparing a batch with and without an access list
under Amsterdam.
@coderabbitai

coderabbitai Bot commented Oct 27, 2026 •

Copy link
Copy Markdown

Important

  • 🔍 Trigger review

This repository does not receive automatic reviews because it has fewer than 10 stars.

Run configuration
  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: defaults
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 02852445-9145-4aca-ae95-1435ea295875
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

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.

@damiannolan
damiannolan marked this pull request as ready for review October 27, 2026 11:21
@damiannolan
damiannolan requested a review from a team as a code owner October 27, 2026 11:21
@tac0turtle
tac0turtle merged commit 1b5560e into main Oct 27, 2026
16 checks passed
@tac0turtle
tac0turtle deleted the fix/amsterdam-supply-and-access-list-gas branch October 27, 2026 11:41
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