pub struct AirContext<B>where
B: StarkField,{ /* private fields */ }Expand description
STARK parameters and trace properties for a specific execution of a computation.
Implementations§
Source§impl<B> AirContext<B>where
B: StarkField,
impl<B> AirContext<B>where
B: StarkField,
Sourcepub fn new(
trace_info: TraceInfo,
transition_constraint_degrees: Vec<TransitionConstraintDegree>,
num_assertions: usize,
options: ProofOptions,
) -> AirContext<B>
pub fn new( trace_info: TraceInfo, transition_constraint_degrees: Vec<TransitionConstraintDegree>, 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_degreesis an empty vector.num_assertionsis zero.- Blowup factor specified by the provided
optionsis too small to accommodate degrees of the specified transition constraints. trace_infodescribes a multi-segment execution trace.
Sourcepub fn new_multi_segment(
trace_info: TraceInfo,
main_transition_constraint_degrees: Vec<TransitionConstraintDegree>,
aux_transition_constraint_degrees: Vec<TransitionConstraintDegree>,
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>, aux_transition_constraint_degrees: Vec<TransitionConstraintDegree>, 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_degreesis an empty vector.num_main_assertionsis zero.trace_info.is_multi_segment() == truebut:aux_transition_constraint_degreesis an empty vector.num_aux_assertionsis zero.
trace_info.is_multi_segment() == falsebut:aux_transition_constraint_degreesis a non-empty vector.num_aux_assertionsis greater than zero.
- Blowup factor specified by the provided
optionsis too small to accommodate degrees of the specified transition constraints.
Sourcepub fn trace_info(&self) -> &TraceInfo
pub fn trace_info(&self) -> &TraceInfo
Returns the trace info for an instance of a computation.
Sourcepub fn trace_len(&self) -> usize
pub fn trace_len(&self) -> usize
Returns length of the execution trace for an instance of a computation.
This is guaranteed to be a power of two greater than or equal to 8.
Sourcepub 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.
Sourcepub 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.
Sourcepub 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.
Sourcepub 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 constraint composition polynomial.
Sourcepub 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.
Sourcepub fn num_aux_transition_constraints(&self) -> usize
pub fn num_aux_transition_constraints(&self) -> usize
Returns the number of transition constraints placed against the auxiliary trace segment.
Sourcepub 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 the auxiliary trace segment.
Sourcepub 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.
Sourcepub fn num_constraint_composition_columns(&self) -> usize
pub fn num_constraint_composition_columns(&self) -> usize
Returns the number of columns needed to store the constraint composition polynomial.
This is the maximum of:
- The maximum evaluation degree over all transition constraints minus the degree of the transition constraint divisor divided by trace length.
1, because the constraint composition polynomial requires at least one column.
Since the degree of a constraint C(x) can be computed as
[constraint.base + constraint.cycles.len()] * [trace_length - 1]
the degree of the constraint composition polynomial can be computed as:
([constraint.base + constraint.cycles.len()] * [trace_length - 1] - [trace_length - n])
where constraint is the constraint attaining the maximum and n is the number of
exemption points. In the case n = 1, the expression simplifies to:
[constraint.base + constraint.cycles.len() - 1] * [trace_length - 1]
Thus, if each column is of length trace_length, we would need
[constraint.base + constraint.cycles.len() - 1]
columns to store the coefficients of the constraint composition polynomial. This means that
if the highest constraint degree is equal to 5, the constraint composition polynomial will
require four columns and if the highest constraint degree is equal to 7, it will require
six columns to store.
Sourcepub 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§
Source§impl<B> Clone for AirContext<B>where
B: Clone + StarkField,
impl<B> Clone for AirContext<B>where
B: Clone + StarkField,
Source§fn clone(&self) -> AirContext<B>
fn clone(&self) -> AirContext<B>
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more