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.

49 lines
1.9 KiB

  1. #![allow(non_snake_case)]
  2. #![allow(non_upper_case_globals)]
  3. #![allow(non_camel_case_types)]
  4. #![allow(clippy::upper_case_acronyms)]
  5. #![allow(dead_code)]
  6. use ark_pallas::{constraints::GVar, Fr, Projective};
  7. use ark_vesta::{constraints::GVar as GVar2, Projective as Projective2};
  8. use folding_schemes::commitment::pedersen::Pedersen;
  9. use folding_schemes::folding::nova::{get_r1cs, ProverParams, VerifierParams};
  10. use folding_schemes::frontend::FCircuit;
  11. use folding_schemes::transcript::poseidon::poseidon_test_config;
  12. // This method computes the Prover & Verifier parameters for the example.
  13. // Warning: this method is only for testing purposes. For a real world use case those parameters
  14. // should be generated carefuly (both the PoseidonConfig and the PedersenParams).
  15. #[allow(clippy::type_complexity)]
  16. pub(crate) fn test_nova_setup<FC: FCircuit<Fr>>(
  17. F_circuit: FC,
  18. ) -> (
  19. ProverParams<Projective, Projective2, Pedersen<Projective>, Pedersen<Projective2>>,
  20. VerifierParams<Projective, Projective2>,
  21. ) {
  22. let mut rng = ark_std::test_rng();
  23. let poseidon_config = poseidon_test_config::<Fr>();
  24. // get the CM & CF_CM len
  25. let (r1cs, cf_r1cs) =
  26. get_r1cs::<Projective, GVar, Projective2, GVar2, FC>(&poseidon_config, F_circuit).unwrap();
  27. let cm_len = r1cs.A.n_rows;
  28. let cf_cm_len = cf_r1cs.A.n_rows;
  29. let pedersen_params = Pedersen::<Projective>::new_params(&mut rng, cm_len);
  30. let cf_pedersen_params = Pedersen::<Projective2>::new_params(&mut rng, cf_cm_len);
  31. let prover_params =
  32. ProverParams::<Projective, Projective2, Pedersen<Projective>, Pedersen<Projective2>> {
  33. poseidon_config: poseidon_config.clone(),
  34. cm_params: pedersen_params,
  35. cf_cm_params: cf_pedersen_params,
  36. };
  37. let verifier_params = VerifierParams::<Projective, Projective2> {
  38. poseidon_config: poseidon_config.clone(),
  39. r1cs,
  40. cf_r1cs,
  41. };
  42. (prover_params, verifier_params)
  43. }
  44. fn main() {}