From 6b1cfd5396b2f0bc5be4e97174512847641a060f Mon Sep 17 00:00:00 2001 From: Weikeng Chen Date: Sat, 3 Sep 2022 19:20:07 -0700 Subject: [PATCH] Fix `is_zero` for twisted Edwards curves (#101) * fix the te is_zero * update CHANGELOG Co-authored-by: onewayfunc --- .github/workflows/ci.yml | 1 + CHANGELOG.md | 1 + src/groups/curves/twisted_edwards/mod.rs | 2 +- 3 files changed, 3 insertions(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index e9c8378..4760c61 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -186,6 +186,7 @@ jobs: echo "ark-ec = { git = 'https://github.com/arkworks-rs/algebra' }" echo "ark-ff = { git = 'https://github.com/arkworks-rs/algebra' }" echo "ark-poly = { git = 'https://github.com/arkworks-rs/algebra' }" + echo "ark-relations = { git = 'https://github.com/arkworks-rs/snark' }" echo "ark-serialize = { git = 'https://github.com/arkworks-rs/algebra' }" echo "ark-algebra-bench-templates = { git = 'https://github.com/arkworks-rs/algebra' }" echo "ark-algebra-test-templates = { git = 'https://github.com/arkworks-rs/algebra' }" diff --git a/CHANGELOG.md b/CHANGELOG.md index 0b41283..396764a 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -18,6 +18,7 @@ ### Bug Fixes +- [\#101](https://github.com/arkworks-rs/r1cs-std/pull/101) Fix `is_zero` for twisted Edwards curves. - [\#86](https://github.com/arkworks-rs/r1cs-std/pull/86) Make result of `query_position_to_coset` consistent with `ark-ldt`. - [\#77](https://github.com/arkworks-rs/r1cs-std/pull/77) Fix BLS12 `G2PreparedGadget`'s `AllocVar` when G2 uses a divisive twist. diff --git a/src/groups/curves/twisted_edwards/mod.rs b/src/groups/curves/twisted_edwards/mod.rs index 1d2dffd..8d9d405 100644 --- a/src/groups/curves/twisted_edwards/mod.rs +++ b/src/groups/curves/twisted_edwards/mod.rs @@ -423,7 +423,7 @@ where } fn is_zero(&self) -> Result::BasePrimeField>, SynthesisError> { - self.x.is_zero()?.and(&self.x.is_one()?) + self.x.is_zero()?.and(&self.y.is_one()?) } #[tracing::instrument(target = "r1cs", skip(cs, f))]