mirror of
https://github.com/arnaucube/Nova.git
synced 2026-01-11 00:21:29 +01:00
Change alloc_num_equals arguments to references (#45)
This commit is contained in:
@@ -213,8 +213,8 @@ where
|
|||||||
let hash = le_bits_to_num(cs.namespace(|| "bits to hash"), hash_bits)?;
|
let hash = le_bits_to_num(cs.namespace(|| "bits to hash"), hash_bits)?;
|
||||||
let check_pass = alloc_num_equals(
|
let check_pass = alloc_num_equals(
|
||||||
cs.namespace(|| "check consistency of u.X[0] with H(params, U, i, z0, zi)"),
|
cs.namespace(|| "check consistency of u.X[0] with H(params, U, i, z0, zi)"),
|
||||||
u.X0.clone(),
|
&u.X0,
|
||||||
hash,
|
&hash,
|
||||||
)?;
|
)?;
|
||||||
|
|
||||||
// Run NIFS Verifier
|
// Run NIFS Verifier
|
||||||
@@ -246,7 +246,7 @@ where
|
|||||||
|
|
||||||
// Compute variable indicating if this is the base case
|
// Compute variable indicating if this is the base case
|
||||||
let zero = alloc_zero(cs.namespace(|| "zero"))?;
|
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
|
// Synthesize the circuit for the base case and get the new running instance
|
||||||
let Unew_base = self.synthesize_base_case(cs.namespace(|| "base case"))?;
|
let Unew_base = self.synthesize_base_case(cs.namespace(|| "base case"))?;
|
||||||
|
|||||||
@@ -130,8 +130,8 @@ pub fn alloc_bignat_constant<F: PrimeField, CS: ConstraintSystem<F>>(
|
|||||||
/// Check that two numbers are equal and return a bit
|
/// Check that two numbers are equal and return a bit
|
||||||
pub fn alloc_num_equals<F: PrimeField, CS: ConstraintSystem<F>>(
|
pub fn alloc_num_equals<F: PrimeField, CS: ConstraintSystem<F>>(
|
||||||
mut cs: CS,
|
mut cs: CS,
|
||||||
a: AllocatedNum<F>,
|
a: &AllocatedNum<F>,
|
||||||
b: AllocatedNum<F>,
|
b: &AllocatedNum<F>,
|
||||||
) -> Result<AllocatedBit, SynthesisError> {
|
) -> Result<AllocatedBit, SynthesisError> {
|
||||||
// Allocate and constrain `r`: result boolean bit.
|
// Allocate and constrain `r`: result boolean bit.
|
||||||
// It equals `true` if `a` equals `b`, `false` otherwise
|
// It equals `true` if `a` equals `b`, `false` otherwise
|
||||||
|
|||||||
Reference in New Issue
Block a user