-
Notifications
You must be signed in to change notification settings - Fork 502
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
Revamps GKR with Compile/AddInstance API and default Fiat–Shamir challenge, adds a reusable hints engine wired into solvers, and hardens gate registration and codegen across curves.
API.NewInput,API.Compile(returns*Circuit), and per-instanceCircuit.AddInstance; removes oldSolve/Printlnpaths.Circuit.GetValue(debug), automatic padding, and default initial Fiat–Shamir challenge (commitment to inputs/outputs) unless provided.gkrhintsengine (GetAssignment,Solve,Prove) and solvers now override these hints for all curves.solver_hints.goandgate_testing.goper curve; fixesMulAccto multiply.gkrgates.Registeroptions validate exclusivity, support per-gate curve allowlists, detect and compare duplicate registrations, and exposeEqualGateFunctionchecks; updated tests.gkrinfo.StoringInfo(removes dependency/print logic);CircuitInfoToCircuitsetsNbUniqueOutputsand validates curves.SliceOfRefs,ExtendRepeatLast) and exportsComputeLogNbInstances.GkrCompressor, builds circuit via new API, and addsRegisterGkrGates.GetValue), adds new benchmarks; removes legacy hint/test paths.Written by Cursor Bugbot for commit dec4b30. This will update automatically on new commits. Configure here.