Skip to content

test_bal_invalid_missing_withdrawal_account_empty_block()

Documentation for tests/amsterdam/eip7928_block_level_access_lists/test_block_access_lists_invalid.py::test_bal_invalid_missing_withdrawal_account_empty_block@20373115.

Generate fixtures for these test cases for Amsterdam with:

fill -v tests/amsterdam/eip7928_block_level_access_lists/test_block_access_lists_invalid.py::test_bal_invalid_missing_withdrawal_account_empty_block --fork Amsterdam

Test that clients reject blocks where BAL is missing an account that was modified only by a withdrawal, in a block with no transactions.

Charlie receives 10 gwei withdrawal in an empty block. BAL is corrupted by removing Charlie's entry entirely.

Source code in tests/amsterdam/eip7928_block_level_access_lists/test_block_access_lists_invalid.py
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
@pytest.mark.valid_from("Amsterdam")
@pytest.mark.exception_test
def test_bal_invalid_missing_withdrawal_account_empty_block(
    blockchain_test: BlockchainTestFiller,
    pre: Alloc,
) -> None:
    """
    Test that clients reject blocks where BAL is missing an account
    that was modified only by a withdrawal, in a block with no transactions.

    Charlie receives 10 gwei withdrawal in an empty block.
    BAL is corrupted by removing Charlie's entry entirely.
    """
    charlie = pre.fund_eoa(amount=0)

    blockchain_test(
        pre=pre,
        post={
            charlie: None,
        },
        blocks=[
            Block(
                txs=[],
                withdrawals=[
                    Withdrawal(
                        index=0,
                        validator_index=0,
                        address=charlie,
                        amount=10,
                    )
                ],
                exception=BlockException.INVALID_BLOCK_ACCESS_LIST,
                expected_block_access_list=BlockAccessListExpectation(
                    account_expectations={
                        charlie: BalAccountExpectation(
                            balance_changes=[
                                BalBalanceChange(
                                    block_access_index=1,
                                    post_balance=10 * 10**9,
                                )
                            ],
                        ),
                    }
                ).modify(remove_accounts(charlie)),
            )
        ],
    )

Parametrized Test Cases

This test generates 1 parametrized test case across 1 fork.