Skip to content

test_max_code_size_with_max_initcode()

Documentation for tests/amsterdam/eip7954_increase_max_contract_size/test_max_code_size.py::test_max_code_size_with_max_initcode@c74f1a67.

Generate fixtures for these test cases for Amsterdam with:

fill -v tests/amsterdam/eip7954_increase_max_contract_size/test_max_code_size.py::test_max_code_size_with_max_initcode --fork Amsterdam

Ensure max-size code deploys when initcode is also at max size.

Source code in tests/amsterdam/eip7954_increase_max_contract_size/test_max_code_size.py
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
def test_max_code_size_with_max_initcode(
    state_test: StateTestFiller,
    pre: Alloc,
    fork: Fork,
) -> None:
    """Ensure max-size code deploys when initcode is also at max size."""
    deploy_code = Op.JUMPDEST * fork.max_code_size()
    initcode = Initcode(
        deploy_code=deploy_code,
        initcode_length=fork.max_initcode_size(),
    )

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

    tx = Transaction(
        sender=alice,
        to=None,
        data=initcode,
    )

    post = {create_address: Account(code=deploy_code)}

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

Parametrized Test Cases

This test generates 1 parametrized test case across 1 fork.