Skip to content

Markdown Content

Below is the verbatim markdown content from tests/amsterdam/eip7954_increase_max_contract_size/test_cases.md@b314d18e.

EIP-7954 Increase Maximum Contract Size Test Cases

Function Name Goal Setup Expectation Status
test_max_code_size Enforce new MAX_CODE_SIZE boundary for contract creation transactions Alice deploys contracts with runtime code at the new max and one byte over. New max: contract deployed. Over max: deployment fails. ✅ Completed
test_max_code_size_via_create Enforce new MAX_CODE_SIZE boundary via CREATE/CREATE2 opcodes Same as above but deployment is done through a factory contract using CREATE and CREATE2. New max: child contract deployed. Over max: child contract does not exist. ✅ Completed
test_max_initcode_size Enforce new MAX_INITCODE_SIZE boundary for contract creation transactions Alice sends creation transactions with initcode at the new max and one byte over. New max: transaction accepted, contract deployed. Over max: transaction rejected. ✅ Completed
test_max_initcode_size_via_create Enforce new MAX_INITCODE_SIZE boundary via CREATE/CREATE2 opcodes Same as above but initcode is passed through a factory contract using CREATE and CREATE2. New max: child contract deployed. Over max: CREATE returns 0, child contract does not exist. ✅ Completed
test_max_initcode_size_gas_metering Verify initcode gas metering at the new max (transaction level) Alice sends a creation transaction with max-size initcode. Gas limit set to exact intrinsic cost, then one short. Exact gas: contract deployed. One short: transaction rejected. ✅ Completed
test_max_code_size_deposit_gas Verify code deposit gas is charged correctly at the new max Alice deploys a contract with exactly MAX_CODE_SIZE bytes. Gas set to exact deposit cost, then one short. Exact gas: contract deployed. One short: deployment fails (out of gas during code deposit). ✅ Completed
test_max_code_size_external_opcodes Verify external code opcodes work with max-size contracts Deterministically pre-deploy a max-size self-checking contract. Call it to run EXTCODESIZE, EXTCODEHASH, and EXTCODECOPY on itself via ADDRESS. Each opcode returns the correct value for the max-size contract. ✅ Completed
test_max_code_size_self_opcodes Verify self code opcodes work with max-size contracts Pre-deploy a max-size contract with CODESIZE and CODECOPY checker logic. Call via DELEGATECALL so opcodes operate on the large contract's own code. CODESIZE returns the correct length, CODECOPY produces the correct hash. ✅ Completed
test_max_code_size_with_max_initcode Deploy max-size code when initcode is also at max size Alice deploys a contract with MAX_CODE_SIZE bytes of runtime code using initcode padded to MAX_INITCODE_SIZE. Contract deployed with the full max-size runtime code. ✅ Completed
test_warm_after_failed_create_over_max_code_size A failed CREATE/CREATE2 over max code size leaves the would-be address warm A creator runs CREATE/CREATE2 whose initcode returns MAX_CODE_SIZE + 1 bytes; a checker then measures the gas of a BALANCE on that address. The address is warm: the post-RETURN size-check rejection still leaves it in the access list. ✅ Completed
test_max_code_size_fork_transition New MAX_CODE_SIZE activates exactly at the fork boundary Before and after the fork, deploy a contract one byte over the parent fork's max code size (valid under the new limit; its initcode stays within both forks' initcode limits). Pre-fork: deployment fails at code deposit (exceeds old limit). Post-fork: deployment succeeds. ✅ Completed
test_max_code_size_via_create_fork_transition New MAX_CODE_SIZE activates at the fork boundary via CREATE/CREATE2 opcodes Same as above but deployment is done through a factory contract using CREATE and CREATE2. Pre-fork: child contract does not exist. Post-fork: child contract deployed. ✅ Completed
test_max_initcode_size_fork_transition New MAX_INITCODE_SIZE activates exactly at the fork boundary for transactions Before the fork, send a creation transaction with the new MAX_INITCODE_SIZE bytes of initcode. After the fork, send the same transaction. Pre-fork: block rejected (initcode exceeds old limit). Post-fork: transaction accepted, contract deployed. ✅ Completed
test_max_initcode_size_via_create_fork_transition New MAX_INITCODE_SIZE activates at the fork boundary via CREATE/CREATE2 opcodes Same as above but initcode is passed through a factory contract using CREATE and CREATE2. Pre-fork: CREATE fails (initcode exceeds old limit). Post-fork: child contract deployed. ✅ Completed
test_max_code_size_with_max_initcode_fork_transition Both new limits activate together at the fork boundary Before the fork, deploy max code with max initcode. After the fork, attempt the same deployment. Pre-fork: block rejected (initcode exceeds old limit). Post-fork: contract deployed with max-size runtime code. ✅ Completed
test_parent_max_code_size_across_fork Old MAX_CODE_SIZE still works on both sides of the transition Before and after the fork, deploy a contract with the old MAX_CODE_SIZE bytes of runtime code. Both deployments succeed. The old limit remains valid after the fork. ✅ Completed
test_over_max_code_size_mainnet Deploying above the new limit fails on mainnet Alice deploys a contract with MAX_CODE_SIZE + 1 bytes of runtime code. Contract does not exist (deployment fails during code deposit). ✅ Completed
test_over_max_initcode_size_mainnet Oversized initcode creation is rejected on mainnet Alice sends a creation transaction with MAX_INITCODE_SIZE + 1 bytes of initcode. Transaction rejected. No contract deployed. ✅ Completed
test_max_code_size_with_max_initcode_mainnet Verify opcodes on a max-size contract on mainnet Call the deterministic max-size self-checking contract. It queries EXTCODESIZE, EXTCODEHASH, and EXTCODECOPY on itself via ADDRESS. Each opcode returns the correct value for the max-size contract. ✅ Completed