Skip to content

test_max_code_size_fork_transition()

Documentation for tests/amsterdam/eip7954_increase_max_contract_size/test_fork_transition.py::test_max_code_size_fork_transition@9c2813ee.

Generate fixtures for these test cases for Amsterdam with:

fill -v tests/amsterdam/eip7954_increase_max_contract_size/test_fork_transition.py::test_max_code_size_fork_transition --fork Amsterdam

Ensure the new max code size limit activates at the fork boundary.

Source code in tests/amsterdam/eip7954_increase_max_contract_size/test_fork_transition.py
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
def test_max_code_size_fork_transition(
    blockchain_test: BlockchainTestFiller,
    pre: Alloc,
    fork: TransitionFork,
) -> None:
    """Ensure the new max code size limit activates at the fork boundary."""
    code_size = fork.transitions_to().max_code_size()
    deploy_code = Op.JUMPDEST * code_size
    initcode = Initcode(deploy_code=deploy_code)

    alice = pre.fund_eoa()
    bob = pre.fund_eoa()

    create_address_pre = compute_create_address(address=alice, nonce=0)
    create_address_post = compute_create_address(address=bob, nonce=0)

    blocks = [
        Block(
            timestamp=14_999,
            txs=[
                Transaction(
                    sender=alice,
                    to=None,
                    data=initcode,
                    gas_limit=fork.transitions_from().transaction_gas_limit_cap(),
                )
            ],
        ),
        Block(
            timestamp=15_000,
            txs=[
                Transaction(
                    sender=bob,
                    to=None,
                    data=initcode,
                    gas_limit=fork.transitions_to().transaction_gas_limit_cap(),
                )
            ],
        ),
    ]

    post: dict[Any, Account | None] = {
        create_address_pre: Account.NONEXISTENT,
        create_address_post: Account(code=deploy_code),
    }

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

Parametrized Test Cases

This test generates 1 parametrized test case across 1 fork.