Skip to content

feat(tests): EIP-7928 tests for EIP 2935#2113

Open
raxhvl wants to merge 5 commits intoethereum:forks/amsterdamfrom
raxhvl:feat/eip-7928/eip-2935
Open

feat(tests): EIP-7928 tests for EIP 2935#2113
raxhvl wants to merge 5 commits intoethereum:forks/amsterdamfrom
raxhvl:feat/eip-7928/eip-2935

Conversation

@raxhvl
Copy link
Member

@raxhvl raxhvl commented Feb 2, 2026

🗒️ Description

Tests for the effects of EIP-2935 historical block hashes on EIP-7928.

✅ Checklist

  • All: Ran fast tox checks to avoid unnecessary CI fails, see also Code Standards and Enabling Pre-commit Checks:
    uvx tox -e 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).

@raxhvl
Copy link
Member Author

raxhvl commented Feb 2, 2026

Note: The blockhash value set during pre-execution is internal to EVM and hence is not verified by BAL which in this test should be okay since clients will eventually compare values from fixtures.

The expression below is used to check the presence of the correct storage slot:

storage_changes=[
             BalStorageSlot(
                     slot=get_history_storage_slot(0),
                     slot_changes=[],
            ),
]

It seems to work but I expect this to mean Storage slot has NO changes and NOT storage slot has SOME changes

@raxhvl raxhvl changed the title 🧪 test(EIP-7928): EIP-7928 tests for EIP 2935 feat(tests): EIP-7928 tests for EIP 2935 Feb 2, 2026
@raxhvl raxhvl self-assigned this Feb 3, 2026
@raxhvl raxhvl added the C-test Category: test label Feb 3, 2026
@fselmo
Copy link
Contributor

fselmo commented Feb 6, 2026

Note: The blockhash value set during pre-execution is internal to EVM and hence is not verified by BAL which in this test should be okay since clients will eventually compare values from fixtures.

The expression below is used to check the presence of the correct storage slot:

storage_changes=[
             BalStorageSlot(
                     slot=get_history_storage_slot(0),
                     slot_changes=[],
            ),
]

It seems to work but I expect this to mean Storage slot has NO changes and NOT storage slot has SOME changes

Nice catch... I don't think we've run into this yet as we have been able to be pretty deterministic with the expectations. I think this is a no-brainer, at least in consistency side. We need to keep consistency that [] means just that (empty set). I'm pushing a commit here that uses validate_any_change: bool as a new field and makes sure that you can't have this flag AND define slot_changes, you're either explicit or you're not.

Definitely happy to iterate on this (and we should discuss), but I think this is pretty explicit at least and would work well. Lmk your thoughts.

Copy link
Contributor

@fselmo fselmo left a comment

Choose a reason for hiding this comment

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

Ty for this! Not sure if this was ready yet given it's failing CI but gave it a first pass. I added an improvement commit as I mentioned above and fixed the lint so we can run CI on this. Let me know your thoughts please.

... also some minor notes from Claude review:

- Missing test: Wrong calldata size queries (EIP-2935 reverts on calldata != 32 bytes)
- test_cases.md: Invalid query entry doesn't mention oracle balance_changes when value > 0

) -> None:
"""
Ensure BAL captures SELFDESTRUCT to history storage address alongside
system call storage writes.
Copy link
Contributor

Choose a reason for hiding this comment

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

We don't seem to be checking any writes here (BalStorageChanges) as this states. Could we implement a similar approach as you did here with beacon roots contract so that we have these expectations as well in the BAL?

I think we can make use of the new validate_any_change bool and validate these two things in the helper for each block:

  • HISTORY_STORAGE_ADDRESS with storage_changes=[BalStorageSlot(slot=..., validate_any_change=True)]
  • SYSTEM_ADDRESS: None

wdyt?

Copy link
Member Author

Choose a reason for hiding this comment

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

Done.

# A setup up block that writes genesis block-hash
# to history storage contract so that it can be
# queried later.
block_1 = Block()
Copy link
Contributor

Choose a reason for hiding this comment

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

This block could also have the BAL expectation from the helper method even though it's empty.

Copy link
Member Author

Choose a reason for hiding this comment

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

Done.

@codecov
Copy link

codecov bot commented Feb 6, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 86.07%. Comparing base (7f584cd) to head (2a0408e).
⚠️ Report is 3 commits behind head on forks/amsterdam.

Additional details and impacted files
@@               Coverage Diff                @@
##           forks/amsterdam    #2113   +/-   ##
================================================
  Coverage            86.07%   86.07%           
================================================
  Files                  599      599           
  Lines                39472    39472           
  Branches              3780     3780           
================================================
  Hits                 33977    33977           
  Misses                4862     4862           
  Partials               633      633           
Flag Coverage Δ
unittests 86.07% <ø> (ø)

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.

@raxhvl
Copy link
Member Author

raxhvl commented Feb 9, 2026

  1. Refactor: Added a helper method for system expectation.
  2. Fixes: Added missing write expectation to some of the blocks. Test case description added.
  3. Additions: New test case for invalid calldata size.

Thanks for the API to validate any change. Should we a similar API for post too? I tried setting slot to TRUE but it doesnt work.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

C-test Category: test

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants