Skip to content

feat(stm): add missing off circuit checks - #3480

Open
damrobi wants to merge 5 commits into
mainfrom
damrobi/msnark/3381-add-off-circuit-checks
Open

feat(stm): add missing off circuit checks#3480
damrobi wants to merge 5 commits into
mainfrom
damrobi/msnark/3381-add-off-circuit-checks

Conversation

@damrobi

@damrobi damrobi commented Aug 13, 2026

Copy link
Copy Markdown
Collaborator

Content

This PR includes the addition of some missing off circuit checks. The goal of those checks is to prevent a prover from trying to create a proof that will fail to verify since the proof creation is a very expensive operations.

Changes

  • Validation of the protocol message hash: it was not done off circuit yet but is done at every step in circuit. Recompute the hash of the protocol message preimage and compares it to the MessageHash received.
  • Check of the validity of the genesis verification key: verifies the key is an actual point on the elliptic curve. The check is done at every step (even post genesis) in circuit.
  • Check that the protocol parameters do not evolve from one epoch to the next: check that protocol_parameters == next_protocol_parameters for the values coming from the rolling state. An update of the parameters would break the recursive proof.
  • Moved all the checks to before the generation of the non recursive proof to allow a failure before the heavy computation: This implied a big restructure of the code around the call to the IVC prover

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

Comments

Issue(s)

Closes #3381

@damrobi damrobi self-assigned this Aug 13, 2026
@github-actions

github-actions Bot commented Aug 13, 2026

Copy link
Copy Markdown

Test Results

     5 files  ± 0     209 suites  ±0   1h 45m 12s ⏱️ - 40m 24s
 3 407 tests  - 43   3 406 ✅  - 44  0 💤 ±0  1 ❌ +1 
11 267 runs   - 46  11 266 ✅  - 47  0 💤 ±0  1 ❌ +1 

For more details on these failures, see this check.

Results for commit b082171. ± Comparison against base commit 58b575a.

This pull request removes 51 and adds 8 tests. Note that renamed tests count towards both.
mithril-stm ‑ circuits::halo2::tests::golden::cases::negative::slow::index_out_of_bounds
mithril-stm ‑ circuits::halo2::tests::golden::cases::negative::slow::index_too_large_for_circuit_range
mithril-stm ‑ circuits::halo2::tests::golden::cases::negative::slow::indices_not_increasing
mithril-stm ‑ circuits::halo2::tests::golden::cases::negative::slow::leaf_merkle_path_mismatch
mithril-stm ‑ circuits::halo2::tests::golden::cases::negative::slow::leaf_swap_keep_merkle_path
mithril-stm ‑ circuits::halo2::tests::golden::cases::negative::slow::leaf_wrong_verification_key
mithril-stm ‑ circuits::halo2::tests::golden::cases::negative::slow::merkle_path_corrupt_sibling
mithril-stm ‑ circuits::halo2::tests::golden::cases::negative::slow::merkle_path_flip_position
mithril-stm ‑ circuits::halo2::tests::golden::cases::negative::slow::merkle_path_length_long
mithril-stm ‑ circuits::halo2::tests::golden::cases::negative::slow::merkle_path_length_short
…
mithril-stm ‑ circuits::halo2_ivc::state::tests::new_rejects_invalid_genesis_verification_key
mithril-stm ‑ proof_system::ivc_halo2_snark::prover_input_helpers::tests::assert_message_hash_matches_preimage::accepts_message_matching_preimage_hash
mithril-stm ‑ proof_system::ivc_halo2_snark::prover_input_helpers::tests::assert_message_hash_matches_preimage::rejects_message_not_matching_preimage_hash
mithril-stm ‑ proof_system::ivc_halo2_snark::rolling_state::tests::assert_correct_parameters::passes_at_first_step_even_when_protocol_parameters_differ
mithril-stm ‑ proof_system::ivc_halo2_snark::rolling_state::tests::assert_correct_parameters::passes_when_protocol_parameters_match_past_first_step
mithril-stm ‑ proof_system::ivc_halo2_snark::rolling_state::tests::assert_correct_parameters::rejects_diverged_protocol_parameters_past_first_step
mithril-stm ‑ protocol::aggregate_signature::clerk::tests::aggregate_signatures_with_type_ivc_snark_fails_when_genesis_verification_key_is_absent
mithril-stm ‑ protocol::aggregate_signature::clerk::tests::aggregate_signatures_with_type_ivc_snark_fails_when_prover_data_carries_no_ivc_rolling_state

♻️ This comment has been updated with latest results.

@damrobi
damrobi deployed to testing-preview August 14, 2026 11:29 — with GitHub Actions Active
@damrobi
damrobi deployed to testing-2-preview August 14, 2026 11:29 — with GitHub Actions Active
@damrobi
damrobi deployed to testing-preview August 14, 2026 14:50 — with GitHub Actions Active
@damrobi
damrobi deployed to testing-2-preview August 14, 2026 14:50 — with GitHub Actions Active
@damrobi
damrobi force-pushed the damrobi/msnark/3381-add-off-circuit-checks branch from 8233f3e to b082171 Compare August 14, 2026 16:08
@damrobi
damrobi marked this pull request as ready for review August 14, 2026 16:09
Comment on lines +85 to +94
pub(crate) fn finish_prepare<D: MembershipDigest>(
checks: IvcProverInputChecks,
certificate_proof: &SnarkProof<D>,
message: &[u8],
aggregate_verification_key_for_snark: &AggregateVerificationKeyForSnark<D>,
global: &Global,
protocol_message_preimage: &ProtocolMessagePreimage,
rolling_state: &IvcRollingState,
prover_setup: &IvcSnarkProverSetup,
) -> StmResult<Self> {
Comment on lines +85 to +94
pub(crate) fn finish_prepare<D: MembershipDigest>(
checks: IvcProverInputChecks,
certificate_proof: &SnarkProof<D>,
message: &[u8],
aggregate_verification_key_for_snark: &AggregateVerificationKeyForSnark<D>,
global: &Global,
protocol_message_preimage: &ProtocolMessagePreimage,
rolling_state: &IvcRollingState,
prover_setup: &IvcSnarkProverSetup,
) -> StmResult<Self> {
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.

Add missing IVC off-circuit checks

2 participants