Skip to content

test_no_evm_execution()

Documentation for tests/shanghai/eip4895_withdrawals/test_withdrawals.py::test_no_evm_execution@ffe48572.

Generate fixtures for these test cases for Bogota with:

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

Test withdrawals don't trigger EVM execution.

Source code in tests/shanghai/eip4895_withdrawals/test_withdrawals.py
def test_no_evm_execution(
    blockchain_test: BlockchainTestFiller,
    pre: Alloc,
) -> None:
    """Test withdrawals don't trigger EVM execution."""
    sender = pre.fund_eoa()
    contracts = [
        pre.deploy_contract(Op.SSTORE(Op.NUMBER, 1)) for _ in range(4)
    ]
    blocks = [
        Block(
            txs=[
                Transaction(
                    sender=sender,
                    to=contracts[2],
                ),
                Transaction(
                    sender=sender,
                    to=contracts[3],
                ),
            ],
            withdrawals=[
                Withdrawal(
                    index=0,
                    validator_index=0,
                    address=contracts[0],
                    amount=1,
                ),
                Withdrawal(
                    index=1,
                    validator_index=1,
                    address=contracts[1],
                    amount=1,
                ),
            ],
        ),
        Block(
            txs=[
                Transaction(
                    sender=sender,
                    to=contracts[0],
                ),
                Transaction(
                    sender=sender,
                    to=contracts[1],
                ),
            ],
            withdrawals=[
                Withdrawal(
                    index=0,
                    validator_index=0,
                    address=contracts[2],
                    amount=1,
                ),
                Withdrawal(
                    index=1,
                    validator_index=1,
                    address=contracts[3],
                    amount=1,
                ),
            ],
        ),
    ]

    post = {
        contracts[0]: Account(storage={2: 1}),
        contracts[1]: Account(storage={2: 1}),
        contracts[2]: Account(storage={1: 1}),
        contracts[3]: Account(storage={1: 1}),
    }

    blockchain_test(pre=pre, post=post, blocks=blocks)

Parametrized Test Cases

This test generates 1 parametrized test case across 6 forks.