[−][src]Struct bulletproofs::r1cs::Verifier
A ConstraintSystem
implementation for use by the verifier.
The verifier adds high-level variable commitments to the transcript, allocates low-level variables and creates constraints in terms of these high-level variables and low-level variables.
When all constraints are added, the verifying code calls verify
which consumes the Verifier
instance, samples random challenges
that instantiate the randomized constraints, and verifies the proof.
Methods
impl<'t> Verifier<'t>
[src]
pub fn new(transcript: &'t mut Transcript) -> Self
[src]
Construct an empty constraint system with specified external input variables.
Inputs
The transcript
parameter is a Merlin proof transcript. The
VerifierCS
holds onto the &mut Transcript
until it consumes
itself during [VerifierCS::verify
], releasing its borrow of the
transcript. This ensures that the transcript cannot be
altered except by the VerifierCS
before proving is complete.
The commitments
parameter is a list of Pedersen commitments
to the external variables for the constraint system. All
external variables must be passed up-front, so that challenges
produced by [ConstraintSystem::challenge_scalar
] are bound
to the external variables.
Returns
Returns a tuple (cs, vars)
.
The first element is the newly constructed constraint system.
The second element is a list of Variable
s corresponding to
the external inputs, which can be used to form constraints.
pub fn commit(&mut self, commitment: CompressedRistretto) -> Variable
[src]
Creates commitment to a high-level variable and adds it to the transcript.
Inputs
The commitment
parameter is a Pedersen commitment
to the external variable for the constraint system. All
external variables must be passed up-front, so that challenges
produced by [ConstraintSystem::challenge_scalar
] are bound
to the external variables.
Returns
Returns a pair of a Pedersen commitment (as a compressed Ristretto point),
and a Variable
corresponding to it, which can be used to form constraints.
pub fn verify(
self,
proof: &R1CSProof,
pc_gens: &PedersenGens,
bp_gens: &BulletproofGens
) -> Result<(), R1CSError>
[src]
self,
proof: &R1CSProof,
pc_gens: &PedersenGens,
bp_gens: &BulletproofGens
) -> Result<(), R1CSError>
Consume this VerifierCS
and attempt to verify the supplied proof
.
The pc_gens
and bp_gens
are generators for Pedersen commitments and
Bulletproofs vector commitments, respectively. The
BulletproofGens
should have gens_capacity
greater than
the number of multiplication constraints that will eventually
be added into the constraint system.
Trait Implementations
impl<'t> ConstraintSystem for Verifier<'t>
[src]
fn transcript(&mut self) -> &mut Transcript
[src]
fn multiply(
&mut self,
left: LinearCombination,
right: LinearCombination
) -> (Variable, Variable, Variable)
[src]
&mut self,
left: LinearCombination,
right: LinearCombination
) -> (Variable, Variable, Variable)
fn allocate(&mut self, _: Option<Scalar>) -> Result<Variable, R1CSError>
[src]
fn allocate_multiplier(
&mut self,
_: Option<(Scalar, Scalar)>
) -> Result<(Variable, Variable, Variable), R1CSError>
[src]
&mut self,
_: Option<(Scalar, Scalar)>
) -> Result<(Variable, Variable, Variable), R1CSError>
fn multipliers_len(&self) -> usize
[src]
fn constrain(&mut self, lc: LinearCombination)
[src]
impl<'t> RandomizableConstraintSystem for Verifier<'t>
[src]
type RandomizedCS = RandomizingVerifier<'t>
Represents a concrete type for the CS in a randomization phase.
fn specify_randomized_constraints<F>(
&mut self,
callback: F
) -> Result<(), R1CSError> where
F: 'static + Fn(&mut Self::RandomizedCS) -> Result<(), R1CSError>,
[src]
&mut self,
callback: F
) -> Result<(), R1CSError> where
F: 'static + Fn(&mut Self::RandomizedCS) -> Result<(), R1CSError>,
Auto Trait Implementations
impl<'t> !RefUnwindSafe for Verifier<'t>
impl<'t> !Send for Verifier<'t>
impl<'t> !Sync for Verifier<'t>
impl<'t> Unpin for Verifier<'t>
impl<'t> !UnwindSafe for Verifier<'t>
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T, U> Cast<U> for T where
U: FromCast<T>,
U: FromCast<T>,
fn cast(self) -> U
impl<T> From<T> for T
[src]
impl<T> FromBits<T> for T
fn from_bits(t: T) -> T
impl<T> FromCast<T> for T
fn from_cast(t: T) -> T
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T, U> IntoBits<U> for T where
U: FromBits<T>,
U: FromBits<T>,
fn into_bits(self) -> U
impl<T> Same<T> for T
type Output = T
Should always be Self
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = !
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,