[−][src]Trait bulletproofs::r1cs::RandomizableConstraintSystem
An extension to the constraint system trait that permits randomized constraints.
Gadgets that do not use randomization should use trait bound CS: ConstraintSystem
,
while gadgets that need randomization should use trait bound CS: RandomizedConstraintSystem
.
Gadgets generally should not use this trait as a bound on the CS argument: it should be used
by the higher-order protocol that composes gadgets together.
Associated Types
type RandomizedCS: RandomizedConstraintSystem
Represents a concrete type for the CS in a randomization phase.
Required methods
fn specify_randomized_constraints<F>(
&mut self,
callback: F
) -> Result<(), R1CSError> where
F: 'static + Fn(&mut Self::RandomizedCS) -> Result<(), R1CSError>,
&mut self,
callback: F
) -> Result<(), R1CSError> where
F: 'static + Fn(&mut Self::RandomizedCS) -> Result<(), R1CSError>,
Specify additional variables and constraints randomized using a challenge scalar bound to the assignments of the non-randomized variables.
If the constraint system’s low-level variables have not been committed yet,
the call returns Ok()
and saves a callback until later.
If the constraint system’s low-level variables are committed already, the callback is invoked immediately and its result is return from this method.
Usage
Inside the closure you can generate one or more challenges using challenge_scalar
method.
cs.specify_randomized_constraints(move |cs| {
let z = cs.challenge_scalar(b"some challenge");
// ...
})
Implementors
impl<'t> RandomizableConstraintSystem for Verifier<'t>
[src]
type RandomizedCS = RandomizingVerifier<'t>
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>,
impl<'t, 'g> RandomizableConstraintSystem for Prover<'t, 'g>
[src]
type RandomizedCS = RandomizingProver<'t, 'g>
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>,