Skip to content

feat(specs,tests): Implement EIP-2780#2175

Open
gurukamath wants to merge 24 commits intoethereum:eips/amsterdam/eip-2780from
gurukamath:eip-2780/implement-eip-final
Open

feat(specs,tests): Implement EIP-2780#2175
gurukamath wants to merge 24 commits intoethereum:eips/amsterdam/eip-2780from
gurukamath:eip-2780/implement-eip-final

Conversation

@gurukamath
Copy link
Copy Markdown
Contributor

@gurukamath gurukamath commented Feb 9, 2026

🗒️ Description

Implement EIP-2780 and some basic tests.

Note: This PR contains some testing framework changes which are not compatible with other Amsterdam tests. This PR however, does not focus on fixing those. Those should be fixed in a future PR.
As a result, the CI is not likely to pass for Amsterdam

🔗 Related Issues or PRs

issue #1940

✅ Checklist

Cute Animal Picture

TBD

@gurukamath gurukamath marked this pull request as draft February 9, 2026 16:15
RazorClient pushed a commit to RazorClient/execution-specs that referenced this pull request Feb 11, 2026
…#2175)

* refactor(bal): absence validators -> BalAccountAbsentValues

* feat: raise for empty lists on BAL absence checks

* refactor: changes from comments on PR ethereum#2175
RazorClient pushed a commit to RazorClient/execution-specs that referenced this pull request Feb 11, 2026
…#2175)

* refactor(bal): absence validators -> BalAccountAbsentValues

* feat: raise for empty lists on BAL absence checks

* refactor: changes from comments on PR ethereum#2175
Copy link
Copy Markdown
Contributor

@SamWilsn SamWilsn left a comment

Choose a reason for hiding this comment

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

Quick, incomplete review

@marioevz
Copy link
Copy Markdown
Member

There's a possibility this becomes a blocker for Devnet-3 since it's listed as requirement for https://eips.ethereum.org/EIPS/eip-8037 which is included.

Spencer checked with Maria, and it seems like it's not a hard requirement but it might be a good idea to get this ready to merge.

@gurukamath
Copy link
Copy Markdown
Contributor Author

gurukamath commented Feb 17, 2026

Spencer checked with Maria, and it seems like it's not a hard requirement but it might be a good idea to get this ready to merge.

To my mind, this needs further clarity, especially when it comes to the EIP-7702 interactions. @jochem-brouwer has nicely summarised some of the open questions in this eth magicians thread

@gurukamath
Copy link
Copy Markdown
Contributor Author

Raised a PR on the EIPs repo to clarify some interactions with EIP-7702 and EIP-7928. See here

We can proceed to write more tests specific to these cases once we agree on these points.

@gurukamath gurukamath force-pushed the eip-2780/implement-eip-final branch 3 times, most recently from 3f816ea to 0d197cc Compare February 19, 2026 15:51
@gurukamath gurukamath marked this pull request as ready for review February 19, 2026 15:52
@gurukamath gurukamath marked this pull request as draft February 19, 2026 17:49
@gurukamath gurukamath force-pushed the eip-2780/implement-eip-final branch from 044f9b3 to 4c9e3e4 Compare February 20, 2026 13:45
@codecov
Copy link
Copy Markdown

codecov bot commented Feb 24, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 86.05%. Comparing base (8b6f6ea) to head (ce7c14c).

Additional details and impacted files
@@                     Coverage Diff                     @@
##           eips/amsterdam/eip-2780    #2175      +/-   ##
===========================================================
+ Coverage                    86.01%   86.05%   +0.03%     
===========================================================
  Files                          599      599              
  Lines                        36904    36993      +89     
  Branches                      3771     3796      +25     
===========================================================
+ Hits                         31744    31833      +89     
  Misses                        4551     4551              
  Partials                       609      609              
Flag Coverage Δ
unittests 86.05% <100.00%> (+0.03%) ⬆️

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.

@gurukamath gurukamath marked this pull request as ready for review February 24, 2026 10:59
@gurukamath
Copy link
Copy Markdown
Contributor Author

Converting back to draft so I can re-base this on the latest forks/amsterdam

@gurukamath gurukamath marked this pull request as draft February 24, 2026 14:10
@gurukamath gurukamath force-pushed the eip-2780/implement-eip-final branch 2 times, most recently from aa8045c to f04a782 Compare February 24, 2026 15:44
@gurukamath gurukamath marked this pull request as ready for review February 24, 2026 15:45
@gurukamath
Copy link
Copy Markdown
Contributor Author

gurukamath commented Feb 25, 2026

@danceratopz This got a bit out of hand in terms of PR size. If this is too much, I'd be happy to split this up into the following 2 PRs.

  1. Implementation + Framework updates and EIP-specific tests (in this PR)
  2. Fix broken legacy tests including BALs and other older fork tests

Do let me know what you think

Copy link
Copy Markdown
Contributor

@SamWilsn SamWilsn left a comment

Choose a reason for hiding this comment

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

From the spec side, my review is complete.

Rename G_* gas cost references to match upstream GAS_* naming
convention in GasCosts dataclass after rebase:
- G_WARM_ACCOUNT_ACCESS -> GAS_WARM_ACCOUNT_ACCESS
- G_NEW_ACCOUNT -> GAS_NEW_ACCOUNT
- G_COLD_ACCOUNT_ACCESS -> GAS_COLD_ACCOUNT_ACCESS
- G_AUTHORIZATION -> GAS_AUTH_PER_EMPTY_ACCOUNT
- G_VERY_LOW -> GAS_VERY_LOW
- G_CODE_DEPOSIT_BYTE -> GAS_CODE_DEPOSIT_PER_BYTE

Also fix:
- Merge duplicate Amsterdam gas_costs() methods in forks.py to
  preserve GAS_BLOCK_ACCESS_LIST_ITEM=2000 from EIP-7928
- Replace pre.empty_account() with Address(pre.fund_eoa(amount=0))
- Add address_has_code=False to BALANCE ops on non-existent accounts
- Rename TX_BASE_COST -> GAS_TX_BASE in amsterdam/transactions.py
@gurukamath gurukamath force-pushed the eip-2780/implement-eip-final branch from 33a093e to 354ecc8 Compare March 13, 2026 10:25
@gurukamath gurukamath closed this Mar 13, 2026
@gurukamath gurukamath reopened this Mar 13, 2026
Address PR review feedback from SamWilsn:
- Rename GAS_COLD_ACCOUNT_COST_NOCODE to GAS_COLD_ACCOUNT_COST_NO_CODE
  across spec, testing framework, and test files
- Add docstrings to EIP-2780 gas constants in vm/gas.py
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.

Hey @gurukamath, here's some initial feedback. I must admit, I need to go deeper and improve my understanding to do this justice in a second round. I haven't looked at the tests updated for interactions yet. Will come back to this.

@gurukamath gurukamath force-pushed the eip-2780/implement-eip-final branch from 8698153 to 1ae2024 Compare March 17, 2026 15:21
@danceratopz
Copy link
Copy Markdown
Member

@danceratopz This got a bit out of hand in terms of PR size. If this is too much, I'd be happy to split this up into the following 2 PRs.

  1. Implementation + Framework updates and EIP-specific tests (in this PR)

  2. Fix broken legacy tests including BALs and other older fork tests

That's a good idea, @gurukamath, I think splitting the older fork tests out would be a great idea to give more targeted reviews.

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.

Hey @gurukamath, here's something that stood out really quickly upon taking another look at these.

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.

Hey @gurukamath, here's a second round after reviewing tests/amsterdam/eip7928_block_level_access_lists/.

@pytest.mark.parametrize(
"fails_at_extcodesize",
[True, False],
ids=["oog_at_extcodesize", "successful_extcodesize"],
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

I think "successful_extcodesize" as-is deviates from the original test's intent; it should be renamed to oog_phase2_at_extcodesize, in which case, how about?

Suggested change
ids=["oog_phase1_at_extcodesize", "oog_phase2_at_extcodesize"],

The question is do we need to add a new test case here "successful_extcodesize", or is it covered elsewhere?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

I did not include a case here since it is covered specifically in tests/amsterdam/eip2780_reduce_intrinsic_tx_gas/test_account_access_opcodes.py::test_account_access_opcode. The original idea was to keep the implementation (and tests) of EIP-7928 and EIP-2780 as independent as possible. Not sure how essential this separation is anymore after the debates we've been having about merging stuff to forks/amsterdam

Op.PUSH20(target_contract) # Target contract address
+ Op.EXTCODESIZE(address_warm=False) # Check code size (cold access)
+ Op.EXTCODESIZE(
address_warm=False, address_has_code=False
Copy link
Copy Markdown
Member

@danceratopz danceratopz Mar 26, 2026

Choose a reason for hiding this comment

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

We only have an Op.STOP, but unless this changes too, we should rename "successful_extcodesize" to "phase2_oog_at_extcodesize". We could consider adding a third successful case but I think the happy case is covered here https://github.com/gurukamath/execution-specs/blob/eip-2780/implement-eip-final/tests/amsterdam/eip7928_block_level_access_lists/test_block_access_lists.py#L246.

Suggested change
address_warm=False, address_has_code=False
address_warm=False, address_has_code=True

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

I think the test ids are a bit misleading and might need to change. The test essentially looks at the target being in BAL vs target not being in BAL. Pre 2780 these two scenarios exactly coincide with Success vs OOG of the opcode. Post 2780, they don't. Which is also why there is a disconnect between the target having code and us using address_has_code=False.

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.

I reviewed all other non-specific Amsterdam tests for hard-coded constants. Didn't add inline comments here, just Clauded these up.Each addresses a few missing hard-coded gas constants from a single fork (Cancun, Prague, Osaka). I still need to self-review them:

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.

4 participants