pub struct Context<F: ScalarField> {
    pub context_id: usize,
    pub advice: Vec<Assigned<F>>,
    pub cells_to_lookup: Vec<AssignedValue<F>>,
    pub zero_cell: Option<AssignedValue<F>>,
    pub selector: Vec<bool>,
    pub advice_equality_constraints: Vec<(ContextCell, ContextCell)>,
    pub constant_equality_constraints: Vec<(F, ContextCell)>,
    /* private fields */
}
Expand description

Represents a single thread of an execution trace.

  • We keep the naming Context for historical reasons.

Fields

context_id: usize

Identifier to reference cells from this Context.

advice: Vec<Assigned<F>>

Single column of advice cells.

cells_to_lookup: Vec<AssignedValue<F>>

Vec tracking all cells that lookup is enabled for.

  • When there is more than 1 advice column all advice cells will be copied to a single lookup enabled column to perform lookups.
zero_cell: Option<AssignedValue<F>>

Cell that represents the zero value as AssignedValue

selector: Vec<bool>

Vec representing the selector column of this Context accompanying each advice column

  • Assumed to have the same length as advice
advice_equality_constraints: Vec<(ContextCell, ContextCell)>

A Vec tracking equality constraints between pairs of Context advice cells.

Assumes both advice cells are in the same Context.

constant_equality_constraints: Vec<(F, ContextCell)>

A Vec tracking pairs equality constraints between Fixed values and Context advice cells.

Assumes the constant and advice cell are in the same Context.

Implementations

Creates a new Context with the given context_id and witness generation enabled/disabled by the witness_gen_only flag.

  • witness_gen_only: flag to determine whether public key generation or only witness generation is being performed.
  • context_id: identifier to reference advice cells from this Context later.

Returns the witness_gen_only flag of the Context

Pushes a QuantumCell to the end of the advice column (Vec of advice cells) in this Context.

  • input: the cell to be assigned.

Returns the AssignedValue of the last cell in the advice column of Context or None if advice is empty

Returns the AssignedValue of the cell at the given offset in the advice column of Context

  • offset: the offset of the cell to be fetched
    • offset may be negative indexing from the end of the column (e.g., -1 is the last cell)
  • Assumes offset is a valid index in advice;
    • 0 <= offset < advice.len() (or advice.len() + offset >= 0 if offset is negative)

Creates an equality constraint between two advice cells.

  • a: the first advice cell to be constrained equal
  • b: the second advice cell to be constrained equal
  • Assumes both cells are advice cells

Pushes multiple advice cells to the advice column of Context and enables them by enabling the corresponding selector specified in gate_offset.

  • inputs: Iterator that specifies the cells to be assigned
  • gate_offsets: specifies relative offset from current position to enable selector for the gate (e.g., 0 is inputs[0]).
    • offset may be negative indexing from the end of the column (e.g., -1 is the last previously assigned cell)

Pushes multiple advice cells to the advice column of Context and enables them by enabling the corresponding selector specified in gate_offset and returns the last assigned cell.

Assumes gate_offsets is the same length as inputs

Returns the last assigned cell

  • inputs: Iterator that specifies the cells to be assigned
  • gate_offsets: specifies indices to enable selector for the gate; assume gate_offsets is sorted in increasing order
    • offset may be negative indexing from the end of the column (e.g., -1 is the last cell)

Pushes multiple advice cells to the advice column of Context and enables them by enabling the corresponding selector specified in gate_offset.

Allows for the specification of equality constraints between cells at equality_offsets within the advice column and external advice cells specified in external_equality (e.g, Fixed column).

  • gate_offsets: specifies indices to enable selector for the gate;
    • offset may be negative indexing from the end of the column (e.g., -1 is the last cell)
  • equality_offsets: specifies pairs of indices to constrain equality
  • external_equality: specifies an existing cell to constrain equality with the cell at a certain index

Assigns a region of witness cells in an iterator and returns a Vec of assigned cells.

  • witnesses: Iterator that specifies the cells to be assigned

Assigns a witness value and returns the corresponding assigned cell.

  • witness: the witness value to be assigned

Assigns a constant value and returns the corresponding assigned cell.

  • c: the constant value to be assigned

Assigns the 0 value to a new cell or returns a previously assigned zero cell from zero_cell.

Trait Implementations

Returns a copy of the value. Read more
Performs copy-assignment from source. Read more
Formats the value using the given formatter. Read more

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more
Immutably borrows from an owned value. Read more
Mutably borrows from an owned value. Read more
Converts self into T using Into<T>. Read more
Causes self to use its Binary implementation when Debug-formatted.
Causes self to use its Display implementation when Debug-formatted. Read more
Causes self to use its LowerExp implementation when Debug-formatted. Read more
Causes self to use its LowerHex implementation when Debug-formatted. Read more
Causes self to use its Octal implementation when Debug-formatted.
Causes self to use its Pointer implementation when Debug-formatted. Read more
Causes self to use its UpperExp implementation when Debug-formatted. Read more
Causes self to use its UpperHex implementation when Debug-formatted. Read more
Formats each item in a sequence. Read more

Returns the argument unchanged.

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Instruments this type with the current Span, returning an Instrumented wrapper. Read more

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Pipes by value. This is generally the method you want to use. Read more
Borrows self and passes that borrow into the pipe function. Read more
Mutably borrows self and passes that borrow into the pipe function. Read more
Borrows self, then passes self.borrow() into the pipe function. Read more
Mutably borrows self, then passes self.borrow_mut() into the pipe function. Read more
Borrows self, then passes self.as_ref() into the pipe function.
Mutably borrows self, then passes self.as_mut() into the pipe function. Read more
Borrows self, then passes self.deref() into the pipe function.
Mutably borrows self, then passes self.deref_mut() into the pipe function. Read more
The alignment of pointer.
The type for initializers.
Initializes a with the given initializer. Read more
Dereferences the given pointer. Read more
Mutably dereferences the given pointer. Read more
Drops the object pointed to by the given pointer. Read more
Should always be Self
Immutable access to a value. Read more
Mutable access to a value. Read more
Immutable access to the Borrow<B> of a value. Read more
Mutable access to the BorrowMut<B> of a value. Read more
Immutable access to the AsRef<R> view of a value. Read more
Mutable access to the AsMut<R> view of a value. Read more
Immutable access to the Deref::Target of a value. Read more
Mutable access to the Deref::Target of a value. Read more
Calls .tap() only in debug builds, and is erased in release builds.
Calls .tap_mut() only in debug builds, and is erased in release builds. Read more
Calls .tap_borrow() only in debug builds, and is erased in release builds. Read more
Calls .tap_borrow_mut() only in debug builds, and is erased in release builds. Read more
Calls .tap_ref() only in debug builds, and is erased in release builds. Read more
Calls .tap_ref_mut() only in debug builds, and is erased in release builds. Read more
Calls .tap_deref() only in debug builds, and is erased in release builds. Read more
Calls .tap_deref_mut() only in debug builds, and is erased in release builds. Read more
The resulting type after obtaining ownership.
Creates owned data from borrowed data, usually by cloning. Read more
Uses borrowed data to replace owned data, usually by cloning. Read more
Attempts to convert self into T using TryInto<T>. Read more
The type returned in the event of a conversion error.
Performs the conversion.
The type returned in the event of a conversion error.
Performs the conversion.
Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more