mirror of
https://github.com/logos-storage/plonky2.git
synced 2026-01-08 16:53:07 +00:00
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.
This commit is contained in:
parent
f48d8c92bd
commit
3fc5ff4fff
@ -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" }
|
||||
|
||||
@ -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::<Vec<_>>();
|
||||
|
||||
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());
|
||||
}
|
||||
@ -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::<PoseidonGoldilocksConfig, 2>()
|
||||
}
|
||||
|
||||
fn bench_prove<C: GenericConfig<D>, const D: usize>() -> Result<()> {
|
||||
let config = CircuitConfig::standard_recursion_config();
|
||||
|
||||
let inputs = PartialWitness::new();
|
||||
let mut builder = CircuitBuilder::<C::F, D>::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::<<C as GenericConfig<D>>::InnerHasher>(state);
|
||||
}
|
||||
|
||||
// Random other gates.
|
||||
builder.add(zero, zero);
|
||||
builder.add_extension(zero_ext, zero_ext);
|
||||
|
||||
let circuit = builder.build::<C>();
|
||||
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)
|
||||
}
|
||||
Loading…
x
Reference in New Issue
Block a user