Note for bus in stwo 2

continue from this blog

Another thought: proving everying thing together and logup by stwo as extra.

Building LogUp trace

basic steps:
  • logup trace generator, size is determined.
    let mut logup_gen = LogupTraceGenerator::new(log_size);
    • generate columns that is associated with this logup trace generator
    let mut col_gen = logup_gen.new_col();
    • write fraction, building

    Notes for bus in stwo

    related to this PR

    Test case

    cargo install --path ./cli-rs

    compile with the correct field

    powdr-rs compile riscv/tests/riscv_data/keccak -o output --field bb
    cargo run --features stwo pil  output/keccak.asm --linker-mode native  -o output --force --field m31  --prove-with stworesult.txt

    This can give keccak_opt.pil file with lookup identity, it is native lookup, …

    Native logup implementation of Stwo backend Powdr -2

    following the first post 1

    test command

    RUST_LOG=stwo=trace cargo test --package powdr-pipeline --test pil --features stwo -- witness_lookup --exact --show-outputresult.txt

    Implementation notes

    Witness to BaseColumn

    witness needs to be transformed into BaseColumns and then use the combine function to get fraction.

    in Plonk example, all the witness columns are …

    Deep dive to InfoEvaluator of Stwo

    The reason I write this is because I saw the verification sample ood points are related to InfoEvalator. InfoEvalator contains this mask or mask offset information which basically embedded the circuit information.

    This mask points of MleEvalProverComponent

    Start with component built

    when a component is buit, it takes a location_allocator, …

    Native logup implementation of Stwo backend Powdr

    Powdr side:

    run test in pipeline (I changed the test so it can include stwo):

    #[test]
    fn witness_lookup() {
        let f = "pil/witness_lookup.pil";
        let inputs = [3, 5, 2, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7]
            .into_iter()
            .map(GoldilocksField::from)
            .collect::<Vec<_();
        let pipeline = make_prepared_pipeline(f, 

    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 …

    Stwo Commitment Data Structure

    Start with the proof of stwo:

    commitmentSchemeProof

    proof.commitments

    contains the proof info, the interesting part is the commitments, in the verification function, there will be commitments[0], commitments[1],commitments[2] represent the commitment of pre-process trace, witness trace and lookup trace commitments. namely, they only have three root commitments, every root commitment should …

    prove with polynomials with variant size in stwo

    Statemachine example in stwo

    this statemachine example has component with different degrees:

    component file

    StateTRansitionEval is the evaluation function, coordinate mark the number of the Eval

    statemachine 0 has just two numbers, the mix_into put these numbers in to channel

    statemachine 1 aslo implement the mix_into function, and mix all …