From 9a466d14671a6927a38bcc69d15b3c3a05c7e5f3 Mon Sep 17 00:00:00 2001 From: Arthur Greef Date: Fri, 29 Apr 2022 15:44:38 -0700 Subject: [PATCH] Change alloc_num_equals arguments to references (#45) --- src/circuit.rs | 6 +++--- src/gadgets/utils.rs | 4 ++-- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/src/circuit.rs b/src/circuit.rs index 4ebbe1c..e585ee3 100644 --- a/src/circuit.rs +++ b/src/circuit.rs @@ -213,8 +213,8 @@ where let hash = le_bits_to_num(cs.namespace(|| "bits to hash"), hash_bits)?; let check_pass = alloc_num_equals( cs.namespace(|| "check consistency of u.X[0] with H(params, U, i, z0, zi)"), - u.X0.clone(), - hash, + &u.X0, + &hash, )?; // Run NIFS Verifier @@ -246,7 +246,7 @@ where // Compute variable indicating if this is the base case let zero = alloc_zero(cs.namespace(|| "zero"))?; - let is_base_case = alloc_num_equals(cs.namespace(|| "Check if base case"), i.clone(), zero)?; //TODO: maybe optimize this? + let is_base_case = alloc_num_equals(cs.namespace(|| "Check if base case"), &i.clone(), &zero)?; //TODO: maybe optimize this? // Synthesize the circuit for the base case and get the new running instance let Unew_base = self.synthesize_base_case(cs.namespace(|| "base case"))?; diff --git a/src/gadgets/utils.rs b/src/gadgets/utils.rs index 075bdd7..2fb45c4 100644 --- a/src/gadgets/utils.rs +++ b/src/gadgets/utils.rs @@ -130,8 +130,8 @@ pub fn alloc_bignat_constant>( /// Check that two numbers are equal and return a bit pub fn alloc_num_equals>( mut cs: CS, - a: AllocatedNum, - b: AllocatedNum, + a: &AllocatedNum, + b: &AllocatedNum, ) -> Result { // Allocate and constrain `r`: result boolean bit. // It equals `true` if `a` equals `b`, `false` otherwise