Struct Env

Source
pub struct Env<C: ArrabbiataCurve>
where C::BaseField: PrimeField,
{ pub a: BigInt, pub idx_var: usize, pub idx_var_next_row: usize, pub constraints: Vec<E<C::ScalarField>>, }

Fields§

§a: BigInt

The parameter a is the coefficients of the elliptic curve in affine coordinates.

§idx_var: usize§idx_var_next_row: usize§constraints: Vec<E<C::ScalarField>>

Implementations§

Source§

impl<C: ArrabbiataCurve> Env<C>
where C::BaseField: PrimeField,

Source

pub fn new() -> Self

Source§

impl<C: ArrabbiataCurve> Env<C>
where C::BaseField: PrimeField,

Source

pub fn get_all_constraints_for_verifier(&self) -> Vec<E<C::ScalarField>>

Get all the constraints for the verifier circuit, only.

The following gadgets are used in the verifier circuit:

Source

pub fn get_all_constraints(&self) -> Vec<E<C::ScalarField>>

Get all the constraints for the verifier circuit and the application.

Source

pub fn get_all_constraints_indexed_by_gadget( &self, ) -> HashMap<Gadget, Vec<E<C::ScalarField>>>

Trait Implementations§

Source§

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

Source§

fn default() -> Self

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

impl<C: ArrabbiataCurve> InterpreterEnv for Env<C>
where C::BaseField: PrimeField,

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

Source§

type Position = (Column, CurrOrNext)

Source§

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 constant(&self, value: BigInt) -> Self::Variable

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(&self, round: usize, i: usize) -> Self::Variable

Return the Poseidon round constants as a constant.
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, ) -> Self::Variable

Load the value to absorb at the current step at the position given by pos. 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> Freeze for Env<C>
where <C as AffineRepr>::BaseField: Sized,

§

impl<C> RefUnwindSafe for Env<C>
where <C as AffineRepr>::BaseField: Sized, <C as AffineRepr>::ScalarField: RefUnwindSafe,

§

impl<C> Send for Env<C>
where <C as AffineRepr>::BaseField: Sized,

§

impl<C> Sync for Env<C>
where <C as AffineRepr>::BaseField: Sized,

§

impl<C> Unpin for Env<C>
where <C as AffineRepr>::BaseField: Sized, <C as AffineRepr>::ScalarField: Unpin,

§

impl<C> UnwindSafe for Env<C>
where <C as AffineRepr>::BaseField: Sized, <C as AffineRepr>::ScalarField: UnwindSafe,

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

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

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

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

Source§

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

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. 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 T
where 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

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

Source§

type Output = T

Should always be Self
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

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 T
where U: Into<T>,

Source§

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 T
where U: TryFrom<T>,

Source§

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 T
where V: MultiLane<T>,

§

fn vzip(self) -> V