mirror of https://github.com/vacp2p/zerokit.git
fix(rln): tree_config parsing (#180)
* fix(rln): tree_config parsing * fix(rln): clippy
This commit is contained in:
parent
8cfd83de54
commit
be88a432d7
|
@ -80,18 +80,17 @@ impl RLN<'_> {
|
||||||
let resources_folder = rln_config["resources_folder"]
|
let resources_folder = rln_config["resources_folder"]
|
||||||
.as_str()
|
.as_str()
|
||||||
.unwrap_or(TEST_RESOURCES_FOLDER);
|
.unwrap_or(TEST_RESOURCES_FOLDER);
|
||||||
let tree_config_opt = rln_config["tree_config"].as_str();
|
let tree_config = rln_config["tree_config"].to_string();
|
||||||
|
|
||||||
let witness_calculator = circom_from_folder(resources_folder)?;
|
let witness_calculator = circom_from_folder(resources_folder)?;
|
||||||
|
|
||||||
let proving_key = zkey_from_folder(resources_folder)?;
|
let proving_key = zkey_from_folder(resources_folder)?;
|
||||||
let verification_key = vk_from_folder(resources_folder)?;
|
let verification_key = vk_from_folder(resources_folder)?;
|
||||||
|
|
||||||
let tree_config: <PoseidonTree as ZerokitMerkleTree>::Config = match tree_config_opt {
|
let tree_config: <PoseidonTree as ZerokitMerkleTree>::Config = if tree_config.is_empty() {
|
||||||
Some(tree_config_str) => {
|
<PoseidonTree as ZerokitMerkleTree>::Config::default()
|
||||||
<PoseidonTree as ZerokitMerkleTree>::Config::from_str(tree_config_str)?
|
} else {
|
||||||
}
|
<PoseidonTree as ZerokitMerkleTree>::Config::from_str(&tree_config)?
|
||||||
None => <PoseidonTree as ZerokitMerkleTree>::Config::default(),
|
|
||||||
};
|
};
|
||||||
|
|
||||||
// We compute a default empty tree
|
// We compute a default empty tree
|
||||||
|
|
Loading…
Reference in New Issue