Trait winterfell::Trace
source · [−]pub trait Trace {
type BaseField: StarkField;
fn layout(&self) -> &TraceLayout;
fn length(&self) -> usize;
fn meta(&self) -> &[u8]ⓘNotable traits for &'_ [u8]impl<'_> Read for &'_ [u8]impl<'_> Write for &'_ mut [u8]
;
fn main_segment(&self) -> &Matrix<Self::BaseField>;
fn build_aux_segment<E>(
&mut self,
aux_segments: &[Matrix<E>],
rand_elements: &[E]
) -> Option<Matrix<E>>
where
E: FieldElement<BaseField = Self::BaseField>;
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
Required Methods
fn layout(&self) -> &TraceLayout
fn layout(&self) -> &TraceLayout
Returns a description of how columns of this trace are arranged into trace segments.
Returns metadata associated with this trace.
fn 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.
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.
fn 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
fn main_trace_width(&self) -> usize
fn main_trace_width(&self) -> usize
Returns the number of columns in the main segment of this trace.
fn aux_trace_width(&self) -> usize
fn aux_trace_width(&self) -> usize
Returns the number of columns in all auxiliary trace segments.
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.