mirror of https://github.com/vacp2p/zerokit.git
Multiplier proof test
This commit is contained in:
parent
c96ab25bc6
commit
b382046584
|
@ -2,8 +2,13 @@ use ark_circom::{CircomBuilder, CircomConfig, CircomCircuit};
|
||||||
use ark_std::rand::thread_rng;
|
use ark_std::rand::thread_rng;
|
||||||
|
|
||||||
use ark_bn254::Bn254;
|
use ark_bn254::Bn254;
|
||||||
use ark_groth16::generate_random_parameters;
|
use ark_groth16::{
|
||||||
use ark_groth16::ProvingKey;
|
ProvingKey,
|
||||||
|
generate_random_parameters,
|
||||||
|
create_random_proof as prove,
|
||||||
|
prepare_verifying_key,
|
||||||
|
verify_proof
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
pub struct Multiplier {
|
pub struct Multiplier {
|
||||||
|
@ -48,3 +53,19 @@ impl Multiplier {
|
||||||
false
|
false
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
fn multiplier_proof() {
|
||||||
|
let mul = Multiplier::new();
|
||||||
|
let inputs = mul.circom.get_public_inputs().unwrap();
|
||||||
|
|
||||||
|
let mut rng = thread_rng();
|
||||||
|
|
||||||
|
let proof = prove(mul.circom, &mul.params, &mut rng).unwrap();
|
||||||
|
|
||||||
|
let pvk = prepare_verifying_key(&mul.params.vk);
|
||||||
|
|
||||||
|
let verified = verify_proof(&pvk, &proof, &inputs).unwrap();
|
||||||
|
|
||||||
|
assert!(verified);
|
||||||
|
}
|
||||||
|
|
Loading…
Reference in New Issue