Constraint system in STWO

struct:

FrameworkComponent<C: FrameworkEval>

it implements component and ComponentProver traits

Trace of polynomials (not constraints):

traits:

Component
fn n_constraints(&self) -> usize;

fn max_constraint_log_degree_bound(&self) -> u32;

fn trace_log_degree_bounds(&self) -> TreeVec<ColumnVec<u32>>;

fn mask_points(&self,point: CirclePoint<SecureField>,) -> TreeVec<ColumnVec<Vec<CirclePoint<SecureField>>>>;

fn evaluate_constraint_quotients_at_point(
        &self,
        point: CirclePoint<SecureField>,
        mask: &TreeVec<ColumnVec<Vec<SecureField>>>,
        evaluation_accumulator: &mut PointEvaluationAccumulator,
    );
}
ComponentProver

pub trait ComponentProver<B: Backend>: Component {
    /// Evaluates the constraint quotients of the component on the evaluation domain.
    /// Accumulates quotients in `evaluation_accumulator`.
    fn evaluate_constraint_quotients_on_domain(
        &self,
        trace: &Trace<'_, B>,
        evaluation_accumulator: &mut DomainEvaluationAccumulator<B>,
    );
}
FrameworkEval
/// A component defined solely in means of the constraints framework.
/// Implementing this trait introduces implementations for [`Component`] and [`ComponentProver`] for
/// the SIMD backend.
/// Note that the constraint framework only support components with columns of the same size.
pub trait FrameworkEval {
    fn log_size(&self) -> u32;

    fn max_constraint_log_degree_bound(&self) -> u32;

    fn evaluate<E: EvalAtRow>(&self, eval: E) -> E;
}
EvalAtRow

This is a trait for evaluating expression at some point or row, so functions in this traits are extract values from trace table

Apart from basic fieldExpOps, it has these functions

Defining a backend

when defining a backend using stwo, checking the following steps (taking plonk example in stwo as showcase):

Step1. Define FrameworkComponent struct

it has eval that implement FrameworkEval, as one of the must element. These elements in FrameworkComponent are about trace. FrameworkComponent is the main interface to the prover, when user uses stwo for a specific case, user can make an alias to make this interface to be specialized. like for plonk below

the important trait component and component prover are all implemented by FramworkComponent in prover/src/constraint_framework, user doesn’t need to care

Step2. Define a struct that contains the trace information and generate traces

Step3. Define constraints by defining a struct that implement FrameworkEval, and has lookup info

Leave a Reply

Your email address will not be published. Required fields are marked *