Skip to content

fix: register gates in GKR Poseidon#1719

Merged
ivokub merged 12 commits intomasterfrom
fix/register-gkrposeidon2-gates
Feb 19, 2026
Merged

fix: register gates in GKR Poseidon#1719
ivokub merged 12 commits intomasterfrom
fix/register-gkrposeidon2-gates

Conversation

@ivokub
Copy link
Copy Markdown
Collaborator

@ivokub ivokub commented Feb 17, 2026

Description

Fixes # (issue)

Type of change

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • This change requires a documentation update

How has this been tested?

  • Test A
  • Test B

How has this been benchmarked?

  • Benchmark A, on Macbook pro M1, 32GB RAM
  • Benchmark B, on x86 Intel xxx, 16GB RAM

Checklist:

  • I have performed a self-review of my code
  • I have commented my code, particularly in hard-to-understand areas
  • I have made corresponding changes to the documentation
  • I have added tests that prove my fix is effective or that my feature works
  • I did not modify files generated from templates
  • golangci-lint does not output errors locally
  • New and existing unit tests pass locally with my changes
  • Any dependent changes have been merged and published in downstream modules

Note

Low Risk
Small, localized change to gate registration ordering with minimal behavioral impact beyond ensuring required gates are registered exactly once; main risk is subtle runtime differences if callers relied on prior implicit registration behavior.

Overview
Fixes missing/duplicated GKR gate registration for Poseidon2 by introducing registerStaticGates() (guarded by sync.Once) and invoking it from both defineCircuit and exported RegisterGates.

Removes unused gate/name helpers (extGate and roundGateNamer.integrated) and centralizes registration of the shared gates (pow*, extGate2, intGate2, extAddGate) so solver setup is deterministic across curves and call sites.

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

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR fixes a bug where several polynomial gates used in the GKR-based Poseidon2 implementation were not being registered with the solver. The gates pow4Gate, pow4TimesGate, pow3Gate, pow2Gate, and pow2TimesGate are used in the circuit definition but were missing from the registerGates function, which would cause runtime failures when the solver tries to use them.

Changes:

  • Added explicit registration for five polynomial gates (pow4Gate, pow4TimesGate, pow3Gate, pow2Gate, pow2TimesGate) in the registerGates function

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread std/permutation/poseidon2/gkr-poseidon2/gkr-poseidon2.go Outdated
Comment thread std/permutation/poseidon2/gkr-poseidon2/gkr-poseidon2.go Outdated
Copy link
Copy Markdown

@cursor cursor bot left a comment

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 and found 2 potential issues.

Comment thread std/permutation/poseidon2/gkr-poseidon2/gkr-poseidon2.go Outdated
Comment thread std/permutation/poseidon2/gkr-poseidon2/gkr-poseidon2.go Outdated
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 1 out of 1 changed files in this pull request and generated no new comments.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@ivokub ivokub merged commit bbfb2f7 into master Feb 19, 2026
13 checks passed
@ivokub ivokub deleted the fix/register-gkrposeidon2-gates branch February 19, 2026 00:47
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.

3 participants