Skip to content

Conversation

@Tabaie
Copy link
Contributor

@Tabaie Tabaie commented Jun 3, 2025

  • 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 of GetValue.

  • 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 returns false, 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 to GkrPermutations to correctly reflect its function. (Note: a future PR should implement compressions instead and revert the name change)

  • A benchmark for gkr-poseidon2


Note

Adds a new GKR API with Compile/AddInstance and GetValue, refactors hint/solver plumbing, strengthens gate registration (dup/equality and curve constraints), and updates generators/tests/examples accordingly.

  • GKR API:
    • Introduces API.NewInput, Circuit.Compile, Circuit.AddInstance, and Circuit.GetValue; removes Import/Series/Solve/Solution and Println.
    • Default Fiat–Shamir seed derives from all inputs/outputs unless a custom initial challenge is provided.
  • Hints/Solver Integration:
    • New per-curve hint engine (internal/gkr/gkrhints) with GetAssignment, Solve, and Prove hints; solvers now override these hints accordingly.
    • Solver hints reworked to instance-by-instance computation and padding to next power-of-two.
    • Exposes ComputeLogNbInstances for proof deserialization.
  • Gate Registry:
    • gkrgates.Register options now validate and may error; prevents duplicate conflicting registrations and supports curve-allowlists; adds equality check for gate functions.
  • Generators/Templates:
    • Fix MulAcc to multiply (was add); add EqualGateFunction helper; update generated solver hints to new flow.
  • Internal Types/Utils:
    • Simplify circuit info (remove reordering/dependency machinery); add slice helpers (ExtendRepeatLast, etc.).
  • Examples/Tests:
    • Revamp tests and examples (incl. Poseidon2 compressor) to new API; add benchmarks and registry tests; minor doc fix (logderivlookup).

Written by Cursor Bugbot for commit 61302f4. This will update automatically on new commits. Configure here.

@Tabaie Tabaie requested a review from Copilot June 3, 2025 20:27
Copilot

This comment was marked as outdated.

@Tabaie Tabaie marked this pull request as ready for review June 3, 2025 21:05
@Tabaie Tabaie requested review from gbotrel and ivokub June 3, 2025 21:05
@Tabaie Tabaie requested a review from Copilot June 3, 2025 21:15
cursor[bot]

This comment was marked as outdated.

cursor[bot]

This comment was marked as outdated.

@ivokub ivokub added the feat: gkr PRs related to GKR label Sep 11, 2025
cursor[bot]

This comment was marked as outdated.

cursor[bot]

This comment was marked as outdated.

cursor[bot]

This comment was marked as outdated.

cursor[bot]

This comment was marked as outdated.

cursor[bot]

This comment was marked as outdated.

@Tabaie Tabaie requested a review from ivokub October 2, 2025 13:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

feat: gkr PRs related to GKR

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Enable the GKR API to add instances

2 participants