Skip to content

Commit

Permalink
feat(params): paramcache to generate params for whitelisted sizes (#952)
Browse files Browse the repository at this point in the history
  • Loading branch information
laser authored Nov 19, 2019
1 parent 379de47 commit aebafd2
Showing 1 changed file with 18 additions and 14 deletions.
32 changes: 18 additions & 14 deletions filecoin-proofs/src/bin/paramcache.rs
Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@
#[macro_use]
extern crate log;

use clap::{App, Arg};
use clap::{values_t, App, Arg};
use paired::bls12_381::Bls12;

use filecoin_proofs::constants::*;
use filecoin_proofs::parameters::{post_public_params, public_params};
use filecoin_proofs::types::*;
use std::collections::HashSet;
use storage_proofs::circuit::election_post::{ElectionPoStCircuit, ElectionPoStCompound};
use storage_proofs::circuit::stacked::StackedCompound;
use storage_proofs::compound_proof::CompoundProof;
Expand Down Expand Up @@ -121,28 +122,31 @@ pub fn main() {
.version("0.1")
.about("Generate and persist Groth parameters and verifying keys")
.arg(
Arg::with_name("test-only")
.long("test-only")
.help("generate only Groth parameters and keys useful for testing")
.takes_value(false),
Arg::with_name("params-for-sector-sizes")
.short("z")
.long("params-for-sector-sizes")
.conflicts_with("all")
.require_delimiter(true)
.value_delimiter(",")
.multiple(true)
.help("A comma-separated list of sector sizes, in bytes, for which Groth parameters will be generated")
)
.get_matches();

let test_only: bool = matches.is_present("test-only");

let smallest = vec![SECTOR_SIZE_ONE_KIB];

let sizes: &[u64] = if test_only {
&smallest
let sizes: HashSet<u64> = if matches.is_present("params-for-sector-sizes") {
values_t!(matches.values_of("params-for-sector-sizes"), u64)
.unwrap()
.into_iter()
.collect()
} else {
&PUBLISHED_SECTOR_SIZES
PUBLISHED_SECTOR_SIZES.iter().cloned().collect()
};

for size in sizes {
cache_post_params(PoStConfig(SectorSize(*size)));
cache_post_params(PoStConfig(SectorSize(size)));

for p in &POREP_PROOF_PARTITION_CHOICES {
cache_porep_params(PoRepConfig(SectorSize(*size), *p));
cache_porep_params(PoRepConfig(SectorSize(size), *p));
}
}
}

0 comments on commit aebafd2

Please sign in to comment.