ark-r1cs-std/crypto-primitives/src/nizk/constraints.rs
crypto-primitives/src/nizk/constraints.rsRaw
1use algebra_core::Field;
2use r1cs_core::{ConstraintSystem, SynthesisError};
3use r1cs_std::prelude::*;
4
5use crate::nizk::NIZK;
6
7pub trait NIZKVerifierGadget<N: NIZK, ConstraintF: Field> {
8 type VerificationKeyGadget: AllocGadget<N::VerificationParameters, ConstraintF>
9 + ToBytesGadget<ConstraintF>;
10
11 type ProofGadget: AllocGadget<N::Proof, ConstraintF>;
12
13 fn check_verify<'a, CS, I, T>(
14 cs: CS,
15 verification_key: &Self::VerificationKeyGadget,
16 input: I,
17 proof: &Self::ProofGadget,
18 ) -> Result<(), SynthesisError>
19 where
20 CS: ConstraintSystem<ConstraintF>,
21 I: Iterator<Item = &'a T>,
22 T: 'a + ToBitsGadget<ConstraintF> + ?Sized;
23
24 fn conditional_check_verify<'a, CS, I, T>(
25 cs: CS,
26 verification_key: &Self::VerificationKeyGadget,
27 input: I,
28 proof: &Self::ProofGadget,
29 condition: &Boolean,
30 ) -> Result<(), SynthesisError>
31 where
32 CS: ConstraintSystem<ConstraintF>,
33 I: Iterator<Item = &'a T>,
34 T: 'a + ToBitsGadget<ConstraintF> + ?Sized;
35}