pub struct ProverTranscript<Challenger> { /* private fields */ }Expand description
Prover transcript over some Challenger that writes to the internal tape and CanSample<F: Field>
A Transcript is an abstraction over Fiat-Shamir so the prover and verifier can send and receive data.
Implementations§
Source§impl<Challenger_: Challenger> ProverTranscript<Challenger_>
impl<Challenger_: Challenger> ProverTranscript<Challenger_>
Sourcepub fn new(challenger: Challenger_) -> Self
pub fn new(challenger: Challenger_) -> Self
Creates a new prover transcript.
By default debug assertions are set to the feature flag debug_assertions.
pub fn with_opts(challenger: Challenger_, options: Options) -> Self
pub fn finalize(self) -> Vec<u8> ⓘ
Sourcepub fn observe<'a, 'b>(&'a mut self) -> TranscriptWriter<'b, impl BufMut + 'b>where
'a: 'b,
pub fn observe<'a, 'b>(&'a mut self) -> TranscriptWriter<'b, impl BufMut + 'b>where
'a: 'b,
Returns a writable buffer that only observes the data written, without writing it to the proof tape.
This method should be used to observe the input statement.
Sourcepub fn decommitment(&mut self) -> TranscriptWriter<'_, impl BufMut>
pub fn decommitment(&mut self) -> TranscriptWriter<'_, impl BufMut>
Returns a writable buffer that only writes the data to the proof tape, without observing it.
This method should only be used to write openings of commitments that were already written
to the transcript as an observed message. For example, in the FRI protocol, the prover sends
a Merkle tree root as a commitment, and later sends leaf openings. The leaf openings should
be written using Self::decommitment because they are verified with respect to the
previously sent Merkle root.
Sourcepub fn message<'a, 'b>(&'a mut self) -> TranscriptWriter<'b, impl BufMut>where
'a: 'b,
pub fn message<'a, 'b>(&'a mut self) -> TranscriptWriter<'b, impl BufMut>where
'a: 'b,
Returns a writable buffer that observes the data written and writes it to the proof tape.
This method should be used by default to write prover messages in an interactive protocol.
Sourcepub fn grind(&mut self, bits: usize) -> u64where
Challenger_: Clone,
pub fn grind(&mut self, bits: usize) -> u64where
Challenger_: Clone,
Grinds a proof of work into the transcript, returning the nonce it found.
Searches for a nonce whose observation drives the next bits sampled bits to zero.
The nonce goes out as a message, and those bits are then sampled so the challenger advances.
VerifierTranscript::verify_grind is the matching check.
A prover that wants to re-roll whatever challenge comes next must redo this search first.
Every term derived from that challenge therefore gains bits of soundness.
That is how a protocol buys back a term no query count can touch.
The search is the obvious one: try nonces in order until one lands.
A trial is one challenger observation plus one sample, and lands with probability 2^-bits.
The expected cost is therefore 2^bits trials.
The search is serial, so a caller pays that in wall clock.
§Preconditions
bitsmust be at most 32, which is the width the sampler masks to.
Source§impl<Challenger_: Default + Challenger> ProverTranscript<Challenger_>
impl<Challenger_: Default + Challenger> ProverTranscript<Challenger_>
pub fn into_verifier(self) -> VerifierTranscript<Challenger_>
Trait Implementations§
Source§impl<F, Challenger_> CanSample<F> for ProverTranscript<Challenger_>where
F: Field,
Challenger_: Challenger,
impl<F, Challenger_> CanSample<F> for ProverTranscript<Challenger_>where
F: Field,
Challenger_: Challenger,
Source§impl<Challenger_> CanSampleBits<u32> for ProverTranscript<Challenger_>where
Challenger_: Challenger,
impl<Challenger_> CanSampleBits<u32> for ProverTranscript<Challenger_>where
Challenger_: Challenger,
fn sample_bits(&mut self, bits: usize) -> u32
Source§impl<Challenger: Clone> Clone for ProverTranscript<Challenger>
impl<Challenger: Clone> Clone for ProverTranscript<Challenger>
Source§fn clone(&self) -> ProverTranscript<Challenger>
fn clone(&self) -> ProverTranscript<Challenger>
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl<Challenger: Debug> Debug for ProverTranscript<Challenger>
impl<Challenger: Debug> Debug for ProverTranscript<Challenger>
Source§impl<Challenger_: Default + Challenger> Default for ProverTranscript<Challenger_>
impl<Challenger_: Default + Challenger> Default for ProverTranscript<Challenger_>
Auto Trait Implementations§
impl<Challenger> Freeze for ProverTranscript<Challenger>where
Challenger: Freeze,
impl<Challenger> RefUnwindSafe for ProverTranscript<Challenger>where
Challenger: RefUnwindSafe,
impl<Challenger> Send for ProverTranscript<Challenger>where
Challenger: Send,
impl<Challenger> Sync for ProverTranscript<Challenger>where
Challenger: Sync,
impl<Challenger> Unpin for ProverTranscript<Challenger>where
Challenger: Unpin,
impl<Challenger> UnsafeUnpin for ProverTranscript<Challenger>where
Challenger: UnsafeUnpin,
impl<Challenger> UnwindSafe for ProverTranscript<Challenger>where
Challenger: UnwindSafe,
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more