Skip to content

Commit aebafd2

Browse files
authored
feat(params): paramcache to generate params for whitelisted sizes (#952)
1 parent 379de47 commit aebafd2

File tree

1 file changed

+18
-14
lines changed

1 file changed

+18
-14
lines changed

filecoin-proofs/src/bin/paramcache.rs

Lines changed: 18 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,13 @@
11
#[macro_use]
22
extern crate log;
33

4-
use clap::{App, Arg};
4+
use clap::{values_t, App, Arg};
55
use paired::bls12_381::Bls12;
66

77
use filecoin_proofs::constants::*;
88
use filecoin_proofs::parameters::{post_public_params, public_params};
99
use filecoin_proofs::types::*;
10+
use std::collections::HashSet;
1011
use storage_proofs::circuit::election_post::{ElectionPoStCircuit, ElectionPoStCompound};
1112
use storage_proofs::circuit::stacked::StackedCompound;
1213
use storage_proofs::compound_proof::CompoundProof;
@@ -121,28 +122,31 @@ pub fn main() {
121122
.version("0.1")
122123
.about("Generate and persist Groth parameters and verifying keys")
123124
.arg(
124-
Arg::with_name("test-only")
125-
.long("test-only")
126-
.help("generate only Groth parameters and keys useful for testing")
127-
.takes_value(false),
125+
Arg::with_name("params-for-sector-sizes")
126+
.short("z")
127+
.long("params-for-sector-sizes")
128+
.conflicts_with("all")
129+
.require_delimiter(true)
130+
.value_delimiter(",")
131+
.multiple(true)
132+
.help("A comma-separated list of sector sizes, in bytes, for which Groth parameters will be generated")
128133
)
129134
.get_matches();
130135

131-
let test_only: bool = matches.is_present("test-only");
132-
133-
let smallest = vec![SECTOR_SIZE_ONE_KIB];
134-
135-
let sizes: &[u64] = if test_only {
136-
&smallest
136+
let sizes: HashSet<u64> = if matches.is_present("params-for-sector-sizes") {
137+
values_t!(matches.values_of("params-for-sector-sizes"), u64)
138+
.unwrap()
139+
.into_iter()
140+
.collect()
137141
} else {
138-
&PUBLISHED_SECTOR_SIZES
142+
PUBLISHED_SECTOR_SIZES.iter().cloned().collect()
139143
};
140144

141145
for size in sizes {
142-
cache_post_params(PoStConfig(SectorSize(*size)));
146+
cache_post_params(PoStConfig(SectorSize(size)));
143147

144148
for p in &POREP_PROOF_PARTITION_CHOICES {
145-
cache_porep_params(PoRepConfig(SectorSize(*size), *p));
149+
cache_porep_params(PoRepConfig(SectorSize(size), *p));
146150
}
147151
}
148152
}

0 commit comments

Comments
 (0)