You can try the analyzer now.
To start analysis, inject the code like this to get the trace for analysis:
rust
let data = builder.build::<C>();
let proof = data.prove(pw)?;
let proof = data.prove(pw.clone())?;
let partition_witness =
plonky2::iop::generator::generate_partial_witness(pw, &data.prover_only, &data.common);
let _witness = format!("{:#?}", partition_witness);
let _data = format!("{:#?}", data);
let _proof = format!("{:#?}", proof);
let _output = format!("Plonky2Data {{\nwitness: {},\ndata: {},\nproof: {}\n}}", _witness, _data, _proof);
let mut file = std::fs::File::create("output.rust").unwrap();
std::io::Write::write_all(&mut file, _output.as_bytes()).unwrap();
data.verify(proof)
let data = builder.build::<C>();
let proof = data.prove(pw)?;
let proof = data.prove(pw.clone())?;
let partition_witness =
plonky2::iop::generator::generate_partial_witness(pw, &data.prover_only, &data.common);
let _witness = format!("{:#?}", partition_witness);
let _data = format!("{:#?}", data);
let _proof = format!("{:#?}", proof);
let _output = format!("Plonky2Data {{\nwitness: {},\ndata: {},\nproof: {}\n}}", _witness, _data, _proof);
let mut file = std::fs::File::create("output.rust").unwrap();
std::io::Write::write_all(&mut file, _output.as_bytes()).unwrap();
data.verify(proof)
You also need to modify PartitionWitness
in plonky2/src/iop/witness.rs
to include Debug, like this:
rust
#[derive(Clone)]
#[derive(Clone, Debug)]
pub struct PartitionWitness<'a, F: Field> {
pub values: Vec<Option<F>>,
...
}
#[derive(Clone)]
#[derive(Clone, Debug)]
pub struct PartitionWitness<'a, F: Field> {
pub values: Vec<Option<F>>,
...
}