From 3fc5ff4fff3ce1ba395853ef6e6d5e8fa36443fb Mon Sep 17 00:00:00 2001 From: Daniel Lubarov Date: Fri, 7 Jan 2022 10:24:54 -0800 Subject: [PATCH] Remove old binaries (#423) FFTs became proper benches, while recursion became tests. We might consider having either bins or benches for recursion in the future, but the code in this old recursion bin won't be useful, so might as well delete it for now. --- plonky2/Cargo.toml | 2 +- plonky2/src/bin/bench_ldes.rs | 34 ----------------------- plonky2/src/bin/bench_recursion.rs | 43 ------------------------------ 3 files changed, 1 insertion(+), 78 deletions(-) delete mode 100644 plonky2/src/bin/bench_ldes.rs delete mode 100644 plonky2/src/bin/bench_recursion.rs diff --git a/plonky2/Cargo.toml b/plonky2/Cargo.toml index 0dbfa2d7..54cf5c1f 100644 --- a/plonky2/Cargo.toml +++ b/plonky2/Cargo.toml @@ -9,7 +9,7 @@ repository = "https://github.com/mir-protocol/plonky2" keywords = ["cryptography", "SNARK", "FRI"] categories = ["cryptography"] edition = "2021" -default-run = "bench_recursion" +default-run = "generate_constants" [dependencies] plonky2_field = { path = "../field" } diff --git a/plonky2/src/bin/bench_ldes.rs b/plonky2/src/bin/bench_ldes.rs deleted file mode 100644 index 57f31290..00000000 --- a/plonky2/src/bin/bench_ldes.rs +++ /dev/null @@ -1,34 +0,0 @@ -use std::time::Instant; - -use plonky2_field::field_types::Field; -use plonky2_field::goldilocks_field::GoldilocksField; -use plonky2_field::polynomial::PolynomialValues; -use rayon::prelude::*; - -type F = GoldilocksField; - -// This is an estimate of how many LDEs the prover will compute. The biggest component, 86, comes -// from wire polynomials which "store" the outputs of S-boxes in our Poseidon gate. -const NUM_LDES: usize = 8 + 8 + 3 + 86 + 3 + 8; - -const DEGREE: usize = 1 << 14; - -const RATE_BITS: usize = 3; - -fn main() { - // We start with random polynomials. - let all_poly_values = (0..NUM_LDES) - .map(|_| PolynomialValues::new(F::rand_vec(DEGREE))) - .collect::>(); - - let start = Instant::now(); - - all_poly_values.into_par_iter().for_each(|poly_values| { - let start = Instant::now(); - let lde = poly_values.lde(RATE_BITS); - let duration = start.elapsed(); - println!("LDE took {:?}", duration); - println!("LDE result: {:?}", lde.values[0]); - }); - println!("All LDEs took {:?}", start.elapsed()); -} diff --git a/plonky2/src/bin/bench_recursion.rs b/plonky2/src/bin/bench_recursion.rs deleted file mode 100644 index f8566b1b..00000000 --- a/plonky2/src/bin/bench_recursion.rs +++ /dev/null @@ -1,43 +0,0 @@ -use anyhow::Result; -use env_logger::Env; -use log::info; -use plonky2::hash::hashing::SPONGE_WIDTH; -use plonky2::iop::witness::PartialWitness; -use plonky2::plonk::circuit_builder::CircuitBuilder; -use plonky2::plonk::circuit_data::CircuitConfig; -use plonky2::plonk::config::{GenericConfig, PoseidonGoldilocksConfig}; - -fn main() -> Result<()> { - // Set the default log filter. This can be overridden using the `RUST_LOG` environment variable, - // e.g. `RUST_LOG=debug`. - // We default to debug for now, since there aren't many logs anyway, but we should probably - // change this to info or warn later. - env_logger::Builder::from_env(Env::default().default_filter_or("debug")).init(); - - bench_prove::() -} - -fn bench_prove, const D: usize>() -> Result<()> { - let config = CircuitConfig::standard_recursion_config(); - - let inputs = PartialWitness::new(); - let mut builder = CircuitBuilder::::new(config); - - let zero = builder.zero(); - let zero_ext = builder.zero_extension(); - - let mut state = [zero; SPONGE_WIDTH]; - for _ in 0..10000 { - state = builder.permute::<>::InnerHasher>(state); - } - - // Random other gates. - builder.add(zero, zero); - builder.add_extension(zero_ext, zero_ext); - - let circuit = builder.build::(); - let proof_with_pis = circuit.prove(inputs)?; - let proof_bytes = serde_cbor::to_vec(&proof_with_pis).unwrap(); - info!("Proof length: {} bytes", proof_bytes.len()); - circuit.verify(proof_with_pis) -}