- 
                Notifications
    
You must be signed in to change notification settings  - Fork 489
 
feat: add Grumpkin elliptic curve (native 2-cycle with BN254) #1409
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
Conversation
          Bug: Incorrect Validation Logic in Decompose FunctionThe  Additional Locations (1) | 
    
          Bug: Input/Output Validation Logic ErrorThe input/output length validation uses   | 
    
          Bug: Invalid Length Handling Causes Out-of-Bounds AccessThe   | 
    
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good to me. I updated a bit:
- package documentation style
 - implemented 
algebra.Curveinterface by adding marshaling - tests for point marshaling
 - added explicit check that the native field is BN254 when initializing Curve
 - decomposition hint input validation
 
With that I saw similar issues for other 2-chain curves. I'll submit them in a separate PR.
Description
This PR implements arithmetic over the Grumpkin elliptic curve as native operations in a BN254 SNARK. This is similar to
sw_bls12377andsw_bls24315packages, except there is no (efficient) pairing on Grumpkin. This needs Consensys/gnark-crypto#625 to be merged first.Grumpkin forms a 2-cycle with BN254 and the combination is useful for many protocols.
TODO:
Type of change
How has this been tested?
Arithmetic tests against gnark-crypto are implemented + edge cases.
How has this been benchmarked?
Checklist:
golangci-lintdoes not output errors locallyNote
Introduce native Grumpkin curve support (affine ops, scalar/joint/multi-scalar mul with GLV) and wire it into defaults and emulation params, with hints and tests.
std/algebra/native/sw_grumpkinimplementing GrumpkinG1Affineops (Add,Double, unified add), scalar mul (const/variable, GLV endomorphism), joint and multi-scalar mul (incl. folding), base mul, marshalling, and equality.std/algebra/defaults.goto returnCurve[sw_grumpkin.ScalarField, sw_grumpkin.G1Affine]viasw_grumpkin.NewCurve.emparams.GrumpkinFpandemparams.GrumpkinFr.sw_grumpkin.Written by Cursor Bugbot for commit 82bd788. This will update automatically on new commits. Configure here.