Skip to content

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

Open
edg-l wants to merge 1 commit into
ethereum:forks/amsterdamfrom
edg-l:test/bal-predeploy-balance-cross-tx
Open

feat(tests): EIP-7928 BAL withdrawal predeploy balance read across txs#2883
edg-l wants to merge 1 commit into
ethereum:forks/amsterdamfrom
edg-l:test/bal-predeploy-balance-cross-tx

Conversation

@edg-l
Copy link
Copy Markdown
Contributor

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

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
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.

1 participant