Skip to content

test_block_at_rlp_limit_with_withdrawals()

Documentation for tests/osaka/eip7934_block_rlp_limit/test_max_block_rlp_size.py::test_block_at_rlp_limit_with_withdrawals@21507778.

Generate fixtures for these test cases for Amsterdam with:

fill -v tests/osaka/eip7934_block_rlp_limit/test_max_block_rlp_size.py::test_block_at_rlp_limit_with_withdrawals --fork Amsterdam

Test that a block at the RLP size limit is valid even when the block contains withdrawals.

Source code in tests/osaka/eip7934_block_rlp_limit/test_max_block_rlp_size.py
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
@EIPChecklist.BlockLevelConstraint.Test.Content.Withdrawals()
@pytest.mark.verify_sync
@pytest.mark.valid_from("Osaka")
def test_block_at_rlp_limit_with_withdrawals(
    blockchain_test: BlockchainTestFiller,
    pre: Alloc,
    post: Alloc,
    env: Environment,
    sender: EOA,
    fork: Fork,
    block_size_limit: int,
) -> None:
    """
    Test that a block at the RLP size limit is valid even when the block
    contains withdrawals.
    """
    withdrawals = [
        Withdrawal(
            index=0,
            validator_index=0,
            address=pre.fund_eoa(),
            amount=1,
        ),
        Withdrawal(
            index=1,
            validator_index=1,
            address=pre.fund_eoa(),
            amount=1,
        ),
    ]

    transactions, extra_data_len = exact_size_transactions(
        sender,
        fork,
        pre,
        env.gas_limit,
        withdrawals=withdrawals,
    )

    block = Block(
        txs=transactions,
        withdrawals=withdrawals,
        extra_data=Bytes(b"\x00" * extra_data_len),
        timestamp=ZeroPaddedHexNumber(HEADER_TIMESTAMP),
    )

    blockchain_test(
        genesis_environment=env,
        pre=pre,
        post=post,
        blocks=[block],
    )

Parametrized Test Cases

This test generates 1 parametrized test case across 2 forks.