Skip to content

test_over_max_code_size_mainnet()

Documentation for tests/amsterdam/eip7954_increase_max_contract_size/test_eip_mainnet.py::test_over_max_code_size_mainnet@87aba1a3.

Generate fixtures for these test cases for Amsterdam with:

fill -v tests/amsterdam/eip7954_increase_max_contract_size/test_eip_mainnet.py::test_over_max_code_size_mainnet --fork Amsterdam

Verify deployment above the new limit is rejected on mainnet.

Source code in tests/amsterdam/eip7954_increase_max_contract_size/test_eip_mainnet.py
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
def test_over_max_code_size_mainnet(
    state_test: StateTestFiller,
    pre: Alloc,
    fork: Fork,
) -> None:
    """Verify deployment above the new limit is rejected on mainnet."""
    deploy_code = Op.JUMPDEST * (fork.max_code_size() + 1)
    initcode = Initcode(deploy_code=deploy_code)

    alice = pre.fund_eoa()
    create_address = compute_create_address(address=alice, nonce=0)

    tx = Transaction(
        sender=alice,
        to=None,
        data=initcode,
        gas_limit=fork.transaction_gas_limit_cap(),
    )

    post: dict[Any, Account | None] = {
        create_address: Account.NONEXISTENT,
    }

    state_test(pre=pre, tx=tx, post=post)

Parametrized Test Cases

This test generates 1 parametrized test case across 1 fork.