pub struct Circuit<F: AcirField> {
pub function_name: String,
pub current_witness_index: u32,
pub opcodes: Vec<Opcode<F>>,
pub private_parameters: BTreeSet<Witness>,
pub public_parameters: PublicInputs,
pub return_values: PublicInputs,
pub assert_messages: Vec<(OpcodeLocation, AssertionPayload<F>)>,
}Expand description
Representation of a single ACIR circuit. The execution trace of this structure is dictated by the construction of a crate::native_types::WitnessMap
Fields§
§function_name: StringName of the function represented by this circuit.
current_witness_index: u32The current highest witness index in the circuit.
This is tracked as an optimization so that when new witness values are created, incrementing this witness results in a new unique witness index without needing to scan all opcodes to find the maximum witness index.
opcodes: Vec<Opcode<F>>The circuit opcodes representing the relationship between witness values.
The opcodes should be further converted into a backend-specific circuit representation. When initial witness inputs are provided, these opcodes can also be used for generating an execution trace.
private_parameters: BTreeSet<Witness>The set of private inputs to the circuit.
public_parameters: PublicInputsThe set of public inputs provided by the prover.
return_values: PublicInputsThe set of public inputs calculated within the circuit.
assert_messages: Vec<(OpcodeLocation, AssertionPayload<F>)>Maps opcode locations to failed assertion payloads. The data in the payload is embedded in the circuit to provide useful feedback to users when a constraint in the circuit is not satisfied.
Implementations§
Source§impl<F: AcirField> Circuit<F>
impl<F: AcirField> Circuit<F>
Sourcepub fn circuit_arguments(&self) -> BTreeSet<Witness>
pub fn circuit_arguments(&self) -> BTreeSet<Witness>
Returns all witnesses which are required to execute the circuit successfully.
Sourcepub fn public_inputs(&self) -> PublicInputs
pub fn public_inputs(&self) -> PublicInputs
Returns all public inputs. This includes those provided as parameters to the circuit and those computed as return values.
Source§impl Circuit<FieldElement>
impl Circuit<FieldElement>
Sourcepub fn from_str(src: &str) -> Result<Self, AcirParserErrorWithSource>
pub fn from_str(src: &str) -> Result<Self, AcirParserErrorWithSource>
Creates a Circuit object from the given string.
pub fn from_str_impl(src: &str) -> Result<Self, AcirParserErrorWithSource>
Trait Implementations§
Source§impl<'de, F> Deserialize<'de> for Circuit<F>where
F: Deserialize<'de> + AcirField,
impl<'de, F> Deserialize<'de> for Circuit<F>where
F: Deserialize<'de> + AcirField,
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Source§impl FromStr for Circuit<FieldElement>
impl FromStr for Circuit<FieldElement>
impl<F: Eq + AcirField> Eq for Circuit<F>
impl<F: AcirField> StructuralPartialEq for Circuit<F>
Auto Trait Implementations§
impl<F> Freeze for Circuit<F>
impl<F> RefUnwindSafe for Circuit<F>where
F: RefUnwindSafe,
impl<F> Send for Circuit<F>where
F: Send,
impl<F> Sync for Circuit<F>where
F: Sync,
impl<F> Unpin for Circuit<F>where
F: Unpin,
impl<F> UnwindSafe for Circuit<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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.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>
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>
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