Skip to content

feat(spec-specs, spec-tests): add EIP-7778 block gas accounting without refunds#2840

Merged
marioevz merged 17 commits into
forks/amsterdamfrom
eips/amsterdam/eip-7778
May 13, 2026
Merged

feat(spec-specs, spec-tests): add EIP-7778 block gas accounting without refunds#2840
marioevz merged 17 commits into
forks/amsterdamfrom
eips/amsterdam/eip-7778

Conversation

@LouisTsai-Csie
Copy link
Copy Markdown
Collaborator

@LouisTsai-Csie LouisTsai-Csie commented May 12, 2026

🗒️ Description

Merge changes necessary for implementing EIP-7778 into the forks/amsterdam branch.

This PR targets the EIP-7778 spec from ethereum/EIPs@3929b1a.

🔗 Related Issues or PRs

✅ Checklist

  • All: Ran fast static checks to avoid unnecessary CI fails, see also Code Standards and Enabling Pre-commit Checks:
    just static
  • All: PR title adheres to the repo standard - it will be used as the squash commit message and should start type(scope):.
  • All: Considered updating the online docs in the ./docs/ directory.
  • All: Set appropriate labels for the changes (only maintainers can apply labels).
  • Tests: Ran mkdocs serve locally and verified the auto-generated docs for new tests in the Test Case Reference are correctly formatted.

Cute Animal Picture

Put a link to a cute animal picture inside the parenthesis-->

@LouisTsai-Csie LouisTsai-Csie changed the title Eips/amsterdam/eip 7778 feat(specs-spec, tests): merge eip-7778 into forks/amsterdam May 12, 2026
@LouisTsai-Csie LouisTsai-Csie added the A-spec-specs Area: Specification—The Ethereum specification itself (eg. `src/ethereum/*`) label May 12, 2026
@LouisTsai-Csie LouisTsai-Csie changed the title feat(specs-spec, tests): merge eip-7778 into forks/amsterdam feat(spec-specs, tests): merge eip-7778 into forks/amsterdam May 12, 2026
@LouisTsai-Csie LouisTsai-Csie added the C-feat Category: an improvement or new feature label May 12, 2026
@LouisTsai-Csie LouisTsai-Csie changed the title feat(spec-specs, tests): merge eip-7778 into forks/amsterdam feat(spec-specs, spec-tests): add EIP-7778 block gas accounting without refunds May 13, 2026
@LouisTsai-Csie LouisTsai-Csie marked this pull request as ready for review May 13, 2026 05:29
@codecov
Copy link
Copy Markdown

codecov Bot commented May 13, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 86.94%. Comparing base (2037311) to head (c957227).

Additional details and impacted files
@@               Coverage Diff                @@
##           forks/amsterdam    #2840   +/-   ##
================================================
  Coverage            86.94%   86.94%           
================================================
  Files                  586      586           
  Lines                35764    35767    +3     
  Branches              3362     3362           
================================================
+ Hits                 31095    31098    +3     
  Misses                4010     4010           
  Partials               659      659           
Flag Coverage Δ
unittests 86.94% <100.00%> (+<0.01%) ⬆️

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

☔ View full report in Codecov by Sentry.
📢 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.

nerolation and others added 11 commits May 13, 2026 13:56
…unds (#1401)

* feat(specs): add eip-7778 implementation

* fix(specs) spliting receipt gas from block gas

* revert receipt_gas_used

* make sure that the calldata floor cost overwrites the tx gas before refund

* receipt gas used after refunds

* clarify variable naming @gurukamath

* revert to using gas used after refunds for cumulative gas in receipt and add gasSpent to receipt

* spec(amsterdam): fix code formatting

---------

Co-authored-by: Guruprasad Kamath <guru241987@gmail.com>
* fix(tests): fix legacy tests to run with eip-7778

* fix(tests): check gas_spent and gas_used after Amsterdam
* feat(spec-tests): add eip-7778 for calldata checks

* feat(spec-tests): post review - use code gas_cost function

Co-authored-by: Louis Tsai <72684086+LouisTsai-Csie@users.noreply.github.com>

* Apply suggestions from code review

---------

Co-authored-by: Louis Tsai <72684086+LouisTsai-Csie@users.noreply.github.com>
Co-authored-by: Mario Vega <marioevz@gmail.com>
The set iteration in `build_refund_tx` is non-deterministic due to
Python's hash randomization, causing fixture output to vary between
runs. Sort by enum value to ensure reproducible fixtures.
@LouisTsai-Csie
Copy link
Copy Markdown
Collaborator Author

I want to do a follow-up PR to remove expected_benchmark_gas_used in BenchmarkTest. This is not required anymore, as we introduce expected_gas_used in BlockchainTest.

env: Environment = Field(default_factory=Environment)

@LouisTsai-Csie LouisTsai-Csie force-pushed the eips/amsterdam/eip-7778 branch from 8ec956b to dc52b58 Compare May 13, 2026 06:38
@LouisTsai-Csie
Copy link
Copy Markdown
Collaborator Author

LouisTsai-Csie commented May 13, 2026

Some missing cases that we could do as follow-up PRs:

  • Refund tx OOG, revert the refund
  • refund quauls/exceeds gas_used_pre_refund // max_refund_quotient
  • storage x->y->0 refund (we have storage x->x->0 refund)
  • behavior at fork transition
  • successful at top frame but fails at subcall.
  • delegate to a contract that does the storage refund (two refunds)
  • authority do multiple authorization in same tx, resulting in cumulative refunds

@danceratopz danceratopz added the A-spec-tests Area: tests for specifications e.g. json_infra label May 13, 2026
Copy link
Copy Markdown
Member

@danceratopz danceratopz left a comment

Choose a reason for hiding this comment

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

Couple of small comments.

Comment thread docs/writing_tests/test_markers.md Outdated
Copy link
Copy Markdown
Member

@marioevz marioevz left a comment

Choose a reason for hiding this comment

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

LGTM, thanks!

Comment thread tests/benchmark/compute/scenario/test_transaction_types.py Outdated
Comment thread tests/benchmark/compute/scenario/test_transaction_types.py
Comment thread tests/benchmark/compute/scenario/test_transaction_types.py Outdated
Copy link
Copy Markdown
Member

@danceratopz danceratopz left a comment

Choose a reason for hiding this comment

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

Small comment, not blocking for Merge: Skips should be illegal ;-)

@danceratopz danceratopz added the A-tests Area: Consensus tests. label May 13, 2026
@marioevz marioevz merged commit cd8c981 into forks/amsterdam May 13, 2026
26 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

A-spec-specs Area: Specification—The Ethereum specification itself (eg. `src/ethereum/*`) A-spec-tests Area: tests for specifications e.g. json_infra A-tests Area: Consensus tests. C-feat Category: an improvement or new feature

Projects

None yet

Development

Successfully merging this pull request may close these issues.

7 participants