pub struct VerifierTranscript<Challenger> { /* private fields */ }Expand description
Verifier transcript over some Challenger that reads from the internal tape and CanSample<F: Field>
You must manually call the destructor with finalize() to check anything that’s written is
fully read out
Implementations§
Source§impl<Challenger_: Challenger> VerifierTranscript<Challenger_>
impl<Challenger_: Challenger> VerifierTranscript<Challenger_>
pub fn new(challenger: Challenger_, vec: Vec<u8>) -> Self
pub fn with_opts( challenger: Challenger_, vec: Vec<u8>, options: Options, ) -> Self
pub fn finalize(self) -> Result<(), Error>
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 reading it from the proof tape.
This method should be used to observe the input statement.
Sourcepub fn decommitment(&mut self) -> TranscriptReader<'_, impl Buf + '_>
pub fn decommitment(&mut self) -> TranscriptReader<'_, impl Buf + '_>
Returns a readable buffer that only reads the data from the proof tape, without observing it.
This method should only be used to read advice that was previously written to the transcript as an observed message.
Sourcepub fn message<'a, 'b>(&'a mut self) -> TranscriptReader<'b, impl Buf>where
'a: 'b,
pub fn message<'a, 'b>(&'a mut self) -> TranscriptReader<'b, impl Buf>where
'a: 'b,
Returns a readable buffer that observes the data read.
This method should be used by default to read verifier messages in an interactive protocol.
Sourcepub fn verify_grind(&mut self, bits: usize) -> Result<u64, Error>
pub fn verify_grind(&mut self, bits: usize) -> Result<u64, Error>
Checks the proof of work that ProverTranscript::grind wrote, returning its nonce.
Reads the nonce as a message, so the challenger observes the same bytes the prover fed it.
Then samples bits and requires every one of them to be zero.
Both transcripts consume the same challenger state either way.
So a caller may keep going after an error without the two sides drifting apart.
§Errors
Returns Error::InsufficientWork when the sampled bits are not all zero.
Returns a deserialization error when the tape holds no nonce.
§Preconditions
bitsmust be at most 32, which is the width the sampler masks to.
Trait Implementations§
Source§impl<F, Challenger_> CanSample<F> for VerifierTranscript<Challenger_>where
F: Field,
Challenger_: Challenger,
impl<F, Challenger_> CanSample<F> for VerifierTranscript<Challenger_>where
F: Field,
Challenger_: Challenger,
Source§impl<Challenger_> CanSampleBits<u32> for VerifierTranscript<Challenger_>where
Challenger_: Challenger,
impl<Challenger_> CanSampleBits<u32> for VerifierTranscript<Challenger_>where
Challenger_: Challenger,
fn sample_bits(&mut self, bits: usize) -> u32
Source§impl<Challenger: Clone> Clone for VerifierTranscript<Challenger>
impl<Challenger: Clone> Clone for VerifierTranscript<Challenger>
Source§fn clone(&self) -> VerifierTranscript<Challenger>
fn clone(&self) -> VerifierTranscript<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 VerifierTranscript<Challenger>
impl<Challenger: Debug> Debug for VerifierTranscript<Challenger>
Source§impl<Challenger> Drop for VerifierTranscript<Challenger>
impl<Challenger> Drop for VerifierTranscript<Challenger>
Auto Trait Implementations§
impl<Challenger> !Freeze for VerifierTranscript<Challenger>
impl<Challenger> RefUnwindSafe for VerifierTranscript<Challenger>where
Challenger: RefUnwindSafe,
impl<Challenger> Send for VerifierTranscript<Challenger>where
Challenger: Send,
impl<Challenger> Sync for VerifierTranscript<Challenger>where
Challenger: Sync,
impl<Challenger> Unpin for VerifierTranscript<Challenger>where
Challenger: Unpin,
impl<Challenger> UnsafeUnpin for VerifierTranscript<Challenger>where
Challenger: UnsafeUnpin,
impl<Challenger> UnwindSafe for VerifierTranscript<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