Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add the proof generation test for note encryption circuit #175

Merged
merged 1 commit into from
Jun 19, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 11 additions & 3 deletions taiga_halo2/src/circuit/note_encryption_circuit.rs
Original file line number Diff line number Diff line change
Expand Up @@ -121,9 +121,11 @@ fn test_halo2_note_encryption_circuit() {
use crate::circuit::gadgets::add::AddConfig;
use crate::circuit::gadgets::assign_free_advice;
use crate::constant::{
NoteCommitmentDomain, NoteCommitmentFixedBases, NoteCommitmentHashDomain,
NoteCommitmentDomain, NoteCommitmentFixedBases, NoteCommitmentHashDomain, SETUP_PARAMS_MAP,
VP_CIRCUIT_PARAMS_SIZE,
};
use crate::note_encryption::{NoteCipher, SecretKey};
use crate::proof::Proof;
use crate::utils::mod_r_p;
use ff::Field;
use group::Curve;
Expand All @@ -139,7 +141,7 @@ fn test_halo2_note_encryption_circuit() {
use halo2_proofs::{
circuit::{Layouter, SimpleFloorPlanner, Value},
dev::MockProver,
plonk::{Advice, Circuit, Column, ConstraintSystem, Error},
plonk::{keygen_pk, keygen_vk, Advice, Circuit, Column, ConstraintSystem, Error},
};
use rand::rngs::OsRng;

Expand Down Expand Up @@ -351,5 +353,11 @@ fn test_halo2_note_encryption_circuit() {
};

let prover = MockProver::run(11, &circuit, vec![]).unwrap();
assert_eq!(prover.verify(), Ok(()))
assert_eq!(prover.verify(), Ok(()));

let params = SETUP_PARAMS_MAP.get(&VP_CIRCUIT_PARAMS_SIZE).unwrap();
let vk = keygen_vk(params, &circuit).expect("keygen_vk should not fail");
let pk = keygen_pk(params, vk.clone(), &circuit).expect("keygen_pk should not fail");
let proof = Proof::create(&pk, params, circuit, &[], &mut rng).unwrap();
assert!(proof.verify(&vk, params, &[]).is_ok());
}