Skip to content

Conversation

fselmo
Copy link
Contributor

@fselmo fselmo commented Aug 21, 2025

What was wrong?

This builds on #1338 but moves Block Access List (BAL) support to Amsterdam. I worked on this branch in conjunction with the EEST branch (ethereum/execution-spec-tests#2067) to get them talking to each other and they are currently working well. This is meant to be an initial implementation for BAL and for Amsterdam support in general. I fully expect that we will iterate on these changes as new PRs on top of forks/amsterdam.

How was it fixed?

Notable updates from #1338:

  • Added the index tracking to t8n tool
  • Passes the BAL object via t8n to be consumed by an appropriate pydantic model on EEST side
  • Passes the BAL hash over t8n
  • Any updates to the spec are being added here as well

Cute Animal Picture

Screenshot 2025-08-27 at 16 11 26

@fselmo fselmo changed the base branch from forks/osaka to forks/amsterdam August 21, 2025 18:59
@fselmo fselmo force-pushed the feat/amsterdam-fork-and-block-access-lists branch 8 times, most recently from 16ca33d to 72cb7e0 Compare August 27, 2025 22:04
@fselmo fselmo force-pushed the feat/amsterdam-fork-and-block-access-lists branch from f4047ce to 39dcb41 Compare August 29, 2025 19:23
@fselmo fselmo deleted the branch ethereum:forks/amsterdam August 29, 2025 19:27
@fselmo fselmo closed this Aug 29, 2025
@fselmo fselmo reopened this Aug 29, 2025
@fselmo fselmo force-pushed the feat/amsterdam-fork-and-block-access-lists branch 3 times, most recently from a817b8e to a5c7b29 Compare August 30, 2025 18:18
@fselmo fselmo marked this pull request as ready for review August 30, 2025 19:42
@codecov-commenter
Copy link

codecov-commenter commented Aug 30, 2025

⚠️ Please install the 'codecov app svg image' to ensure uploads and comments are reliably processed by Codecov.

Codecov Report

❌ Patch coverage is 38.01843% with 269 lines in your changes missing coverage. Please review.
✅ Project coverage is 82.68%. Comparing base (07f75bb) to head (6abe0ec).

Files with missing lines Patch % Lines
...reum/forks/amsterdam/block_access_lists/tracker.py 32.60% 93 Missing ⚠️
...um/forks/amsterdam/block_access_lists/rlp_utils.py 14.70% 58 Missing ⚠️
...reum/forks/amsterdam/block_access_lists/builder.py 35.71% 54 Missing ⚠️
src/ethereum/forks/amsterdam/fork.py 18.18% 18 Missing ⚠️
src/ethereum/forks/amsterdam/state.py 20.00% 16 Missing ⚠️
...eum/forks/amsterdam/vm/instructions/environment.py 7.69% 12 Missing ⚠️
...ethereum/forks/amsterdam/vm/instructions/system.py 11.11% 8 Missing ⚠️
src/ethereum/forks/amsterdam/vm/interpreter.py 12.50% 7 Missing ⚠️
...thereum/forks/amsterdam/vm/instructions/storage.py 25.00% 3 Missing ⚠️
❗ Your organization needs to install the Codecov GitHub app to enable full functionality.
Additional details and impacted files
@@                 Coverage Diff                 @@
##           forks/amsterdam    #1381      +/-   ##
===================================================
- Coverage            83.07%   82.68%   -0.40%     
===================================================
  Files                  792      797       +5     
  Lines                47429    47850     +421     
  Branches              4239     4306      +67     
===================================================
+ Hits                 39404    39567     +163     
- Misses                7540     7798     +258     
  Partials               485      485              
Flag Coverage Δ
unittests 82.68% <38.01%> (-0.40%) ⬇️

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.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@fselmo fselmo force-pushed the feat/amsterdam-fork-and-block-access-lists branch from 9408d94 to c250ee2 Compare September 9, 2025 18:20
return Bytes(encoded)


def validate_block_access_list_against_execution(
Copy link
Contributor Author

Choose a reason for hiding this comment

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

@nerolation this doesn't look like it's currently being used anywhere. Was there a goal to use this within the spec?

Copy link
Contributor

Choose a reason for hiding this comment

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

My original thought was that it might be helpful for debugging.
You can check a BAL is correct by building it during execution, hashing it, and comparing the hashes. You won't know what's wrong though.
Happy to remove it!

@fselmo

This comment was marked as resolved.

@fselmo fselmo deleted the branch ethereum:forks/amsterdam September 12, 2025 21:01
@kevaundray
Copy link
Contributor

the reason we want it for every fork is so that we can run the full test suite on the "zk EL"

I think I just wanted to know if we did want this for every fork. Is the answer here yes then? I'm in the process of moving amsterdam fork out of here and cleaning this up with a rebase. Once this is done I think we can start shaping this up a bit more. But yeah, clarity on that from you @kevaundray and @SamWilsn would be good and we can refactor it here.

State tracking would be useful for the zkEVM team or to be more precise, the ability to eventually generate an ExecutionWitness akin to reth's debug_executionWitness -- Geth also has this endpoint though they are not compatible with Reth, which is one of the reasons we'd like to have the specs be the truth.

Would leave Sam to opine on the execution specs side

@fselmo fselmo deleted the branch ethereum:forks/amsterdam September 19, 2025 17:22
@fselmo fselmo closed this Sep 19, 2025
@fselmo fselmo reopened this Sep 19, 2025
@fselmo fselmo force-pushed the feat/amsterdam-fork-and-block-access-lists branch 2 times, most recently from 615ebdb to 68c1b96 Compare September 19, 2025 21:48
@fselmo

This comment was marked as resolved.

@fselmo fselmo force-pushed the feat/amsterdam-fork-and-block-access-lists branch 7 times, most recently from bf99e47 to 06d5523 Compare September 20, 2025 00:25
@nerolation

This comment was marked as resolved.

@fselmo fselmo force-pushed the feat/amsterdam-fork-and-block-access-lists branch from b8ad380 to d1cae55 Compare September 23, 2025 14:00
nerolation and others added 5 commits September 23, 2025 09:46
- bal -> block_access_list; re-add custom rlp encoding for block access list
- bytes to uint
- move away from method-style

- Update EIP-7928 implementation: system contracts at index 0, migrate to RLP
  - System contracts (parent hash, beacon root) now use block_access_index 0
  - Transactions use block_access_index 1 to len(transactions)
  - Post-execution changes use block_access_index len(transactions) + 1
  - Migrated from SSZ to RLP encoding as per updated EIP-7928 spec
  - Updated all tests to match new API and structure
  - Replaced tx_index with block_access_index throughout codebase

- add system contract logic
- add markdown docstrings
- update BAL format; address comments
- ssz encoding and bal validation
- six ssz types
- bal tests
- balspecs
- fix(bal): Initialize the state tracker before system contract calls

- We were missing system contract calls to beacon roots and history
  contracts. This change initializes the state tracker before system
  contract calls and passes the tracker to these calls if post-Amsterdam.

- fix(docs): Fix issues with toxenvs: lint, doc, json_infra
- fix(t8n): Only initialize the bal_change_tracker for amsterdam
- feat(fork criteria): Index upcoming forks for better ordering / fix issues
- chore(forks): Fix issues from lint after rebase with Osaka latest
- fix(setuptools): Update packages to include amsterdam
- chore(lint): Fix 'tox -e static' issues

- Fix bug in tracker
  Manually cherry-picked from e72991b
  Author: nerolation

- chore(tests): Attempt to resolve issues with CI tests
- chore(lint): fix issues from running ``tox -e static`` locally
- refactor(bal): Send BAL as a list over t8n tool
- fix(amsterdam): Add change tracker to state test in t8n
- chore(lint,tests): Fix tests after moving bal from osaka -> amsterdam
- chore(forks): Move bals from Osaka to Amsterdam
- chore(lint): Fix lint issues

- refactor(bal): Send the full bal object and bal_hash over t8n

  - If we send the full object over JSON, we can model_validate() on ESST.
  - If we send the hash, once we fill the pydantic model, we can get the rlp
    and the hash and validate that our objects match while only really
    validating the parts of the BAL we are interested in for each test.

- chore: point to working eest branch
- chore(bals): Remove unused SSZ utils.py
  The SSZ implementation is no longer needed as we are now using RLP
- refactor(bals): Clean up BAL module types and imports
  - Bytes -> Bytes32 type for storage slots
  - Remove unused imports / fix imports / fix linting
  - Update function signatures to match tracker

- fix(bals-tx-index): Track bal indexes in t8n
  Keep track of BAL index state in t8n as is done in the Osaka ``fork.py`` implementation.
- Move BALs from amsterdam -> forks/amsterdam
- rename: build -> build_block_access_list
- fix docc issues
@fselmo fselmo force-pushed the feat/amsterdam-fork-and-block-access-lists branch from 6c6c7b3 to 79d701f Compare September 23, 2025 15:47
fselmo and others added 4 commits September 23, 2025 09:52
* fix zero-value transfer tracking
* fix reverted frame tracking
* rename variables
* fix missing addresses bug
* fix: docs run & move imports to top of file

---------

Co-authored-by: fselmo <[email protected]>
@fselmo fselmo force-pushed the feat/amsterdam-fork-and-block-access-lists branch from 79d701f to 8c82882 Compare September 23, 2025 15:52
@fselmo fselmo changed the title feat(fork,bal): Adds basic Amsterdam fork setup and Block Access List support feat: Block-Level Access List support for Amsterdam Sep 28, 2025
* fix self-destruct implementation

* fix self-destruct tracking balance

* fix it in the bal finalization by filtering

* add balance reset and fix tests

* simplify pre-balance tracking not using snapshots

* fix: lint issues

---------

Co-authored-by: fselmo <[email protected]>
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.

5 participants