Struct kimchi::snarky::constraint_system::SnarkyConstraintSystem
source · pub struct SnarkyConstraintSystem<Field>where
Field: PrimeField,{ /* private fields */ }
Expand description
The constraint system.
Implementations§
source§impl<Field: PrimeField> SnarkyConstraintSystem<Field>
impl<Field: PrimeField> SnarkyConstraintSystem<Field>
sourcepub fn set_primary_input_size(&mut self, num_pub_inputs: usize)
pub fn set_primary_input_size(&mut self, num_pub_inputs: usize)
Sets the number of public-input. It must and can only be called once.
pub fn set_prev_challenges(&mut self, prev_challenges: usize)
pub fn compute_witness_for_ocaml( &mut self, public_inputs: &[Field], private_inputs: &[Field] ) -> [Vec<Field>; 15]
sourcepub fn compute_witness<FUNC>(
&mut self,
external_values: FUNC
) -> [Vec<Field>; 15]where
FUNC: Fn(usize) -> Field,
pub fn compute_witness<FUNC>( &mut self, external_values: FUNC ) -> [Vec<Field>; 15]where FUNC: Fn(usize) -> Field,
Compute the witness, given the constraint system sys
and a function that converts the indexed secret inputs to their concrete values.
Panics
Will panic if some inputs like public_input_size
are unknown(None value).
pub fn create(constants: Constants<Field>) -> Self
sourcepub fn get_primary_input_size(&self) -> usize
pub fn get_primary_input_size(&self) -> usize
pub fn get_prev_challenges(&self) -> Option<usize>
sourcepub fn set_public_input_size(&mut self, x: usize)
pub fn set_public_input_size(&mut self, x: usize)
Sets the number of public-input. It should only be called once.
sourcepub fn get_rows_len(&self) -> usize
pub fn get_rows_len(&self) -> usize
Returns the number of rows in the constraint system. Note: This is not necessarily the number of rows of the compiled circuit. If the circuit has not finished compiling, you will only get the current number of rows.
sourcepub fn finalize(&mut self)
pub fn finalize(&mut self)
Fill the gate
values(input and output), and finalize the circuit
.
Panics
Will panic if circuit
is completed.
sourcepub fn digest(&mut self) -> [u8; 32]
pub fn digest(&mut self) -> [u8; 32]
Produces a digest of the constraint system.
Panics
Will panic if the constraint system has not previously been compiled (via Self::finalize
).
pub fn finalize_and_get_gates(&mut self) -> &mut Vec<CircuitGate<Field>>
source§impl<Field: PrimeField> SnarkyConstraintSystem<Field>
impl<Field: PrimeField> SnarkyConstraintSystem<Field>
sourcepub fn add_basic_snarky_constraint<Cvar>(
&mut self,
labels: &[Cow<'static, str>],
loc: &Cow<'static, str>,
constraint: BasicSnarkyConstraint<Cvar>
)where
Cvar: SnarkyCvar<Field = Field>,
pub fn add_basic_snarky_constraint<Cvar>( &mut self, labels: &[Cow<'static, str>], loc: &Cow<'static, str>, constraint: BasicSnarkyConstraint<Cvar> )where Cvar: SnarkyCvar<Field = Field>,
Applies the basic SnarkyConstraint
.
Simply, place the values of selector
(sl
, sr
, so
…) and input
(l
, r
, o
, m
).
Panics
Will panic if constant selector
constraints are not matching.
sourcepub fn add_constraint<Cvar>(
&mut self,
labels: &[Cow<'static, str>],
loc: &Cow<'static, str>,
constraint: KimchiConstraint<Cvar, Field>
)where
Cvar: SnarkyCvar<Field = Field>,
pub fn add_constraint<Cvar>( &mut self, labels: &[Cow<'static, str>], loc: &Cow<'static, str>, constraint: KimchiConstraint<Cvar, Field> )where Cvar: SnarkyCvar<Field = Field>,
Trait Implementations§
source§impl<Field> Clone for SnarkyConstraintSystem<Field>where
Field: PrimeField + Clone,
impl<Field> Clone for SnarkyConstraintSystem<Field>where Field: PrimeField + Clone,
source§fn clone(&self) -> SnarkyConstraintSystem<Field>
fn clone(&self) -> SnarkyConstraintSystem<Field>
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read more