Struct proof_system::proof_spec::ProofSpec
source · [−]pub struct ProofSpec<E: PairingEngine, G: AffineCurve> {
pub statements: Statements<E, G>,
pub meta_statements: MetaStatements,
pub setup_params: Vec<SetupParams<E, G>>,
pub context: Option<Vec<u8>>,
}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 Statements and MetaStatements.
Fields
statements: Statements<E, G>meta_statements: MetaStatementssetup_params: Vec<SetupParams<E, G>>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.
Implementations
sourceimpl<E, G> ProofSpec<E, G>where
E: PairingEngine,
G: AffineCurve,
impl<E, G> ProofSpec<E, G>where
E: PairingEngine,
G: AffineCurve,
pub fn new(
statements: Statements<E, G>,
meta_statements: MetaStatements,
setup_params: Vec<SetupParams<E, G>>,
context: Option<Vec<u8>>
) -> Self
pub fn add_statement(&mut self, statement: Statement<E, G>) -> usize
pub fn add_meta_statement(&mut self, meta_statement: MetaStatement) -> usize
sourcepub fn is_valid(&self) -> bool
pub fn is_valid(&self) -> bool
Sanity check to ensure the proof spec is valid. This should never be false 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>>), 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>>), 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>>), ProofSystemError>
pub fn derive_prepared_parameters(
&self
) -> Result<(StatementDerivedParams<LegoPreparedVerifyingKey<E>>, StatementDerivedParams<PreparedEncryptionGens<E>>, StatementDerivedParams<PreparedEncryptionKey<E>>, StatementDerivedParams<SaverPreparedVerifyingKey<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
sourceimpl<E: PairingEngine, G: AffineCurve> CanonicalDeserialize for ProofSpec<E, G>
impl<E: PairingEngine, G: AffineCurve> CanonicalDeserialize for ProofSpec<E, G>
sourcefn deserialize<R: Read>(reader: R) -> Result<Self, SerializationError>
fn deserialize<R: Read>(reader: R) -> Result<Self, SerializationError>
Self from reader.sourcefn deserialize_uncompressed<R: Read>(
reader: R
) -> Result<Self, SerializationError>
fn deserialize_uncompressed<R: Read>(
reader: R
) -> Result<Self, SerializationError>
Self from reader without compression.sourcefn deserialize_unchecked<R: Read>(reader: R) -> Result<Self, SerializationError>
fn deserialize_unchecked<R: Read>(reader: R) -> Result<Self, SerializationError>
self from reader without compression, and without performing
validity checks. Should be used only when the input is trusted. Read moresourceimpl<E: PairingEngine, G: AffineCurve> CanonicalSerialize for ProofSpec<E, G>
impl<E: PairingEngine, G: AffineCurve> CanonicalSerialize for ProofSpec<E, G>
sourcefn serialize<W: Write>(&self, writer: W) -> Result<(), SerializationError>
fn serialize<W: Write>(&self, writer: W) -> Result<(), SerializationError>
self into writer.
It is left up to a particular type for how it strikes the
serialization efficiency vs compression tradeoff.
For standard types (e.g. bool, lengths, etc.) typically an uncompressed
form is used, whereas for algebraic types compressed forms are used. Read morefn serialized_size(&self) -> usize
sourcefn serialize_uncompressed<W: Write>(
&self,
writer: W
) -> Result<(), SerializationError>
fn serialize_uncompressed<W: Write>(
&self,
writer: W
) -> Result<(), SerializationError>
self into writer without compression.sourcefn serialize_unchecked<W: Write>(
&self,
writer: W
) -> Result<(), SerializationError>
fn serialize_unchecked<W: Write>(
&self,
writer: W
) -> Result<(), SerializationError>
self into writer without compression, and without
performing validity checks. Should be used only when there is no
danger of adversarial manipulation of the output. Read more