Skip to content

test(stm): consolidate the recursive circuit MockProver tests - #3486

Open
hjeljeli32 wants to merge 10 commits into
mainfrom
hjeljeli32/3464-consolidate-recursive-circuit-mockprover-tests
Open

test(stm): consolidate the recursive circuit MockProver tests#3486
hjeljeli32 wants to merge 10 commits into
mainfrom
hjeljeli32/3464-consolidate-recursive-circuit-mockprover-tests

Conversation

@hjeljeli32

@hjeljeli32 hjeljeli32 commented Aug 24, 2026

Copy link
Copy Markdown
Collaborator

Content

This PR consolidates the MockProver tests in circuits::halo2_ivc and replaces every negative case's verify().is_err() with an exact failure signature. Consolidating test functions saves nothing, since MockProver::run re-synthesizes on every call, so only removing invocations helps. The tests were also weaker than their names: six were found to reject even with their tampering removed, because the cheap stimulus pairs empty proof slots with a trivial accumulator, which balances only at genesis where the gating scales both accumulator contributions to the group identity.

Measured locally at -j 4 on the ci-tests-snark profile: the slow tier goes from 403.2 s to 277.9 s aggregated and 107.0 s to 76.5 s wall, 22 tests becoming 15 and 20 MockProver invocations becoming 14. Net of −6.5 s drift on untouched tests, −118.7 s is attributable; about 65 s of the saving went on four deliberately added invocations. Fast tier unchanged at 541 passing. Per-item numbers are in #3464.

Changes

  • Failure-signature helper (tests/common/failure_signature.rs): a runner generic over Circuit<NativeField> asserting that the failing rows on the public-statement instance column are exactly the expected set and that every failure is a permutation failure. Unit-tested on a minimal two-instance-column circuit.
  • Public-input layout (tests/common/public_input_layout.rs): named row accessors for the global, state and accumulator sections, so no test carries a row literal, guarded by section-length and serialization-order tests.
  • Satisfiable non-genesis fixtures (tests/common/helpers.rs, tests/transitions/positive.rs): same-epoch and next-epoch stimuli built from the committed step assets, so nothing is proved at test time, plus two untampered acceptance cases; the first in-circuit positive coverage of non-genesis steps.
  • Consolidated binding cases (tests/transitions/negative/): thirteen single-field cases become three, one per transition context. Coverage widens at no cost, the step counter and the two genesis verification-key rows having been untested.
  • Preimage encoding cases (tests/encoding/negative.rs): the three byte-range cases now assert the message row plus the decoded field their window feeds, flipping one byte rather than filling a range. A new case isolates the message equality.
  • Accumulator case (tests/in_circuit/accumulator.rs): an untampered canary on a clone, then the whole accumulator section asserted rather than one element. Keeps its freshly proved certificate, the only unseen proof the circuit verifies.
  • Row-dependent mutation delta: mutations add row + 1, since two tampered cells in one permutation class stay equal under a shared delta and left one accumulator row unreported.
  • Deletions: in_circuit/state_transition.rs in full and public_inputs.rs's slow module: six cases, three vacuous and three duplicating the genesis case. Both weak rejection helpers are gone.
  • Genesis-only stimulus made explicit: the trivial-accumulator builders are renamed to say genesis and assert the step counter is zero, their generic names having invited the non-genesis use.
  • Not covered, unchanged from main: the chain-link constraints have no negative coverage, which the deleted cases did not provide either, and an exact row set does not prove each row carries the field named for it. Both are recorded for follow-up.

Pre-submit checklist

  • Branch
    • Tests are provided (if possible)
    • Crates versions are updated (if relevant)
    • CHANGELOG file is updated (if relevant)
    • Commit sequence broadly makes sense
    • Key commits have useful messages
  • PR
    • All check jobs of the CI have succeeded
    • Self-reviewed the diff
    • Useful pull request description
    • Reviewer requested
  • Documentation
    • No new TODOs introduced

Issue(s)

Closes #3464

@hjeljeli32 hjeljeli32 self-assigned this Aug 24, 2026
@hjeljeli32 hjeljeli32 added the run-slow-tests Technical label to run slow tests tiers in the CI. label Aug 24, 2026
@hjeljeli32
hjeljeli32 removed the request for review from curiecrypt August 24, 2026 03:10
@github-actions

github-actions Bot commented Aug 24, 2026

Copy link
Copy Markdown

Test Results

     5 files  ± 0     209 suites  ±0   1h 49m 11s ⏱️ + 49m 41s
 3 465 tests +69   3 465 ✅ +69  0 💤 ±0  0 ❌ ±0 
11 328 runs  +78  11 328 ✅ +78  0 💤 ±0  0 ❌ ±0 

Results for commit 9f019ec. ± Comparison against base commit 6ca6181.

♻️ This comment has been updated with latest results.

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Pull request overview

Consolidates recursive-circuit MockProver tests while strengthening rejection assertions with exact failure signatures.

Changes:

  • Adds public-input layout and failure-signature helpers.
  • Introduces satisfiable non-genesis fixtures and positive checks.
  • Consolidates negative transition, encoding, and accumulator cases.

Reviewed changes

Copilot reviewed 16 out of 16 changed files in this pull request and generated 4 comments.

Show a summary per file
File Description
transitions/positive.rs Adds non-genesis acceptance tests.
transitions/negative/same_epoch.rs Consolidates same-epoch binding checks.
transitions/negative/next_epoch.rs Consolidates next-epoch binding checks.
transitions/negative/genesis.rs Consolidates genesis public-input checks.
transitions/mod.rs Clarifies transition-test scope.
in_circuit/state_transition.rs Removes redundant negative tests.
in_circuit/public_inputs.rs Removes migrated MockProver checks.
in_circuit/mod.rs Updates test organization documentation.
in_circuit/accumulator.rs Checks the complete accumulator signature.
golden/positive.rs Uses explicit genesis fixtures.
encoding/negative.rs Adds exact preimage failure signatures.
common/public_input_layout.rs Defines named public-input rows.
common/mod.rs Exposes new test helpers.
common/helpers.rs Adds asset-backed step fixtures.
common/generators/mod.rs Removes unused generator exports.
common/failure_signature.rs Adds exact MockProver failure classification.
Suppressed comments (1)

mithril-stm/src/circuits/halo2_ivc/tests/common/public_input_layout.rs:58

  • These crate-visible enum variants are missing doc comments. Document each variant so the public row-layout API remains self-describing.
pub(crate) enum StateField {

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment thread mithril-stm/src/circuits/halo2_ivc/tests/common/public_input_layout.rs Outdated

@damrobi damrobi left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

LGTM 👍
Just one small nitpick and the Copilot comments that seem relevant

Comment thread mithril-stm/src/circuits/halo2_ivc/tests/common/failure_signature.rs Outdated
@hjeljeli32
hjeljeli32 force-pushed the hjeljeli32/3464-consolidate-recursive-circuit-mockprover-tests branch from fe8639f to 9f019ec Compare August 25, 2026 01:07
@hjeljeli32
hjeljeli32 deployed to testing-2-preview August 25, 2026 02:08 — with GitHub Actions Active
@hjeljeli32
hjeljeli32 deployed to testing-preview August 25, 2026 02:08 — with GitHub Actions Active

@jpraynaud jpraynaud 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 👍

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

Labels

run-slow-tests Technical label to run slow tests tiers in the CI.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Consolidate the recursive circuit MockProver tests

4 participants