Repository navigation
PLONK: range-check the proof's evaluations - #29
Open
SamDelaney wants to merge 2 commits into
Open
SamDelaney wants to merge 2 commits into
SamDelaney wants to merge 2 commits into
Conversation
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>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #28.
plonk_prepare_proofreduced the proof's six evaluation scalars modrwithout a range check, so the fixture proof still verified witha_eval + rorz_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_proofdecodes each evaluation withscalar_in_field, which fails outside[0, r). Failing matches how the function already treats a bad point. The helper moves frombullet.aktocommon/inputs.ak, so both proof decoders share one check; Bulletproofs behaviour and costs are unchanged.tests/plonk_props.akgets four tests: afailproperty that shifts any of the six evaluations byk * r(kfrom -1000 to 1000, not zero),failtests for an evaluation of exactlyrand of-1, and a test that0andr - 1decode. Therand-1tests compare the decoded scalar instead of verifying, because a wrong evaluation fails verification with or without the check.Checks
aiken check -D: 93/93, no warnings.aiken buildsucceeds, andaiken fmtis clean on the committed files.rand-1tests fail onmain.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.