Skip to content

test_bal_withdrawal_to_coinbase_empty_block()

Documentation for tests/amsterdam/eip7928_block_level_access_lists/test_block_access_lists_eip4895.py::test_bal_withdrawal_to_coinbase_empty_block@c74f1a67.

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_to_coinbase_empty_block --fork Amsterdam

Ensure BAL captures withdrawal to coinbase when there are no transactions.

Empty block with 1 withdrawal of 10 gwei to coinbase/fee recipient. Coinbase receives only withdrawal (no transaction fees).

Source code in tests/amsterdam/eip7928_block_level_access_lists/test_block_access_lists_eip4895.py
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
def test_bal_withdrawal_to_coinbase_empty_block(
    pre: Alloc,
    blockchain_test: BlockchainTestFiller,
) -> None:
    """
    Ensure BAL captures withdrawal to coinbase when there are no transactions.

    Empty block with 1 withdrawal of 10 gwei to coinbase/fee recipient.
    Coinbase receives only withdrawal (no transaction fees).
    """
    coinbase = pre.fund_eoa(amount=0)

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

    blockchain_test(
        pre=pre,
        blocks=[block],
        post={
            coinbase: Account(balance=10 * GWEI),
        },
    )

Parametrized Test Cases

This test generates 1 parametrized test case across 1 fork.