diff --git a/rln-cli/src/commands.rs b/rln-cli/src/commands.rs index fdf73d6..9b97a8d 100644 --- a/rln-cli/src/commands.rs +++ b/rln-cli/src/commands.rs @@ -12,7 +12,7 @@ pub(crate) enum Commands { NewWithParams { #[arg(short, long, default_value_t = TEST_TREE_DEPTH)] tree_depth: usize, - #[arg(short, long, default_value = "../rln/resources/tree_depth_30")] + #[arg(short, long, default_value = "../rln/resources/tree_depth_10")] resources_path: PathBuf, }, SetTree { diff --git a/rln-cli/src/examples/relay.rs b/rln-cli/src/examples/relay.rs index f470eee..6edc0ac 100644 --- a/rln-cli/src/examples/relay.rs +++ b/rln-cli/src/examples/relay.rs @@ -17,7 +17,7 @@ use rln::{ const MESSAGE_LIMIT: u32 = 1; -const TREE_DEPTH: usize = 30; +const TREE_DEPTH: usize = 10; #[derive(Parser)] #[command(author, version, about, long_about = None)] diff --git a/rln-wasm/tests/browser.rs b/rln-wasm/tests/browser.rs index e9a8702..4ac8d41 100644 --- a/rln-wasm/tests/browser.rs +++ b/rln-wasm/tests/browser.rs @@ -75,9 +75,9 @@ mod tests { const WITNESS_CALCULATOR_JS: &str = include_str!("../resources/witness_calculator.js"); const ARKZKEY_BYTES: &[u8] = - include_bytes!("../../rln/resources/tree_depth_30/rln_final.arkzkey"); + include_bytes!("../../rln/resources/tree_depth_10/rln_final.arkzkey"); - const CIRCOM_BYTES: &[u8] = include_bytes!("../../rln/resources/tree_depth_30/rln.wasm"); + const CIRCOM_BYTES: &[u8] = include_bytes!("../../rln/resources/tree_depth_10/rln.wasm"); wasm_bindgen_test_configure!(run_in_browser); diff --git a/rln-wasm/tests/node.rs b/rln-wasm/tests/node.rs index a1279e5..8dae5c5 100644 --- a/rln-wasm/tests/node.rs +++ b/rln-wasm/tests/node.rs @@ -73,9 +73,9 @@ mod tests { async fn calculateWitness(circom_path: &str, input: Object) -> Result; } - const ARKZKEY_PATH: &str = "../rln/resources/tree_depth_30/rln_final.arkzkey"; + const ARKZKEY_PATH: &str = "../rln/resources/tree_depth_10/rln_final.arkzkey"; - const CIRCOM_PATH: &str = "../rln/resources/tree_depth_30/rln.wasm"; + const CIRCOM_PATH: &str = "../rln/resources/tree_depth_10/rln.wasm"; #[wasm_bindgen_test] pub async fn rln_wasm_benchmark() { diff --git a/rln/README.md b/rln/README.md index 873909d..01e68d9 100644 --- a/rln/README.md +++ b/rln/README.md @@ -55,7 +55,7 @@ fn main() { // 1. Initialize RLN with parameters: // - the tree depth; // - the tree config, if it is not defined, the default value will be set - let tree_depth = 30; + let tree_depth = 10; let input = Cursor::new(json!({}).to_string()); let mut rln = RLN::new(tree_depth, input).unwrap(); diff --git a/rln/resources/tree_depth_10/graph.bin b/rln/resources/tree_depth_10/graph.bin new file mode 100644 index 0000000..7e8bbde Binary files /dev/null and b/rln/resources/tree_depth_10/graph.bin differ diff --git a/rln/resources/tree_depth_10/rln.wasm b/rln/resources/tree_depth_10/rln.wasm new file mode 100644 index 0000000..14b14b6 Binary files /dev/null and b/rln/resources/tree_depth_10/rln.wasm differ diff --git a/rln/resources/tree_depth_10/rln_final.arkzkey b/rln/resources/tree_depth_10/rln_final.arkzkey new file mode 100644 index 0000000..450ad4a Binary files /dev/null and b/rln/resources/tree_depth_10/rln_final.arkzkey differ diff --git a/rln/src/circuit/mod.rs b/rln/src/circuit/mod.rs index 12fa83e..475edef 100644 --- a/rln/src/circuit/mod.rs +++ b/rln/src/circuit/mod.rs @@ -19,17 +19,17 @@ use {ark_ff::Field, ark_serialize::CanonicalDeserialize, ark_serialize::Canonica use crate::utils::FrOrSecret; -pub const ARKZKEY_BYTES: &[u8] = include_bytes!("../../resources/tree_depth_30/rln_final.arkzkey"); +pub const ARKZKEY_BYTES: &[u8] = include_bytes!("../../resources/tree_depth_10/rln_final.arkzkey"); #[cfg(not(target_arch = "wasm32"))] -const GRAPH_BYTES: &[u8] = include_bytes!("../../resources/tree_depth_30/graph.bin"); +const GRAPH_BYTES: &[u8] = include_bytes!("../../resources/tree_depth_10/graph.bin"); lazy_static! { static ref ARKZKEY: (ProvingKey, ConstraintMatrices) = read_arkzkey_from_bytes_uncompressed(ARKZKEY_BYTES).expect("Failed to read arkzkey"); } -pub const TEST_TREE_DEPTH: usize = 30; +pub const TEST_TREE_DEPTH: usize = 10; // The following types define the pairing friendly elliptic curve, the underlying finite fields and groups default to this module // Note that proofs are serialized assuming Fr to be 4x8 = 32 bytes in size. Hence, changing to a curve with different encoding will make proof verification to fail diff --git a/rln/src/public.rs b/rln/src/public.rs index d1c7f67..eea4d88 100644 --- a/rln/src/public.rs +++ b/rln/src/public.rs @@ -105,7 +105,7 @@ impl RLN { /// ``` /// use std::io::Cursor; /// - /// let tree_depth = 30; + /// let tree_depth = 10; /// let input_buffer = Cursor::new(json!({}).to_string()); /// /// // We create a new RLN instance @@ -167,8 +167,8 @@ impl RLN { /// use std::fs::File; /// use std::io::Read; /// - /// let tree_depth = 30; - /// let resources_folder = "./resources/tree_depth_30/"; + /// let tree_depth = 10; + /// let resources_folder = "./resources/tree_depth_10/"; /// /// let mut resources: Vec> = Vec::new(); /// for filename in ["rln_final.arkzkey", "graph.bin"] { @@ -228,7 +228,7 @@ impl RLN { /// use std::fs::File; /// use std::io::Read; /// - /// let resources_folder = "./resources/tree_depth_30/"; + /// let resources_folder = "./resources/tree_depth_10/"; /// /// let mut resources: Vec> = Vec::new(); /// for filename in ["rln_final.arkzkey", "graph.bin"] { @@ -267,7 +267,7 @@ impl RLN { /// use std::fs::File; /// use std::io::Read; /// - /// let zkey_path = "./resources/tree_depth_30/rln_final.arkzkey"; + /// let zkey_path = "./resources/tree_depth_10/rln_final.arkzkey"; /// /// let mut file = File::open(zkey_path).expect("Failed to open file"); /// let metadata = std::fs::metadata(zkey_path).expect("Failed to read metadata"); @@ -517,7 +517,7 @@ impl RLN { /// use rln::circuit::Fr; /// use rln::utils::*; /// - /// let tree_depth = 30; + /// let tree_depth = 10; /// let start_index = 10; /// let no_of_leaves = 256; /// diff --git a/rln/tests/ffi.rs b/rln/tests/ffi.rs index ed17711..b917c04 100644 --- a/rln/tests/ffi.rs +++ b/rln/tests/ffi.rs @@ -414,7 +414,7 @@ mod test { // We obtain the root from the RLN instance let root_rln_folder = get_tree_root(rln_pointer); - let zkey_path = "./resources/tree_depth_30/rln_final.arkzkey"; + let zkey_path = "./resources/tree_depth_10/rln_final.arkzkey"; let mut zkey_file = File::open(zkey_path).expect("no file found"); let metadata = std::fs::metadata(zkey_path).expect("unable to read metadata"); let mut zkey_buffer = vec![0; metadata.len() as usize]; @@ -424,7 +424,7 @@ mod test { let zkey_data = &Buffer::from(&zkey_buffer[..]); - let graph_data = "./resources/tree_depth_30/graph.bin"; + let graph_data = "./resources/tree_depth_10/graph.bin"; let mut graph_file = File::open(graph_data).expect("no file found"); let metadata = std::fs::metadata(graph_data).expect("unable to read metadata"); let mut graph_buffer = vec![0; metadata.len() as usize];