Struct snarkvm_circuit_environment::circuit::Circuit
source · pub struct Circuit;
Trait Implementations§
source§impl ConstraintSynthesizer<Fp256<FrParameters>> for Circuit
impl ConstraintSynthesizer<Fp256<FrParameters>> for Circuit
source§fn generate_constraints<CS: ConstraintSystem<Fq>>(
&self,
cs: &mut CS
) -> Result<(), SynthesisError>
fn generate_constraints<CS: ConstraintSystem<Fq>>( &self, cs: &mut CS ) -> Result<(), SynthesisError>
Synthesizes the constraints from the environment into a snarkvm_algorithms::r1cs
-compliant constraint system.
source§impl Environment for Circuit
impl Environment for Circuit
source§fn zero() -> LinearCombination<Self::BaseField>
fn zero() -> LinearCombination<Self::BaseField>
Returns the zero
constant.
source§fn one() -> LinearCombination<Self::BaseField>
fn one() -> LinearCombination<Self::BaseField>
Returns the one
constant.
source§fn new_variable(mode: Mode, value: Self::BaseField) -> Variable<Self::BaseField>
fn new_variable(mode: Mode, value: Self::BaseField) -> Variable<Self::BaseField>
Returns a new variable of the given mode and value.
source§fn new_witness<Fn: FnOnce() -> Output::Primitive, Output: Inject>(
mode: Mode,
logic: Fn
) -> Output
fn new_witness<Fn: FnOnce() -> Output::Primitive, Output: Inject>( mode: Mode, logic: Fn ) -> Output
Returns a new witness of the given mode and value.
source§fn scope<S: Into<String>, Fn, Output>(name: S, logic: Fn) -> Outputwhere
Fn: FnOnce() -> Output,
fn scope<S: Into<String>, Fn, Output>(name: S, logic: Fn) -> Outputwhere Fn: FnOnce() -> Output,
Enters a new scope for the environment.
source§fn enforce<Fn, A, B, C>(constraint: Fn)where
Fn: FnOnce() -> (A, B, C),
A: Into<LinearCombination<Self::BaseField>>,
B: Into<LinearCombination<Self::BaseField>>,
C: Into<LinearCombination<Self::BaseField>>,
fn enforce<Fn, A, B, C>(constraint: Fn)where Fn: FnOnce() -> (A, B, C), A: Into<LinearCombination<Self::BaseField>>, B: Into<LinearCombination<Self::BaseField>>, C: Into<LinearCombination<Self::BaseField>>,
Adds one constraint enforcing that (A * B) == C
.
source§fn is_satisfied() -> bool
fn is_satisfied() -> bool
Returns true
if all constraints in the environment are satisfied.
source§fn is_satisfied_in_scope() -> bool
fn is_satisfied_in_scope() -> bool
Returns true
if all constraints in the current scope are satisfied.
source§fn num_constants() -> u64
fn num_constants() -> u64
Returns the number of constants in the entire circuit.
source§fn num_public() -> u64
fn num_public() -> u64
Returns the number of public variables in the entire circuit.
source§fn num_private() -> u64
fn num_private() -> u64
Returns the number of private variables in the entire circuit.
source§fn num_constraints() -> u64
fn num_constraints() -> u64
Returns the number of constraints in the entire circuit.
source§fn num_constants_in_scope() -> u64
fn num_constants_in_scope() -> u64
Returns the number of constants for the current scope.
source§fn num_public_in_scope() -> u64
fn num_public_in_scope() -> u64
Returns the number of public variables for the current scope.
source§fn num_private_in_scope() -> u64
fn num_private_in_scope() -> u64
Returns the number of private variables for the current scope.
source§fn num_constraints_in_scope() -> u64
fn num_constraints_in_scope() -> u64
Returns the number of constraints for the current scope.
source§fn num_nonzeros_in_scope() -> (u64, u64, u64)
fn num_nonzeros_in_scope() -> (u64, u64, u64)
Returns the number of nonzeros for the current scope.
source§fn halt<S: Into<String>, T>(message: S) -> T
fn halt<S: Into<String>, T>(message: S) -> T
Halts the program from further synthesis, evaluation, and execution in the current environment.
source§fn inject_r1cs(r1cs: R1CS<Self::BaseField>)
fn inject_r1cs(r1cs: R1CS<Self::BaseField>)
TODO (howardwu): Abstraction - Refactor this into an appropriate design. Circuits should not have easy access to this during synthesis. Returns the R1CS circuit, resetting the circuit.
source§fn eject_r1cs_and_reset() -> R1CS<Self::BaseField>
fn eject_r1cs_and_reset() -> R1CS<Self::BaseField>
TODO (howardwu): Abstraction - Refactor this into an appropriate design. Circuits should not have easy access to this during synthesis. Returns the R1CS circuit, resetting the circuit.
source§fn eject_assignment_and_reset(
) -> Assignment<<Self::Network as Environment>::Field>
fn eject_assignment_and_reset( ) -> Assignment<<Self::Network as Environment>::Field>
TODO (howardwu): Abstraction - Refactor this into an appropriate design. Circuits should not have easy access to this during synthesis. Returns the R1CS assignment of the circuit, resetting the circuit.
type Affine = <Testnet3 as Environment>::Affine
type BaseField = <Testnet3 as Environment>::Field
type Network = Testnet3
type ScalarField = <Testnet3 as Environment>::Scalar
source§const EDWARDS_A: Self::BaseField = <Self::Network as console::Environment>::EDWARDS_A
const EDWARDS_A: Self::BaseField = <Self::Network as console::Environment>::EDWARDS_A
A
of the twisted Edwards curve.source§const EDWARDS_D: Self::BaseField = <Self::Network as console::Environment>::EDWARDS_D
const EDWARDS_D: Self::BaseField = <Self::Network as console::Environment>::EDWARDS_D
D
of the twisted Edwards curve.source§const MONTGOMERY_A: Self::BaseField = <Self::Network as console::Environment>::MONTGOMERY_A
const MONTGOMERY_A: Self::BaseField = <Self::Network as console::Environment>::MONTGOMERY_A
A
of the Montgomery curve.source§const MONTGOMERY_B: Self::BaseField = <Self::Network as console::Environment>::MONTGOMERY_B
const MONTGOMERY_B: Self::BaseField = <Self::Network as console::Environment>::MONTGOMERY_B
B
of the Montgomery curve.source§const MAX_STRING_BYTES: u32 = <Self::Network as console::Environment>::MAX_STRING_BYTES
const MAX_STRING_BYTES: u32 = <Self::Network as console::Environment>::MAX_STRING_BYTES
source§fn assert<Boolean: Into<LinearCombination<Self::BaseField>>>(boolean: Boolean)
fn assert<Boolean: Into<LinearCombination<Self::BaseField>>>(boolean: Boolean)
true
.source§fn assert_eq<A, B>(a: A, b: B)where
A: Into<LinearCombination<Self::BaseField>>,
B: Into<LinearCombination<Self::BaseField>>,
fn assert_eq<A, B>(a: A, b: B)where A: Into<LinearCombination<Self::BaseField>>, B: Into<LinearCombination<Self::BaseField>>,
A == B
.source§fn assert_neq<A, B>(a: A, b: B)where
A: Into<LinearCombination<Self::BaseField>>,
B: Into<LinearCombination<Self::BaseField>>,
fn assert_neq<A, B>(a: A, b: B)where A: Into<LinearCombination<Self::BaseField>>, B: Into<LinearCombination<Self::BaseField>>,
A != B
.source§impl PartialEq<Circuit> for Circuit
impl PartialEq<Circuit> for Circuit
impl Copy for Circuit
impl Eq for Circuit
impl StructuralEq for Circuit
impl StructuralPartialEq for Circuit
Auto Trait Implementations§
impl RefUnwindSafe for Circuit
impl Send for Circuit
impl Sync for Circuit
impl Unpin for Circuit
impl UnwindSafe for Circuit
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
§impl<Q, K> Equivalent<K> for Qwhere
Q: Eq + ?Sized,
K: Borrow<Q> + ?Sized,
impl<Q, K> Equivalent<K> for Qwhere Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
§impl<Q, K> Equivalent<K> for Qwhere
Q: Eq + ?Sized,
K: Borrow<Q> + ?Sized,
impl<Q, K> Equivalent<K> for Qwhere Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key
and return true
if they are equal.