Skip to content

fix(tests): Optimize filling of MIP-8 tests#31

Merged
pdobacz merged 3 commits into
forks/monad_ninefrom
optimize-fill
Jul 1, 2026
Merged

fix(tests): Optimize filling of MIP-8 tests#31
pdobacz merged 3 commits into
forks/monad_ninefrom
optimize-fill

Conversation

@pdobacz

@pdobacz pdobacz commented Jul 1, 2026

Copy link
Copy Markdown
Collaborator

Closes ENG-1130

Two tests were culprit of excessive feature release generation. The reason was two-fold:

  • thousands of test cases because of covering a huge matrix of parameters
  • long individual runs because doing a lot of SSTORE operations to write down assertion results

This PR solves both - splits the largest parameters set, which used to cover the full page store (4x32 slots) into a separate test, and also splits the remaining test cases into parametrizations which are sections of the original parameter space.

Greptile Summary

This PR refactors two expensive test functions in the MIP-8 pageified storage test suite by extracting the logic into private helpers (_state_growth_counters_inside_subcall and _state_growth_counters_after_subcall) and splitting each into a small-value parametric test and a dedicated full-page test, while also shrinking the measurement sweep from a full page to exactly the slots actually touched.

  • Parametric range reduced: slot-count params changed from [0, 1, 32] to [0, 1, 2], with the 32-slot scenario moved to separate *_full_page tests (3 and 12 cases respectively).
  • measured_slots optimization: instead of always sweeping all SLOTS_PER_PAGE (128) slots, a formula is used to sweep only as far as the farthest slot actually written, with a runtime assert to guard the page boundary.
  • after_subcall cross-product: the (call_op × child_exit) product is replaced with 6 hand-picked pairs (all call_ops under STOP, all child_exits under CALL), dropping DELEGATECALL/CREATE × {REVERT,INVALID,SELFDESTRUCT} combinations from the parametric sweep.

Confidence Score: 4/5

Safe to merge; the refactor correctly reduces test generation cost without breaking the logic of the measurement sweep or the full-page boundary test.

The measured_slots formula accurately covers exactly the slots written by the setup prefix, the runtime assert guards the page boundary, and the full-page tests preserve all original call_op x child_exit combinations. The only gap is that DELEGATECALL and CREATE paired with non-STOP exits are no longer exercised under the small-value parametric sweep, so a defect that only appears with slot counts of 0, 1, or 2 in those paths would be missed.

The cross-product reduction logic in test_state_growth_counters_after_subcall (lines 1760-1778) deserves a second look to confirm the intentional coverage trade-off is acceptable.

Important Files Changed

Filename Overview
tests/monad_ten/mip8_pageified_storage/test_cross_call.py Logic extracted into two private helpers; parametric tests now use small values [0,1,2] while full-page tests use all-32; measured_slots formula correctly reflects actual slot layout; one coverage gap noted for non-STOP exits with DELEGATECALL/CREATE in the parametric sweep.

Flowchart

%%{init: {'theme': 'neutral'}}%%
flowchart TD
    A["test_state_growth_counters_inside_subcall"] --> H1["_state_growth_counters_inside_subcall"]
    B["test_state_growth_counters_inside_subcall_full_page"] --> H1
    C["test_state_growth_counters_after_subcall"] --> H2["_state_growth_counters_after_subcall"]
    D["test_state_growth_counters_after_subcall_full_page"] --> H2
Loading
%%{init: {'theme': 'base', 'themeVariables': {"darkMode": true, "background": "#0d1117", "primaryColor": "#21262d", "primaryTextColor": "#e6edf3", "primaryBorderColor": "#8b949e", "lineColor": "#8b949e", "textColor": "#e6edf3", "edgeLabelBackground": "#161b22", "actorBkg": "#21262d", "actorBorder": "#8b949e", "actorTextColor": "#e6edf3", "actorLineColor": "#8b949e", "signalColor": "#8b949e", "signalTextColor": "#e6edf3", "noteBkgColor": "#373320", "noteBorderColor": "#d4a72c", "noteTextColor": "#f0e6c0", "labelBoxBkgColor": "#21262d", "labelBoxBorderColor": "#8b949e", "labelTextColor": "#e6edf3", "loopTextColor": "#e6edf3", "activationBkgColor": "#30363d", "activationBorderColor": "#8b949e"}}}%%
flowchart TD
    A["test_state_growth_counters_inside_subcall"] --> H1["_state_growth_counters_inside_subcall"]
    B["test_state_growth_counters_inside_subcall_full_page"] --> H1
    C["test_state_growth_counters_after_subcall"] --> H2["_state_growth_counters_after_subcall"]
    D["test_state_growth_counters_after_subcall_full_page"] --> H2
Loading

Fix All in Claude Code

Prompt To Fix All With AI
Fix the following 1 code review issue. Work through them one at a time, proposing concise fixes.

---

### Issue 1 of 1
tests/monad_ten/mip8_pageified_storage/test_cross_call.py:1760-1778
**Missing combinations in parametric sweep**

The six hand-picked `(call_op, child_exit)` pairs leave `DELEGATECALL + REVERT`, `DELEGATECALL + INVALID`, `DELEGATECALL + SELFDESTRUCT`, `CREATE + REVERT`, `CREATE + INVALID`, and `CREATE + SELFDESTRUCT` out of the small-value combinatorial test. Those six combinations only appear in `test_state_growth_counters_after_subcall_full_page` with all slot params hardcoded to 32. A bug that surfaces exclusively with small slot counts (e.g. 0 or 1) in `DELEGATECALL + REVERT` would pass undetected.

Reviews (1): Last reviewed commit: "cap state growth measurement sweep to sl..." | Re-trigger Greptile

Greptile also left 1 inline comment on this PR.

pdobacz added 3 commits June 30, 2026 13:37
Replace 32 in the 6 size axes with 2 for the combinatoric matrix and
move full-page (128-slot) coverage into dedicated low-cardinality tests.

Co-Authored-By: Claude <claude-opus-4-8>
Replace the full 3x4 call_op x child_exit product with the union of
all call_op under STOP and all child_exit under CALL (8748 -> 4374).

Co-Authored-By: Claude <claude-opus-4-8>
Sweep only up to the farthest slot the params reach instead of a full
page, dropping the per-case cost ~10x for the small-value variants.

Co-Authored-By: Claude <claude-opus-4-8>
@pdobacz pdobacz requested review from QEDK and mijovic as code owners July 1, 2026 10:08
Comment thread tests/monad_ten/mip8_pageified_storage/test_cross_call.py
@pdobacz pdobacz merged commit 6c4209c into forks/monad_nine Jul 1, 2026
5 checks passed
@pdobacz pdobacz deleted the optimize-fill branch July 1, 2026 15:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants