pub struct CircuitForTest<F: PrimeField> {
pub x: F,
}Expand description
CircuitForTest implements a simple test circuit computing
y = x^3 + x + 5 with 4 R1CS constraints.
It is used in unit tests to verify constraint extraction and witness generation.
Fields§
§x: FCircuitForTest::x is the input variable x of the circuit.
Trait Implementations§
Source§impl<F: PrimeField> ConstraintSynthesizer<F> for CircuitForTest<F>
impl<F: PrimeField> ConstraintSynthesizer<F> for CircuitForTest<F>
Source§fn generate_constraints(
self,
cs: ConstraintSystemRef<F>,
) -> Result<(), SynthesisError>
fn generate_constraints( self, cs: ConstraintSystemRef<F>, ) -> Result<(), SynthesisError>
Drives generation of new constraints inside
cs. Read moreSource§impl<F: SonobeField> FCircuit for CircuitForTest<F>
impl<F: SonobeField> FCircuit for CircuitForTest<F>
Source§type Field = F
type Field = F
FCircuit::Field is the field over which the circuit is defined.Source§type StateVar = [FpVar<F>; 1]
type StateVar = [FpVar<F>; 1]
FCircuit::StateVar is the in-circuit variable type for the state. Read moreSource§type ExternalInputs = ()
type ExternalInputs = ()
FCircuit::ExternalInputs is the type of external inputs provided to
each step of the circuit.Source§type ExternalOutputs = ()
type ExternalOutputs = ()
FCircuit::ExternalOutputs is the type of external outputs produced
by each step of the circuit.Source§fn dummy_state(&self) -> Self::State
fn dummy_state(&self) -> Self::State
FCircuit::dummy_state returns a dummy state for the circuit. Read moreSource§fn same_state_shape(_a: &Self::State, _b: &Self::State) -> bool
fn same_state_shape(_a: &Self::State, _b: &Self::State) -> bool
FCircuit::same_state_shape returns whether two states a and b
have the same shape/structure. Read moreSource§fn dummy_external_inputs(&self) -> Self::ExternalInputs
fn dummy_external_inputs(&self) -> Self::ExternalInputs
FCircuit::dummy_external_inputs returns dummy external inputs for
the circuit.Source§fn generate_step_constraints(
&self,
_i: FpVar<Self::Field>,
z_i: Self::StateVar,
_external_inputs: Self::ExternalInputs,
) -> Result<(Self::StateVar, Self::ExternalOutputs), SynthesisError>
fn generate_step_constraints( &self, _i: FpVar<Self::Field>, z_i: Self::StateVar, _external_inputs: Self::ExternalInputs, ) -> Result<(Self::StateVar, Self::ExternalOutputs), SynthesisError>
FCircuit::generate_step_constraints generates the constraints for
the i-th step of invocation of the step circuit with the current state
state and external inputs external_inputs, producing the next state
and external outputs. Read moreAuto Trait Implementations§
impl<F> Freeze for CircuitForTest<F>where
F: Freeze,
impl<F> RefUnwindSafe for CircuitForTest<F>where
F: RefUnwindSafe,
impl<F> Send for CircuitForTest<F>
impl<F> Sync for CircuitForTest<F>
impl<F> Unpin for CircuitForTest<F>where
F: Unpin,
impl<F> UnsafeUnpin for CircuitForTest<F>where
F: UnsafeUnpin,
impl<F> UnwindSafe for CircuitForTest<F>where
F: 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
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more