Nova/src/lib.rs
src/lib.rsRaw
1//! This library implements core components of Nova.
2#![allow(non_snake_case)]
3#![allow(clippy::type_complexity)]
4#![deny(missing_docs)]
5
6pub mod bellperson;
7mod circuit;
8mod commitments;
9mod constants;
10pub mod errors;
11pub mod gadgets;
12pub mod nifs;
13pub mod pasta;
14mod poseidon;
15pub mod r1cs;
16pub mod traits;
17
18use errors::NovaError;
19use r1cs::{R1CSGens, R1CSShape, RelaxedR1CSInstance, RelaxedR1CSWitness};
20use traits::Group;
21
22/// A SNARK that proves the knowledge of a valid `RecursiveSNARK`
23pub struct CompressedSNARKTrivial<G: Group> {
24 W: RelaxedR1CSWitness<G>,
25}
26
27impl<G: Group> CompressedSNARKTrivial<G> {
28 /// Produces a proof of a instance given its satisfying witness `W`.
29 pub fn prove(W: &RelaxedR1CSWitness<G>) -> Result<CompressedSNARKTrivial<G>, NovaError> {
30 Ok(Self { W: W.clone() })
31 }
32
33 /// Verifies the proof of a folded instance `U` given its shape `S` public parameters `gens`
34 pub fn verify(
35 &self,
36 gens: &R1CSGens<G>,
37 S: &R1CSShape<G>,
38 U: &RelaxedR1CSInstance<G>,
39 ) -> Result<(), NovaError> {
40 // check that the witness is a valid witness to the folded instance `U`
41 S.is_sat_relaxed(gens, U, &self.W)
42 }
43}