-
Notifications
You must be signed in to change notification settings - Fork 281
feat(grumpkin): GLV scalar decomposition + generic MSM crate #1211
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
quangvdao
wants to merge
15
commits into
a16z:main
Choose a base branch
from
quangvdao:grumpkin
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Conversation
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
…ndow sweep - Add GLV inline constants and decompose_scalar for Grumpkin - Split PIPPENGER_WINDOW into BASELINE_WINDOW and GLV_WINDOW - Add window sweep benchmarks: GLV_WINDOW=10 is ~2x faster than 12 - Add GLV_PROGRESS.md tracking benchmarks and findings
Window sweep results: w=8 gives 105M cycles vs 261M at w=12 (2.5x speedup)
…LV+Pippenger - Use heap allocation (Box) for large precompute tables - Increase guest memory to 128MB, stack to 64MB - Document precompute sizes and full sweep results
- Add examples/msm/ with modular Pippenger, GLV, and fixed-base MSM - Define MsmGroup, WindowedScalar, GlvCapable traits - Implement Grumpkin curve integration in curves/grumpkin.rs - GLV+Pippenger is ~1.2% faster than old impl (103.8M vs 105.1M cycles) - Fixed-base has ~2% overhead due to trait indirection (acceptable) - Update GLV_PROGRESS.md with benchmark comparison
Replaced by generic examples/msm/ with trait-based abstractions.
- Add edge case tests for GLV decomposition (k=0, k=n-1, k=λ, etc.) - Add GLV lattice determinant verification test - Add timing documentation for variable-time MSM operations - Untrack GLV_PROGRESS.md (local development notes)
Adds missing assertion that half-scalar bytes.len() <= 16, matching the check in sdk.rs. Prevents potential out-of-bounds panic during trace generation if GLV decomposition somehow produces oversized values.
quangvdao
added a commit
to quangvdao/jolt
that referenced
this pull request
Jan 23, 2026
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
This PR adds GLV (Gallant-Lambert-Vanstone) scalar decomposition for Grumpkin and a modular, trait-based MSM implementation.
This code has only been lightly audited and may contain bugs. While a security review was conducted covering the critical cryptographic invariants (GLV decomposition correctness, endomorphism properties, Pippenger algorithm), the implementation has not undergone a formal third-party audit. Use with caution in production systems.
Dependencies
This PR builds on top of the base Grumpkin field division inlines. Please merge #1209 first.
What's New
GLV Scalar Decomposition (
jolt-inlines/grumpkin/)GrumpkinPoint::endomorphism()— maps(x, y) → (βx, y)whereβ³ = 1GrumpkinPoint::decompose_scalar(k)— splits 256-bit scalar into two ~128-bit half-scalars(k₁, k₂)wherek ≡ k₁ + k₂·λ (mod n)hcf()to spoil proof on mismatchGRUMPKIN_GLVR_ADVvirtual instruction for non-deterministic decomposition adviceGeneric MSM Crate (
examples/msm/)MsmGroup,WindowedScalar,GlvCapabletraits for curve-agnostic MSMFixedBaseTablefor generator multiplication (lookups + additions only)Security Hardening
β³ = 1,λ² + λ + 1 = 0,φ³ = Id,φ(P) = [λ]Pn₁₁·n₂₂ − n₁₂·n₂₁ = nk = 0, 1, n-1, λ, λ±1, λ²Benchmarks (MSM_SIZE = 1024)
Key results:
Files Changed
jolt-inlines/grumpkin/src/sdk.rs— GLV constants, endomorphism, decompose_scalarjolt-inlines/grumpkin/src/lib.rs— GLV inline opcode registrationjolt-inlines/grumpkin/src/sequence_builder.rs— GLV advice implementationjolt-inlines/grumpkin/src/host.rs— Inline registrationjolt-inlines/grumpkin/src/tests.rs— Security invariant testsexamples/msm/— New generic MSM crate with Grumpkin integration