Skip to content

test_withdrawing_to_precompiles()

Documentation for tests/shanghai/eip4895_withdrawals/test_withdrawals.py::test_withdrawing_to_precompiles@02aafd78.

Generate fixtures for these test cases for Bogota with:

fill -v tests/shanghai/eip4895_withdrawals/test_withdrawals.py::test_withdrawing_to_precompiles --fork Bogota

Test withdrawing to all precompiles for a given fork.

Source code in tests/shanghai/eip4895_withdrawals/test_withdrawals.py
767
768
769
770
771
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
@pytest.mark.xdist_group(name="bigmem")
@pytest.mark.parametrize("amount", [0, 1])
@pytest.mark.with_all_precompiles
@pytest.mark.slow()
def test_withdrawing_to_precompiles(
    blockchain_test: BlockchainTestFiller,
    pre: Alloc,
    precompile: int,
    amount: int,
) -> None:
    """Test withdrawing to all precompiles for a given fork."""
    sender = pre.fund_eoa()
    post: Dict = {}

    blocks = [
        # First block performs the withdrawal
        Block(
            withdrawals=[
                Withdrawal(
                    index=0,
                    validator_index=0,
                    address=Address(precompile),
                    amount=amount,
                )
            ]
        ),
        # Second block sends a transaction to the precompile
        Block(
            txs=[
                Transaction(
                    sender=sender,
                    gas_limit=100000,
                    to=Address(precompile),
                ),
            ],
        ),
    ]
    blockchain_test(pre=pre, post=post, blocks=blocks)

Parametrized Test Cases

This test generates 36 parametrized test cases across 6 forks.