-
Notifications
You must be signed in to change notification settings - Fork 439
feat: GKR Add Instance #1504
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
base: master
Are you sure you want to change the base?
feat: GKR Add Instance #1504
Conversation
Co-authored-by: Copilot <[email protected]>
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.
Pull Request Overview
This PR refactors the GKR API to decouple circuit definition from instance assignment, replaces the Println function with GetValue, and improves gate registration by checking for duplicate definitions and renaming GkrCompressions to GkrPermutations.
- Separation of circuit definition and instance assignment in the GKR API
- Removal of Println in favor of GetValue and updates in hint generation functions
- Enhanced gate registration logic with duplicate checks and more precise error reporting
Reviewed Changes
Copilot reviewed 51 out of 51 changed files in this pull request and generated 1 comment.
Show a summary per file
File | Description |
---|---|
internal/gkr/bls24-315/gate_testing.go | Added EqualGateFunction helper for comparing gate functions |
internal/gkr/bls12-381/solver_hints.go | Refactored SolvingData with new options and padding strategy |
internal/gkr/bls12-381/gkr.go | Fixed MulAcc to correctly multiply instead of adding |
internal/gkr/bls12-377/solver_hints.go & gkr.go | Similar refactoring as in bls12-381 modules |
internal/generator/backend/template/* | Updated template hints and solver generation to use the new SolvingData |
constraint/solver/gkrgates/registry_test.go | Modified tests to account for the updated Register API return values |
constraint/solver/gkrgates/registry.go | Revised Register function to return a (bool, error) tuple and added equality check |
constraint/*/solver.go (across multiple curves) | Updated solver initialization to use the new gkr.NewSolvingData helper |
Comments suppressed due to low confidence (2)
constraint/solver/gkrgates/registry.go:113
- Consider adding a comment explaining the rationale behind setting curvesForTesting to [ecc.BN254] and allowedCurves to gnark.Curves() when no curves are specified, to improve maintainability.
if len(curvesForTesting) == 0 {
constraint/solver/gkrgates/registry.go:122
- The updated Register function returns (false, nil) when a gate is already registered. Consider updating the documentation to clearly define this behavior for API consumers.
if g, ok := gates[s.name]; ok {
Change the GKR API so that defining the circuit and assigning instances are separated. It removes the necessity of defining hints for the output and deferred "finalize" functions.
Remove the
Println
function in favor ofGetValue
.gkrgates.Register
now checks if a gate of the same name has already been registered. If so, it compares the gates and returns an error if they are not equal. If they are equal, it returnsfalse, nil
.Remove all logic pertaining to reordering of wires and instances.
Unless the user explicitly provides their own initial challenge, automatically use all input and output of the circuit as initial Fiat-Shamir challenge.
Rename
GkrCompressions
toGkrPermutations
to correctly reflect its function. (Note: a future PR should implement compressions instead and revert the name change)A benchmark for gkr-poseidon2