refactor(stm): combine pairing checks ivc verify - #3454
Conversation
Test Results 5 files ± 0 209 suites ±0 59m 49s ⏱️ - 1h 36m 49s Results for commit bd5a2c8. ± Comparison against base commit 084c534. This pull request removes 73 and adds 2 tests. Note that renamed tests count towards both.♻️ This comment has been updated with latest results. |
2a4c47e to
5433b3a
Compare
cd079a5 to
b75f104
Compare
There was a problem hiding this comment.
Pull request overview
This PR refactors IvcProof::verify to batch the dual MSM (KZG opening) and folded accumulator pairing equations into a single combined pairing check, reducing verifier time by avoiding a second multi-Miller loop + final exponentiation.
Changes:
- Convert the folded accumulator equation into a
DualMSM, scale it by a transcript-derived challenger, and add it to the proof’sdual_msmbefore running a single pairing check. - Replace the two distinct verification failure variants with a single
IvcProofError::MsmPairingCheckFailed. - Update verification tests and add a test asserting the combined check holds for multiple candidate scalars.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 5 comments.
| File | Description |
|---|---|
| mithril-stm/src/proof_system/ivc_halo2_snark/proof.rs | Implements the combined pairing check in verify and updates/adds tests accordingly. |
| mithril-stm/src/proof_system/ivc_halo2_snark/errors.rs | Collapses prior error variants into MsmPairingCheckFailed for the new combined check path. |
Suppressed comments (6)
mithril-stm/src/proof_system/ivc_halo2_snark/proof.rs:222
- The PR description says to keep (or rerun) an individual pairing check on failure to identify whether the dual MSM or the accumulator caused the failure. The current implementation always returns
MsmPairingCheckFailedwithout re-checking individual equations, so the error source is lost and the PR behavior no longer matches the stated intent/issue acceptance criteria.
if !combined.check(verifier_setup.verifier_params()) {
return Err(IvcProofError::MsmPairingCheckFailed.into());
}
mithril-stm/src/proof_system/ivc_halo2_snark/proof.rs:751
- This assertion message still claims the failure is specifically the “KZG opening check”, but the error is now
MsmPairingCheckFailedfrom the combined pairing check. Update the message to match the new behavior.
Some(&IvcProofError::MsmPairingCheckFailed),
"different protocol message must fail the KZG opening check, got: {err}"
mithril-stm/src/proof_system/ivc_halo2_snark/proof.rs:778
- This assertion message still refers to the “KZG opening check”, but the code now reports
MsmPairingCheckFailedfrom the combined pairing check. Adjust the message to prevent confusion when the test fails.
Some(&IvcProofError::MsmPairingCheckFailed),
"mismatched state corrupts public inputs and must fail the KZG opening check, got: {err}"
mithril-stm/src/proof_system/ivc_halo2_snark/proof.rs:805
- This assertion message still refers to the “KZG opening check”, but verification now reports
MsmPairingCheckFailedfrom the combined pairing check. Update the message to match the new error semantics.
Some(&IvcProofError::MsmPairingCheckFailed),
"mismatched accumulator corrupts public inputs and must fail the KZG opening check, got: {err}"
mithril-stm/src/proof_system/ivc_halo2_snark/proof.rs:830
- This assertion message still mentions the “KZG opening check”, but the code now fails via the combined pairing check and returns
MsmPairingCheckFailed. Update the message to reflect the combined-check behavior.
Some(&IvcProofError::MsmPairingCheckFailed),
"Poseidon bytes via Blake2b path must fail the KZG opening check, got: {err}"
mithril-stm/src/proof_system/ivc_halo2_snark/proof.rs:874
- This assertion message still claims the failure is specifically the “accumulator check (not the KZG check)”, but verification now returns a single
MsmPairingCheckFailedfor the combined check, so the distinction no longer exists. Update the message to avoid implying separate error paths.
Some(&IvcProofError::MsmPairingCheckFailed),
"wrong fixed bases must fail the accumulator check (not the KZG check), got: {err}"
3c1f9df to
615d02b
Compare
|
LGTM |
615d02b to
cf79ba8
Compare
…for the r value also fixed comments and tests mentioning separated checks
cf79ba8 to
bd5a2c8
Compare
Content
This PR includes an update to the verification function of the recursive proof to combine the two pairing checks (dual MSM and accumulator) into one to speed up the verification.
Changes
rto combine as: combined_msm = dual_msm + r * acc_msmMeasured gain
Pre-submit checklist
Issue(s)
Closes #3420