Repository navigation
Conversation
Merge the eight RevertPrefound* ports into one test parametrized on how the prefunded account is touched (CREATE or CALL), whether the frame then goes OOG, and the prefund amount (1 or 10 wei). Bugs fixed: - RevertPrefoundOOG and RevertPrefoundEmptyOOG_Paris prefunded an unrelated EOA instead of the creator's CREATE address, so the post (nonce 0, balance unchanged) held whether or not the CREATE was reverted. The prefunded account is now compute_create_address(target, nonce=1). Mutation check: dropping the OOG turns all four OOG cases red. - RevertPrefound and RevertPrefoundEmpty_Paris pinned the creator at 0xA000... and the prefunded account at its derived literal; both are now dynamic, so the pre_alloc_mutable marker is removed. OOG is now a 16 MiB KECCAK256 memory expansion with the default tx gas limit instead of tuned gas limits. The target's storage is now asserted too (CREATE result and the trailing SSTORE, or empty on OOG). The environment override is dropped. Removed: - tests/ported_static/stRevertTest/test_revert_prefound_oog.py - tests/ported_static/stRevertTest/test_revert_prefound_call.py - tests/ported_static/stRevertTest/test_revert_prefound_call_oog.py - tests/ported_static/stRevertTest/test_revert_prefound_empty_call_oog_paris.py - tests/ported_static/stRevertTest/test_revert_prefound_empty_call_paris.py - tests/ported_static/stRevertTest/test_revert_prefound_empty_oog_paris.py - tests/ported_static/stRevertTest/test_revert_prefound_empty_paris.py
Deploy the self-destructing callee first and have it SELFDESTRUCT to CALLER instead of the caller's pinned address, so neither contract needs a fixed address and the pre_alloc_mutable marker is removed. CALLER costs 2 gas against PUSH20's 3, so the measured gas drops by exactly 1 (7637 -> 7636 before the cold access reprice). The environment override and unused tx data are dropped.
The ported caller only stored lt(gas(), initialgas) after each call, which is 1 whatever the call returned, so a client that failed a call with a boundary gas operand still passed. Store each call's success flag in slots 0-3 and keep the legacy gas-decrease flags in 0x10-0x13. Mutation check: an INVALID callee turns all 12 cases red. The caller is rebuilt from its Yul source with the callee threaded in, so neither contract needs a pinned address and the pre_alloc_mutable marker is removed. Parametrize directly on the call gas operand, drop the 800000 tx gas limit (it OOGs on Amsterdam) and the environment override.
Merge the six CallcodeToPrecompile*/DelegatecallToPrecompile* ports into test_call_to_precompile_in_static_frame.py, parametrized on the call opcode (CALLCODE, DELEGATECALL) and the frame that STATICCALLs the precompile caller (transaction target, called contract, CREATE2 init code). The precompile caller and the result reader are generated from one table of precompile inputs and expected outputs; the post storage is identical to the old fixtures for all six cases. All contracts are now deployed at dynamic addresses, so the pre_alloc_mutable marker is removed. The ecrecover check compared the recovered address with ORIGIN, which only matched because the sender was pinned to the signing key; it now compares with the signer constant. The created contract's address is derived with compute_create2_address. The environment override, tx value, tx gas limit and unchecked balances are dropped. Removed: - tests/ported_static/stStaticFlagEnabled/test_callcode_to_precompile_from_called_contract.py - tests/ported_static/stStaticFlagEnabled/test_callcode_to_precompile_from_contract_initialization.py - tests/ported_static/stStaticFlagEnabled/test_callcode_to_precompile_from_transaction.py - tests/ported_static/stStaticFlagEnabled/test_delegatecall_to_precompile_from_called_contract.py - tests/ported_static/stStaticFlagEnabled/test_delegatecall_to_precompile_from_contract_initialization.py - tests/ported_static/stStaticFlagEnabled/test_delegatecall_to_precompile_from_transaction.py
Merge the CALL and DELEGATECALL loop ports into one test parametrized on the call opcode. The partner contract is deployed first and calls back through CALLER (CALL) or ADDRESS (DELEGATECALL, where ADDRESS is the entry contract in every frame), which removes the pinned partner address that broke the reference cycle. Frame counts are unchanged. Removed: - tests/ported_static/stRevertTest/test_loop_delegate_calls_depth_then_revert.py
Merge the two ports into one test parametrized on the depth of the CREATE (1023, 1022). The contract self-calls through ADDRESS instead of its pinned 0xA000... address; the constant JUMPI targets that depended on the PUSH20 width are rebuilt with Conditional. The post now derives the child and grandchild addresses, asserts that no grandchild exists when its CREATE would exceed the call depth limit, and checks the contract's counter and remaining balance. The environment keeps only the block gas limit the deep recursion needs. The Prague cap stays: the recursion needs a tx gas limit far above the Osaka cap. Removed: - tests/ported_static/stRevertTest/test_loop_calls_depth_then_revert3.py
Merge RevertPrecompiledTouch_{nonce,noncestorage,Paris,storage_Paris}
into one test parametrized on the precompiles' pre-state and the call
opcode used to touch them (ids d0-d3 as before). The caller contracts
are generated from the opcode, and the target is now asserted to have
empty storage, which makes the OOG that reverts the touching frame
observable (mutation check: a 1M tx gas limit turns all 16 cases red).
The post asserts the full pre-state of every precompile in every case;
the storage_Paris port only checked the balance of precompile 3 for
two of its cases. The pre_alloc_mutable marker stays: the precompiles'
pre-state is the subject. The sender nonce override is dropped.
Removed:
- tests/ported_static/stRevertTest/test_revert_precompiled_touch_nonce.py
- tests/ported_static/stRevertTest/test_revert_precompiled_touch_noncestorage.py
- tests/ported_static/stRevertTest/test_revert_precompiled_touch_paris.py
- tests/ported_static/stRevertTest/test_revert_precompiled_touch_storage_paris.py
Merge the stCallCreateCallCodeTest (CALL) and stDelegatecallTestHomestead (DELEGATECALL) Call1024PreCalls ports into one test parametrized on the recursion opcode and the tx gas. The recursion targets ADDRESS, so the pinned target, recipient and sender of the DELEGATECALL port are gone and its pre_alloc_mutable marker is removed. The DELEGATECALL port's gas-limited case (989 frames) sat on a knife edge: replacing the PUSH20 self address by ADDRESS (1 gas less per frame) flipped it to reaching the depth limit. Its tx gas moves to 9193697319756, the middle of a band (at least +-12e9 gas) where both opcodes stop at 989 frames on Cancun and Prague. The case now also runs for CALL, and the depth-limit cases for DELEGATECALL. The Prague cap stays: the recursion needs a tx gas limit far above the Osaka cap. Removed: - tests/ported_static/stDelegatecallTestHomestead/test_call1024_pre_calls.py
Merge the stCallCreateCallCodeTest (CALL) and stDelegatecallTestHomestead (DELEGATECALL) CallRecursiveBombPreCall ports into one test parametrized on how the target enters the bomb. The bomb recurses into the address passed in calldata: ADDRESS cannot be used because in the DELEGATECALL frame it is the target. This removes the pinned bomb address of the DELEGATECALL port. The empty value recipient 0xBAD304... is now pre.nonexistent_account(), and the target's storage is asserted in both cases. The Prague cap stays: the bomb needs a tx gas limit far above the Osaka cap. Removed: - tests/ported_static/stDelegatecallTestHomestead/test_call_recursive_bomb_pre_call.py
The Call1024BalanceTooLow/Callcode1024BalanceTooLow fillers recurse into the contract itself sending the frame count as value. The value never leaves the contract, so its balance (1024 + 10 wei of tx value) stays above every count below the depth limit and the recursion only ever stopped at depth 1024: "balance too low" was never exercised. An unused 7000 wei EOA was also funded in all four files. Merge the four ports into one test parametrized on the opcode and the contract balance. The original 1024 wei cases are kept (they stop at the depth limit, 1025 frames), and new balance_too_low cases with 500 wei stop at the first count above the balance (511 frames). The contract's final balance is asserted too. Mutation check: sending 0 value turns both balance_too_low cases red. stDelegatecallTestHomestead Call1024BalanceTooLow is byte-identical to Delegatecall1024 apart from the tx gas limit (both far above what the recursion needs), so it is dropped as a duplicate. The dead EOA and the environment fields other than the block gas limit are dropped. The Prague cap stays: the depth-limit cases need a tx gas limit far above the Osaka cap. Removed: - tests/ported_static/stCallCreateCallCodeTest/test_callcode1024_balance_too_low.py - tests/ported_static/stDelegatecallTestHomestead/test_call1024_balance_too_low.py - tests/ported_static/stDelegatecallTestHomestead/test_delegatecall1024.py
Merge the four CallLoseGasOOG/CallcodeLoseGasOOG ports (both stDelegatecallTestHomestead files use DELEGATECALL) into one test parametrized on the recursion opcode and the tx gas limit. Every opcode now runs all three gas cases: the default gas limit (the inner frame OOGs and the outer one completes) and the two tuned limits 166262/156262 under which the whole tx runs out of gas. The fork- dependent gas limits for the passing case are replaced by the default. The dead 7000 wei EOA, the tx value and the contract balance are dropped. Removed: - tests/ported_static/stCallCreateCallCodeTest/test_callcode_lose_gas_oog.py - tests/ported_static/stDelegatecallTestHomestead/test_call_lose_gas_oog.py - tests/ported_static/stDelegatecallTestHomestead/test_callcode_lose_gas_oog.py
delegatecodeDynamicCode DELEGATECALLs the pinned address 0xFFE4..., the child's address under pre-EIP-161 nonces. The child is created at a different address, so the DELEGATECALL hit an empty account and the test asserted the child's code never ran (slot 0 and 0x14 zero). The call now targets SLOAD(0xA), the address CREATE returned, and the child's writes into the creator's storage are asserted. Mutation check: delegating into an empty account turns every case red. Merge it with callcodeDynamicCode into one test parametrized on the call opcode (CALLCODE, DELEGATECALL), the create opcode (CREATE, CREATE2) and whether the creator runs as code or as init code. Init code is built from Bytecode with Initcode and stored with Om.MSTORE; created addresses come from compute_create_address / compute_create2_address instead of literals, so no address is pinned and the pre_alloc_mutable marker is removed from both files. The fixed inner call gas (bumped per fork on Amsterdam) is replaced by forwarding all gas, and the child's code is asserted. Removed: - tests/ported_static/stDelegatecallTestHomestead/test_delegatecode_dynamic_code.py
callcodeDynamicCode2SelfCall and delegatecodeDynamicCode2SelfCall created a child whose init code CALLCODEs/DELEGATECALLs 0x13136008..., the child's own address under the filler's pinned creator and nonce. With a dynamic creator the literal names an unrelated empty account, so the "self call" no longer called itself. The call now targets ADDRESS. Both targets have no code at that point, so the post is the same either way and no mutation check can tell them apart; the change restores the intent the title states. Merge the two ports into one test parametrized on the call opcode and on whether the creator then calls into the deployed child (the second callcodeDynamicCode2SelfCall case, now also run with DELEGATECALL). Init code is built from Bytecode and created addresses are derived, so the pre_alloc_mutable marker is removed from both files. The fixed and fork-bumped call gas, the entry contract and the environment override are dropped; the child's code is asserted. Removed: - tests/ported_static/stDelegatecallTestHomestead/test_delegatecode_dynamic_code2_self_call.py
callcodeInInitcodeToExisContractWithVTransferNEMoney deployed the existing contract at a dynamic address but CALLCODEd its filler address 0x1000...0001 from the init code, so the "existing contract" was never called and a client skipping the balance check would only have shown up in the call's return flag. The init code now targets the deployed contract, whose writes (slot 2, CALLER in 0xB) are asserted whenever the call succeeds. Mutation check: CALLCODE without value turns both ne_money cases red. Merge the three callcodeInInitcode* and three delegatecallInInitcode* ports into test_callcode_in_initcode.py, parametrized on the call opcode, empty or existing callee, the created contract's endowment and the create opcode (CREATE, CREATE2; previously only the CALLCODE files ran both). Init code is Bytecode stored with Om.MSTORE, created addresses are derived and empty callees are pre.nonexistent_account(), so no address is pinned and the pre_alloc_mutable marker is removed from the four files that had it. delegatecallInInitcodeToExistingContractOOG only goes OOG before EIP-150; on Cancun+ its 100000 gas ask is capped and the tx gas limit (153096) was tuned to it. It is kept as an oversized gas ask (2**32) with the default tx gas limit. Fixed call gas, the entry contract, an unused creator contract and the environment overrides are dropped; the init code stores CALLER and a completion flag in every case. Removed: - tests/ported_static/stCallCodes/test_callcode_in_initcode_to_empty_contract.py - tests/ported_static/stCallCodes/test_callcode_in_initcode_to_existing_contract.py - tests/ported_static/stCallCodes/test_callcode_in_initcode_to_exis_contract_with_v_transfer_ne_money.py - tests/ported_static/stDelegatecallTestHomestead/test_delegatecall_in_initcode_to_empty_contract.py - tests/ported_static/stDelegatecallTestHomestead/test_delegatecall_in_initcode_to_existing_contract.py - tests/ported_static/stDelegatecallTestHomestead/test_delegatecall_in_initcode_to_existing_contract_oog.py
Merge the twelve stCallCreateCallCodeTest call(code)Output* ports and the six stDelegatecallTestHomestead callOutput*/callcodeOutput3 ports into one test parametrized on the call opcode, the (args, ret) sizes (output1/2/3/3partial) and whether the callee fails on a stack underflow. The 24-case grid covers every old case; the old posts (the memory word survives the call) are all still asserted. stDelegatecallTestHomestead callcodeOutput3 is byte-identical to its callOutput3 (both DELEGATECALL) and is folded into the same case. The call's success flag (slot 1) and the callee's storage are now asserted. Fixed call gas, the tx gas limit and value, and the balances are dropped. Removed: - tests/ported_static/stCallCreateCallCodeTest/test_call_output1.py - tests/ported_static/stCallCreateCallCodeTest/test_call_output2.py - tests/ported_static/stCallCreateCallCodeTest/test_call_output3.py - tests/ported_static/stCallCreateCallCodeTest/test_call_output3_fail.py - tests/ported_static/stCallCreateCallCodeTest/test_call_output3partial.py - tests/ported_static/stCallCreateCallCodeTest/test_call_output3partial_fail.py - tests/ported_static/stCallCreateCallCodeTest/test_callcode_output1.py - tests/ported_static/stCallCreateCallCodeTest/test_callcode_output2.py - tests/ported_static/stCallCreateCallCodeTest/test_callcode_output3.py - tests/ported_static/stCallCreateCallCodeTest/test_callcode_output3_fail.py - tests/ported_static/stCallCreateCallCodeTest/test_callcode_output3partial.py - tests/ported_static/stCallCreateCallCodeTest/test_callcode_output3partial_fail.py - tests/ported_static/stDelegatecallTestHomestead/test_call_output1.py - tests/ported_static/stDelegatecallTestHomestead/test_call_output2.py - tests/ported_static/stDelegatecallTestHomestead/test_call_output3.py - tests/ported_static/stDelegatecallTestHomestead/test_call_output3partial.py - tests/ported_static/stDelegatecallTestHomestead/test_call_output3partial_fail.py - tests/ported_static/stDelegatecallTestHomestead/test_callcode_output3.py
ABAcalls2 is ABAcalls3 with a 1e9 tx gas limit (and a larger A balance). It was capped at Prague because that limit exceeds the Osaka transaction gas limit cap. It is now a tx_gas_limit case of test_ab_acalls3 at 2**24, whose fork-derived replay predicts the counters and balances for any budget, so it runs from Berlin onward (72 rounds through Prague, 68 on Amsterdam) instead of only on Cancun/Prague. Removed: - tests/ported_static/stSystemOperationsTest/test_ab_acalls2.py
B now calls back to CALLER instead of A's pinned address, and A calls B's deployed address, so neither contract needs a fixed address and the pre_alloc_mutable marker is removed. The PC-derived storage keys are computed from the assembled value expressions (B's key moves from 41 to 21 with the shorter CALLER push). The Prague cap only existed because the ported 1e9 tx gas limit exceeds the Osaka cap. Each level keeps a 100000 gas reserve, so the top-level results (A stores 1, B stores 2) do not depend on the budget: with the default tx gas limit the test passes on every fork from Cancun. The environment override and tx value are dropped.
B calls back to CALLER instead of A's pinned address and is deployed first, so A can reference it for its CALL and SELFDESTRUCT. No address is pinned and the pre_alloc_mutable marker is removed. B's PC-derived storage key is computed from the assembled value expression. The environment override and tx value are dropped.
CallRecursiveBomb1/2 are CallRecursiveBomb3 with a 15000 gas reserve instead of 224 and tx gas limits of 20622100/20622099. The one-gas difference is meaningless since EIP-150 (both store depth 256), so bomb2 is dropped as a duplicate. Both exceed the Osaka tx gas limit cap, which is why they were capped at Prague. The bomb3 replay now takes the reserve as a parameter. It reproduces the ported depth 256 at both bomb1/2 budgets on Cancun, and bomb1 runs at 2**24 from Berlin onward (243 levels, 98 on Amsterdam). Removed: - tests/ported_static/stSystemOperationsTest/test_call_recursive_bomb1.py - tests/ported_static/stSystemOperationsTest/test_call_recursive_bomb2.py
costRevert measured each failing call with an 80M tx gas limit and classified a cost above 0x04000000 as "all the gas"; it was capped at Prague because 80M exceeds the Osaka tx gas limit cap. The budget is now 16M and the threshold 0x00100000 (still a PUSH4, so the contract's constant jump targets are unchanged): every error case burns nearly the whole budget, a REVERT costs 2609. The REVERT cost now adds the EIP-8038 cold account access delta (+400 from Amsterdam). The test runs on every fork from Cancun.
The fuzzed target's code never references its own or any deployed address (its EXTCODECOPY source and SELFDESTRUCT beneficiary are computed from constants), so it no longer needs its pinned address and the pre_alloc_mutable marker is removed; its nonce 254 is kept. The second contract was never reached and is dropped, as are the pinned sender key, the environment override, the gas price and the vacuous coinbase assertion.
The contract no longer needs its pinned address or nonce 0: the storage key (the second CREATE's address) is derived with compute_create_address(nonce=2) and the final nonce is 3 with the default deploy nonce. The pre_alloc_mutable marker is removed. The environment keeps the block fields the code reads (number, timestamp, prev_randao) and drops the coinbase and base fee overrides.
The contract called itself at its pinned address 0xC0DE and took both SELFDESTRUCT beneficiaries as 2-byte calldata fields (0x1001, 0x1002, or 0xC0DE for itself), which forced pinned addresses. It now calls ADDRESS and reads full 20-byte beneficiaries from calldata, the beneficiaries are pre.nonexistent_account() (or the contract), and the code is rebuilt with Conditional instead of constant jumps. The call opcode is fixed per case instead of dispatched from calldata. The pre_alloc_mutable marker is removed. The eight cases are parametrized on the opcode and on whether the called frame selfdestructs to the contract itself, which also makes the previously duplicated ids unique. The contract's final balance (0) is now asserted. The sender nonce, environment override and tx gas limit are dropped.
revert_opcode_with_big_output_in_init, create_js_no_collision, create_name_registrator_per_txs, create_contract_via_transaction_cost53000 and test_random_test overrode the coinbase, base fee, block gas limit and prev_randao, which put each of them in its own pre-alloc group. None of them asserts the coinbase. test_random_test reads NUMBER and TIMESTAMP, which keep their default values (1 and 1000); PREVRANDAO only feeds its stack and its asserted post (the second CREATE's address keyed with TIMESTAMP, and its nonce) is unchanged with the default. The overrides are removed and the tests now share the default group.
Drop deploy_contract(nonce=1) and Transaction(data=Bytes("")), which
are the defaults.
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## forks/bogota #4005 +/- ##
=============================================
Coverage 95.10% 95.10%
=============================================
Files 673 673
Lines 40904 40904
Branches 3778 3778
=============================================
Hits 38903 38903
Misses 1393 1393
Partials 608 608
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
spencer-tb
left a comment
There was a problem hiding this comment.
AI Swarm Review, 3x rotation of 10 fresh agents, findings re-checked by fills, traces and spec mutants. Two coverage losses, the test_callcode_in_initcode merge and the 170000 case of the lose-gas test, the rest are small things inline :)
Checked: every claimed fix against the old port and the filler, the depth-1024 mechanics, the pre-alloc packing of test_revert_prefound, a full-range fill, and spec mutants of try/catch rules against base.
There was a problem hiding this comment.
Agree with Spencer on the callcode_in_initcode coverage loss (my numbers are on his threads). Apart from that the fixes hold up; what's left below is clean-up and consistency.
No filler dropped (2,098 at base and head, 56 moved). On Cancun 154 of 156 old cases map to new ones: 55 identical, 46 differ only in nonce, tx value or unused accounts, 53 are the stated changes; the 2 without a counterpart are the zero_value cases. Traced 4 changed cases on Cancun, all as intended, including the delegatecode_dynamic_code fix.
My agent ran the same checks as described in the #3997 review.
Area: maintainability
Priority: Normal
The PR removes @manually-enhanced from test_callcode_dynamic_code.py and test_callcode_dynamic_code2_self_call.py, and none of the rewritten or merged files have it (test_revert_prefound.py, test_callcode_in_initcode.py, test_call_output.py, test_transaction64_rule_integer_boundaries.py, and others). tests/ported_static/README.md says hand-corrected files need it so regeneration does not overwrite them. Could you add it, or note in the README that regeneration is retired?
Area: readability
Priority: Normal
19 of the 27 touched files still carry legacy # Source: comments (37 blocks, 98 lines, down from 138 and 502). In the rewritten and merged files many now describe code that no longer exists: pinned addresses, fixed call gas, a single opcode where the test now covers several (two examples inline). Could you drop them or replace them with a short line on the new code?
Files
Misleading:
stCallCodes/test_callcode_in_initcode.py:130stCallCodes/test_callcode_dynamic_code.py:70stCallCodes/test_callcode_dynamic_code2_self_call.py:64,93stCallCreateCallCodeTest/test_call_output.py:98stCallCreateCallCodeTest/test_call1024_balance_too_low.py:65stCallCreateCallCodeTest/test_call1024_pre_calls.py:63stCallCreateCallCodeTest/test_call_lose_gas_oog.py:63stCallCreateCallCodeTest/test_call_recursive_bomb_pre_call.py:51,66stEIP150Specific/test_suicide_to_existing_contract.py:46,52stEIP150Specific/test_transaction64_rule_integer_boundaries.py:69stRevertTest/test_revert_precompiled_touch.py:72stRevertTest/test_loop_calls_depth_then_revert2.py:60stSystemOperationsTest/test_ab_acalls1.py:39,51andtest_ab_acalls_suicide0.py:36,43
Redundant:
stCallCodes/test_callcode_dynamic_code.py:27,86,test_callcode_dynamic_code2_self_call.py:25,test_callcode_in_initcode.py:114stCallCreateCallCodeTest/test_call_output.py:92stSystemOperationsTest/test_double_selfdestruct_test.py:61,test_extcodecopy.py:37,test_test_random_test.py:36stRevertTest/test_cost_revert.py:228-294(eight blocks; alsobytes.fromhex(...)code at line 260 that is easy to write withOp)
Area: documentation
Priority: Minor
The PR body lists "call the existing contract in callcode_in_initcode" as a fix, but at base the ne_money test already called a callee pinned at 0x1000...0001 with code SSTORE(2, 1), and the post asserted slot 2 empty. It's a refactor, so I'd drop it from the fix list before squashing.
Area: readability
Priority: Minor
Some clean-up of the same kind is left in the directories this PR touches. None of it blocks; it could be a follow-up PR.
List
stDelegatecallTestHomestead/test_call_with_high_value_and_gas_oog.pyandtest_callcode_with_high_value_and_gas_oog.pyare identical apart from their names (both DELEGATECALL); withstCallCreateCallCodeTest/test_callcode_with_high_value_and_gas_oog.pythey could be one test over the opcode.stSystemOperationsTest/test_create_hash_collision.pystill haspre_alloc_mutableand two pinned addresses;stCallCodes/test_callcode_emptycontract.py:40still calls a fixed0x945304...where its delegatecall sibling usespre.nonexistent_account().- Opcode or value siblings that could be one test: in
stSystemOperationsTest,test_call_to_name_registrator_address_too_big_left/rightwithtest_callcode_to_name_registrator_addres_too_big_left/right,test_call_to_name_registrator_zeor_size_mem_expansionwithtest_callcode_to_name_registrator_zero_mem_expanion,test_return0/1/2,test_call_to_name_registrator_too_much_memory0/1/2andnot_much_memory0/1,test_create_name_registrator_out_of_memory_bonds0/1,test_create_name_registrator_zero_mem/zero_mem2,test_call_recursive_bomb_log/log2,test_suicide_caller_addres_too_big_left/right; instRevertTest,test_revert_in_call_code,test_revert_in_delegate_callandtest_revert_in_static_call; instDelegatecallTestHomestead,test_delegatecall_sender_checkandtest_delegatecall_value_check; instCallCodes,test_call_oog_additional_gas_costs1/2. data=Bytes("")remains in 87 files in these directories.stRevertTest/test_python_revert_test_tue201814_minus_1430.pystill haspre_alloc_mutableand four pinned addresses (fuzzer output, more work to unpin).
Lower the floor to TangerineWhistle, pin the created and creator nonces, store the callee's CALLVALUE, and bring back the zero-value CALLCODE case. The empty-contract CALLCODE case now carries an endowment so the call reaches the empty callee.
The 170000 gas case from CallcodeLoseGasOOG fails if the out-of-gas inner frame burns more than its grant. It is skipped on EIP-8037 forks, where state gas exceeds that budget.
The target now holds enough wei for two value calls per frame, so the value calls at the depth limit fail on depth rather than balance.
Funding the target with the prefund amount gives the two prefund variants distinct targets and CREATE addresses, so all eight cases share one pre-allocation group.
Remove the legacy filler-source comments that no longer describe the code, write cost_revert's raw DELEGATECALL contract with Op, and add the @manually-enhanced marker to the rewritten and merged files.
danceratopz
left a comment
There was a problem hiding this comment.
Thanks Mario for the fixes since the last review!
I asked my agent to re-check the new head with the #3997 method: no cases are dropped, and all 129 base *_in_initcode_to_existing_contract cases are covered again.
Comments inline.
- The PR body still lists "call the existing contract in
callcode_in_initcode" as a fix, but base already called that callee; I'd drop it before squashing. - The clean-up outside the touched files (the duplicate
high_value_and_gas_oogpair, the pins increate_hash_collisionandcallcode_emptycontract, the sibling merges) is still open; fine as a follow-up PR.
| storage = {0: GAS_LIMITED_FRAMES, 1: 1, 2: 1, 3: 1} | ||
| else: | ||
| storage = {0: MAX_CALL_DEPTH + 1, 1: 1, 2: 0, 3: 0} | ||
| post = {target: Account(storage=storage)} |
There was a problem hiding this comment.
The new funding fixes the depth-limit cases, but the post only checks storage, which ends the same whether the deepest value calls fail on depth or on balance, so the test still passes with the old 2024 wei. Could we also assert the target's balance? Two wei leave per frame for every frame except the one at the depth limit. I asked my agent to check this: with the change all 12 cases fill, and with the old balance the 8 depth-limit cases fail.
Diff
diff --git a/tests/ported_static/stCallCreateCallCodeTest/test_call1024_pre_calls.py b/tests/ported_static/stCallCreateCallCodeTest/test_call1024_pre_calls.py
index 48c9a871cb..04cb797bb0 100644
--- a/tests/ported_static/stCallCreateCallCodeTest/test_call1024_pre_calls.py
+++ b/tests/ported_static/stCallCreateCallCodeTest/test_call1024_pre_calls.py
@@ -62,6 +62,9 @@ def test_call1024_pre_calls(
env = Environment(gas_limit=HIGH_GAS_LIMIT)
sender = pre.fund_eoa(amount=0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF)
recipient = pre.fund_eoa()
+ # Enough wei for two value calls in every frame.
+ target_balance = 2 * (MAX_CALL_DEPTH + 1)
+ tx_value = 10
target = pre.deploy_contract(
code=Op.SSTORE(2, Op.CALL(gas=0xFFFF, address=recipient, value=1))
@@ -69,15 +72,25 @@ def test_call1024_pre_calls(
+ Op.SSTORE(0, Op.ADD(Op.SLOAD(0), 1))
+ Op.SSTORE(1, opcode(gas=0xFFFFFFFFFFF, address=Op.ADDRESS))
+ Op.STOP,
- balance=2 * (MAX_CALL_DEPTH + 1),
+ balance=target_balance,
)
- tx = Transaction(sender=sender, to=target, gas_limit=tx_gas, value=10)
+ tx = Transaction(
+ sender=sender, to=target, gas_limit=tx_gas, value=tx_value
+ )
if tx_gas == GAS_LIMITED_TX_GAS:
storage = {0: GAS_LIMITED_FRAMES, 1: 1, 2: 1, 3: 1}
+ value_call_frames = GAS_LIMITED_FRAMES
else:
storage = {0: MAX_CALL_DEPTH + 1, 1: 1, 2: 0, 3: 0}
- post = {target: Account(storage=storage)}
+ # Only the frame at the depth limit cannot send value.
+ value_call_frames = MAX_CALL_DEPTH
+ post = {
+ target: Account(
+ storage=storage,
+ balance=target_balance + tx_value - 2 * value_call_frames,
+ )
+ }
state_test(env=env, pre=pre, post=post, tx=tx)
Description
Warning
This PR was AI-produced. I need to manually review it before marking it ready for review.
Part of finalizing the
tests/ported_static/port: cleanup to reduce pre-alloc groups and removepre_alloc_mutablewhere not needed. Files are disjoint from the otherfinalize-ported-static-*PRs, so each can be reviewed and merged independently.stCallCodes,stCallCreateCallCodeTest,stDelegatecallTestHomestead,stRevertTest,stStaticFlagEnabled,stSystemOperationsTestand others (output,lose_gas_oog,call1024_pre_calls, recursive bomb,loop_calls_depth_then_revert, precompile touch).envoverrides.*dynamic_code2_self_call, delegate into the created child, make*1024_balance_too_lowreach a low balance, call the existing contract incallcode_in_initcode, and assert call success intransaction64_rule_integer_boundaries.Filled on all forks through Bogota.
Related Issues or PRs
N/A.
Checklist
just static<type>(<area>): <description>, where<type>and<area>come from an appropriateC-<type>, respectivelyA-<area>, label. The title should match the target squash commit message.Cute Animal Picture