Skip to content

Commit

Permalink
* init decoupling-post-worker code
Browse files Browse the repository at this point in the history
  • Loading branch information
gegezai committed Sep 1, 2021
1 parent 9cc6444 commit e5a3606
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 6 deletions.
27 changes: 21 additions & 6 deletions filecoin-proofs/src/api/post_util.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,9 @@ use bincode::deserialize;
use filecoin_hashers::Hasher;
use log::{info, trace};
use storage_proofs_core::{
cache_key::CacheKey, merkle::MerkleTreeTrait, proof::ProofScheme, sector::SectorId,
cache_key::CacheKey, merkle::MerkleTreeTrait, sector::SectorId,
};
use storage_proofs_post::fallback::{self, generate_leaf_challenge, FallbackPoSt, SectorProof};
use storage_proofs_post::fallback::{self, generate_leaf_challenge, SectorProof};

use crate::{
api::as_safe_commitment,
Expand Down Expand Up @@ -288,10 +288,11 @@ pub fn partition_vanilla_proofs<Tree: MerkleTreeTrait>(

info!("partition_vanilla_proofs:finish");

ensure!(
FallbackPoSt::<Tree>::verify_all_partitions(pub_params, pub_inputs, &partition_proofs)?,
"partitioned vanilla proofs failed to verify"
);
/* After splitting partitions, all partitions cannot be checked */
// ensure!(
// FallbackPoSt::<Tree>::verify_all_partitions(pub_params, pub_inputs, &partition_proofs)?,
// "partitioned vanilla proofs failed to verify"
// );

Ok(partition_proofs)
}
Expand All @@ -308,3 +309,17 @@ pub(crate) fn get_partitions_for_window_post(
None
}
}

pub fn get_post_vanilla_params<Tree: 'static + MerkleTreeTrait>(
post_config: &PoStConfig,
) -> Result<String> {
use storage_proofs_core::compound_proof::PubVanRsp;

let rsp = PubVanRsp {
challengecount: post_config.challenge_count,
sectorcount: post_config.sector_count,
};
let rs = serde_json::to_string(&rsp)?;

Ok(rs)
}
7 changes: 7 additions & 0 deletions storage-proofs-core/src/compound_proof.rs
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ use rand::{rngs::OsRng, RngCore};
use rayon::prelude::{
IndexedParallelIterator, IntoParallelIterator, IntoParallelRefIterator, ParallelIterator,
};
use serde::{Deserialize, Serialize};

use crate::{
error::Result,
Expand Down Expand Up @@ -497,3 +498,9 @@ where
Ok(res)
}
}

#[derive(Serialize, Deserialize)]
pub struct PubVanRsp {
pub challengecount: usize,
pub sectorcount: usize,
}

0 comments on commit e5a3606

Please sign in to comment.