|
1 | 1 | #[macro_use] |
2 | 2 | extern crate log; |
3 | 3 |
|
4 | | -use clap::{App, Arg}; |
| 4 | +use clap::{values_t, App, Arg}; |
5 | 5 | use paired::bls12_381::Bls12; |
6 | 6 |
|
7 | 7 | use filecoin_proofs::constants::*; |
8 | 8 | use filecoin_proofs::parameters::{post_public_params, public_params}; |
9 | 9 | use filecoin_proofs::types::*; |
| 10 | +use std::collections::HashSet; |
10 | 11 | use storage_proofs::circuit::election_post::{ElectionPoStCircuit, ElectionPoStCompound}; |
11 | 12 | use storage_proofs::circuit::stacked::StackedCompound; |
12 | 13 | use storage_proofs::compound_proof::CompoundProof; |
@@ -121,28 +122,31 @@ pub fn main() { |
121 | 122 | .version("0.1") |
122 | 123 | .about("Generate and persist Groth parameters and verifying keys") |
123 | 124 | .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") |
128 | 133 | ) |
129 | 134 | .get_matches(); |
130 | 135 |
|
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() |
137 | 141 | } else { |
138 | | - &PUBLISHED_SECTOR_SIZES |
| 142 | + PUBLISHED_SECTOR_SIZES.iter().cloned().collect() |
139 | 143 | }; |
140 | 144 |
|
141 | 145 | for size in sizes { |
142 | | - cache_post_params(PoStConfig(SectorSize(*size))); |
| 146 | + cache_post_params(PoStConfig(SectorSize(size))); |
143 | 147 |
|
144 | 148 | for p in &POREP_PROOF_PARTITION_CHOICES { |
145 | | - cache_porep_params(PoRepConfig(SectorSize(*size), *p)); |
| 149 | + cache_porep_params(PoRepConfig(SectorSize(size), *p)); |
146 | 150 | } |
147 | 151 | } |
148 | 152 | } |
0 commit comments