Skip to content

refactor(tests): merge stMemory*, stStackTests, stLogTests, stShift files - #4003

Draft
marioevz wants to merge 18 commits into
ethereum:forks/bogotafrom
marioevz:finalize-ported-static-merges
Draft

marioevz wants to merge 18 commits into
ethereum:forks/bogotafrom
marioevz:finalize-ported-static-merges

Conversation

@marioevz

Copy link
Copy Markdown
Member

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 remove pre_alloc_mutable where not needed. Files are disjoint from the other finalize-ported-static-* PRs, so each can be reviewed and merged independently.

  • Merge sibling files in stMemoryStressTest, stMemoryTest, stStackTests, stLogTests, stShift and stArgsZeroOneBalance into parametrized tests.
  • Fix vacuous or wrong cases: call every RETURN bound contract, check that *_dejavu OOG calls actually fail, make the stack_limit overflow observable, and test the intended operands in shift_signed_combinations.

Filled on all forks through Bogota.

Related Issues or PRs

N/A.

Checklist

  • Ran fast static checks to avoid CI fails, see Code Standards & Verifying Changes: just static
  • PR title has the form <type>(<area>): <description>, where <type> and <area> come from an appropriate C-<type>, respectively A-<area>, label. The title should match the target squash commit message.

Cute Animal Picture

Put a link to a cute animal picture inside the parenthesis-->

Merge the 40 single-case SHL/SHR/SAR files into one test parametrized on
(opcode, shift, value), with ids matching the old file names. The
expected result is computed from the operands, the slot keeps a
non-zero initial value so zero results stay observable, and tx
gas/value, balances and the sender post entry are dropped. valid_from
is lowered from Cancun to Constantinople. Old and new Osaka fixtures
store the same value for every case.

Removed:
- tests/ported_static/stShift/test_sar00.py
- tests/ported_static/stShift/test_sar01.py
- tests/ported_static/stShift/test_sar10.py
- tests/ported_static/stShift/test_sar11.py
- tests/ported_static/stShift/test_sar_0_256_minus_1.py
- tests/ported_static/stShift/test_sar_2_254_254.py
- tests/ported_static/stShift/test_sar_2_255_1.py
- tests/ported_static/stShift/test_sar_2_255_255.py
- tests/ported_static/stShift/test_sar_2_255_256.py
- tests/ported_static/stShift/test_sar_2_255_257.py
- tests/ported_static/stShift/test_sar_2_255_minus_1_248.py
- tests/ported_static/stShift/test_sar_2_255_minus_1_254.py
- tests/ported_static/stShift/test_sar_2_255_minus_1_255.py
- tests/ported_static/stShift/test_sar_2_255_minus_1_256.py
- tests/ported_static/stShift/test_sar_2_256_minus_1_0.py
- tests/ported_static/stShift/test_sar_2_256_minus_1_1.py
- tests/ported_static/stShift/test_sar_2_256_minus_1_255.py
- tests/ported_static/stShift/test_sar_2_256_minus_1_256.py
- tests/ported_static/stShift/test_shl01.py
- tests/ported_static/stShift/test_shl01_minus_0100.py
- tests/ported_static/stShift/test_shl01_minus_0101.py
- tests/ported_static/stShift/test_shl01_minus_ff.py
- tests/ported_static/stShift/test_shl10.py
- tests/ported_static/stShift/test_shl11.py
- tests/ported_static/stShift/test_shl_2_255_minus_1_1.py
- tests/ported_static/stShift/test_shl_minus_1_0.py
- tests/ported_static/stShift/test_shl_minus_1_1.py
- tests/ported_static/stShift/test_shl_minus_1_255.py
- tests/ported_static/stShift/test_shl_minus_1_256.py
- tests/ported_static/stShift/test_shr01.py
- tests/ported_static/stShift/test_shr10.py
- tests/ported_static/stShift/test_shr11.py
- tests/ported_static/stShift/test_shr_2_255_1.py
- tests/ported_static/stShift/test_shr_2_255_255.py
- tests/ported_static/stShift/test_shr_2_255_256.py
- tests/ported_static/stShift/test_shr_2_255_257.py
- tests/ported_static/stShift/test_shr_minus_1_0.py
- tests/ported_static/stShift/test_shr_minus_1_1.py
- tests/ported_static/stShift/test_shr_minus_1_255.py
- tests/ported_static/stShift/test_shr_minus_1_256.py
The filler writes the fourth value (5) into the shift array instead of
the value array, so shift 2**63 and value 5 were never exercised: the
shift list held 5 and the value list held 0 twice. Use the intended
lists.

Replace the 1008-slot single-transaction loop port (80M gas, Prague
only) with a test parametrized on opcode x shift that stores one result
per value, computed in Python, over a non-zero initial slot value. The
debug marker/operand slots are dropped. No gas limit, so the test now
runs from Constantinople through Bogota.

Mutation check: building the code with the filler's value list (0 in
place of 5) while expecting the fixed results turns the shl-0x80 case
red.
Merge the 46 *NonConst files into one test parametrized on opcode x
tx_value. Every operand is BALANCE(ADDRESS), which equals the tx value.
Stored results are listed per operand value; calldataload with data
becomes its own "calldataload_with_data" case. A canary stored before
the opcode makes the no-result cases observable and shows which cases
halt (jump, jumpi with operand 1). Hardcoded gas, balances and the
resolve_expect_post scaffolding are dropped.

valid_from is lowered from Cancun to Frontier (add already ran from
Frontier), with delegatecall from Homestead, create from SpuriousDragon
(contract nonce 1) and suicide from Cancun (account survives). Old and
new Osaka fixtures store the same values (create differs only by the
created address).

Removed:
- tests/ported_static/stArgsZeroOneBalance/test_add_non_const.py
- tests/ported_static/stArgsZeroOneBalance/test_addmod_non_const.py
- tests/ported_static/stArgsZeroOneBalance/test_and_non_const.py
- tests/ported_static/stArgsZeroOneBalance/test_balance_non_const.py
- tests/ported_static/stArgsZeroOneBalance/test_byte_non_const.py
- tests/ported_static/stArgsZeroOneBalance/test_call_non_const.py
- tests/ported_static/stArgsZeroOneBalance/test_callcode_non_const.py
- tests/ported_static/stArgsZeroOneBalance/test_calldatacopy_non_const.py
- tests/ported_static/stArgsZeroOneBalance/test_calldataload_non_const.py
- tests/ported_static/stArgsZeroOneBalance/test_codecopy_non_const.py
- tests/ported_static/stArgsZeroOneBalance/test_create_non_const.py
- tests/ported_static/stArgsZeroOneBalance/test_delegatecall_non_const.py
- tests/ported_static/stArgsZeroOneBalance/test_div_non_const.py
- tests/ported_static/stArgsZeroOneBalance/test_eq_non_const.py
- tests/ported_static/stArgsZeroOneBalance/test_exp_non_const.py
- tests/ported_static/stArgsZeroOneBalance/test_extcodecopy_non_const.py
- tests/ported_static/stArgsZeroOneBalance/test_extcodesize_non_const.py
- tests/ported_static/stArgsZeroOneBalance/test_gt_non_const.py
- tests/ported_static/stArgsZeroOneBalance/test_iszero_non_const.py
- tests/ported_static/stArgsZeroOneBalance/test_jump_non_const.py
- tests/ported_static/stArgsZeroOneBalance/test_jumpi_non_const.py
- tests/ported_static/stArgsZeroOneBalance/test_log0_non_const.py
- tests/ported_static/stArgsZeroOneBalance/test_log1_non_const.py
- tests/ported_static/stArgsZeroOneBalance/test_log2_non_const.py
- tests/ported_static/stArgsZeroOneBalance/test_log3_non_const.py
- tests/ported_static/stArgsZeroOneBalance/test_lt_non_const.py
- tests/ported_static/stArgsZeroOneBalance/test_mload_non_const.py
- tests/ported_static/stArgsZeroOneBalance/test_mod_non_const.py
- tests/ported_static/stArgsZeroOneBalance/test_mstore8_non_const.py
- tests/ported_static/stArgsZeroOneBalance/test_mstore_non_const.py
- tests/ported_static/stArgsZeroOneBalance/test_mul_non_const.py
- tests/ported_static/stArgsZeroOneBalance/test_mulmod_non_const.py
- tests/ported_static/stArgsZeroOneBalance/test_not_non_const.py
- tests/ported_static/stArgsZeroOneBalance/test_or_non_const.py
- tests/ported_static/stArgsZeroOneBalance/test_return_non_const.py
- tests/ported_static/stArgsZeroOneBalance/test_sdiv_non_const.py
- tests/ported_static/stArgsZeroOneBalance/test_sgt_non_const.py
- tests/ported_static/stArgsZeroOneBalance/test_sha3_non_const.py
- tests/ported_static/stArgsZeroOneBalance/test_signext_non_const.py
- tests/ported_static/stArgsZeroOneBalance/test_sload_non_const.py
- tests/ported_static/stArgsZeroOneBalance/test_slt_non_const.py
- tests/ported_static/stArgsZeroOneBalance/test_smod_non_const.py
- tests/ported_static/stArgsZeroOneBalance/test_sstore_non_const.py
- tests/ported_static/stArgsZeroOneBalance/test_sub_non_const.py
- tests/ported_static/stArgsZeroOneBalance/test_suicide_non_const.py
- tests/ported_static/stArgsZeroOneBalance/test_xor_non_const.py
Merge the 45 log{0..4}_* files into one test parametrized on topic
count x case (ids log{n}_{case}, matching the old file names). The
logger code is built from the case; the caller forwards all gas instead
of a fixed 1000 and no longer sends value, and stores the CALL result
plus a canary so the failing cases are observable. pc now also runs
for LOG1/LOG2. Hardcoded tx gas, values and balances are dropped and
valid_from is lowered from Cancun to TangerineWhistle (all-gas
forwarding). Old and new Osaka fixtures agree on the success of every
case. test_log_in_oog_call is unchanged.

Removed:
- tests/ported_static/stLogTests/test_log0_empty_mem.py
- tests/ported_static/stLogTests/test_log0_log_mem_start_too_high.py
- tests/ported_static/stLogTests/test_log0_log_memsize_too_high.py
- tests/ported_static/stLogTests/test_log0_log_memsize_zero.py
- tests/ported_static/stLogTests/test_log0_non_empty_mem.py
- tests/ported_static/stLogTests/test_log0_non_empty_mem_log_mem_size1.py
- tests/ported_static/stLogTests/test_log0_non_empty_mem_log_mem_size1_log_mem_start31.py
- tests/ported_static/stLogTests/test_log1_caller.py
- tests/ported_static/stLogTests/test_log1_empty_mem.py
- tests/ported_static/stLogTests/test_log1_log_mem_start_too_high.py
- tests/ported_static/stLogTests/test_log1_log_memsize_too_high.py
- tests/ported_static/stLogTests/test_log1_log_memsize_zero.py
- tests/ported_static/stLogTests/test_log1_max_topic.py
- tests/ported_static/stLogTests/test_log1_non_empty_mem.py
- tests/ported_static/stLogTests/test_log1_non_empty_mem_log_mem_size1.py
- tests/ported_static/stLogTests/test_log1_non_empty_mem_log_mem_size1_log_mem_start31.py
- tests/ported_static/stLogTests/test_log2_caller.py
- tests/ported_static/stLogTests/test_log2_empty_mem.py
- tests/ported_static/stLogTests/test_log2_log_mem_start_too_high.py
- tests/ported_static/stLogTests/test_log2_log_memsize_too_high.py
- tests/ported_static/stLogTests/test_log2_log_memsize_zero.py
- tests/ported_static/stLogTests/test_log2_max_topic.py
- tests/ported_static/stLogTests/test_log2_non_empty_mem.py
- tests/ported_static/stLogTests/test_log2_non_empty_mem_log_mem_size1.py
- tests/ported_static/stLogTests/test_log2_non_empty_mem_log_mem_size1_log_mem_start31.py
- tests/ported_static/stLogTests/test_log3_caller.py
- tests/ported_static/stLogTests/test_log3_empty_mem.py
- tests/ported_static/stLogTests/test_log3_log_mem_start_too_high.py
- tests/ported_static/stLogTests/test_log3_log_memsize_too_high.py
- tests/ported_static/stLogTests/test_log3_log_memsize_zero.py
- tests/ported_static/stLogTests/test_log3_max_topic.py
- tests/ported_static/stLogTests/test_log3_non_empty_mem.py
- tests/ported_static/stLogTests/test_log3_non_empty_mem_log_mem_size1.py
- tests/ported_static/stLogTests/test_log3_non_empty_mem_log_mem_size1_log_mem_start31.py
- tests/ported_static/stLogTests/test_log3_pc.py
- tests/ported_static/stLogTests/test_log4_caller.py
- tests/ported_static/stLogTests/test_log4_empty_mem.py
- tests/ported_static/stLogTests/test_log4_log_mem_start_too_high.py
- tests/ported_static/stLogTests/test_log4_log_memsize_too_high.py
- tests/ported_static/stLogTests/test_log4_log_memsize_zero.py
- tests/ported_static/stLogTests/test_log4_max_topic.py
- tests/ported_static/stLogTests/test_log4_non_empty_mem.py
- tests/ported_static/stLogTests/test_log4_non_empty_mem_log_mem_size1.py
- tests/ported_static/stLogTests/test_log4_non_empty_mem_log_mem_size1_log_mem_start31.py
- tests/ported_static/stLogTests/test_log4_pc.py
Merge the stackOverflow{,M1}{,DUP,PUSH} files into test_stack_overflow
parametrized on opcode (the 15 single-push opcodes, PUSH1-32, DUP1-16)
x overflow, with the stack height derived from fork.max_stack_height().
At the limit the created account holds the tx value; one past it the
creation fails. The byte-identical stackOverflowSWAP and stacksanitySWAP
become test_stack_full_swap in the same file. The unused funded
contract_0, the base-fee/coinbase Environment and the fixed 6M gas are
dropped, and valid_from is lowered from Cancun to Frontier.

test_shallow_stack: drop the Environment (base_fee_per_gas=10, unused
coinbase); no code reads a block field. This moves stStackTests out of
the separate base-fee pre-alloc group.

Removed:
- tests/ported_static/stStackTests/test_stack_overflow_dup.py
- tests/ported_static/stStackTests/test_stack_overflow_m1.py
- tests/ported_static/stStackTests/test_stack_overflow_m1_dup.py
- tests/ported_static/stStackTests/test_stack_overflow_m1_push.py
- tests/ported_static/stStackTests/test_stack_overflow_push.py
- tests/ported_static/stStackTests/test_stack_overflow_swap.py
- tests/ported_static/stStackTests/test_stacksanity_swap.py
Merge the 40 mem{0b,31b,32b,33b}_singleByte, mem{32,64}kb{,±n} and
mem{32,64}kb_singleByte{,±n} files into test_memory_size.py,
parametrized on opcode (MSTORE/MSTORE8) x offset with ids matching the
old file names. The expected MSIZE is derived from offset and store
width; the MSTORE cases keep the MLOAD read-back slot. The Amsterdam
gas_limit band-aid, tx value, balances and nonce asserts are dropped
and valid_from is lowered from Cancun to Frontier. Old and new Osaka
fixtures store identical values.

Removed:
- tests/ported_static/stMemoryTest/test_mem0b_single_byte.py
- tests/ported_static/stMemoryTest/test_mem31b_single_byte.py
- tests/ported_static/stMemoryTest/test_mem32b_single_byte.py
- tests/ported_static/stMemoryTest/test_mem32kb.py
- tests/ported_static/stMemoryTest/test_mem32kb_minus_1.py
- tests/ported_static/stMemoryTest/test_mem32kb_minus_31.py
- tests/ported_static/stMemoryTest/test_mem32kb_minus_32.py
- tests/ported_static/stMemoryTest/test_mem32kb_minus_33.py
- tests/ported_static/stMemoryTest/test_mem32kb_plus_1.py
- tests/ported_static/stMemoryTest/test_mem32kb_plus_31.py
- tests/ported_static/stMemoryTest/test_mem32kb_plus_32.py
- tests/ported_static/stMemoryTest/test_mem32kb_plus_33.py
- tests/ported_static/stMemoryTest/test_mem32kb_single_byte.py
- tests/ported_static/stMemoryTest/test_mem32kb_single_byte_minus_1.py
- tests/ported_static/stMemoryTest/test_mem32kb_single_byte_minus_31.py
- tests/ported_static/stMemoryTest/test_mem32kb_single_byte_minus_32.py
- tests/ported_static/stMemoryTest/test_mem32kb_single_byte_minus_33.py
- tests/ported_static/stMemoryTest/test_mem32kb_single_byte_plus_1.py
- tests/ported_static/stMemoryTest/test_mem32kb_single_byte_plus_31.py
- tests/ported_static/stMemoryTest/test_mem32kb_single_byte_plus_32.py
- tests/ported_static/stMemoryTest/test_mem32kb_single_byte_plus_33.py
- tests/ported_static/stMemoryTest/test_mem33b_single_byte.py
- tests/ported_static/stMemoryTest/test_mem64kb.py
- tests/ported_static/stMemoryTest/test_mem64kb_minus_1.py
- tests/ported_static/stMemoryTest/test_mem64kb_minus_31.py
- tests/ported_static/stMemoryTest/test_mem64kb_minus_32.py
- tests/ported_static/stMemoryTest/test_mem64kb_minus_33.py
- tests/ported_static/stMemoryTest/test_mem64kb_plus_1.py
- tests/ported_static/stMemoryTest/test_mem64kb_plus_31.py
- tests/ported_static/stMemoryTest/test_mem64kb_plus_32.py
- tests/ported_static/stMemoryTest/test_mem64kb_plus_33.py
- tests/ported_static/stMemoryTest/test_mem64kb_single_byte.py
- tests/ported_static/stMemoryTest/test_mem64kb_single_byte_minus_1.py
- tests/ported_static/stMemoryTest/test_mem64kb_single_byte_minus_31.py
- tests/ported_static/stMemoryTest/test_mem64kb_single_byte_minus_32.py
- tests/ported_static/stMemoryTest/test_mem64kb_single_byte_minus_33.py
- tests/ported_static/stMemoryTest/test_mem64kb_single_byte_plus_1.py
- tests/ported_static/stMemoryTest/test_mem64kb_single_byte_plus_31.py
- tests/ported_static/stMemoryTest/test_mem64kb_single_byte_plus_32.py
- tests/ported_static/stMemoryTest/test_mem64kb_single_byte_plus_33.py
The stackLimit{Gas,Push31,Push32}_{1023,1024,1025} fillers had their
only distinguishing check (the target balance including the tx value)
commented out, so the port asserted an empty storage in every case and
the 1025 overflow was indistinguishable from success.

Merge the nine files into test_stack_limit.py parametrized on the pushed
item (GAS/PUSH31/PUSH32) x stack peak, with the loop count derived from
the peak and the loop-back JUMPI target from the setup length. A canary
stored after the loop is expected iff the peak fits within
fork.max_stack_height(). The fixed 100k gas, tx value and balances are
dropped and valid_from is lowered from Cancun to Frontier.

Mutation check: lowering the loop count by one (so the 1025 peak is
1024) turns the three 1025 cases red; the old port passed it.

Removed:
- tests/ported_static/stMemoryTest/test_stack_limit_gas_1023.py
- tests/ported_static/stMemoryTest/test_stack_limit_gas_1024.py
- tests/ported_static/stMemoryTest/test_stack_limit_gas_1025.py
- tests/ported_static/stMemoryTest/test_stack_limit_push31_1023.py
- tests/ported_static/stMemoryTest/test_stack_limit_push31_1024.py
- tests/ported_static/stMemoryTest/test_stack_limit_push31_1025.py
- tests/ported_static/stMemoryTest/test_stack_limit_push32_1023.py
- tests/ported_static/stMemoryTest/test_stack_limit_push32_1024.py
- tests/ported_static/stMemoryTest/test_stack_limit_push32_1025.py
Merge the 11 stMemoryTest *_dejavu files that touch memory at offset
0xFFFFFFF into test_memory_expansion_oog.py, parametrized on the
memory-touching code. The old posts asserted only an empty target
storage, which also holds if the code never runs. A caller now invokes
the target with all gas and stores the CALL result over a non-zero
initial value, followed by a canary, so the post proves the sub-call
ran and failed.

Restore the filler intent of the LOG cases: log2_dejavu pushed one
operand too few (stack underflow instead of memory OOG), and
log3_dejavu/log4_dejavu both ran LOG2. They now run LOG2/LOG3/LOG4
with full operands. The hardcoded 100k gas, tx value and balances are
dropped and valid_from is lowered from Cancun to TangerineWhistle
(all-gas forwarding).

Mutation check: with a small offset (0x100) all 11 cases turn red.

calldatacopy_dejavu2 and codecopy_dejavu2 succeed and stay as they are.

Removed:
- tests/ported_static/stMemoryTest/test_calldatacopy_dejavu.py
- tests/ported_static/stMemoryTest/test_codecopy_dejavu.py
- tests/ported_static/stMemoryTest/test_extcodecopy_dejavu.py
- tests/ported_static/stMemoryTest/test_log1_dejavu.py
- tests/ported_static/stMemoryTest/test_log2_dejavu.py
- tests/ported_static/stMemoryTest/test_log3_dejavu.py
- tests/ported_static/stMemoryTest/test_log4_dejavu.py
- tests/ported_static/stMemoryTest/test_mload_dejavu.py
- tests/ported_static/stMemoryTest/test_mstore_dejavu.py
- tests/ported_static/stMemoryTest/test_mstroe8_dejavu.py
- tests/ported_static/stMemoryTest/test_sha3_dejavu.py
The RETURN_Bounds filler stores slots 7-16 from calls that all target
contract 6 (RETURN(2**256-1, 0)), so the ten contracts returning a
non-zero huge size never ran and every slot read 1. Calling them all
from one frame is not workable either: each failing call burns 63/64 of
the remaining gas.

Parametrize on the 16 (offset, size) pairs instead: one returner per
case, called with all gas by a caller that stores the CALL result over a
non-zero initial value plus a canary. Size 0 succeeds for any offset;
any huge non-zero size runs out of gas. The tx gas axis (150k arm
reverted the whole tx; 500k/15M arms were identical), the 0x7ff..
call gas, value and balances are dropped, and valid_from is lowered from
Cancun to TangerineWhistle (all-gas forwarding).

Mutation check: returning size 0 from every contract (the old
behaviour) turns the 10 non-zero-size cases red.
Merge the 15 CALL/CALLCODE/DELEGATECALL/STATICCALL _Bounds files into
test_call_bounds.py, parametrized on opcode x (offset, size), where the
region is used for both args and return data and the bounds are
2^{28,32,64,128,256}-1. Each old file ran a sequence of calls in one
frame, so only the calls up to the first huge-size one ever executed
and the rest were dead code; every old region is now its own case.

The target makes a single call to a storage counter; an entry contract
calls the target with all gas and stores the result over a non-zero
initial value plus a canary. Size 0 succeeds at any offset and bumps
the counter (in the target for CALLCODE/DELEGATECALL, not at all for
STATICCALL); a huge size makes the target run out of gas. Previously
the post only showed the whole tx reverting. The tx gas axis, the
0x7ff.. call gas, value and balances are dropped; valid_from goes from
Cancun to TangerineWhistle (Byzantium for STATICCALL).

Removed:
- tests/ported_static/stMemoryStressTest/test_call_bounds2.py
- tests/ported_static/stMemoryStressTest/test_call_bounds2a.py
- tests/ported_static/stMemoryStressTest/test_call_bounds3.py
- tests/ported_static/stMemoryStressTest/test_callcode_bounds.py
- tests/ported_static/stMemoryStressTest/test_callcode_bounds2.py
- tests/ported_static/stMemoryStressTest/test_callcode_bounds3.py
- tests/ported_static/stMemoryStressTest/test_callcode_bounds4.py
- tests/ported_static/stMemoryStressTest/test_delegatecall_bounds.py
- tests/ported_static/stMemoryStressTest/test_delegatecall_bounds2.py
- tests/ported_static/stMemoryStressTest/test_delegatecall_bounds3.py
- tests/ported_static/stMemoryStressTest/test_static_call_bounds.py
- tests/ported_static/stMemoryStressTest/test_static_call_bounds2.py
- tests/ported_static/stMemoryStressTest/test_static_call_bounds2a.py
- tests/ported_static/stMemoryStressTest/test_static_call_bounds3.py
Merge CREATE_Bounds{,2,3} into test_create_bounds.py parametrized on the
init code (offset, size) region, bounds 2^{28,32,64,128,256}-1. The old
files ran several CREATEs in one frame, so everything after the first
huge-size CREATE was dead code; each region is now its own case.

An entry contract calls the creator with all gas and stores the result
over a non-zero initial value plus a canary. Size 0 creates an empty
account holding the CREATE value at any offset; a huge size makes the
creator run out of gas and nothing is created. The unused memory
prefill, tx gas axis and balances are dropped; valid_from goes from
Cancun to TangerineWhistle (all-gas forwarding).

Removed:
- tests/ported_static/stMemoryStressTest/test_create_bounds2.py
- tests/ported_static/stMemoryStressTest/test_create_bounds3.py
Merge MLOAD_Bounds{,2}, MSTORE_Bounds{,2} and mload32bitBound* into
test_memory_op_bounds.py, one case per out-of-budget memory access
(MLOAD at 2^32-1, 2^32, 6294967296, 2^64-1, 2^128-1, 2^256-1; MSTORE
at 2^32-1, 2^40-1, 2^64-1; RETURN of 2^32-1 bytes with and without a
prior MSTORE). MLOAD_Bounds{,2} ran several accesses in one frame, so
only the first huge one ever executed; each is now its own case.

The old posts only showed the tx reverting (target balance or empty
storage). An entry contract now calls the target with all gas and
stores the CALL result over a non-zero initial value plus a canary.
The tx gas axis, values and balances are dropped; valid_from goes from
Cancun to TangerineWhistle (all-gas forwarding). The Prague-only
MLOAD_Bounds3/MSTORE_Bounds2a (affordable offsets under a 250M block)
are left as they are.

Removed:
- tests/ported_static/stMemoryStressTest/test_mload32bit_bound.py
- tests/ported_static/stMemoryStressTest/test_mload32bit_bound2.py
- tests/ported_static/stMemoryStressTest/test_mload32bit_bound_msize.py
- tests/ported_static/stMemoryStressTest/test_mload32bit_bound_return.py
- tests/ported_static/stMemoryStressTest/test_mload32bit_bound_return2.py
- tests/ported_static/stMemoryStressTest/test_mload_bounds.py
- tests/ported_static/stMemoryStressTest/test_mload_bounds2.py
- tests/ported_static/stMemoryStressTest/test_mstore_bounds.py
- tests/ported_static/stMemoryStressTest/test_mstore_bounds2.py
@marioevz marioevz added this to the Finalize Ported-Static milestone Nov 14, 2026
@codecov

codecov Bot commented Nov 14, 2026 •

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 95.11%. Comparing base (4c8ae33) to head (3d2dad3).
⚠️ Report is 12 commits behind head on forks/bogota.

Additional details and impacted files
@@              Coverage Diff              @@
##           forks/bogota    #4003   +/-   ##
=============================================
  Coverage         95.10%   95.11%           
=============================================
  Files               673      673           
  Lines             40904    40904           
  Branches           3778     3778           
=============================================
+ Hits              38903    38905    +2     
+ Misses             1393     1392    -1     
+ Partials            608      607    -1     
Flag Coverage Δ
unittests 95.10% <ø> (+<0.01%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@danceratopz danceratopz added the A-tests Area: Consensus tests. label Nov 17, 2026

@spencer-tb spencer-tb left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM! AI Swarm Review, 3x rotation of 10 fresh agents, findings re-checked by fills, traces and spec mutants, small things inline :)

The 25 dropped @manually-enhanced tags (memory, stack PUSH, addNonConst) guarded enhancements that still hold, so can we keep a tag on the merged files?

Checked: every old operand set against a new case, the shift results re-derived, a pre-Cancun fill of the touched files, a full-range fill, and spec mutants of try/catch rules against base.

@danceratopz danceratopz left a comment •

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to me. The four fixes are right, no filler is dropped, and the merged tests store the same values as the old ports. My points are small and come on top of Spencer's inline ones on the bounds tests.

  • Cases on Cancun: 514 old to 574 new. The only drops are duplicates (the PUSH1 arm in two files, the identical swap files) and the two calldatacopy arms with calldata, which nothing could observe. All 219 mapped cases and all 81 test_shallow_stack cases store the same post state, and 13 traced new cases on Cancun behave as intended.
  • Legacy material: the 13 files the PR writes have no # Source: blocks or raw hex left.

My agent ran the same checks as described in the #3997 review.

Area: coverage, readability
Priority: Minor

A few files in the same directories still have the patterns this PR fixes elsewhere. A follow-up PR is fine.

  • stMemoryStressTest/test_jumpi_bounds.py and test_jump_bounds2.py run four out-of-range jumps in one frame. The first one fails, so the other three are dead code, which the *CALL*_Bounds and CREATE_Bounds commits fixed by giving each bound its own case.
  • stMemoryTest/test_mload8bit_bound.py and test_mload16bit_bound.py store MLOAD of empty memory, which is 0, and expect empty storage, so the post holds whether or not the code runs. They differ only in the offset and fit one parametrized test.
Other leftovers in the touched directories (checked at the head)
  • stMemoryStressTest: test_jump_bounds.py, test_jumpi_bounds.py, test_jump_bounds2.py, test_pop_bounds.py, test_sload_bounds.py, test_sstore_bounds.py, test_dup_bounds.py and test_fill_stack.py keep valid_from("Cancun"), the tx_gas axis and the tx value, which the merged bounds tests dropped. The jump, pop, sload and sstore ones are the same "one op at bounds up to 2^256-1" family and could share one parametrized test.
  • stMemoryTest: test_mload8bit_bound.py and test_mload16bit_bound.py keep the fixed tx gas (220,000 and 100,000), value and balances.
  • stLogTests/test_log_in_oog_call.py keeps its # Source: lll comment, fixed 210,000 gas and balances (the commit says it is left unchanged on purpose).
  • stStackTests/test_underflow_test.py (3,930 lines) and test_shallow_stack.py still use valid_from("Cancun") and fixed tx gas. Larger, could be a follow-up PR.

Smaller things:

  • The other behaviour changes are only in the commit messages, which the squash merge drops: the lowered valid_from, top-level OOG becoming OOG in a sub-call, the dropped tx gas axes, duplicates and calldatacopy arm. A short list in the PR body would keep them.
  • One question inline, on the LOG caller's gas and value.

Comment on lines +187 to +191
caller = pre.deploy_contract(
code=Op.SSTORE(key=0, value=Op.CALL(address=logger))
+ Op.SSTORE(key=1, value=CANARY)
+ Op.STOP,
)

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Question: should the caller keep the old fillers' CALL(1000, logger, 23)? The logger then gets 1,000 gas plus the 2,300 stipend, so every success case also shows that its LOG fits in 3,300 gas, and the call carries value. With all gas and no value, a client that overcharges a LOG would still pass here. The commit message says the change is deliberate, so fine to keep it if you prefer.

Details

The old success cases pass with that budget on every fork they ran on, Cancun to Bogota (the most expensive, log4_non_empty_mem, needs about 2,200 gas). Something like this, not filled by my agent:

    caller = pre.deploy_contract(
        code=Op.SSTORE(
            key=0, value=Op.CALL(gas=1000, address=logger, value=23)
        )
        + Op.SSTORE(key=1, value=CANARY)
        + Op.STOP,
        balance=23,
    )

With a fixed gas the test no longer depends on the 63/64 rule, so valid_from could probably go back below TangerineWhistle.

Check the logger's LOG record (address, topics, data) through the
expected receipt, and an empty log list for the out-of-gas cases.
Restore the old fillers' zero-size call ahead of the huge one, so a
failing case shows the returned child's write is undone. Check the
counter's storage for STATICCALL, which never writes to the target.
Restore the old filler's empty CREATE, so a failing case shows the
created account is undone when the creator halts.
Carry the @manually-enhanced marker of the merged files over.
@danceratopz danceratopz mentioned this pull request Nov 20, 2026
13 of 27 tasks

@danceratopz danceratopz left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the fixes since the last review, Mario.

I asked my agent to re-check the new head (case mapping, fixture comparison, traces) and no case was dropped; the method is the same as in the #3997 review.

Comments inline.

  • Could the PR description list the behaviour changes too? The squash keeps only the body, so the restored first calls in the bounds tests, the log assertions, the lowered valid_from and the dropped duplicate cases would otherwise only be in the dropped commit messages.
  • Missed clean-up in files this PR does not touch, fine as a follow-up: stMemoryTest/test_mload8bit_bound.py and test_mload16bit_bound.py expect empty storage after MLOAD of empty memory, so the post holds whether or not the code runs; stMemoryStressTest/test_jumpi_bounds.py and test_jump_bounds2.py run four out-of-range jumps in one frame, so the last three are dead code.

One thread is still open, the LOG caller's gas budget: could you reply there with fixed or a short reason not to fix?

code, data = logger_code(topic_count, case)
logger = pre.deploy_contract(code=code)
caller = pre.deploy_contract(
code=Op.SSTORE(key=0, value=Op.CALL(address=logger))

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Follow-up to my earlier question on the logger's gas, which is still open. Now that the logs are asserted, would you keep the old fillers' budget? This call still forwards all gas, so a client that overcharges LOG still passes the success cases. Sending value like the fillers did (1,000 gas plus the 2,300 stipend) no longer works from Amsterdam on, because the transfer adds a log and breaks the new log assertions, but a plain 3,300 gas call without value does. I asked my agent to verify the change below: it fills on every fork through Bogota. Fine to leave as is if you prefer all gas.

Suggested diff (fills through Bogota: 658 passed)
diff --git a/tests/ported_static/stLogTests/test_log.py b/tests/ported_static/stLogTests/test_log.py
index be43e52f36..dfe11332bd 100644
--- a/tests/ported_static/stLogTests/test_log.py
+++ b/tests/ported_static/stLogTests/test_log.py
@@ -84,6 +84,8 @@ CASES_WITHOUT_TOPICS = [
     "non_empty_mem_log_mem_size1_log_mem_start31",
 ]
 CASES_WITH_TOPICS = ["max_topic", "caller", "pc"]
+# The old fillers' budget: 1,000 gas plus the 2,300 value stipend.
+LOGGER_GAS = 3_300
 
 
 def logger_code(topic_count: int, case: str) -> Tuple[Bytecode, bytes]:
@@ -207,7 +209,7 @@ def test_log(
     code, data = logger_code(topic_count, case)
     logger = pre.deploy_contract(code=code)
     caller = pre.deploy_contract(
-        code=Op.SSTORE(key=0, value=Op.CALL(address=logger))
+        code=Op.SSTORE(key=0, value=Op.CALL(gas=LOGGER_GAS, address=logger))
         + Op.SSTORE(key=1, value=CANARY)
         + Op.STOP,
     )

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

A-tests Area: Consensus tests.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants