Skip to content

test_max_code_size_with_max_initcode_mainnet()

Documentation for tests/amsterdam/eip7954_increase_max_contract_size/test_eip_mainnet.py::test_max_code_size_with_max_initcode_mainnet@c74f1a67.

Generate fixtures for these test cases for Amsterdam with:

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

Verify max-size contract works on mainnet.

Calls the deterministic max-size contract which checks EXTCODESIZE, EXTCODEHASH, and EXTCODECOPY on itself. The contract bytecode is the same used for deployment tests, padded to max code size.

Source code in tests/amsterdam/eip7954_increase_max_contract_size/test_eip_mainnet.py
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
def test_max_code_size_with_max_initcode_mainnet(
    state_test: StateTestFiller,
    pre: Alloc,
    fork: Fork,
    max_code_size_contract: tuple,
) -> None:
    """
    Verify max-size contract works on mainnet.

    Calls the deterministic max-size contract which checks EXTCODESIZE,
    EXTCODEHASH, and EXTCODECOPY on itself. The contract bytecode is
    the same used for deployment tests, padded to max code size.
    """
    target, target_code = max_code_size_contract

    alice = pre.fund_eoa()

    tx = Transaction(
        sender=alice,
        to=target,
        gas_limit=fork.transaction_gas_limit_cap(),
    )

    post = {
        target: Account(
            storage={
                0: len(target_code),
                1: keccak256(bytes(target_code)),
                2: keccak256(bytes(target_code)),
            }
        )
    }

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

Parametrized Test Cases

This test generates 1 parametrized test case across 1 fork.