diff --git a/fil-proofs-tooling/src/bin/check_parameters/main.rs b/fil-proofs-tooling/src/bin/check_parameters/main.rs new file mode 100644 index 000000000..bd1ffb6ae --- /dev/null +++ b/fil-proofs-tooling/src/bin/check_parameters/main.rs @@ -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> { + 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(()) +} diff --git a/storage-proofs/core/src/parameter_cache.rs b/storage-proofs/core/src/parameter_cache.rs index d092ef7a1..5fc35e4cf 100644 --- a/storage-proofs/core/src/parameter_cache.rs +++ b/storage-proofs/core/src/parameter_cache.rs @@ -268,7 +268,7 @@ fn ensure_parent(path: &PathBuf) -> Result<()> { // Reads parameter mappings using mmap so that they can be lazily // loaded later. -fn read_cached_params(cache_entry_path: &PathBuf) -> Result> { +pub fn read_cached_params(cache_entry_path: &PathBuf) -> Result> { info!("checking cache_path: {:?} for parameters", cache_entry_path); with_exclusive_read_lock(cache_entry_path, |_| { let params = Parameters::build_mapped_parameters(cache_entry_path.to_path_buf(), false)?;