Skip to content

Conversation

Forostovec
Copy link

@Forostovec Forostovec commented Sep 29, 2025

This change fixes a crash in the recursive PLONK verifier when a circuit has zero public inputs. Previously, PrepareVerification unconditionally accessed witness.Public[0], causing an out-of-range panic. We now initialize PI to zero and only sum Lagrange contributions when len(witness.Public) > 0, matching the native backend’s behavior for zero-public-input circuits. A dedicated test was added to ensure recursive verification succeeds with an inner circuit that has no public inputs.


Note

Safely compute PI when there are zero public inputs and add a test verifying recursive proof works with an inner circuit that has no public inputs.

  • Verifier (std/recursion/plonk/verifier.go):
    • Initialize pi to 0 and compute Lagrange sum only when len(witness.Public) > 0.
    • Restructure PI loop: guard first term, adjust wPowI/lagrange updates to avoid out-of-range access.
  • Tests (std/recursion/plonk/verifier_test.go):
    • Add InnerCircuitZeroPublic and helper to produce proof with zero public inputs.
    • Add TestZeroPublicInputsBW6InBN254 to ensure recursive verification succeeds with empty witness.Public.

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

@ivokub ivokub added type: typo Fixes typos in comments or documentation src: community Community originating PRs and issues labels Oct 7, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

src: community Community originating PRs and issues type: typo Fixes typos in comments or documentation

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants