Skip to content

Commit 90c7226

Browse files
raxhvlfselmo
authored andcommitted
✨ feat(test): test_bal_2930_account_listed_but_untouched
1 parent d3c3328 commit 90c7226

File tree

2 files changed

+43
-3
lines changed

2 files changed

+43
-3
lines changed

tests/amsterdam/eip7928_block_level_access_lists/test_block_access_lists_eip2930.py

Lines changed: 42 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,46 @@
2828
pytestmark = pytest.mark.valid_from("Amsterdam")
2929

3030

31+
def test_bal_2930_account_listed_but_untouched(
32+
pre: Alloc,
33+
blockchain_test: BlockchainTestFiller,
34+
):
35+
"""Ensure BAL excludes untouched access list accounts."""
36+
alice = pre.fund_eoa()
37+
bob = pre.fund_eoa()
38+
oracle = pre.deploy_contract(code=Op.STOP)
39+
40+
access_list = AccessList(
41+
address=oracle,
42+
storage_keys=[Hash(0x1)],
43+
)
44+
45+
gas_limit = 1_000_000
46+
47+
tx = Transaction(ty=1, sender=alice, to=bob, gas_limit=gas_limit, access_list=[access_list])
48+
49+
block = Block(
50+
txs=[tx],
51+
expected_block_access_list=BlockAccessListExpectation(
52+
account_expectations={
53+
alice: BalAccountExpectation(
54+
nonce_changes=[BalNonceChange(tx_index=1, post_nonce=1)],
55+
),
56+
# The address excluded from BAL since state is not accessed
57+
oracle: None,
58+
}
59+
),
60+
)
61+
62+
blockchain_test(
63+
pre=pre,
64+
blocks=[block],
65+
post={
66+
alice: Account(nonce=1),
67+
},
68+
)
69+
70+
3171
def test_bal_2930_slot_listed_but_untouched(
3272
pre: Alloc,
3373
blockchain_test: BlockchainTestFiller,
@@ -66,8 +106,8 @@ def test_bal_2930_slot_listed_but_untouched(
66106
alice: BalAccountExpectation(
67107
nonce_changes=[BalNonceChange(tx_index=1, post_nonce=1)],
68108
),
69-
# The address excluded from BAL since state is not accessed
70-
pure_calculator: None,
109+
# The account was loaded.
110+
pure_calculator: BalAccountExpectation(),
71111
}
72112
),
73113
)

tests/amsterdam/eip7928_block_level_access_lists/test_cases.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414
| `test_bal_delegated_storage_writes` | Ensure BAL captures delegated storage writes via `DELEGATECALL` and `CALLCODE` | Alice calls `Oracle` contract which uses `DELEGATECALL`/`CALLCODE` to `TargetContract` that writes `0x42` to slot `0x01`. | BAL MUST include Alice (nonce changes), `Oracle` (storage changes for slot `0x01` = `0x42`), and `TargetContract` (empty changes). | ✅ Completed |
1515
| `test_bal_delegated_storage_reads` | Ensure BAL captures delegated storage reads via `DELEGATECALL` and `CALLCODE` | Alice calls `Oracle` contract (with slot `0x01` = `0x42`) which uses `DELEGATECALL`/`CALLCODE` to `TargetContract` that reads from slot `0x01`. | BAL MUST include Alice (nonce changes), `Oracle` (storage reads for slot `0x01`), and `TargetContract` (empty changes). | ✅ Completed |
1616
| `test_bal_block_rewards` | BAL tracks fee recipient balance changes from block rewards | Alice sends 100 wei to Bob with Charlie as fee recipient | BAL MUST include fee recipient Charlie with `balance_changes` reflecting transaction fees collected from the block. | ✅ Completed |
17+
| `test_bal_2930_account_listed_but_untouched` | Ensure BAL excludes listed but untouched account | Alice sends a simple eth transfer tx to Bob with EIP-2930 access list including `Oracle` | BAL MUST NOT include any entry for `Oracle` because it wasn't accessed. | ✅ Completed |
1718
| `test_bal_2930_slot_listed_but_untouched` | Ensure BAL excludes listed but untouched storage slots | Alice sends tx with EIP-2930 access list including `(PureCalculator, slot=0x01)`; PureCalculator executes pure arithmetic (adding two numbers) without touching slot `0x01` | BAL MUST NOT include any entry for PureCalculator's slot `0x01` because it doesn't access state | ✅ Completed |
1819
| `test_bal_2930_slot_listed_and_unlisted_writes` | Ensure BAL includes storage writes regardless of access list presence | Alice sends tx with EIP-2930 access list including `(StorageWriter, slot=0x01)`; StorageWriter executes `SSTORE` to slots `0x01` and `0x02` | BAL MUST include `storage_changes` for StorageWriter's slots `0x01` and `0x02` | ✅ Completed |
1920
| `test_bal_2930_slot_listed_and_unlisted_reads` | Ensure BAL includes storage reads regardless of access list presence | Alice sends tx with EIP-2930 access list including `(StorageReader, slot=0x01)`; StorageReader executes `SLOAD` from slots `0x01` and `0x02` | BAL MUST include `storage_reads` for StorageReader's slots `0x01` and `0x02` | ✅ Completed |
@@ -27,5 +28,4 @@
2728
| `test_bal_precompile_funded_then_called` | BAL records precompile with balance change (fund) and access (call) | **Tx0**: Alice sends `1 ETH` to `ecrecover` (0x01). **Tx1**: Alice (or Bob) calls `ecrecover` with valid input and `0 ETH`. | BAL **MUST** include address `0x01` with `balance_changes` (from Tx0). No `storage_changes` or `code_changes`. | 🟡 Planned |
2829
| `test_bal_precompile_call_only` | BAL records precompile when called with no balance change | Alice calls `ecrecover` (0x01) with a valid input, sending **0 ETH**. | BAL **MUST** include address `0x01` in access list, with **no** `balance_changes`, `storage_changes`, or `code_changes`. | 🟡 Planned |
2930

30-
3131
> ℹ️ Scope describes whether a test spans a single transaction (`tx`) or entire block (`blk`).

0 commit comments

Comments
 (0)