Skip to content

Commit

Permalink
fix: phase2-cli paramgen and filename parsing (#1240)
Browse files Browse the repository at this point in the history
  • Loading branch information
DrPeterVanNostrand authored Aug 5, 2020
1 parent 9225fd1 commit bbdce8a
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions filecoin-proofs/src/bin/phase2.rs
Original file line number Diff line number Diff line change
Expand Up @@ -209,7 +209,7 @@ fn params_filename(
}

// Parses a phase2 parameters filename into the tuple:
// (proof, hasher, sector-size, head, param-number, param-size).
// (proof, hasher, sector-size, head, param-number, param-size, is-raw).
fn parse_params_filename(path: &str) -> (Proof, Hasher, Sector, String, usize, ParamSize, bool) {
// Remove directories from the path.
let filename = path.rsplitn(2, '/').next().unwrap();
Expand Down Expand Up @@ -255,6 +255,10 @@ fn parse_params_filename(path: &str) -> (Proof, Hasher, Sector, String, usize, P

let raw_fmt = split.get(6) == Some(&"raw");

if param_size.is_large() && raw_fmt {
unimplemented!("large-raw params are not currently supported: {}", path);
}

(
proof,
hasher,
Expand Down Expand Up @@ -442,7 +446,6 @@ fn create_initial_params<Tree: 'static + MerkleTreeTrait>(
ParamSize::Large,
false,
);
let small_path = params_filename(proof, hasher, sector_size, &head, 0, ParamSize::Small, true);

{
info!("writing large initial params to file: {}", large_path);
Expand All @@ -452,13 +455,18 @@ fn create_initial_params<Tree: 'static + MerkleTreeTrait>(
info!("finished writing large params to file");
}

// TODO: add conversion from large to small params to phase2 crate, then write initial params as
// small-raw.
/*
let small_path = params_filename(proof, hasher, sector_size, &head, 0, ParamSize::Small, true);
{
info!("writing small initial params to file: {}", small_path);
let file = File::create(&small_path).unwrap();
let mut writer = BufWriter::with_capacity(1024 * 1024, file);
params.write_small(&mut writer).unwrap();
info!("finished writing small params to file");
}
*/

info!(
"successfully created and wrote initial params for circuit: {}-{}-{}-{}, dt_total={}s",
Expand Down

0 comments on commit bbdce8a

Please sign in to comment.