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 …

    Plonky3 notes about some basics

    Traits

    BaseAire

    contains width(the number of columns) and preprocessed_trace(what is this used for?)

    AirBuilderWithPublicValues

    it extend the AirBuilder trait, which is the main trait, by adding the function to get public values

    AirBuilder

    it has many functions like these: to help user build air constraints

    The main function return M, …

    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 …

    Plonky3 logging

    Pre-step:

    add these to workspace dependencies

    tracing = "0.1.37"
    tracing-forest = "0.1.6"
    tracing-subscriber = "0.3.17"
    step 1:

    add tracing subscriber to dependencies, namely, the dependencies should have these three

    tracing.workspace = true
    tracing-subscriber = { workspace = true, features = ["std", "env-filter"] }
    tracing-forest = { workspace = true, features