Open
Conversation
Collaborator
Author
|
@yelhousni one more thing I'm thinking about doing -- instead of manually defining the constants in |
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes and found 1 potential issue.
Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, have a team admin enable autofix in the Cursor dashboard.
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.

Description
I wanted to see if there are any stale generated files -- when we run go generate then we only create new files, but don't remove any existing implementation, so any leftovers from before will be kept.
So I deleted all files with "DO NOT EDIT" header and ran
go generate ./...again, which indicated that the following files were stale:for the direct e6 we have implemented it by hand, so the fix was to remove the header.
For the rest it seems it comes from the fact that we use early returns based on curve names, not by the features the curves provide.
Now instead of feature gating code generation based on curve names, we do it based on the features what the curves provide (HasG2, IsCompressiblePoint etc. or field suite MiMC etc based on configuration). This ensures that all the implementations are always up-to-date and we don't rely on manually-generated and copied implementation.
I implemented also code generation for a=-3 and a!=0 case. It seems with the dedicated formulas there is no regression compared to current hand-written implementation.
Type of change
Please delete options that are not relevant.
How has this been tested?
Generated files are consistent.
Checklist:
golangci-lintdoes not output errors locallyNote
High Risk
Touches core elliptic-curve arithmetic (doubling/tripling/scalar-mul) and serialization across multiple curves; small mistakes could cause incorrect group operations or invalid point acceptance in security-critical code.
Overview
Regenerates a large set of ECC generated files and updates curve formulas/metadata across
bls12-*,bls24-*,bn254,bw6-*,grumpkin,secp256k1, andsecp256r1.Arithmetic changes primarily clarify and standardize Jacobian/extended-Jacobian doubling constants (e.g., explicit
M = 3*X²) and documentation aroundTriple, plus minor cleanup (scoping temps) across G1/G2 implementations.Serialization and tests are refreshed: encoder/decoder error messages are curve-specific, compressed/uncompressed handling is tightened, several tests are adjusted for correct Jacobian initialization (
FromAffine) and deterministic field ops, andsecp256k1gains a full generatedmarshal.go+ tests.secp256r1additionally updates formulas to support nonzeroa(including adding aTripleimplementation and switching scalar multiplication to NAF mixed-add), and adds new batch/subgroup-related tests/bench adjustments.Written by Cursor Bugbot for commit 87b1bfe. This will update automatically on new commits. Configure here.