Skip to content

test_withdrawing_to_precompiles()

Documentation for tests/shanghai/eip4895_withdrawals/test_withdrawals.py::test_withdrawing_to_precompiles@7b8124a7.

Generate fixtures for these test cases for Osaka with:

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

Test withdrawing to all precompiles for a given fork.

Source code in tests/shanghai/eip4895_withdrawals/test_withdrawals.py
758
759
760
761
762
763
764
765
766
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
@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 4 forks.