Trait winter_prover::Trace
source · pub trait Trace: Sized {
type BaseField: StarkField;
fn layout(&self) -> &TraceLayout;
fn length(&self) -> usize;
fn meta(&self) -> &[u8] ⓘ;
fn main_segment(&self) -> &Matrix<Self::BaseField>;
fn build_aux_segment<E: FieldElement<BaseField = Self::BaseField>>(
&mut self,
aux_segments: &[Matrix<E>],
rand_elements: &[E]
) -> Option<Matrix<E>>;
fn read_main_frame(
&self,
row_idx: usize,
frame: &mut EvaluationFrame<Self::BaseField>
);
fn get_info(&self) -> TraceInfo { ... }
fn main_trace_width(&self) -> usize { ... }
fn aux_trace_width(&self) -> usize { ... }
fn validate<A, E>(
&self,
air: &A,
aux_segments: &[Matrix<E>],
aux_rand_elements: &AuxTraceRandElements<E>
)
where
A: Air<BaseField = Self::BaseField>,
E: FieldElement<BaseField = Self::BaseField>,
{ ... }
}
Expand description
Defines an execution trace of a computation.
Execution trace can be reduced to a two-dimensional matrix in which each row represents the state of a computation at a single point in time and each column corresponds to an algebraic column tracked over all steps of the computation.
Building a trace is required for STARK proof generation. An execution trace of a specific instance of a computation must be supplied to Prover::prove() method to generate a STARK proof.
This crate exposes one concrete implementation of the Trace trait: TraceTable. This implementation supports concurrent trace generation and should be sufficient in most situations. However, if functionality provided by TraceTable is not sufficient, uses can provide custom implementations of the Trace trait which better suit their needs.
Required Associated Types
sourcetype BaseField: StarkField
type BaseField: StarkField
Base field for this execution trace.
All cells of this execution trace contain values which are elements in this field.
Required Methods
sourcefn layout(&self) -> &TraceLayout
fn layout(&self) -> &TraceLayout
Returns a description of how columns of this trace are arranged into trace segments.
sourcefn main_segment(&self) -> &Matrix<Self::BaseField>
fn main_segment(&self) -> &Matrix<Self::BaseField>
Returns a reference to a Matrix describing the main segment of this trace.
sourcefn build_aux_segment<E: FieldElement<BaseField = Self::BaseField>>(
&mut self,
aux_segments: &[Matrix<E>],
rand_elements: &[E]
) -> Option<Matrix<E>>
fn build_aux_segment<E: FieldElement<BaseField = Self::BaseField>>(
&mut self,
aux_segments: &[Matrix<E>],
rand_elements: &[E]
) -> Option<Matrix<E>>
Builds and returns the next auxiliary trace segment. If there are no more segments to build (i.e., the trace is complete), None is returned.
The aux_segments
slice contains a list of auxiliary trace segments built as a result
of prior invocations of this function. Thus, for example, on the first invocation,
aux_segments
will be empty; on the second invocation, it will contain a single matrix
(the one built during the first invocation) etc.
sourcefn read_main_frame(
&self,
row_idx: usize,
frame: &mut EvaluationFrame<Self::BaseField>
)
fn read_main_frame(
&self,
row_idx: usize,
frame: &mut EvaluationFrame<Self::BaseField>
)
Reads an evaluation frame from the main trace segment at the specified row.
Provided Methods
sourcefn main_trace_width(&self) -> usize
fn main_trace_width(&self) -> usize
Returns the number of columns in the main segment of this trace.
sourcefn aux_trace_width(&self) -> usize
fn aux_trace_width(&self) -> usize
Returns the number of columns in all auxiliary trace segments.
sourcefn validate<A, E>(
&self,
air: &A,
aux_segments: &[Matrix<E>],
aux_rand_elements: &AuxTraceRandElements<E>
)where
A: Air<BaseField = Self::BaseField>,
E: FieldElement<BaseField = Self::BaseField>,
fn validate<A, E>(
&self,
air: &A,
aux_segments: &[Matrix<E>],
aux_rand_elements: &AuxTraceRandElements<E>
)where
A: Air<BaseField = Self::BaseField>,
E: FieldElement<BaseField = Self::BaseField>,
Checks if this trace is valid against the specified AIR, and panics if not.
NOTE: this is a very expensive operation and is intended for use only in debug mode.