Skip to content

test_bal_7002_no_withdrawal_requests()

Documentation for tests/amsterdam/eip7928_block_level_access_lists/test_block_access_lists_eip7002.py::test_bal_7002_no_withdrawal_requests@892e6d1e.

Generate fixtures for these test cases for Amsterdam with:

fill -v tests/amsterdam/eip7928_block_level_access_lists/test_block_access_lists_eip7002.py::test_bal_7002_no_withdrawal_requests --fork Amsterdam

Ensure BAL captures EIP-7002 system contract dequeue operation even when block has no withdrawal requests.

This test verifies that the post-execution dequeue system call always reads queue state (slots 0-3), even when no requests are present. The system contract should have storage_reads but no storage_changes.

Source code in tests/amsterdam/eip7928_block_level_access_lists/test_block_access_lists_eip7002.py
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
def test_bal_7002_no_withdrawal_requests(
    pre: Alloc,
    blockchain_test: BlockchainTestFiller,
) -> None:
    """
    Ensure BAL captures EIP-7002 system contract dequeue operation even
    when block has no withdrawal requests.

    This test verifies that the post-execution dequeue system call always
    reads queue state (slots 0-3), even when no requests are present. The
    system contract should have storage_reads but no storage_changes.
    """
    alice = pre.fund_eoa()
    bob = pre.fund_eoa(amount=0)

    value = 10

    tx = Transaction(
        sender=alice,
        to=bob,
        value=value,
        gas_limit=200_000,
    )

    block = Block(
        txs=[tx],
        expected_block_access_list=BlockAccessListExpectation(
            account_expectations={
                alice: BalAccountExpectation(
                    nonce_changes=[
                        BalNonceChange(block_access_index=1, post_nonce=1)
                    ],
                ),
                bob: BalAccountExpectation(
                    balance_changes=[
                        BalBalanceChange(
                            block_access_index=1, post_balance=value
                        )
                    ],
                ),
                Spec7002.WITHDRAWAL_REQUEST_PREDEPLOY_ADDRESS: BalAccountExpectation(  # noqa: E501
                    storage_reads=[
                        Spec7002.EXCESS_WITHDRAWAL_REQUESTS_STORAGE_SLOT,
                        Spec7002.WITHDRAWAL_REQUEST_COUNT_STORAGE_SLOT,
                        Spec7002.WITHDRAWAL_REQUEST_QUEUE_HEAD_STORAGE_SLOT,
                        Spec7002.WITHDRAWAL_REQUEST_QUEUE_TAIL_STORAGE_SLOT,
                    ],
                    storage_changes=[],
                ),
            }
        ),
    )

    blockchain_test(
        pre=pre,
        blocks=[block],
        post={
            alice: Account(nonce=1),
            bob: Account(balance=value),
        },
    )

Parametrized Test Cases

This test generates 1 parametrized test case across 1 fork.