pub trait CompoundProof<'a, S: ProofScheme<'a>, C: Circuit<Scalar> + CircuitComponent + Send>where
S::Proof: Sync + Send,
S::PublicParams: ParameterSetMetadata + Sync + Send,
S::PublicInputs: Clone + Sync,
Self: CacheableParameters<C, S::PublicParams>,{
Show 18 methods
// Required methods
fn generate_public_inputs(
pub_in: &S::PublicInputs,
pub_params: &S::PublicParams,
partition_k: Option<usize>,
) -> Result<Vec<Fr>>;
fn circuit(
public_inputs: &S::PublicInputs,
component_private_inputs: C::ComponentPrivateInputs,
vanilla_proof: &S::Proof,
public_param: &S::PublicParams,
partition_k: Option<usize>,
) -> Result<C>;
fn blank_circuit(public_params: &S::PublicParams) -> C;
// Provided methods
fn setup(sp: &SetupParams<'a, S>) -> Result<PublicParams<'a, S>> { ... }
fn partition_count(public_params: &PublicParams<'a, S>) -> usize { ... }
fn prove(
pub_params: &PublicParams<'a, S>,
pub_in: &S::PublicInputs,
priv_in: &S::PrivateInputs,
groth_params: &Bls12GrothParams,
) -> Result<Vec<Proof<Bls12>>> { ... }
fn prove_with_vanilla(
pub_params: &PublicParams<'a, S>,
pub_in: &S::PublicInputs,
vanilla_proofs: Vec<S::Proof>,
groth_params: &Bls12GrothParams,
) -> Result<Vec<Proof<Bls12>>> { ... }
fn verify<'b>(
public_params: &PublicParams<'a, S>,
public_inputs: &S::PublicInputs,
multi_proof: &MultiProof<'b>,
requirements: &S::Requirements,
) -> Result<bool> { ... }
fn batch_verify<'b>(
public_params: &PublicParams<'a, S>,
public_inputs: &[S::PublicInputs],
multi_proofs: &[MultiProof<'b>],
requirements: &S::Requirements,
) -> Result<bool> { ... }
fn circuit_proofs(
pub_in: &S::PublicInputs,
vanilla_proofs: Vec<S::Proof>,
pub_params: &S::PublicParams,
groth_params: &Bls12GrothParams,
priority: bool,
) -> Result<Vec<Proof<Bls12>>> { ... }
fn aggregate_proofs(
prover_srs: &ProverSRS<Bls12>,
hashed_seeds_and_comm_rs: &[u8],
proofs: &[Proof<Bls12>],
version: AggregateVersion,
) -> Result<AggregateProof<Bls12>> { ... }
fn verify_aggregate_proofs(
ip_verifier_srs: &VerifierSRS<Bls12>,
pvk: &PreparedVerifyingKey<Bls12>,
hashed_seeds_and_comm_rs: &[u8],
public_inputs: &[Vec<Fr>],
aggregate_proof: &AggregateProof<Bls12>,
version: AggregateVersion,
) -> Result<bool> { ... }
fn groth_params<R: RngCore>(
rng: Option<&mut R>,
public_params: &S::PublicParams,
) -> Result<Bls12GrothParams> { ... }
fn verifying_key<R: RngCore>(
rng: Option<&mut R>,
public_params: &S::PublicParams,
) -> Result<VerifyingKey<Bls12>> { ... }
fn srs_key<R: RngCore>(
rng: Option<&mut R>,
public_params: &S::PublicParams,
num_proofs_to_aggregate: usize,
) -> Result<ProverSRS<Bls12>> { ... }
fn srs_verifier_key<R: RngCore>(
rng: Option<&mut R>,
public_params: &S::PublicParams,
num_proofs_to_aggregate: usize,
) -> Result<VerifierSRS<Bls12>> { ... }
fn circuit_for_test(
public_parameters: &PublicParams<'a, S>,
public_inputs: &S::PublicInputs,
private_inputs: &S::PrivateInputs,
) -> Result<(C, Vec<Fr>)> { ... }
fn circuit_for_test_all(
public_parameters: &PublicParams<'a, S>,
public_inputs: &S::PublicInputs,
private_inputs: &S::PrivateInputs,
) -> Result<Vec<(C, Vec<Fr>)>> { ... }
}
Expand description
The CompoundProof trait bundles a proof::ProofScheme and a bellperson::Circuit together. It provides methods equivalent to those provided by proof::ProofScheme (setup, prove, verify). See documentation at proof::ProofScheme for details. Implementations should generally only need to supply circuit and generate_public_inputs. The remaining trait methods are used internally and implement the necessary plumbing.
Required Methods§
sourcefn generate_public_inputs(
pub_in: &S::PublicInputs,
pub_params: &S::PublicParams,
partition_k: Option<usize>,
) -> Result<Vec<Fr>>
fn generate_public_inputs( pub_in: &S::PublicInputs, pub_params: &S::PublicParams, partition_k: Option<usize>, ) -> Result<Vec<Fr>>
generate_public_inputs generates public inputs suitable for use as input during verification of a proof generated from this CompoundProof’s bellperson::Circuit (C). These inputs correspond to those allocated when C is synthesized.
sourcefn circuit(
public_inputs: &S::PublicInputs,
component_private_inputs: C::ComponentPrivateInputs,
vanilla_proof: &S::Proof,
public_param: &S::PublicParams,
partition_k: Option<usize>,
) -> Result<C>
fn circuit( public_inputs: &S::PublicInputs, component_private_inputs: C::ComponentPrivateInputs, vanilla_proof: &S::Proof, public_param: &S::PublicParams, partition_k: Option<usize>, ) -> Result<C>
circuit constructs an instance of this CompoundProof’s bellperson::Circuit. circuit takes PublicInputs, PublicParams, and Proof from this CompoundProof’s proof::ProofScheme (S) and uses them to initialize Circuit fields which will be used to construct public and private inputs during circuit synthesis.
fn blank_circuit(public_params: &S::PublicParams) -> C
Provided Methods§
fn setup(sp: &SetupParams<'a, S>) -> Result<PublicParams<'a, S>>
fn partition_count(public_params: &PublicParams<'a, S>) -> usize
sourcefn prove(
pub_params: &PublicParams<'a, S>,
pub_in: &S::PublicInputs,
priv_in: &S::PrivateInputs,
groth_params: &Bls12GrothParams,
) -> Result<Vec<Proof<Bls12>>>
fn prove( pub_params: &PublicParams<'a, S>, pub_in: &S::PublicInputs, priv_in: &S::PrivateInputs, groth_params: &Bls12GrothParams, ) -> Result<Vec<Proof<Bls12>>>
prove is equivalent to ProofScheme::prove.
fn prove_with_vanilla( pub_params: &PublicParams<'a, S>, pub_in: &S::PublicInputs, vanilla_proofs: Vec<S::Proof>, groth_params: &Bls12GrothParams, ) -> Result<Vec<Proof<Bls12>>>
fn verify<'b>( public_params: &PublicParams<'a, S>, public_inputs: &S::PublicInputs, multi_proof: &MultiProof<'b>, requirements: &S::Requirements, ) -> Result<bool>
sourcefn batch_verify<'b>(
public_params: &PublicParams<'a, S>,
public_inputs: &[S::PublicInputs],
multi_proofs: &[MultiProof<'b>],
requirements: &S::Requirements,
) -> Result<bool>
fn batch_verify<'b>( public_params: &PublicParams<'a, S>, public_inputs: &[S::PublicInputs], multi_proofs: &[MultiProof<'b>], requirements: &S::Requirements, ) -> Result<bool>
Efficiently verify multiple proofs.
sourcefn circuit_proofs(
pub_in: &S::PublicInputs,
vanilla_proofs: Vec<S::Proof>,
pub_params: &S::PublicParams,
groth_params: &Bls12GrothParams,
priority: bool,
) -> Result<Vec<Proof<Bls12>>>
fn circuit_proofs( pub_in: &S::PublicInputs, vanilla_proofs: Vec<S::Proof>, pub_params: &S::PublicParams, groth_params: &Bls12GrothParams, priority: bool, ) -> Result<Vec<Proof<Bls12>>>
circuit_proof creates and synthesizes a circuit from concrete params/inputs, then generates a groth proof from it. It returns a groth proof. circuit_proof is used internally and should neither be called nor implemented outside of default trait methods.
sourcefn aggregate_proofs(
prover_srs: &ProverSRS<Bls12>,
hashed_seeds_and_comm_rs: &[u8],
proofs: &[Proof<Bls12>],
version: AggregateVersion,
) -> Result<AggregateProof<Bls12>>
fn aggregate_proofs( prover_srs: &ProverSRS<Bls12>, hashed_seeds_and_comm_rs: &[u8], proofs: &[Proof<Bls12>], version: AggregateVersion, ) -> Result<AggregateProof<Bls12>>
Given a prover_srs key, a list of groth16 proofs, and an ordered list of seeds (used to derive the PoRep challenges) hashed pair-wise with the comm_rs using sha256, aggregate them all into an AggregateProof type.
sourcefn verify_aggregate_proofs(
ip_verifier_srs: &VerifierSRS<Bls12>,
pvk: &PreparedVerifyingKey<Bls12>,
hashed_seeds_and_comm_rs: &[u8],
public_inputs: &[Vec<Fr>],
aggregate_proof: &AggregateProof<Bls12>,
version: AggregateVersion,
) -> Result<bool>
fn verify_aggregate_proofs( ip_verifier_srs: &VerifierSRS<Bls12>, pvk: &PreparedVerifyingKey<Bls12>, hashed_seeds_and_comm_rs: &[u8], public_inputs: &[Vec<Fr>], aggregate_proof: &AggregateProof<Bls12>, version: AggregateVersion, ) -> Result<bool>
Verifies the aggregate proof, with respect to the flattened input list.
Note that this method internally instantiates an OSRng and passes it to the verify_aggregate_proofs
method in bellperson. While proofs would normally parameterize the type of rng used, we don’t
want it exposed past this level so as not to force the wrapper calls around this method in
rust-filecoin-proofs-api to unroll this call outside of the tree parameterized with_shape
macro
usage.
sourcefn groth_params<R: RngCore>(
rng: Option<&mut R>,
public_params: &S::PublicParams,
) -> Result<Bls12GrothParams>
fn groth_params<R: RngCore>( rng: Option<&mut R>, public_params: &S::PublicParams, ) -> Result<Bls12GrothParams>
If the rng option argument is set, parameters will be generated using it. This is used for testing only, or where parameters are otherwise unavailable (e.g. benches). If rng is not set, an error will result if parameters are not present.
sourcefn verifying_key<R: RngCore>(
rng: Option<&mut R>,
public_params: &S::PublicParams,
) -> Result<VerifyingKey<Bls12>>
fn verifying_key<R: RngCore>( rng: Option<&mut R>, public_params: &S::PublicParams, ) -> Result<VerifyingKey<Bls12>>
If the rng option argument is set, parameters will be generated using it. This is used for testing only, or where parameters are otherwise unavailable (e.g. benches). If rng is not set, an error will result if parameters are not present.
sourcefn srs_key<R: RngCore>(
rng: Option<&mut R>,
public_params: &S::PublicParams,
num_proofs_to_aggregate: usize,
) -> Result<ProverSRS<Bls12>>
fn srs_key<R: RngCore>( rng: Option<&mut R>, public_params: &S::PublicParams, num_proofs_to_aggregate: usize, ) -> Result<ProverSRS<Bls12>>
If the rng option argument is set, parameters will be generated using it. This is used for testing only, or where parameters are otherwise unavailable (e.g. benches). If rng is not set, an error will result if parameters are not present.
sourcefn srs_verifier_key<R: RngCore>(
rng: Option<&mut R>,
public_params: &S::PublicParams,
num_proofs_to_aggregate: usize,
) -> Result<VerifierSRS<Bls12>>
fn srs_verifier_key<R: RngCore>( rng: Option<&mut R>, public_params: &S::PublicParams, num_proofs_to_aggregate: usize, ) -> Result<VerifierSRS<Bls12>>
If the rng option argument is set, parameters will be generated using it. This is used for testing only, or where parameters are otherwise unavailable (e.g. benches). If rng is not set, an error will result if parameters are not present.
fn circuit_for_test( public_parameters: &PublicParams<'a, S>, public_inputs: &S::PublicInputs, private_inputs: &S::PrivateInputs, ) -> Result<(C, Vec<Fr>)>
sourcefn circuit_for_test_all(
public_parameters: &PublicParams<'a, S>,
public_inputs: &S::PublicInputs,
private_inputs: &S::PrivateInputs,
) -> Result<Vec<(C, Vec<Fr>)>>
fn circuit_for_test_all( public_parameters: &PublicParams<'a, S>, public_inputs: &S::PublicInputs, private_inputs: &S::PrivateInputs, ) -> Result<Vec<(C, Vec<Fr>)>>
Like circuit_for_test but returns values for all partitions.