diff --git a/CHANGELOG.md b/CHANGELOG.md index 396764a..2f7fa41 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,6 +1,7 @@ # CHANGELOG ## Pending +- [\#117](https://github.com/arkworks-rs/r1cs-std/pull/117) Fix result of `precomputed_base_scalar_mul_le` to not discard previous value. ### Breaking changes diff --git a/src/groups/curves/short_weierstrass/mod.rs b/src/groups/curves/short_weierstrass/mod.rs index 91eae94..b41d959 100644 --- a/src/groups/curves/short_weierstrass/mod.rs +++ b/src/groups/curves/short_weierstrass/mod.rs @@ -559,7 +559,7 @@ where .map(|(b, c)| (b.borrow().clone(), *c)) .unzip(); let base = bases[0]; - *self = Self::constant(base).scalar_mul_le(bits.iter())?; + *self += Self::constant(base).scalar_mul_le(bits.iter())?; Ok(()) } } diff --git a/src/groups/mod.rs b/src/groups/mod.rs index a02e303..fb8c746 100644 --- a/src/groups/mod.rs +++ b/src/groups/mod.rs @@ -134,7 +134,7 @@ pub trait CurveVar: // else, set self = self; result = bit.borrow().select(&self_plus_base, &result)?; } - *self = result; + *self += result; Ok(()) }