Skip to content

feat(GKR): Koalabear - #1868

Merged
Tabaie merged 44 commits into
masterfrom
feat/gkr/e6
Nov 3, 2026
Merged

Tabaie merged 44 commits into
masterfrom
feat/gkr/e6

Conversation

@Tabaie

@Tabaie Tabaie commented Oct 6, 2026 •

Copy link
Copy Markdown
Contributor

This PR finishes the implementation of GKR for Koalabear.
The input and output columns are over Koalabear. The outgoing claims are over E6.
Internally, the first round of each sum-check is mixed. All other rounds are entirely over the extensions.


Note

High Risk
Changes the Fiat–Shamir transcript and Prove/Verify hasher API across all curves; incorrect caller seeding or challenge ordering would break soundness, and the rename is a breaking public API change.

Overview
Refactors GKR Fiat–Shamir across the generated curve packages: Prove/Verify now take hash.FieldHasher, transcripts use Absorb/Squeeze via NewNativeTranscript (replacing byte hash.Hash and Bind/Challenge), and BindGkrFinalEvalProof is renamed to AbsorbGkrFinalEvalProof. Each curve moves from package gkr to its own package (e.g. gkrbn254), with shared gkr.EvaluationClaim and gkr.PrimeField used from constraint gate registration.

Adds DeserializeProof as the inverse of Proof.Flatten, tightens Claims.Check (wire 0, instance count, missing wires, evaluation-point length), and documents that verifiers must seed the hasher like the prover. Sumcheck proving splits eq/input evaluation buffers in roundPolynomial; tests add Poseidon2 end-to-end flatten/deserialize flows and stronger claim checks, with test helpers moved to gkrtesting.

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

Tabaie added 25 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>
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>
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>
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 6, 2026 05:57
@Tabaie
Tabaie added this pull request to stack #1869 October 6, 2026 05:58
Tabaie added 2 commits October 9, 2026 09:36
Signed-off-by: Arya Tabaie <arya.pourtabatabaie@gmail.com>
Signed-off-by: Arya Tabaie <arya.pourtabatabaie@gmail.com>

@cursor cursor Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cursor Bugbot has reviewed your changes using high effort and found 2 potential issues.

There are 3 total unresolved issues (including 1 from previous review).

Fix All in Cursor

❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.

Reviewed by Cursor Bugbot for commit 4f6c711. Configure here.

Comment thread gkr/koalabear/gkr.go Resolved
Comment thread gkr/koalabear/gkr.go Resolved
Tabaie added 3 commits October 9, 2026 11:58
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>
Base automatically changed from feat/gkr/extensions to master October 16, 2026 14:18
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>
@socket-security

socket-security Bot commented Oct 18, 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.22.1-0.20261009142911-8911ee45d22b ⏵ v0.22.1-0.20261103155519-1a9aede5b1c376 +1100100100100

View full report

Signed-off-by: Arya Tabaie <arya.pourtabatabaie@gmail.com>
@Tabaie

Tabaie commented Oct 18, 2026

Copy link
Copy Markdown
Contributor Author

Thanks for the feedback @ivokub. I think I addressed it all. Though it now pins an unmerged gnark-crypto commit from Consensys-Incorporated/gnark-crypto#920

@Tabaie
Tabaie requested a review from ivokub October 18, 2026 20:28
@Tabaie Tabaie mentioned this pull request Oct 19, 2026
Signed-off-by: Arya Tabaie <arya.pourtabatabaie@gmail.com>
ivokub
ivokub previously approved these changes Oct 22, 2026

@ivokub ivokub left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

All comments from the previous round are addressed. Claims.Check now ties each claim's evaluation-point length to the assignment's column size, which closes the soundness gap where a proof covering a subset of instances verified against a larger assignment — the main finding of last round. The new regression test covers exactly that attack.

The switch to hash.FieldHasher is a strict improvement: it removes the SetBytesCanonical panic path for non-field-native hashes and makes the transcript field-aware. The PadBlock fix in 81c88ac is important and correct — without it a Squeeze is not committed into the running state, so "squeeze, then absorb" would be transcript-indistinguishable from absorbing alone. Renames (Absorb/Squeeze, roundPolynomialBaseInputs/roundPolynomialExt) match behavior now.

Non-blocking notes: (1) consider exporting a default hasher constructor from gkr/koalabear (e.g. NewPoseidon2Hasher) so external callers don't need to discover extensionsHash.NewBaseFieldHashAdapterE6(poseidon2.NewMerkleDamgardHasher()) themselves — the prime-field backends have mimc.NewFieldHasher(), KoalaBear has no equivalent; (2) the gnark-crypto pin needs updating once the upstream PR lands. The API breaks vs master (gkrapi.Field removal, BindGkrFinalEvalProof rename) are acceptable here since external use goes through the concrete backend constructors.

@ivokub
ivokub dismissed their stale review October 22, 2026 00:07

Though perhaps we should wait for a bit for the FieldHasher PR feedback? I also recommended some changes there, particularly for the extension adapter (which perhaps makes sense o remove there and we just do the slicing of the array here).

@ivokub ivokub left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@Tabaie - is it ready to merge? Should we update gnark-crypto to its master?

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 commented Nov 3, 2026 •

Copy link
Copy Markdown
Contributor Author

@Tabaie - is it ready to merge? Should we update gnark-crypto to its master?

@ivokub Should be good now!

@Tabaie
Tabaie requested a review from ivokub November 3, 2026 16:11

@ivokub ivokub left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks! Looks good and corresponds to gnark-crypto changes. Good to merge!

@Tabaie
Tabaie removed this pull request from stack #1869 November 3, 2026 18:24
@Tabaie
Tabaie merged commit 9f5b5bd into master Nov 3, 2026
17 checks passed
@Tabaie
Tabaie deleted the feat/gkr/e6 branch November 3, 2026 18:25
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.

2 participants