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

feat: verify proof in release mode #17

Merged
merged 1 commit into from
May 23, 2023
Merged
Show file tree
Hide file tree
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
15 changes: 8 additions & 7 deletions snark-verifier-sdk/src/halo2.rs
Original file line number Diff line number Diff line change
Expand Up @@ -121,14 +121,10 @@ where
#[cfg(feature = "display")]
end_timer!(proof_time);

if let Some((instance_path, proof_path)) = path {
write_instances(&instances, instance_path);
fs::write(proof_path, &proof).unwrap();
}

debug_assert!({
// validate proof before caching
assert!({
let mut transcript_read =
PoseidonTranscript::<NativeLoader, &[u8]>::new::<SECURE_MDS>(proof.as_slice());
PoseidonTranscript::<NativeLoader, &[u8]>::from_spec(&proof[..], POSEIDON_SPEC.clone());
VerificationStrategy::<_, V>::finalize(
verify_proof::<_, V, _, _, _>(
params.verifier_params(),
Expand All @@ -141,6 +137,11 @@ where
)
});

if let Some((instance_path, proof_path)) = path {
write_instances(&instances, instance_path);
fs::write(proof_path, &proof).unwrap();
}

proof
}

Expand Down
3 changes: 2 additions & 1 deletion snark-verifier-sdk/src/halo2/aggregation.rs
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,8 @@ use halo2_base::{
use itertools::Itertools;
use rand::{rngs::StdRng, SeedableRng};
use serde::{Deserialize, Serialize};
#[cfg(debug_assertions)]
use snark_verifier::util::arithmetic::fe_to_limbs;
use snark_verifier::{
loader::{
self,
Expand All @@ -34,7 +36,6 @@ use snark_verifier::{
kzg::{KzgAccumulator, KzgAsProvingKey, KzgAsVerifyingKey, KzgSuccinctVerifyingKey},
AccumulationScheme, AccumulationSchemeProver, PolynomialCommitmentScheme,
},
util::arithmetic::fe_to_limbs,
verifier::SnarkVerifier,
};
use std::{
Expand Down