-
Notifications
You must be signed in to change notification settings - Fork 315
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: add a check parameter command that maps parameter files
- Loading branch information
1 parent
5e760a7
commit 76cecb4
Showing
2 changed files
with
42 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
use std::path::PathBuf; | ||
|
||
use anyhow::Result; | ||
use bellperson::groth16::MappedParameters; | ||
use clap::{value_t, App, Arg, SubCommand}; | ||
use paired::bls12_381::Bls12; | ||
|
||
use storage_proofs::parameter_cache::read_cached_params; | ||
|
||
fn run_map(parameter_file: &PathBuf) -> Result<MappedParameters<Bls12>> { | ||
read_cached_params(parameter_file) | ||
} | ||
|
||
fn main() -> Result<()> { | ||
fil_logger::init(); | ||
|
||
let map_cmd = SubCommand::with_name("map") | ||
.about("build mapped parameters") | ||
.arg( | ||
Arg::with_name("param") | ||
.long("parameter-file") | ||
.help("The parameter file to map") | ||
.required(true) | ||
.takes_value(true), | ||
); | ||
|
||
let matches = App::new("check_parameters") | ||
.version("0.1") | ||
.subcommand(map_cmd) | ||
.get_matches(); | ||
|
||
match matches.subcommand() { | ||
("map", Some(m)) => { | ||
let parameter_file = value_t!(m, "param", PathBuf)?; | ||
run_map(¶meter_file)?; | ||
} | ||
_ => panic!("Unrecognized subcommand"), | ||
} | ||
|
||
Ok(()) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters