Struct winterfell::AirContext
[−]pub struct AirContext<B> where
B: StarkField, { /* private fields */ }
Expand description
STARK parameters and trace properties for a specific execution of a computation.
Implementations
impl<B> AirContext<B> where
B: StarkField,
impl<B> AirContext<B> where
B: StarkField,
pub fn new(
trace_info: TraceInfo,
transition_constraint_degrees: Vec<TransitionConstraintDegree, Global>,
num_assertions: usize,
options: ProofOptions
) -> AirContext<B>
pub fn new(
trace_info: TraceInfo,
transition_constraint_degrees: Vec<TransitionConstraintDegree, Global>,
num_assertions: usize,
options: ProofOptions
) -> AirContext<B>
Returns a new instance of AirContext instantiated for computations which require a single execution trace segment.
The list of transition constraint degrees defines the total number of transition constraints and their expected degrees. Constraint evaluations computed by Air::evaluate_transition() function are expected to be in the order defined by this list.
Panics
Panics if
transition_constraint_degrees
is an empty vector.num_assertions
is zero.- Blowup factor specified by the provided
options
is too small to accommodate degrees of the specified transition constraints. trace_info
describes a multi-segment execution trace.
pub fn new_multi_segment(
trace_info: TraceInfo,
main_transition_constraint_degrees: Vec<TransitionConstraintDegree, Global>,
aux_transition_constraint_degrees: Vec<TransitionConstraintDegree, Global>,
num_main_assertions: usize,
num_aux_assertions: usize,
options: ProofOptions
) -> AirContext<B>
pub fn new_multi_segment(
trace_info: TraceInfo,
main_transition_constraint_degrees: Vec<TransitionConstraintDegree, Global>,
aux_transition_constraint_degrees: Vec<TransitionConstraintDegree, Global>,
num_main_assertions: usize,
num_aux_assertions: usize,
options: ProofOptions
) -> AirContext<B>
Returns a new instance of AirContext instantiated for computations which require multiple execution trace segments.
The lists of transition constraint degrees defines the total number of transition
constraints and their expected degrees. Constraint evaluations computed by
Air::evaluate_transition() function are expected to be
in the order defined by main_transition_constraint_degrees
list. Constraint evaluations
computed by Air::evaluate_aux_transition() function
are expected to be in the order defined by aux_transition_constraint_degrees
list.
Panics
Panics if
main_transition_constraint_degrees
is an empty vector.num_main_assertions
is zero.trace_info.is_multi_segment() == true
but:aux_transition_constraint_degrees
is an empty vector.num_aux_assertions
is zero.
trace_info.is_multi_segment() == false
but:aux_transition_constraint_degrees
is a non-empty vector.num_aux_assertions
is greater than zero.
- Blowup factor specified by the provided
options
is too small to accommodate degrees of the specified transition constraints.
pub fn trace_len(&self) -> usize
pub fn trace_len(&self) -> usize
Returns length of the execution trace for an instance of a computation.
pub fn trace_poly_degree(&self) -> usize
pub fn trace_poly_degree(&self) -> usize
Returns degree of trace polynomials for an instance of a computation.
The degree is always trace_length
- 1.
pub fn ce_domain_size(&self) -> usize
pub fn ce_domain_size(&self) -> usize
Returns size of the constraint evaluation domain.
This is guaranteed to be a power of two, and is equal to trace_length * ce_blowup_factor
.
pub fn composition_degree(&self) -> usize
pub fn composition_degree(&self) -> usize
Returns the degree to which all constraint polynomials are normalized before they are composed together.
This degree is always ce_domain_size
- 1.
pub fn lde_domain_size(&self) -> usize
pub fn lde_domain_size(&self) -> usize
Returns the size of the low-degree extension domain.
This is guaranteed to be a power of two, and is equal to trace_length * lde_blowup_factor
.
pub fn num_transition_constraints(&self) -> usize
pub fn num_transition_constraints(&self) -> usize
Returns the number of transition constraints for a computation.
The number of transition constraints is defined by the total number of transition constraint degree descriptors (for both the main and the auxiliary trace constraints). This number is used to determine how many transition constraint coefficients need to be generated for merging transition constraints into a composition polynomial.
pub fn num_main_transition_constraints(&self) -> usize
pub fn num_main_transition_constraints(&self) -> usize
Returns the number of transition constraints placed against the main trace segment.
pub fn num_aux_transition_constraints(&self) -> usize
pub fn num_aux_transition_constraints(&self) -> usize
Returns the number of transition constraints placed against all auxiliary trace segments.
pub fn num_assertions(&self) -> usize
pub fn num_assertions(&self) -> usize
Returns the total number of assertions defined for a computation.
The number of assertions consists of the assertions placed against the main segment of an execution trace as well as assertions placed against all auxiliary trace segments.
pub fn num_transition_exemptions(&self) -> usize
pub fn num_transition_exemptions(&self) -> usize
Returns the number of rows at the end of an execution trace to which transition constraints do not apply.
This is guaranteed to be at least 1 (which is the default value), but could be greater. The maximum number of exemptions is determined by a combination of transition constraint degrees and blowup factor specified for the computation.
pub fn set_num_transition_exemptions(self, n: usize) -> AirContext<B>
pub fn set_num_transition_exemptions(self, n: usize) -> AirContext<B>
Sets the number of transition exemptions for this context.
Panics
Panics if:
- The number of exemptions is zero.
- The number of exemptions exceeds half of the trace length.
- Given the combination of transition constraints degrees and the blowup factor in this context, the number of exemptions is too larger for a valid computation of the constraint composition polynomial.
Trait Implementations
impl<B> Clone for AirContext<B> where
B: Clone + StarkField,
impl<B> Clone for AirContext<B> where
B: Clone + StarkField,
fn clone(&self) -> AirContext<B>
fn clone(&self) -> AirContext<B>
Returns a copy of the value. Read more
1.0.0 · sourcefn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from source
. Read more
impl<B> PartialEq<AirContext<B>> for AirContext<B> where
B: PartialEq<B> + StarkField,
impl<B> PartialEq<AirContext<B>> for AirContext<B> where
B: PartialEq<B> + StarkField,
fn eq(&self, other: &AirContext<B>) -> bool
fn eq(&self, other: &AirContext<B>) -> bool
This method tests for self
and other
values to be equal, and is used
by ==
. Read more
fn ne(&self, other: &AirContext<B>) -> bool
fn ne(&self, other: &AirContext<B>) -> bool
This method tests for !=
.
impl<B> Eq for AirContext<B> where
B: Eq + StarkField,
impl<B> StructuralEq for AirContext<B> where
B: StarkField,
impl<B> StructuralPartialEq for AirContext<B> where
B: StarkField,
Auto Trait Implementations
impl<B> RefUnwindSafe for AirContext<B> where
B: RefUnwindSafe,
impl<B> Send for AirContext<B>
impl<B> Sync for AirContext<B>
impl<B> Unpin for AirContext<B> where
B: Unpin,
impl<B> UnwindSafe for AirContext<B> where
B: UnwindSafe,
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
sourceimpl<T> ToOwned for T where
T: Clone,
impl<T> ToOwned for T where
T: Clone,
type Owned = T
type Owned = T
The resulting type after obtaining ownership.
sourcefn clone_into(&self, target: &mut T)
fn clone_into(&self, target: &mut T)
toowned_clone_into
)Uses borrowed data to replace owned data, usually by cloning. Read more