mirror of https://github.com/vacp2p/zerokit.git
add new path arg (#207)
This commit is contained in:
parent
c6c1bfde91
commit
a1c292cb2e
|
@ -15,6 +15,8 @@ pub(crate) enum Commands {
|
||||||
/// Sets a custom config file
|
/// Sets a custom config file
|
||||||
#[arg(short, long)]
|
#[arg(short, long)]
|
||||||
config: PathBuf,
|
config: PathBuf,
|
||||||
|
#[arg(short, long)]
|
||||||
|
tree_config_input: PathBuf,
|
||||||
},
|
},
|
||||||
SetTree {
|
SetTree {
|
||||||
tree_height: usize,
|
tree_height: usize,
|
||||||
|
|
|
@ -1,4 +1,3 @@
|
||||||
use std::io::Cursor;
|
|
||||||
use std::{fs::File, io::Read, path::Path};
|
use std::{fs::File, io::Read, path::Path};
|
||||||
|
|
||||||
use clap::Parser;
|
use clap::Parser;
|
||||||
|
@ -35,6 +34,7 @@ fn main() -> Result<()> {
|
||||||
Some(Commands::NewWithParams {
|
Some(Commands::NewWithParams {
|
||||||
tree_height,
|
tree_height,
|
||||||
config,
|
config,
|
||||||
|
tree_config_input,
|
||||||
}) => {
|
}) => {
|
||||||
let mut resources: Vec<Vec<u8>> = Vec::new();
|
let mut resources: Vec<Vec<u8>> = Vec::new();
|
||||||
for filename in ["rln.wasm", "rln_final.zkey", "verification_key.json"] {
|
for filename in ["rln.wasm", "rln_final.zkey", "verification_key.json"] {
|
||||||
|
@ -45,13 +45,13 @@ fn main() -> Result<()> {
|
||||||
file.read_exact(&mut buffer)?;
|
file.read_exact(&mut buffer)?;
|
||||||
resources.push(buffer);
|
resources.push(buffer);
|
||||||
}
|
}
|
||||||
|
let tree_config_input_file = File::open(&tree_config_input)?;
|
||||||
state.rln = Some(RLN::new_with_params(
|
state.rln = Some(RLN::new_with_params(
|
||||||
*tree_height,
|
*tree_height,
|
||||||
resources[0].clone(),
|
resources[0].clone(),
|
||||||
resources[1].clone(),
|
resources[1].clone(),
|
||||||
resources[2].clone(),
|
resources[2].clone(),
|
||||||
// TODO: use appropriate tree_config
|
tree_config_input_file,
|
||||||
Cursor::new(""),
|
|
||||||
)?);
|
)?);
|
||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
|
|
|
@ -2,7 +2,7 @@ use color_eyre::Result;
|
||||||
use rln::public::RLN;
|
use rln::public::RLN;
|
||||||
use std::fs::File;
|
use std::fs::File;
|
||||||
|
|
||||||
use crate::config::{InnerConfig, Config};
|
use crate::config::{Config, InnerConfig};
|
||||||
|
|
||||||
#[derive(Default)]
|
#[derive(Default)]
|
||||||
pub(crate) struct State<'a> {
|
pub(crate) struct State<'a> {
|
||||||
|
|
Loading…
Reference in New Issue