feat(stm): add missing off circuit checks - #3480
Conversation
Test Results 5 files ± 0 209 suites ±0 1h 38m 3s ⏱️ - 40m 2s Results for commit 7a4a79a. ± Comparison against base commit c8ff793. This pull request removes 41 and adds 10 tests. Note that renamed tests count towards both.♻️ This comment has been updated with latest results. |
8233f3e to
b082171
Compare
hjeljeli32
left a comment
There was a problem hiding this comment.
Good initial work 👍 . I left 2 comments.
99e2d7b to
1da401e
Compare
hjeljeli32
left a comment
There was a problem hiding this comment.
LGTM. I just left 2 non-blocking suggestions.
added regular protocol message check to genesis branch and refactored IvcProverInput functions
There was a problem hiding this comment.
Pull request overview
Adds early off-circuit validation to avoid generating expensive proofs for invalid IVC transitions.
Changes:
- Validates message hashes, genesis keys, and protocol-parameter continuity.
- Splits IVC request validation from proof generation.
- Adds focused validation tests and propagates new errors.
Reviewed changes
Copilot reviewed 10 out of 10 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
signature.rs |
Propagates global validation failures. |
clerk.rs |
Runs preflight checks before proving. |
rolling_state.rs |
Checks protocol-parameter continuity. |
prover_input.rs |
Splits validation and preparation. |
prover_input_helpers.rs |
Adds message-preimage hash validation. |
proof.rs |
Exposes genesis and transition preflight checks. |
setup.rs |
Handles fallible global construction. |
state.rs |
Validates genesis verification keys. |
errors.rs |
Adds validation error variants. |
bench/helpers.rs |
Propagates global construction errors. |
Suppressed comments (1)
mithril-stm/src/proof_system/ivc_halo2_snark/prover_input.rs:63
- The new preflight still does not validate that the rolling state's step counter can advance. A state at
u64::MAXpasses this function, soaggregate_signatures_with_typegenerates the expensive certificate proof and only then fails inbuild_next_statewithStepCounterOverflow. Invokenew_step_counter()here so this existing failure path is rejected before proving, as intended by this split.
let transition_type = IvcTransitionType::try_compute_transition_type(
rolling_state,
protocol_message_preimage,
)?;
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
| match current_rolling_state { | ||
| Some(rolling_state) => { | ||
| rolling_state.assert_protocol_parameters_unchanged()?; | ||
|
|
||
| off_circuit_checks(msg, &avk, &protocol_message_preimage, rolling_state)?; |
| /// # Errors | ||
| /// Fails if the genesis Schnorr verifying key is absent, the message preimage is not PREIMAGE_SIZE bytes, | ||
| /// or the proof itself fails. | ||
| /// Bundles the outputs of [`prepare_ivc_snark_request`]: everything [`prove_ivc_snark`] needs to |
| } | ||
|
|
||
| /// Generates the certificate proof and completes IVC proving for a request already validated by | ||
| /// [`prepare_ivc_snark_request`]. |
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
protocol_parameters == next_protocol_parametersfor the values coming from the rolling state. An update of the parameters would break the recursive proof.Pre-submit checklist
Comments
Issue(s)
Closes #3381