RandomizedConstraintSystem

Trait RandomizedConstraintSystem 

Source
pub trait RandomizedConstraintSystem: ConstraintSystem {
    // Required method
    fn challenge_scalar(&mut self, label: &'static [u8]) -> Scalar;
}
Expand description

Represents a constraint system in the second phase: when the challenges can be sampled to create randomized constraints.

Note: this trait also includes ConstraintSystem trait in order to allow composition of gadgets: e.g. a shuffle gadget can be used in both phases.

Required Methods§

Source

fn challenge_scalar(&mut self, label: &'static [u8]) -> Scalar

Generates a challenge scalar.

§Usage

This method is available only within the scope of a closure provided to specify_randomized_constraints, which implements the “randomization” phase of the protocol.

Arbitrary number of challenges can be generated with additional calls.

cs.specify_randomized_constraints(move |cs| {
    let z = cs.challenge_scalar(b"some challenge");
    // ...
})

Implementors§