Stwo backend note2

following note1

packed31 is a vector of length 16

try to understand how the trace is generated

the bottom lines actually transfer the M31 values into circleDomain

from start:

N is log N instances

this code is to initialise the witness columns, later use to store the witness.

this code generate N numbers of BaseColumns, each based columns has length 2^log_size, but it is presented by chunks of 16 length each, as packedM31.

Constraints

in the code, the constraints is generated by component

wideFibonacciComponent is a FrameworkComponent that has general type C which implement FrameworkEval, FrameworkEval requires to defined a function evaluate which has general type E that implement EvalAtRow

WideFibonacciComponent is defined like this

frameworkComponent is defined like this

when perceive eval, remember it is a type that implement FrameworkEval, which doesn’t mean it is a struct called FrameworkEval

FrameworkEval looks like this, it is a trait!!!

EvalAtRow looks like this

where all the operations defined

new function for a generate a new component

this piece of code generate a

FIB sequence length is 32

log n instance is 6

implementation of FrameworkEval for WideFibonacciEval,

The most important function here is evaluate, which generate the fibonacci constraint

let’t understand it!

so the eval is a place to store all the constraint, it is AssertEvaluator struct

the evaluate function has input eval restricted by E EvalatRow

and the function is called like this

which means eval as AssertEvaluator should implemented EvalatRow

let’s see how it looks:

recall the component of AssertEvaluator

TreeVec is essentially a wrapper around a Vec (a dynamically-sized array in Rust)

The new function take a trace, create a vector that has the same length with the trace

the trait EvalAtRow has these functions need to be defined:

let’s start digging into this one

The AssertEvaluator’s implementation for next_interaction mask is:

trace is a TreeVec<Vec<Vec<BaseField>>>

it can be something like this:

self.trace = [
  [ [1, 2, 3], [4, 5], [6] ],
  [ [7, 8], [9, 10, 11] ]
];

when indexing TreeVec[], it find a set of witness for a single fibonacci instance, indexing TreeVec[][] find a specific witness trace (from the same vaiable!) like find [1,2,3], then row+offset will find the witness values in a specific row

and then next function next trace mask is based on next interaction mask

it would be go to the next column and the same row to read witness value.

then note3

Leave a Reply

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