-
Notifications
You must be signed in to change notification settings - Fork 494
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
| c.assignments[wI] = utils.ExtendRepeatLast(c.assignments[wI], nbPaddedInstances) | ||
| } | ||
| for _, wI := range c.outs { | ||
| c.assignments[wI] = utils.ExtendRepeatLast(c.assignments[wI], nbPaddedInstances) |
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.
Bug: Intermediate wires not padded in finalize
The padding logic only extends input and output wire assignments to the next power of 2, but intermediate wires are not padded. This creates an inconsistency because the ProveHint calls repeatUntilEnd which pads all wires including intermediate ones. The mismatch between frontend and hint padding could cause the GKR proof verification to fail or produce incorrect results when intermediate wire values are accessed after padding.
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
Printlnfunction in favor ofGetValue.gkrgates.Registernow 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
GkrCompressionstoGkrPermutationsto correctly reflect its function. (Note: a future PR should implement compressions instead and revert the name change)A benchmark for gkr-poseidon2
Note
Introduce a compile-then-add-instances GKR API with GetValue, enforce gate registry validation (incl. curve support and equality checks), refactor hints/solvers, and update Poseidon2 compressor, generators, and tests.
API.NewInput,API.Compile,Circuit.AddInstance, andCircuit.GetValue; remove oldSolve/Verifyflow andPrintln.gkrgates):RegisterOptions with validation; prevent conflicting duplicate registrations by function equality checks; support per-gate allowed curves; addEqualGateFunction.gkrhintsengine (GetAssignment,Solve,Prove) across curves; generate-newsolver_hintsand fixMulAccto multiply.gkrinfo(remove dependency/permutation logic); exportComputeLogNbInstances; add utilsSliceOfRefs,ExtendRepeatLast.GkrCompressionswithGkrCompressor; addRegisterGkrGates; adapt circuits/tests.gate_testing.gogeneration; adjust outputs when not generating test vectors.Written by Cursor Bugbot for commit f05b1c1. This will update automatically on new commits. Configure here.