Trait o1vm::legacy::trace::Tracer

source ·
pub trait Tracer<const N_REL: usize, C: FoldingConfig, Env> {
    type Selector;

    // Required methods
    fn init(domain_size: usize, selector: C::Selector, env: &mut Env) -> Self;
    fn push_row(
        &mut self,
        selector: Self::Selector,
        row: &[<<C as FoldingConfig>::Curve as AffineRepr>::ScalarField; N_REL]
    );
    fn pad_with_row(
        &mut self,
        selector: Self::Selector,
        row: &[<<C as FoldingConfig>::Curve as AffineRepr>::ScalarField; N_REL]
    ) -> usize;
    fn pad_with_zeros(&mut self, selector: Self::Selector) -> usize;
    fn pad_dummy(&mut self, selector: Self::Selector) -> usize;
}
Expand description

Tracer builds traces for some program executions. The constant type N_REL is defined as the maximum number of relation columns the trace can use per row. The type C encodes the folding configuration, from which the selector, which encodes the information of the kind of information the trace encodes, and scalar field are derived. Examples of selectors are:

  • For Keccak, Step encodes the row being performed at a time: round, squeeze, padding, etc…
  • For MIPS, Instruction encodes the CPU instruction being executed: add, sub, load, store, etc…

Required Associated Types§

Required Methods§

source

fn init(domain_size: usize, selector: C::Selector, env: &mut Env) -> Self

Initialize a new trace with the given domain size, selector, and environment.

source

fn push_row( &mut self, selector: Self::Selector, row: &[<<C as FoldingConfig>::Curve as AffineRepr>::ScalarField; N_REL] )

Add a witness row to the circuit (only for relation columns)

source

fn pad_with_row( &mut self, selector: Self::Selector, row: &[<<C as FoldingConfig>::Curve as AffineRepr>::ScalarField; N_REL] ) -> usize

Pad the rows of one opcode with the given row until reaching the domain size if needed. Returns the number of rows that were added. It does not add selector columns.

source

fn pad_with_zeros(&mut self, selector: Self::Selector) -> usize

Pads the rows of one opcode with zero rows until reaching the domain size if needed. Returns the number of rows that were added. It does not add selector columns.

source

fn pad_dummy(&mut self, selector: Self::Selector) -> usize

Pad the rows of one opcode with the first row until reaching the domain size if needed. It only tries to pad witnesses which are non empty. Returns the number of rows that were added. It does not add selector columns.

  • Use None for single traces
  • Use Some(selector) for multi traces

Implementors§

source§

impl Tracer<N_MIPS_REL_COLS, DecomposableMIPSFoldingConfig, Env<<<DecomposableMIPSFoldingConfig as FoldingConfig>::Curve as AffineRepr>::ScalarField>> for MIPSTrace

§

type Selector = ()

source§

impl Tracer<N_ZKVM_KECCAK_REL_COLS, KeccakConfig, KeccakEnv<<<KeccakConfig as FoldingConfig>::Curve as AffineRepr>::ScalarField>> for KeccakTrace

§

type Selector = ()

source§

impl<const N: usize, const N_REL: usize, C: FoldingConfig, Env> Tracer<N_REL, C, Env> for DecomposedTrace<N, C>where DecomposedTrace<N, C>: DecomposableTracer<Env>, Trace<N, C>: Tracer<N_REL, C, Env, Selector = ()>, usize: From<<C as FoldingConfig>::Selector>,

Generic implementation of the Tracer trait for the DecomposedTrace struct. It requires the DecomposedTrace to implement the DecomposableTracer trait, and the Trace struct to implement the Tracer trait with Selector set to (), and usize to implement the From trait with C::Selector.

§

type Selector = <C as FoldingConfig>::Selector