arnaucube
arnaucube/NovaPublic Self-hosted repository
Change alloc_num_equals arguments to references (#45)

Arthur Greef arthurgreef@live.com
Fri, 29 Apr 2022 15:44:38 -0700
commit

9a466d14671a6927a38bcc69d15b3c3a05c7e5f3

parent

bcbdec2982ca6ff0e839fc3c03be8590154e42ff

2 files changed, 5 insertions(+), 5 deletions(-)

jump to
M src/circuit.rs → src/circuit.rs

@@ -213,8 +213,8 @@ let hash_bits = ro.get_hash(cs.namespace(|| "Input hash"))?;

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 @@ self.alloc_witness(cs.namespace(|| "allocate the circuit witness"))?;

// 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"))?;
M src/gadgets/utils.rs → src/gadgets/utils.rs

@@ -130,8 +130,8 @@

/// Check that two numbers are equal and return a bit pub fn alloc_num_equals<F: PrimeField, CS: ConstraintSystem<F>>( mut cs: CS, - a: AllocatedNum<F>, - b: AllocatedNum<F>, + a: &AllocatedNum<F>, + b: &AllocatedNum<F>, ) -> Result<AllocatedBit, SynthesisError> { // Allocate and constrain `r`: result boolean bit. // It equals `true` if `a` equals `b`, `false` otherwise