Skip to content

Commit

Permalink
feat: write contributions file
Browse files Browse the repository at this point in the history
The input file is split into 3 pieces, `*.vk`, `*.params` and `*.contribs`.
In order to verify they are actually the pieces from the original file,
you can concatenate them to get the orginal file back via:

```
cat *.vk *.params *.contribs > same-as-original.bin
```
  • Loading branch information
vmx committed Aug 3, 2020
1 parent 5c7c515 commit 45cca9f
Showing 1 changed file with 21 additions and 3 deletions.
24 changes: 21 additions & 3 deletions filecoin-proofs/src/bin/phase2.rs
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ use simplelog::{self, CombinedLogger, LevelFilter, TermLogger, TerminalMode, Wri
use storage_proofs::compound_proof::{self, CompoundProof};
use storage_proofs::hasher::Sha256Hasher;
use storage_proofs::merkle::MerkleTreeTrait;
use storage_proofs::parameter_cache::CacheableParameters;
use storage_proofs::parameter_cache::{self, CacheableParameters};
use storage_proofs::porep::stacked::{StackedCircuit, StackedCompound, StackedDrg};
use storage_proofs::post::fallback::{FallbackPoSt, FallbackPoStCircuit, FallbackPoStCompound};

Expand Down Expand Up @@ -1535,8 +1535,26 @@ fn main() {
- 64
- 4
- (param_num as u64 * 544);
println!("size of the params file is {} bytes", params_file_size);
io::copy(&mut input_file.take(params_file_size), &mut params_file).unwrap();
println!("size of the parameters file is {} bytes", params_file_size);
io::copy(
&mut Read::by_ref(&mut input_file).take(params_file_size),
&mut params_file,
)
.unwrap();
}

{
// Writing the contributions to disk is not needed for the final parameters,
// they won't be published, they are only there for verification purpose
let contribs_path =
format!("v{}-{}.contribs", parameter_cache::VERSION, &identifier);
println!("writing contributions to file: {}", contribs_path);
let mut contribs_file = File::create(&contribs_path).unwrap();
let contribs_file_size = io::copy(&mut input_file, &mut contribs_file).unwrap();
println!(
"size of the contributions file is {} bytes",
contribs_file_size
);
}

{
Expand Down

0 comments on commit 45cca9f

Please sign in to comment.