Skip to content

test_bal_withdrawal_no_evm_execution()

Documentation for tests/amsterdam/eip7928_block_level_access_lists/test_block_access_lists_eip4895.py::test_bal_withdrawal_no_evm_execution@892e6d1e.

Generate fixtures for these test cases for Amsterdam with:

fill -v tests/amsterdam/eip7928_block_level_access_lists/test_block_access_lists_eip4895.py::test_bal_withdrawal_no_evm_execution --fork Amsterdam

Ensure BAL captures withdrawal without triggering EVM execution.

Oracle contract starts with 0 balance and storage slot 0x01 = 0x42. Oracle's code writes 0xFF to slot 0x01 when called. Block with 0 transactions and 1 withdrawal of 10 gwei to Oracle. Storage slot 0x01 remains 0x42 (EVM never executes).

Source code in tests/amsterdam/eip7928_block_level_access_lists/test_block_access_lists_eip4895.py
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
def test_bal_withdrawal_no_evm_execution(
    pre: Alloc,
    blockchain_test: BlockchainTestFiller,
) -> None:
    """
    Ensure BAL captures withdrawal without triggering EVM execution.

    Oracle contract starts with 0 balance and storage slot 0x01 = 0x42.
    Oracle's code writes 0xFF to slot 0x01 when called.
    Block with 0 transactions and 1 withdrawal of 10 gwei to Oracle.
    Storage slot 0x01 remains 0x42 (EVM never executes).
    """
    oracle = pre.deploy_contract(
        code=Op.SSTORE(0x01, 0xFF),
        storage={0x01: 0x42},
    )

    block = Block(
        txs=[],
        withdrawals=[
            Withdrawal(
                index=0,
                validator_index=0,
                address=oracle,
                amount=10,
            )
        ],
        expected_block_access_list=BlockAccessListExpectation(
            account_expectations={
                oracle: BalAccountExpectation(
                    balance_changes=[
                        BalBalanceChange(
                            block_access_index=1, post_balance=10 * GWEI
                        )
                    ],
                    storage_reads=[],
                    storage_changes=[],
                ),
            }
        ),
    )

    blockchain_test(
        pre=pre,
        blocks=[block],
        post={
            oracle: Account(
                balance=10 * GWEI,
                storage={0x01: 0x42},
            ),
        },
    )

Parametrized Test Cases

This test generates 1 parametrized test case across 1 fork.