From f0f9faca245c15d3b297fd6bbe068b6387689a99 Mon Sep 17 00:00:00 2001 From: nemo Date: Wed, 30 Sep 2020 07:47:52 -0400 Subject: [PATCH 1/2] fix: ensure all PoSt code paths are tested (dpost & legacy) --- filecoin-proofs/tests/api.rs | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/filecoin-proofs/tests/api.rs b/filecoin-proofs/tests/api.rs index 95aaf2d59..eca0ddab6 100644 --- a/filecoin-proofs/tests/api.rs +++ b/filecoin-proofs/tests/api.rs @@ -185,13 +185,16 @@ fn winning_post(sector_size: u64, fake: bool) - // The following methods of proof generation are functionally equivalent: // 1) // - /* let priv_replicas = vec![( sector_id, - private_replica_info, + private_replica_info.clone(), )]; let proof = generate_winning_post::(&config, &randomness, &priv_replicas[..], prover_id)?; - */ + + let valid = + verify_winning_post::(&config, &randomness, &pub_replicas[..], prover_id, &proof)?; + assert!(valid, "proof did not verify"); + // // 2) let mut vanilla_proofs = Vec::with_capacity(sector_count); @@ -372,8 +375,11 @@ fn window_post( ///////////////////////////////////////////// // The following methods of proof generation are functionally equivalent: // 1) - //let proof = generate_window_post::(&config, &randomness, &priv_replicas, prover_id)?; - // + let proof = generate_window_post::(&config, &randomness, &priv_replicas, prover_id)?; + + let valid = verify_window_post::(&config, &randomness, &pub_replicas, prover_id, &proof)?; + assert!(valid, "proof did not verify"); + // 2) let replica_sectors = priv_replicas .iter() From 97ee077e8cdfa92531ae05365ad0ffd97b89d957 Mon Sep 17 00:00:00 2001 From: nemo Date: Wed, 30 Sep 2020 07:51:34 -0400 Subject: [PATCH 2/2] style: fmt fix: fix unused result warnings --- filecoin-proofs/tests/api.rs | 5 +---- storage-proofs/porep/src/stacked/vanilla/memory_handling.rs | 5 ++--- 2 files changed, 3 insertions(+), 7 deletions(-) diff --git a/filecoin-proofs/tests/api.rs b/filecoin-proofs/tests/api.rs index eca0ddab6..f449cf576 100644 --- a/filecoin-proofs/tests/api.rs +++ b/filecoin-proofs/tests/api.rs @@ -185,10 +185,7 @@ fn winning_post(sector_size: u64, fake: bool) - // The following methods of proof generation are functionally equivalent: // 1) // - let priv_replicas = vec![( - sector_id, - private_replica_info.clone(), - )]; + let priv_replicas = vec![(sector_id, private_replica_info.clone())]; let proof = generate_winning_post::(&config, &randomness, &priv_replicas[..], prover_id)?; let valid = diff --git a/storage-proofs/porep/src/stacked/vanilla/memory_handling.rs b/storage-proofs/porep/src/stacked/vanilla/memory_handling.rs index 08d50c597..b791ce1dc 100644 --- a/storage-proofs/porep/src/stacked/vanilla/memory_handling.rs +++ b/storage-proofs/porep/src/stacked/vanilla/memory_handling.rs @@ -76,9 +76,8 @@ impl CacheReader { // This is unused, but included to document the meaning of its components. // This allows splitting the reset in order to avoid a pause. pub fn reset(&self) -> Result<()> { - self.start_reset(); - self.finish_reset(); - Ok(()) + self.start_reset()?; + self.finish_reset() } pub fn start_reset(&self) -> Result<()> {