Skip to content

Commit 0c89b0f

Browse files
authored
Use point.is_zero() for allocating infinity in SW curves (#178)
1 parent a9a01a7 commit 0c89b0f

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

src/groups/curves/short_weierstrass/bls12/mod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ impl<P: Bls12Config> AllocVar<G1Prepared<P>, P::Fp> for G1PreparedVar<P> {
6767
let y = FpVar::new_variable(ark_relations::ns!(cs, "y"), || g1_prep.map(|g| g.y), mode)?;
6868
let infinity = Boolean::new_variable(
6969
ark_relations::ns!(cs, "inf"),
70-
|| g1_prep.map(|g| g.infinity),
70+
|| g1_prep.map(|g| g.is_zero()),
7171
mode,
7272
)?;
7373
let g = AffineVar::new(x, y, infinity);

src/groups/curves/short_weierstrass/mod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -165,7 +165,7 @@ where
165165
let point = self.value()?.into_affine();
166166
let x = F::new_constant(ConstraintSystemRef::None, point.x)?;
167167
let y = F::new_constant(ConstraintSystemRef::None, point.y)?;
168-
let infinity = Boolean::constant(point.infinity);
168+
let infinity = Boolean::constant(point.is_zero());
169169
Ok(AffineVar::new(x, y, infinity))
170170
} else {
171171
let cs = self.cs();

0 commit comments

Comments
 (0)