Skip to content

plonk(recursion): handle zero public inputs in PI computation and add tests#1618

Merged
ivokub merged 5 commits intoConsensys:typo/fixes-v15from
Forostovec:fix/plonk-recursion-zero-public-inputs
Dec 18, 2025
Merged

plonk(recursion): handle zero public inputs in PI computation and add tests#1618
ivokub merged 5 commits intoConsensys:typo/fixes-v15from
Forostovec:fix/plonk-recursion-zero-public-inputs

Conversation

@Forostovec
Copy link
Copy Markdown
Contributor

@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

Handles zero public inputs in recursive PLONK PI computation and adds a test verifying recursive proof with no public inputs.

  • Verifier (std/recursion/plonk/verifier.go):
    • Safely compute PI when there are zero public inputs:
      • Initialize pi to 0 and only accumulate ∑ Lᵢ*wᵢ when len(witness.Public) > 0.
      • Adjust lagrange/denom/wPowI progression to avoid out-of-range access.
  • Tests (std/recursion/plonk/verifier_test.go):
    • Add InnerCircuitZeroPublic and getInnerZeroPublic helper.
    • New test TestZeroPublicInputsBW6InBN254 validating recursive verification for a circuit with no public inputs (ensures witness.Public is empty).

Written by Cursor Bugbot for commit 3f3d36c. 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
@ivokub
Copy link
Copy Markdown
Collaborator

ivokub commented Dec 17, 2025

Thanks for the contribution. Indeed, it crashed before. I only added a small change to avoid doing non-native 0+Pi[0]*L_0. It would have taken hot path anyway, but imo a bit cleaner.

@ivokub ivokub changed the base branch from master to typo/fixes-v15 December 18, 2025 00:16
@ivokub ivokub merged commit e37f3d9 into Consensys:typo/fixes-v15 Dec 18, 2025
3 checks passed
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