From a8314863d5e7e8325476eaea35fc20c5384dc4a2 Mon Sep 17 00:00:00 2001 From: lightsing Date: Thu, 22 Aug 2024 17:37:42 +0800 Subject: [PATCH] some fix --- src/bn256/fr.rs | 3 +-- src/bn256/fr_sp1.rs | 2 +- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/src/bn256/fr.rs b/src/bn256/fr.rs index ac90d403..821c37d0 100644 --- a/src/bn256/fr.rs +++ b/src/bn256/fr.rs @@ -325,9 +325,8 @@ impl<'a> MulAddAssign<&'a Fr, Fr> for Fr { impl<'a, 'b> MulAddAssign<&'a Fr, &'b Fr> for Fr { fn mul_add_assign(&mut self, a: &'a Self, b: &'b Self) { - *self = *self + *a + *b; + *self = *self + a * b; } - } #[cfg(test)] diff --git a/src/bn256/fr_sp1.rs b/src/bn256/fr_sp1.rs index 39b8497f..b1e2e46e 100644 --- a/src/bn256/fr_sp1.rs +++ b/src/bn256/fr_sp1.rs @@ -132,7 +132,7 @@ impl Fr { CtOption::new(Fr(tmp), Choice::from(is_some)) } - pub fn from_raw(limbs: [u64; 4]) -> Fr { + pub const fn from_raw(limbs: [u64; 4]) -> Fr { // FIXME: handle limbs that are larger than modulus. let mut tmp = [0, 0, 0, 0, 0, 0, 0, 0];