Enforce PCS transcript iterator cardinality - #232
Open
latifkasuli wants to merge 1 commit into
Open
Conversation
latifkasuli
force-pushed
the
feature/pcs-transcript-cardinality
branch
from
August 18, 2026 10:58
5881c22 to
e0f65d6
Compare
latifkasuli
marked this pull request as ready for review
August 18, 2026 11:05
latifkasuli
requested review from
albert-garreta and
frozenspider
as code owners
August 18, 2026 11:05
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.
Follow-up to #231.
PcsProverTranscript::write_const_many_itercurrently sizes and zero-fills the proof stream from the declared length, then zips those chunks with the supplied iterator. A short iterator therefore leaves zero-filled proof elements that the prover never absorbs, while the verifier later reads and absorbs them. A long iterator is silently truncated, and an overflowing declared length can panic.This PR:
InvalidInputerror for underflow, overflow, zero-width encodings, and length arithmetic overflow;The transcript-v1 snapshot pins the existing proof bytes and next challenge for an exact write. A focused
Zip+ IPRS/Prove(batch=1, poly_size=2^12)Criterion run measured 494.63 us onmainand 495.46 us with this implementation; proof size remains 150,380 bytes. The discarded transcript-clone prototype measured 517.56 us under the same configuration.Tests cover exact writes, short/empty/long inputs, zero-width encodings, overflowing lengths, non-
ExactSizeIteratorinputs, atomic rollback, the transcript-v1 compatibility snapshot, PCS round trips, protocol round trips, and existing tamper cases. Proof-stream encapsulation is intentionally deferred to a separate follow-up.