pub struct ProofSpec<E: Pairing> {
pub statements: Statements<E>,
pub meta_statements: MetaStatements,
pub setup_params: Vec<SetupParams<E>>,
pub context: Option<Vec<u8>>,
pub aggregate_groth16: Option<Vec<BTreeSet<usize>>>,
pub aggregate_legogroth16: Option<Vec<BTreeSet<usize>>>,
pub snark_aggregation_srs: Option<SnarkpackSRS<E>>,
}
Expand description
Describes the relations that need to proven. This is created independently by the prover and verifier and must
be agreed upon and be same before creating a Proof
. Represented as collection of Statement
s and MetaStatement
s.
Also contains other instructions like which proofs to aggregate.
Fields§
§statements: Statements<E>
§meta_statements: MetaStatements
§setup_params: Vec<SetupParams<E>>
§context: Option<Vec<u8>>
context
is any arbitrary data that needs to be hashed into the proof and it must be kept
same while creating and verifying the proof. Eg of context
are the purpose of
the proof or the verifier’s identity or some verifier-specific identity of the holder
or all of the above combined.
aggregate_groth16: Option<Vec<BTreeSet<usize>>>
Statement indices for which Groth16 proof should be aggregated. Each BTreeSet represents one group of statements whose proof will be aggregated into 1 aggregate proof. The number of aggregate proofs is the length of the vector
aggregate_legogroth16: Option<Vec<BTreeSet<usize>>>
Same as aggregate_groth16
above but aggregates LegoGroth16 proof instead of Groth16.
snark_aggregation_srs: Option<SnarkpackSRS<E>>
Implementations§
Source§impl<E: Pairing> ProofSpec<E>
impl<E: Pairing> ProofSpec<E>
Sourcepub fn new(
statements: Statements<E>,
meta_statements: MetaStatements,
setup_params: Vec<SetupParams<E>>,
context: Option<Vec<u8>>,
) -> Self
pub fn new( statements: Statements<E>, meta_statements: MetaStatements, setup_params: Vec<SetupParams<E>>, context: Option<Vec<u8>>, ) -> Self
Create a new ProofSpec
Sourcepub fn new_with_aggregation(
statements: Statements<E>,
meta_statements: MetaStatements,
setup_params: Vec<SetupParams<E>>,
context: Option<Vec<u8>>,
aggregate_groth16: Option<Vec<BTreeSet<usize>>>,
aggregate_legogroth16: Option<Vec<BTreeSet<usize>>>,
snark_aggregation_srs: Option<SnarkpackSRS<E>>,
) -> Self
pub fn new_with_aggregation( statements: Statements<E>, meta_statements: MetaStatements, setup_params: Vec<SetupParams<E>>, context: Option<Vec<u8>>, aggregate_groth16: Option<Vec<BTreeSet<usize>>>, aggregate_legogroth16: Option<Vec<BTreeSet<usize>>>, snark_aggregation_srs: Option<SnarkpackSRS<E>>, ) -> Self
Same as Self::new
but specifies which proofs should be aggregated.
pub fn add_statement(&mut self, statement: Statement<E>) -> usize
pub fn add_meta_statement(&mut self, meta_statement: MetaStatement) -> usize
Sourcepub fn validate(&self) -> Result<(), ProofSystemError>
pub fn validate(&self) -> Result<(), ProofSystemError>
Sanity check to ensure the proof spec is valid. This should never error as these are used by same entity creating them.
Sourcepub fn derive_commitment_keys(
&self,
) -> Result<(StatementDerivedParams<Vec<E::G1Affine>>, StatementDerivedParams<Vec<E::G1Affine>>, StatementDerivedParams<(Vec<E::G1Affine>, Vec<E::G1Affine>)>, StatementDerivedParams<Vec<E::G1Affine>>, StatementDerivedParams<[E::G1Affine; 2]>, StatementDerivedParams<[E::G1Affine; 2]>, StatementDerivedParams<[E::G1Affine; 2]>), ProofSystemError>
pub fn derive_commitment_keys( &self, ) -> Result<(StatementDerivedParams<Vec<E::G1Affine>>, StatementDerivedParams<Vec<E::G1Affine>>, StatementDerivedParams<(Vec<E::G1Affine>, Vec<E::G1Affine>)>, StatementDerivedParams<Vec<E::G1Affine>>, StatementDerivedParams<[E::G1Affine; 2]>, StatementDerivedParams<[E::G1Affine; 2]>, StatementDerivedParams<[E::G1Affine; 2]>), ProofSystemError>
Derive commitment keys for Schnorr protocol from public params. This is done to avoid creating them if the same public params are used in multiple statements and is effectively a pre-processing step done for optimization.
Sourcepub fn derive_prepared_parameters(
&self,
) -> Result<(StatementDerivedParams<LegoPreparedVerifyingKey<E>>, StatementDerivedParams<PreparedEncryptionGens<E>>, StatementDerivedParams<PreparedEncryptionKey<E>>, StatementDerivedParams<SaverPreparedVerifyingKey<E>>, StatementDerivedParams<PreparedBBSPlusSigParams<E>>, StatementDerivedParams<PreparedBBSPlusPk<E>>, StatementDerivedParams<PreparedAccumParams<E>>, StatementDerivedParams<PreparedAccumPk<E>>, StatementDerivedParams<KBPreparedAccumParams<E>>, StatementDerivedParams<KBPreparedAccumPk<E>>, StatementDerivedParams<PreparedPSSigParams<E>>, StatementDerivedParams<PreparedPSPk<E>>, StatementDerivedParams<PreparedBBSSigParams23<E>>, StatementDerivedParams<SmcParamsWithPairingAndCommitmentKey<E>>), ProofSystemError>
pub fn derive_prepared_parameters( &self, ) -> Result<(StatementDerivedParams<LegoPreparedVerifyingKey<E>>, StatementDerivedParams<PreparedEncryptionGens<E>>, StatementDerivedParams<PreparedEncryptionKey<E>>, StatementDerivedParams<SaverPreparedVerifyingKey<E>>, StatementDerivedParams<PreparedBBSPlusSigParams<E>>, StatementDerivedParams<PreparedBBSPlusPk<E>>, StatementDerivedParams<PreparedAccumParams<E>>, StatementDerivedParams<PreparedAccumPk<E>>, StatementDerivedParams<KBPreparedAccumParams<E>>, StatementDerivedParams<KBPreparedAccumPk<E>>, StatementDerivedParams<PreparedPSSigParams<E>>, StatementDerivedParams<PreparedPSPk<E>>, StatementDerivedParams<PreparedBBSSigParams23<E>>, StatementDerivedParams<SmcParamsWithPairingAndCommitmentKey<E>>), ProofSystemError>
Derive prepared keys for performing pairings. This is done to avoid preparing the same parameters again and is effectively a pre-processing step done for optimization.
Trait Implementations§
Source§impl<E: Pairing> CanonicalDeserialize for ProofSpec<E>
impl<E: Pairing> CanonicalDeserialize for ProofSpec<E>
Source§fn deserialize_with_mode<R: Read>(
reader: R,
compress: Compress,
validate: Validate,
) -> Result<Self, SerializationError>
fn deserialize_with_mode<R: Read>( reader: R, compress: Compress, validate: Validate, ) -> Result<Self, SerializationError>
fn deserialize_compressed<R>(reader: R) -> Result<Self, SerializationError>where
R: Read,
fn deserialize_compressed_unchecked<R>(
reader: R,
) -> Result<Self, SerializationError>where
R: Read,
fn deserialize_uncompressed<R>(reader: R) -> Result<Self, SerializationError>where
R: Read,
fn deserialize_uncompressed_unchecked<R>(
reader: R,
) -> Result<Self, SerializationError>where
R: Read,
Source§impl<E: Pairing> CanonicalSerialize for ProofSpec<E>
impl<E: Pairing> CanonicalSerialize for ProofSpec<E>
Source§fn serialize_with_mode<W: Write>(
&self,
writer: W,
compress: Compress,
) -> Result<(), SerializationError>
fn serialize_with_mode<W: Write>( &self, writer: W, compress: Compress, ) -> Result<(), SerializationError>
fn serialized_size(&self, compress: Compress) -> usize
fn serialize_compressed<W>(&self, writer: W) -> Result<(), SerializationError>where
W: Write,
fn compressed_size(&self) -> usize
fn serialize_uncompressed<W>(&self, writer: W) -> Result<(), SerializationError>where
W: Write,
fn uncompressed_size(&self) -> usize
Source§impl<'de, E: Pairing> Deserialize<'de> for ProofSpec<E>
impl<'de, E: Pairing> Deserialize<'de> for ProofSpec<E>
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Source§impl<E: Pairing> Valid for ProofSpec<E>
impl<E: Pairing> Valid for ProofSpec<E>
fn check(&self) -> Result<(), SerializationError>
fn batch_check<'a>(
batch: impl Iterator<Item = &'a Self> + Send,
) -> Result<(), SerializationError>where
Self: 'a,
impl<E: Pairing> StructuralPartialEq for ProofSpec<E>
Auto Trait Implementations§
impl<E> Freeze for ProofSpec<E>
impl<E> RefUnwindSafe for ProofSpec<E>where
<E as Pairing>::G1Affine: RefUnwindSafe,
<E as Pairing>::G2Affine: RefUnwindSafe,
<E as Pairing>::ScalarField: RefUnwindSafe,
impl<E> Send for ProofSpec<E>
impl<E> Sync for ProofSpec<E>
impl<E> Unpin for ProofSpec<E>
impl<E> UnwindSafe for ProofSpec<E>where
<E as Pairing>::G1Affine: UnwindSafe,
<E as Pairing>::G2Affine: UnwindSafe,
<E as Pairing>::ScalarField: UnwindSafe + RefUnwindSafe,
Blanket Implementations§
Source§impl<T> ArchivePointee for T
impl<T> ArchivePointee for T
Source§type ArchivedMetadata = ()
type ArchivedMetadata = ()
Source§fn pointer_metadata(
_: &<T as ArchivePointee>::ArchivedMetadata,
) -> <T as Pointee>::Metadata
fn pointer_metadata( _: &<T as ArchivePointee>::ArchivedMetadata, ) -> <T as Pointee>::Metadata
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CanonicalSerializeHashExt for Twhere
T: CanonicalSerialize,
impl<T> CanonicalSerializeHashExt for Twhere
T: CanonicalSerialize,
fn hash<H>(&self) -> GenericArray<u8, <H as OutputSizeUser>::OutputSize>where
H: Digest,
fn hash_uncompressed<H>(
&self,
) -> GenericArray<u8, <H as OutputSizeUser>::OutputSize>where
H: Digest,
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self
into a Left
variant of Either<Self, Self>
if into_left
is true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self
into a Left
variant of Either<Self, Self>
if into_left(&self)
returns true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read moreSource§impl<T> LayoutRaw for T
impl<T> LayoutRaw for T
Source§fn layout_raw(_: <T as Pointee>::Metadata) -> Result<Layout, LayoutError>
fn layout_raw(_: <T as Pointee>::Metadata) -> Result<Layout, LayoutError>
Source§impl<T, N1, N2> Niching<NichedOption<T, N1>> for N2
impl<T, N1, N2> Niching<NichedOption<T, N1>> for N2
Source§unsafe fn is_niched(niched: *const NichedOption<T, N1>) -> bool
unsafe fn is_niched(niched: *const NichedOption<T, N1>) -> bool
Source§fn resolve_niched(out: Place<NichedOption<T, N1>>)
fn resolve_niched(out: Place<NichedOption<T, N1>>)
out
indicating that a T
is niched.