Fix base scalar multiplication (#117)

This commit is contained in:
Pascal Berrang
2023-03-23 21:53:45 +00:00
committed by GitHub
parent 69003c80d4
commit b477880a3b
3 changed files with 3 additions and 2 deletions

View File

@@ -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

View File

@@ -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(())
}
}

View File

@@ -134,7 +134,7 @@ pub trait CurveVar<C: CurveGroup, ConstraintF: Field>:
// else, set self = self;
result = bit.borrow().select(&self_plus_base, &result)?;
}
*self = result;
*self += result;
Ok(())
}