Struct arrabbiata::constraints::Env
source · pub struct Env<C: ArrabbiataCurve> {
pub a: BigInt,
pub idx_var: usize,
pub idx_var_next_row: usize,
pub idx_var_pi: usize,
pub constraints: Vec<E<C::ScalarField>>,
pub activated_gadget: Option<Gadget>,
}
Fields§
§a: BigInt
The parameter a is the coefficients of the elliptic curve in affine coordinates.
idx_var: usize
§idx_var_next_row: usize
§idx_var_pi: usize
§constraints: Vec<E<C::ScalarField>>
§activated_gadget: Option<Gadget>
Implementations§
source§impl<C: ArrabbiataCurve> Env<C>where
<<C as CommitmentCurve>::Params as CurveConfig>::BaseField: PrimeField,
impl<C: ArrabbiataCurve> Env<C>where <<C as CommitmentCurve>::Params as CurveConfig>::BaseField: PrimeField,
source§impl<C: ArrabbiataCurve> Env<C>
impl<C: ArrabbiataCurve> Env<C>
sourcepub fn get_all_constraints_for_ivc(&self) -> Vec<E<C::ScalarField>>
pub fn get_all_constraints_for_ivc(&self) -> Vec<E<C::ScalarField>>
Get all the constraints for the IVC circuit, only.
The following gadgets are used in the IVC circuit:
- Instruction::Poseidon to verify the challenges and the public IO
- Instruction::EllipticCurveScaling and Instruction::EllipticCurveAddition to accumulate the commitments
sourcepub fn get_all_constraints(&self) -> Vec<E<C::ScalarField>>
pub fn get_all_constraints(&self) -> Vec<E<C::ScalarField>>
Get all the constraints for the IVC circuit and the application.
Trait Implementations§
source§impl<C: ArrabbiataCurve> Default for Env<C>where
<<C as CommitmentCurve>::Params as CurveConfig>::BaseField: PrimeField,
impl<C: ArrabbiataCurve> Default for Env<C>where <<C as CommitmentCurve>::Params as CurveConfig>::BaseField: PrimeField,
source§impl<C: ArrabbiataCurve> InterpreterEnv for Env<C>
impl<C: ArrabbiataCurve> InterpreterEnv for Env<C>
An environment to build constraints. The constraint environment is mostly useful when we want to perform a Nova proof. The constraint environment must be instantiated only once, at the last step of the computation.
source§fn write_public_input(
&mut self,
pos: Self::Position,
_v: BigInt
) -> Self::Variable
fn write_public_input( &mut self, pos: Self::Position, _v: BigInt ) -> Self::Variable
Return the corresponding expression regarding the selected public input
source§fn write_column(
&mut self,
pos: Self::Position,
v: Self::Variable
) -> Self::Variable
fn write_column( &mut self, pos: Self::Position, v: Self::Variable ) -> Self::Variable
Return the corresponding expression regarding the selected column
source§fn double_ec_point(
&mut self,
pos_x: Self::Position,
pos_y: Self::Position,
x1: Self::Variable,
y1: Self::Variable
) -> (Self::Variable, Self::Variable)
fn double_ec_point( &mut self, pos_x: Self::Position, pos_y: Self::Position, x1: Self::Variable, y1: Self::Variable ) -> (Self::Variable, Self::Variable)
Double the elliptic curve point given by the affine coordinates
(x1, y1)
and save the result in the registers pos_x
and pos_y
.
type Position = (Column, CurrOrNext)
§type Variable = Operations<ExprInner<Operations<ConstantExprInner<<C as AffineRepr>::ScalarField, ChallengeTerm>>, Column>>
type Variable = Operations<ExprInner<Operations<ConstantExprInner<<C as AffineRepr>::ScalarField, ChallengeTerm>>, Column>>
The variable should be seen as a certain object that can be built by
multiplying and adding, i.e. the variable can be seen as a solution
to a polynomial.
When instantiating as expressions - “constraints” - it defines
multivariate polynomials.
source§fn allocate(&mut self) -> Self::Position
fn allocate(&mut self) -> Self::Position
Allocate a new variable in the circuit for the current row
source§fn allocate_next_row(&mut self) -> Self::Position
fn allocate_next_row(&mut self) -> Self::Position
Allocate a new variable in the circuit for the next row
source§fn read_position(&self, pos: Self::Position) -> Self::Variable
fn read_position(&self, pos: Self::Position) -> Self::Variable
Return the corresponding variable at the given position
fn allocate_public_input(&mut self) -> Self::Position
fn constant(&self, value: BigInt) -> Self::Variable
source§fn activate_gadget(&mut self, gadget: Gadget)
fn activate_gadget(&mut self, gadget: Gadget)
Activate the gadget for the row.
fn add_constraint(&mut self, constraint: Self::Variable)
fn constrain_boolean(&mut self, x: Self::Variable)
source§fn assert_zero(&mut self, x: Self::Variable)
fn assert_zero(&mut self, x: Self::Variable)
Assert that the variable is zero
source§fn assert_equal(&mut self, x: Self::Variable, y: Self::Variable)
fn assert_equal(&mut self, x: Self::Variable, y: Self::Variable)
Assert that the two variables are equal
source§unsafe fn bitmask_be(
&mut self,
_x: &Self::Variable,
_highest_bit: u32,
_lowest_bit: u32,
pos: Self::Position
) -> Self::Variable
unsafe fn bitmask_be( &mut self, _x: &Self::Variable, _highest_bit: u32, _lowest_bit: u32, pos: Self::Position ) -> Self::Variable
Flagged as unsafe as it does require an additional range check Read more
source§fn square(&mut self, pos: Self::Position, x: Self::Variable) -> Self::Variable
fn square(&mut self, pos: Self::Position, x: Self::Variable) -> Self::Variable
Compute the square a field element
source§fn fetch_input(&mut self, pos: Self::Position) -> Self::Variable
fn fetch_input(&mut self, pos: Self::Position) -> Self::Variable
Fetch an input of the application
source§fn coin_folding_combiner(&mut self, pos: Self::Position) -> Self::Variable
fn coin_folding_combiner(&mut self, pos: Self::Position) -> Self::Variable
Return the folding combiner
source§fn load_poseidon_state(
&mut self,
pos: Self::Position,
_i: usize
) -> Self::Variable
fn load_poseidon_state( &mut self, pos: Self::Position, _i: usize ) -> Self::Variable
Load the state of the Poseidon hash function into the environment
source§unsafe fn save_poseidon_state(&mut self, _x: Self::Variable, _i: usize)
unsafe fn save_poseidon_state(&mut self, _x: Self::Variable, _i: usize)
Save the state of poseidon into the environment Read more
fn get_poseidon_round_constant( &mut self, pos: Self::Position, _round: usize, _i: usize ) -> Self::Variable
source§fn get_poseidon_mds_matrix(&mut self, i: usize, j: usize) -> Self::Variable
fn get_poseidon_mds_matrix(&mut self, i: usize, j: usize) -> Self::Variable
Return the requested MDS matrix coefficient
source§unsafe fn fetch_value_to_absorb(
&mut self,
pos: Self::Position,
_curr_round: usize
) -> Self::Variable
unsafe fn fetch_value_to_absorb( &mut self, pos: Self::Position, _curr_round: usize ) -> Self::Variable
Load the public value to absorb at the current step.
The position should be a public column. Read more
source§unsafe fn load_temporary_accumulators(
&mut self,
pos_x: Self::Position,
pos_y: Self::Position,
_side: Side
) -> (Self::Variable, Self::Variable)
unsafe fn load_temporary_accumulators( &mut self, pos_x: Self::Position, pos_y: Self::Position, _side: Side ) -> (Self::Variable, Self::Variable)
Load the affine coordinates of the elliptic curve point currently saved
in the temporary accumulators. Temporary accumulators could be seen as
a CPU cache, an intermediate storage between the RAM (random access
memory) and the CPU registers (memory cells that are constrained). Read more
source§unsafe fn save_temporary_accumulators(
&mut self,
_x: Self::Variable,
_y: Self::Variable,
_side: Side
)
unsafe fn save_temporary_accumulators( &mut self, _x: Self::Variable, _y: Self::Variable, _side: Side )
Save temporary accumulators into the environment Read more
source§unsafe fn is_same_ec_point(
&mut self,
pos: Self::Position,
_x1: Self::Variable,
_y1: Self::Variable,
_x2: Self::Variable,
_y2: Self::Variable
) -> Self::Variable
unsafe fn is_same_ec_point( &mut self, pos: Self::Position, _x1: Self::Variable, _y1: Self::Variable, _x2: Self::Variable, _y2: Self::Variable ) -> Self::Variable
Check if the points given by (x1, y1) and (x2, y2) are equals. Read more
source§fn compute_lambda(
&mut self,
pos: Self::Position,
is_same_point: Self::Variable,
x1: Self::Variable,
y1: Self::Variable,
x2: Self::Variable,
y2: Self::Variable
) -> Self::Variable
fn compute_lambda( &mut self, pos: Self::Position, is_same_point: Self::Variable, x1: Self::Variable, y1: Self::Variable, x2: Self::Variable, y2: Self::Variable ) -> Self::Variable
Compute the coefficient λ used in the elliptic curve addition.
If the two points are the same, the λ is computed as follows: Read more
source§fn compute_x5(&self, x: Self::Variable) -> Self::Variable
fn compute_x5(&self, x: Self::Variable) -> Self::Variable
Compute the x^5 of the given variable
Auto Trait Implementations§
impl<C> RefUnwindSafe for Env<C>where <C as AffineRepr>::ScalarField: RefUnwindSafe,
impl<C> Send for Env<C>
impl<C> Sync for Env<C>
impl<C> Unpin for Env<C>where <C as AffineRepr>::ScalarField: Unpin,
impl<C> UnwindSafe for Env<C>where <C as AffineRepr>::ScalarField: UnwindSafe,
Blanket Implementations§
source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more