Prover

Struct Prover 

Source
pub struct Prover {
    pub prover_key: Option<ProverKey>,
    pub preprocessed_transcript: Transcript,
    /* private fields */
}
Expand description

Abstraction structure designed to construct a circuit and generate Proofs for it.

Fields§

§prover_key: Option<ProverKey>

ProverKey which is used to create proofs about a specific PLONK circuit

§preprocessed_transcript: Transcript

Store the messages exchanged during the preprocessing stage This is copied each time, we make a proof

Implementations§

Source§

impl Prover

Source

pub fn composer_mut(&mut self) -> &mut TurboComposer

Mutable borrow of TurboComposer.

Source

pub fn preprocess(&mut self, commit_key: &CommitKey) -> Result<(), Error>

Preprocesses the underlying constraint system.

Source§

impl Prover

Source

pub fn new(label: &'static [u8]) -> Prover

Creates a new Prover instance.

Source

pub fn with_size(label: &'static [u8], size: usize) -> Prover

Creates a new Prover object with some expected size.

Source

pub const fn gates(&self) -> u32

Returns the number of gates in the circuit thet the Prover actually stores inside.

Source

pub fn clear_witness(&mut self)

Resets the witnesses in the prover object. This function is used when the user wants to make multiple proofs with the same circuit.

Source

pub fn clear(&mut self)

Clears all data in the Prover instance. This function is used when the user wants to use the same Prover to make a Proof regarding a different circuit.

Source

pub fn key_transcript(&mut self, label: &'static [u8], message: &[u8])

Keys the Transcript with additional seed information Wrapper around Transcript::append_message.

Source

pub fn prove_with_preprocessed( &self, commit_key: &CommitKey, prover_key: &ProverKey, ) -> Result<Proof, Error>

Creates a [Proof] that demonstrates that a circuit is satisfied.

§Note

If you intend to construct multiple Proofs with different witnesses, after calling this method, the user should then call Prover::clear_witness. This is automatically done when Prover::prove is called.

Source

pub fn prove(&mut self, commit_key: &CommitKey) -> Result<Proof, Error>

Proves a circuit is satisfied, then clears the witness variables If the circuit is not pre-processed, then the preprocessed circuit will also be computed.

Trait Implementations§

Source§

impl Default for Prover

Source§

fn default() -> Prover

Returns the “default value” for a type. Read more

Auto Trait Implementations§

§

impl Freeze for Prover

§

impl RefUnwindSafe for Prover

§

impl Send for Prover

§

impl Sync for Prover

§

impl Unpin for Prover

§

impl UnwindSafe for Prover

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self>

Converts 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 more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

Converts 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
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.