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,

source

pub fn new() -> Self

source§

impl<C: ArrabbiataCurve> Env<C>

source

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:

source

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: Clone + ArrabbiataCurve> Clone for Env<C>where C::ScalarField: Clone,

source§

fn clone(&self) -> Env<C>

Returns a copy of the value. Read more
1.0.0 · source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
source§

impl<C: Debug + ArrabbiataCurve> Debug for Env<C>where C::ScalarField: Debug,

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
source§

impl<C: ArrabbiataCurve> Default for Env<C>where <<C as CommitmentCurve>::Params as CurveConfig>::BaseField: PrimeField,

source§

fn default() -> Self

Returns the “default value” for a type. Read more
source§

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

Return the corresponding expression regarding the selected public input

source§

fn write_column( &mut self, pos: Self::Position, v: Self::Variable ) -> Self::Variable

Return the corresponding expression regarding the selected column

source§

unsafe fn inverse( &mut self, pos: Self::Position, x: Self::Variable ) -> Self::Variable

Inverse of a variable

Safety

Zero is not allowed as an input.

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)

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>>

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

Allocate a new variable in the circuit for the current row
source§

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

Return the corresponding variable at the given position
source§

fn allocate_public_input(&mut self) -> Self::Position

source§

fn constant(&self, value: BigInt) -> Self::Variable

source§

fn activate_gadget(&mut self, gadget: Gadget)

Activate the gadget for the row.
source§

fn add_constraint(&mut self, constraint: Self::Variable)

source§

fn constrain_boolean(&mut self, x: Self::Variable)

source§

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)

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

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

Compute the square a field element
source§

fn fetch_input(&mut self, pos: Self::Position) -> Self::Variable

Fetch an input of the application
source§

fn reset(&mut self)

Reset the environment to build the next row
source§

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

Load the state of the Poseidon hash function into the environment
source§

unsafe fn save_poseidon_state(&mut self, _x: Self::Variable, _i: usize)

Save the state of poseidon into the environment Read more
source§

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

Return the requested MDS matrix coefficient
source§

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)

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 )

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

Check if the points given by (x1, y1) and (x2, y2) are equals. Read more
source§

fn zero(&self) -> Self::Variable

Build the constant zero
source§

fn one(&self) -> Self::Variable

Build the constant one
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

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

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> Any for Twhere T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for Twhere T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for Twhere T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T, U> Into<U> for Twhere U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

§

impl<T> Pointable for T

§

const ALIGN: usize = mem::align_of::<T>()

The alignment of pointer.
§

type Init = T

The type for initializers.
§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
source§

impl<T> Same<T> for T

§

type Output = T

Should always be Self
source§

impl<T> ToOwned for Twhere T: Clone,

§

type Owned = T

The resulting type after obtaining ownership.
source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
source§

impl<T, U> TryFrom<U> for Twhere U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for Twhere U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
§

impl<V, T> VZip<V> for Twhere V: MultiLane<T>,

§

fn vzip(self) -> V