Speed up verifier identity MSMs - #292
Open
ValarDragon wants to merge 2 commits into
Open
Conversation
ValarDragon
force-pushed
the
optimize/montgomery-identity-msm
branch
from
August 31, 2026 19:02
95d2a31 to
125a7ec
Compare
ValarDragon
marked this pull request as ready for review
August 31, 2026 19:43
ValarDragon
force-pushed
the
optimize/montgomery-identity-msm
branch
from
September 2, 2026 07:33
125a7ec to
41fdb3c
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
CurveExt;that identity-only operation;
Halo2 verifiers.
Public
MSM::eval, point-returning MSMs, custom verification strategies, andthe prepared fixed-base zero-check path remain canonical and unchanged.
Rationale
A Pasta scalar with value
kis stored as the reduced residueR k mod q.Interpreting those limbs directly therefore scales the complete MSM by
R.Because
Ris invertible modulo the prime group order, the scaled result isthe identity exactly when the canonical result is. An identity-only caller can
thus skip both scalar canonicalization and an output-point
R^-1correction.The public hook treats full width as a performance hint only: every
Someverdict is exact for zero, sparse, small, or dense scalars, and unsupported or
unprofitable inputs return
Noneand usebest_multiexp.Performance
These are drift-corrected interleaved control/candidate Criterion means. Each
leg used 40-50 samples, a 2 s warm-up, and a 5 s measurement period. Negative
values mean this branch was faster.
orbitsorbitsThe
orbitsrows used unprepared parameters; armed prepared zero checks keeptheir existing route. A point-returning version was also tested on the full
Orchard prover and was flat to 0.2-0.3% slower, so no prover or commitment path
is included here.
Release Apple-arm64 inspection confirms that the existing canonical scalar
decomposition remains instruction-for-instruction identical to
main. The newpath reads Montgomery limbs without
PrimeField::to_reprand performs nooutput-point correction.
Testing
orbits: 215 and 233 passed;orbits: 138 and 136 passed;plonk_apivalid/invalid single and batch verification, with andwithout
orbits;git diff --check.API
This adds the defaulted public
CurveExt::try_multiexp_full_width_is_identity_vartimemethod. Its defaultimplementation returns
None, preserving downstreamCurveExtimplementations. The implementation also adds crate-private helpers for the
Pasta backend and Halo2's verifier-only evaluator.