Skip to content

feat(tests): EIP-7928 BAL withdrawal predeploy balance read across txs#2883

Merged
fselmo merged 3 commits into
ethereum:forks/amsterdamfrom
edg-l:test/bal-predeploy-balance-cross-tx
May 22, 2026
Merged

feat(tests): EIP-7928 BAL withdrawal predeploy balance read across txs#2883
fselmo merged 3 commits into
ethereum:forks/amsterdamfrom
edg-l:test/bal-predeploy-balance-cross-tx

Conversation

@edg-l

@edg-l edg-l commented May 19, 2026

Copy link
Copy Markdown
Contributor

Summary

Adds a cross-tx test in tests/amsterdam/eip7928_block_level_access_lists/test_block_access_lists_cross_index.py covering a transaction reading the post-state balance of WITHDRAWAL_REQUEST_PREDEPLOY after a prior transaction in the same block paid the withdrawal fee.

Coverage gap

The existing EIP-7002 / EIP-7251 BAL tests cover the per-tx storage and balance entries for the predeploys in isolation, and the post-execution NOOP-filtering paths, but they do not exercise the case where:

  • a user transaction mutates a predeploy's account info (here: balance, via the withdrawal fee),
  • and a subsequent transaction in the same block reads that field through an account-info opcode (BALANCE).

This is the cross-tx propagation of a BAL balance_change to a later transaction's view of the account, for an account that is also touched during pre-execution system calls.

Test

test_bal_withdrawal_predeploy_balance_observed_cross_tx:

  1. tx 0: EOA sends 1 wei to WITHDRAWAL_REQUEST_PREDEPLOY with valid withdrawal-request calldata. The predeploy retains the fee, so its balance transitions 0 -> 1, recorded as a balance_change at block_access_index = 1.
  2. tx 1: calls a contract whose code is SSTORE(0, BALANCE(WITHDRAWAL_REQUEST_PREDEPLOY)) + STOP.
  3. Post-state: reader.storage[0] == 1.

The expected BAL declares the predeploy balance_change at index 1 and the reader's storage_change at index 2.

Fee retention is consistent with existing BAL tests in the same suite: test_bal_7002_clean_sweep in test_block_access_lists_eip7002.py already asserts Account(balance=withdrawal_request.fee) in post-state after a single fee-paying transaction.

Notes

  • Happy to trim the BlockAccessListExpectation if a slimmer declaration is preferred, or to extend to EXTCODESIZE / EXTCODEHASH / EXTCODECOPY as parametrised variants.
  • CONSOLIDATION_REQUEST_PREDEPLOY (EIP-7251) admits the same shape; can mirror if useful.

Add a cross-tx test in eip7928_block_level_access_lists/test_block_access_lists_cross_index.py
that verifies a transaction observing the BAL balance change of the
WITHDRAWAL_REQUEST_PREDEPLOY recorded by a prior transaction within the
same block.

tx 0 pays the withdrawal fee (balance 0 -> fee, recorded as a BAL
balance_change at index 1). tx 1 calls a contract that performs
SSTORE(0, BALANCE(WITHDRAWAL_REQUEST_PREDEPLOY)); the assertion that
slot 0 equals fee exercises that tx 1's pre-state for the predeploy
includes tx 0's BAL prefix entry.
@edg-l edg-l marked this pull request as ready for review May 19, 2026 20:39

@fselmo fselmo left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Thank you! This lgtm. Will wait for CI check and merge 👍🏼

@codecov

codecov Bot commented May 22, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 90.44%. Comparing base (62b914c) to head (4523d4b).
⚠️ Report is 9 commits behind head on forks/amsterdam.

Additional details and impacted files
@@                 Coverage Diff                 @@
##           forks/amsterdam    #2883      +/-   ##
===================================================
+ Coverage            87.16%   90.44%   +3.27%     
===================================================
  Files                  586      535      -51     
  Lines                35791    32439    -3352     
  Branches              3364     3012     -352     
===================================================
- Hits                 31198    29338    -1860     
+ Misses                3943     2573    -1370     
+ Partials               650      528     -122     
Flag Coverage Δ
unittests 90.44% <ø> (+3.27%) ⬆️

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.

@fselmo fselmo merged commit 29473de into ethereum:forks/amsterdam May 22, 2026
17 checks passed
@edg-l edg-l deleted the test/bal-predeploy-balance-cross-tx branch May 23, 2026 08:36
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