diff --git a/rln/src/circuit.rs b/rln/src/circuit.rs index ba7bf13..4dadf39 100644 --- a/rln/src/circuit.rs +++ b/rln/src/circuit.rs @@ -28,7 +28,7 @@ pub fn ZKEY() -> ProvingKey /*, ConstraintMatrices)*/ { } pub fn VK() -> VerifyingKey { - let mut verifyingKey: VerifyingKey; + let verifyingKey: VerifyingKey; if Path::new(VK_PATH).exists() { let verifyingKey = vk_from_json(VK_PATH); @@ -46,7 +46,7 @@ pub fn CIRCOM() -> CircomBuilder { let cfg = CircomConfig::::new(WASM_PATH, R1CS_PATH).unwrap(); // should be )?; but need to address "the trait `From` is not implemented for `protocol::ProofError`" // We build the circuit - let mut builder = CircomBuilder::new(cfg); + let builder = CircomBuilder::new(cfg); builder } @@ -127,7 +127,7 @@ fn vk_from_json(vk_path: &str) -> VerifyingKey { let json = std::fs::read_to_string(vk_path).unwrap(); let json: Value = serde_json::from_str(&json).unwrap(); - let mut vk = VerifyingKey { + let vk = VerifyingKey { alpha_g1: json_to_g1(&json, "vk_alpha_1"), beta_g2: json_to_g2(&json, "vk_beta_2"), gamma_g2: json_to_g2(&json, "vk_gamma_2"), diff --git a/rln/src/lib.rs b/rln/src/lib.rs index 576866f..3b71b39 100644 --- a/rln/src/lib.rs +++ b/rln/src/lib.rs @@ -119,7 +119,7 @@ mod test { // We generate all relevant keys let provingKey = &ZKEY(); let verificationKey = &VK(); - let mut builder = CIRCOM(); + let builder = CIRCOM(); // Let's generate a zkSNARK proof let (proof, inputs) = generate_proof(builder, provingKey, rlnWitness).unwrap(); diff --git a/rln/src/main.rs b/rln/src/main.rs index 7167879..2063c88 100644 --- a/rln/src/main.rs +++ b/rln/src/main.rs @@ -1,19 +1,16 @@ -/// This is basic entry point for `cargo run` to play around with proof, -/// outputs, etc. -/// -use ark_circom::{CircomBuilder, CircomConfig}; -use ark_std::rand::thread_rng; + + use color_eyre::Result; -use ark_bn254::Bn254; -use num_bigint::BigInt; + + // Tracing use ark_relations::r1cs::{ConstraintLayer, ConstraintTrace, TracingMode}; use tracing_subscriber::layer::SubscriberExt; // JSON -use serde::Deserialize; + use rln::circuit::{CIRCOM, VK, ZKEY}; use rln::protocol::{generate_proof, initRLNWitnessFromJSON, verify_proof}; @@ -77,7 +74,7 @@ fn groth16_proof_example() -> Result<()> { // We generate all relevant keys let provingKey = &ZKEY(); let verificationKey = &VK(); - let mut builder = CIRCOM(); + let builder = CIRCOM(); // We compute witness from the json input example let rlnWitness = initRLNWitnessFromJSON(input_json_str); diff --git a/rln/src/public.rs b/rln/src/public.rs index f4109d8..cb33cec 100644 --- a/rln/src/public.rs +++ b/rln/src/public.rs @@ -58,7 +58,7 @@ impl RLN { let cfg = CircomConfig::::new("./resources/rln.wasm", "./resources/rln.r1cs").unwrap(); - let mut builder = CircomBuilder::new(cfg); + let builder = CircomBuilder::new(cfg); // create an empty instance for setting it up let circom = builder.setup(); @@ -72,7 +72,7 @@ impl RLN { println!("Public inputs {:#?} ", inputs); let leaf = Field::from(0); - let mut tree = PoseidonTree::new(21, leaf); + let tree = PoseidonTree::new(21, leaf); RLN { circom, @@ -197,7 +197,7 @@ impl RLN { // let tree = IncrementalMerkleTree::empty(hasher, merkle_depth); let leaf = Field::from(0); - let mut tree = PoseidonTree::new(21, leaf); + let tree = PoseidonTree::new(21, leaf); RLN { circom, @@ -208,7 +208,7 @@ impl RLN { /// returns current membership root /// * `root` is a scalar field element in 32 bytes - pub fn get_root(&self, mut result_data: W) -> io::Result<()> { + pub fn get_root(&self, _result_data: W) -> io::Result<()> { //let root = self.tree.get_root(); // Converts PrimeFieldRepr into LE //root.into_repr().write_le(&mut result_data)?;