Skip to content

refactor(GKR): Remove the Z/pZ assumption - #1859

Open
Tabaie wants to merge 11 commits into
masterfrom
feat/gkr/extensions
Open

Tabaie wants to merge 11 commits into
masterfrom
feat/gkr/extensions

Conversation

@Tabaie

@Tabaie Tabaie commented Oct 2, 2026 •

Copy link
Copy Markdown
Contributor

This PR refactors the GKR codebase, in particular gate testing infrastructure and code generation, so that they accommodate extension fields.

NOTE: Pinning an unmerged gnark-crypto. Only to be merged after that.


Note

High Risk
Changes Fiat–Shamir binding/challenge derivation and gate compilation over all GKR curves, which can alter proof transcripts and break compatibility with prior proofs if encodings differ.

Overview
This PR drops the implicit “everything is ℤ/pℤ” assumption in GKR by threading a gkrcore.Field description (prime field via PrimeField, extensions via minimal polynomial) through gate compilation, gate metadata discovery (degree / solvable variable), circuit compile APIs, and test caches. Gate testing now runs over both BN254 and a sample extension field so metadata stays consistent outside prime fields.

Fiat–Shamir is centralized: per-curve transcript copies are removed in favor of gkrcore.HashTranscript, which binds elements with Marshal() and derives challenges via Challenge() (replacing getChallenge / Bytes()). Prove/verify and sumcheck paths across curves are updated accordingly.

Supporting cleanup includes renaming internal/small_rational → internal/rational, exposing Field / PrimeField on gkrapi.Compile, updating codegen templates, refreshing GKR benchmarks to Poseidon2, tightening test-vector parsing (big.Rat, Marshal in fake hashes), fixing Groth16 test proof padding for empty commitments, and bumping gnark-crypto.

Reviewed by Cursor Bugbot for commit 8f615fb. Bugbot is set up for automated code reviews on this repo. Configure here.

Tabaie added 7 commits October 1, 2026 08:36
Signed-off-by: Arya Tabaie <arya.pourtabatabaie@gmail.com>
Signed-off-by: Arya Tabaie <arya.pourtabatabaie@gmail.com>
Signed-off-by: Arya Tabaie <arya.pourtabatabaie@gmail.com>
Signed-off-by: Arya Tabaie <arya.pourtabatabaie@gmail.com>
Signed-off-by: Arya Tabaie <arya.pourtabatabaie@gmail.com>
Signed-off-by: Arya Tabaie <arya.pourtabatabaie@gmail.com>
Signed-off-by: Arya Tabaie <arya.pourtabatabaie@gmail.com>
@Tabaie
Tabaie requested a review from a team as a code owner October 2, 2026 02:40
@socket-security

socket-security Bot commented Oct 2, 2026 •

Copy link
Copy Markdown

Review the following changes in direct dependencies. Learn more about Socket for GitHub.

Diff Package Supply Chain
Security
Vulnerability Quality Maintenance License
Updatedgolang/​github.com/​consensys/​gnark-crypto@​v0.21.1-0.20260913224755-1409fe592052 ⏵ v0.21.1-0.20261002031104-9e7ec3b0d8ca76 +1100100100100

View full report

Tabaie added 4 commits October 1, 2026 21:45
Signed-off-by: Arya Tabaie <arya.pourtabatabaie@gmail.com>
Signed-off-by: Arya Tabaie <arya.pourtabatabaie@gmail.com>
@Tabaie
Tabaie added this pull request to stack #1869 October 6, 2026 05:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant