Skip to content

Commit 64ece87

Browse files
porcuquinedignifiedquire
authored andcommitted
fix(storage-proofs): enforce conditions around use of LayeredDrgPoRep::prove
1 parent 10da513 commit 64ece87

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

storage-proofs/src/layered_drgporep.rs

+9-1
Original file line numberDiff line numberDiff line change
@@ -496,11 +496,19 @@ impl<'a, L: Layers> ProofScheme<'a> for L {
496496
pub_inputs: &'b Self::PublicInputs,
497497
priv_inputs: &'b Self::PrivateInputs,
498498
) -> Result<Self::Proof> {
499-
let proofs = Self::prove_all_partitions(pub_params, pub_inputs, priv_inputs, 1)?;
500499
let k = match pub_inputs.k {
501500
None => 0,
502501
Some(k) => k,
503502
};
503+
let proofs = Self::prove_all_partitions(pub_params, pub_inputs, priv_inputs, k)?;
504+
505+
// Because partition proofs require a common setup, the general ProofScheme implementation,
506+
// which makes use of `ProofScheme::prove` cannot be used here. Instead, we need to prove all
507+
// partitions in one pass, as implemented by `prove_all_partitions` below.
508+
assert!(
509+
k < 2,
510+
"It is a programmer error to call LayeredDrgPoRep::prove with more than one partition."
511+
);
504512

505513
Ok(proofs[k].to_owned())
506514
}

0 commit comments

Comments
 (0)