Trait winter_prover::Trace

source ·
pub trait Trace: Sized {
    type BaseField: StarkField;

    // Required methods
    fn layout(&self) -> &TraceLayout;
    fn length(&self) -> usize;
    fn meta(&self) -> &[u8] ;
    fn main_segment(&self) -> &ColMatrix<Self::BaseField>;
    fn build_aux_segment<E: FieldElement<BaseField = Self::BaseField>>(
        &mut self,
        aux_segments: &[ColMatrix<E>],
        rand_elements: &[E]
    ) -> Option<ColMatrix<E>>;
    fn read_main_frame(
        &self,
        row_idx: usize,
        frame: &mut EvaluationFrame<Self::BaseField>
    );

    // Provided methods
    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: &[ColMatrix<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§

source

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§

source

fn layout(&self) -> &TraceLayout

Returns a description of how columns of this trace are arranged into trace segments.

source

fn length(&self) -> usize

Returns the number of rows in this trace.

source

fn meta(&self) -> &[u8]

Returns metadata associated with this trace.

source

fn main_segment(&self) -> &ColMatrix<Self::BaseField>

Returns a reference to a [Matrix] describing the main segment of this trace.

source

fn build_aux_segment<E: FieldElement<BaseField = Self::BaseField>>( &mut self, aux_segments: &[ColMatrix<E>], rand_elements: &[E] ) -> Option<ColMatrix<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.

source

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§

source

fn get_info(&self) -> TraceInfo

Returns trace info for this trace.

source

fn main_trace_width(&self) -> usize

Returns the number of columns in the main segment of this trace.

source

fn aux_trace_width(&self) -> usize

Returns the number of columns in all auxiliary trace segments.

source

fn validate<A, E>( &self, air: &A, aux_segments: &[ColMatrix<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.

Object Safety§

This trait is not object safe.

Implementors§