You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

36 lines
1.1 KiB

  1. use ark_std::UniformRand;
  2. use sigmabus_poc::transcript::{tests::poseidon_test_config, PoseidonTranscript};
  3. use criterion::{criterion_group, criterion_main, Criterion};
  4. use ark_bn254::{Bn254, Fr, G1Projective};
  5. use ark_std::rand::{RngCore, SeedableRng};
  6. use ark_std::test_rng;
  7. use sigmabus_poc::sigmabus::Sigmabus;
  8. fn bench_prove(c: &mut Criterion) {
  9. let mut rng = ark_std::rand::rngs::StdRng::seed_from_u64(test_rng().next_u64());
  10. let poseidon_config = poseidon_test_config::<Fr>();
  11. // generate the trusted setup
  12. let params = Sigmabus::<Bn254>::setup(&mut rng, &poseidon_config);
  13. // compute the witness x
  14. let x = Fr::rand(&mut rng);
  15. let mut transcript_p = PoseidonTranscript::<G1Projective>::new(&poseidon_config);
  16. // generate Sigmabus proof for X==x*G
  17. c.bench_function("prove", |b| {
  18. b.iter(|| {
  19. let _proof = Sigmabus::<Bn254>::prove(&mut rng, &params, &mut transcript_p, x).unwrap();
  20. });
  21. });
  22. }
  23. criterion_group! {
  24. name=prover_benches;
  25. config=Criterion::default();
  26. targets=
  27. bench_prove,
  28. }
  29. criterion_main!(prover_benches);