pub struct ArithmeticCircuit<F>where
F: Field,{
pub constraints: Vec<Constraint<F>>,
pub witness_size: usize,
pub public_input_size: usize,
}Expand description
An arithmetic circuit containing constraints and metadata
Fields§
§constraints: Vec<Constraint<F>>The constraints in the circuit
witness_size: usizeThe number of witness wires (excluding public inputs)
public_input_size: usizeThe number of public input wires
Implementations§
Source§impl<F> ArithmeticCircuit<F>where
F: Field,
impl<F> ArithmeticCircuit<F>where
F: Field,
Sourcepub fn new(
witness_size: usize,
public_input_size: usize,
) -> ArithmeticCircuit<F>
pub fn new( witness_size: usize, public_input_size: usize, ) -> ArithmeticCircuit<F>
Create a new empty circuit
Sourcepub fn total_wires(&self) -> usize
pub fn total_wires(&self) -> usize
Get the total number of wires (witness + public inputs)
Sourcepub fn add_constraint(&mut self, constraint: Constraint<F>)
pub fn add_constraint(&mut self, constraint: Constraint<F>)
Add a constraint to the circuit
Sourcepub fn validate(&self, width: usize) -> Result<(), Error>
pub fn validate(&self, width: usize) -> Result<(), Error>
Validate the circuit against a concrete trace width.
Rejects circuits whose constraints reference a wire index >= width. Such indices were
previously silently skipped during trace generation and constraint evaluation, which
dropped the constraint entirely and broke soundness (a prover could omit any constraint
by giving its output wire an out-of-range index). Returning an error makes the failure
explicit instead.
Trait Implementations§
Source§impl<F> Clone for ArithmeticCircuit<F>
impl<F> Clone for ArithmeticCircuit<F>
Source§fn clone(&self) -> ArithmeticCircuit<F>
fn clone(&self) -> ArithmeticCircuit<F>
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreAuto Trait Implementations§
impl<F> Freeze for ArithmeticCircuit<F>
impl<F> RefUnwindSafe for ArithmeticCircuit<F>where
F: RefUnwindSafe,
impl<F> Send for ArithmeticCircuit<F>
impl<F> Sync for ArithmeticCircuit<F>
impl<F> Unpin for ArithmeticCircuit<F>where
F: Unpin,
impl<F> UnsafeUnpin for ArithmeticCircuit<F>
impl<F> UnwindSafe for ArithmeticCircuit<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> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
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