Struct proof_system::proof_spec::ProofSpec
source · 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.