diff --git a/src/gadgets/ecc.rs b/src/gadgets/ecc.rs index 97389cb2b..7831329b3 100644 --- a/src/gadgets/ecc.rs +++ b/src/gadgets/ecc.rs @@ -101,15 +101,15 @@ impl AllocatedPoint { } /// Allocates a default point on the curve, set to the identity point. - pub fn default>(mut cs: CS) -> Result { + pub fn default>(mut cs: CS) -> Self { let zero = alloc_zero(cs.namespace(|| "zero")); let one = alloc_one(cs.namespace(|| "one")); - Ok(Self { + Self { x: zero.clone(), y: zero, is_infinity: one, - }) + } } /// Returns coordinates associated with the point. @@ -509,7 +509,7 @@ impl AllocatedPoint { // when self.is_infinity = 1, return the default point, else return res // we already set res.is_infinity to be self.is_infinity, so we do not need to set it here - let default = Self::default(cs.namespace(|| "default"))?; + let default = Self::default(cs.namespace(|| "default")); let x = conditionally_select2( cs.namespace(|| "check if self.is_infinity is zero (x)"), &default.x, diff --git a/src/gadgets/r1cs.rs b/src/gadgets/r1cs.rs index ea8c8ec91..a93a6e474 100644 --- a/src/gadgets/r1cs.rs +++ b/src/gadgets/r1cs.rs @@ -124,7 +124,7 @@ impl AllocatedRelaxedR1CSInstance { limb_width: usize, n_limbs: usize, ) -> Result { - let W = AllocatedPoint::default(cs.namespace(|| "allocate W"))?; + let W = AllocatedPoint::default(cs.namespace(|| "allocate W")); let E = W.clone(); let u = W.x.clone(); // In the default case, W.x = u = 0 @@ -159,7 +159,7 @@ impl AllocatedRelaxedR1CSInstance { limb_width: usize, n_limbs: usize, ) -> Result { - let E = AllocatedPoint::default(cs.namespace(|| "allocate default E"))?; + let E = AllocatedPoint::default(cs.namespace(|| "allocate default E")); let u = alloc_one(cs.namespace(|| "one"));