Skip to content

PLONK: range-check the proof's evaluations - #29

Open
SamDelaney wants to merge 2 commits into
mainfrom
sam/plonk-eval-range
Open

SamDelaney wants to merge 2 commits into
mainfrom
sam/plonk-eval-range

Conversation

@SamDelaney

Copy link
Copy Markdown
Collaborator

Fixes #28.

plonk_prepare_proof reduced the proof's six evaluation scalars mod r without a range check, so the fixture proof still verified with a_eval + r or z_omega - r. This closes the last known gap of the kind #23 closed for public inputs (#12) and #25 and #26 closed for Bulletproofs.

Changes

  • plonk_prepare_proof decodes each evaluation with scalar_in_field, which fails outside [0, r). Failing matches how the function already treats a bad point. The helper moves from bullet.ak to common/inputs.ak, so both proof decoders share one check; Bulletproofs behaviour and costs are unchanged.
  • tests/plonk_props.ak gets four tests: a fail property that shifts any of the six evaluations by k * r (k from -1000 to 1000, not zero), fail tests for an evaluation of exactly r and of -1, and a test that 0 and r - 1 decode. The r and -1 tests compare the decoded scalar instead of verifying, because a wrong evaluation fails verification with or without the check.
  • PLONK report: the check (sections 3 and 4), the tests (section 7) and the re-measured cost. Test counts go from 89 to 93 in the three report headers and the root README.

Checks

  • aiken check -D: 93/93, no warnings. aiken build succeeds, and aiken fmt is clean on the committed files.
  • Mutation-checked: removing either half of the check, moving either bound by one in either direction, or skipping it for any one of the six evaluations makes at least one new test fail. The property and the r and -1 tests fail on main.
  • Cost: verifying the PLONK fixture goes from 4,971,405 mem / 8,114,984,267 CPU to 4,986,729 / 8,118,889,553, about 15K memory and 3.9M CPU more. compressed_proof_round_trip (Bulletproofs) is unchanged.

Note

#27 edits the same test-count lines and the PLONK cost paragraph, so whichever merges second needs a small rebase. Neither changes the other's test count, so the total after both is 93.

SamDelaney and others added 2 commits November 19, 2026 09:25
plonk_prepare_proof converted the six evaluation scalars with
scalar.from_int, which reduces mod r and accepts negative values. The
transcript hashes each evaluation only after that reduction, so a proof
with a_eval + r or z_omega - r verified exactly like the original, and one
proof had unboundedly many encodings. It now fails unless every evaluation
is in [0, r), as uncompress_proof does for Bulletproofs scalars.

The check is scalar_in_field, moved from bullet.ak to common/inputs.ak so
both proof decoders share it; Bulletproofs behaviour and costs are
unchanged. Verifying the PLONK fixture costs about 15K more memory and
3.9M more CPU.

New tests in tests/plonk_props: a fail property shifting any evaluation by
k * r (k from -1000 to 1000, not zero), fail tests for an evaluation of
exactly r and of -1, and a test that 0 and r - 1 decode. Removing either
half of the check, moving either bound by one in either direction, or
skipping it for any one evaluation makes one of them fail.

Fixes #28

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
PLONK report: the check in sections 3 and 4, the new tests in section 7,
and the re-measured fixture cost (4.99M memory, 8.12B CPU). Test counts go
from 89 to 93 in all three report headers and the root README, which still
said 79; the PLONK report's point_tests paragraph still said 82.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
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.

PLONK: plonk_prepare_proof reduces the evaluation scalars mod r, so one proof has many encodings that verify

1 participant