Implement Stwo challenger in Powdr 1

The first place the challenger is called is in stark.rs prove function:

in circuit_builder.rs in plonky3, the ConstraintSystem has a field: challenges_by_stage, can check how this field is built.

in stark.rs, the constraintSystem is initialized from a pil file

circuit_builder.rs

Data struct has a challenges field, and has a get …

Review, remove_trait_impls

Related type:

TraitsResolver

TraitsResolver helps to find the implementation for a given trait function and concrete type arguments.

TraitsResolver has a function resolve_trait_function_reference (see below) for a given polynomial reference, it resolves its trait

one of the input to this polynomialReference,

using fibo_no_public example, PolynomialReference looks like:

Understanding the remove_trait_impls

How Powdr translates PIL to Plonky3 and what about to stwo —2

following the first post

got two tasks:

  • generate trace from pil to stwo
  • implement FrameworkEval trait, which is used by stwo to define constraint, to PowdrCircuit

let’s talk about generate trace first.

in stwo, the trace is in this format as showed in last post

ColumnVec<CircleEvaluation<SimdBackend, BaseField, BitReversedOrder>>

how powdr …

How Powdr translates PIL to Plonky3 STARK—1

in Powdr, the proving function of Plonky3 is in function prove_with_key, in stark.rs

you can see the inputs for prove_with_key function has “air”, this is what used to define constraints, powdr gives “&circuit” to it, and it is a powdrcircuit, probably powdrcircuit applies the trait of AIR

so at this …