group: Add scalar multiplication bounds to Group
The Scalar associated type is moved from CurveProjective to Group.
This commit is contained in:
parent
3f0efc3a66
commit
b72d0935b4
|
@ -221,7 +221,7 @@ impl<G: CurveProjective, E: ScalarEngine<Fr = G::Scalar>> Group<E> for Point<G>
|
|||
Point(G::identity())
|
||||
}
|
||||
fn group_mul_assign(&mut self, by: &G::Scalar) {
|
||||
self.0.mul_assign(by.to_repr());
|
||||
self.0.mul_assign(by);
|
||||
}
|
||||
fn group_add_assign(&mut self, other: &Self) {
|
||||
self.0.add_assign(&other.0);
|
||||
|
|
|
@ -317,7 +317,7 @@ where
|
|||
let mut a_answer = a_inputs.wait()?;
|
||||
AddAssign::<&E::G1>::add_assign(&mut a_answer, &a_aux.wait()?);
|
||||
AddAssign::<&E::G1>::add_assign(&mut g_a, &a_answer);
|
||||
a_answer.mul_assign(s);
|
||||
MulAssign::<E::Fr>::mul_assign(&mut a_answer, s);
|
||||
AddAssign::<&E::G1>::add_assign(&mut g_c, &a_answer);
|
||||
|
||||
let mut b1_answer: E::G1 = b_g1_inputs.wait()?;
|
||||
|
@ -326,7 +326,7 @@ where
|
|||
AddAssign::<&E::G2>::add_assign(&mut b2_answer, &b_g2_aux.wait()?);
|
||||
|
||||
AddAssign::<&E::G2>::add_assign(&mut g_b, &b2_answer);
|
||||
b1_answer.mul_assign(r);
|
||||
MulAssign::<E::Fr>::mul_assign(&mut b1_answer, r);
|
||||
AddAssign::<&E::G1>::add_assign(&mut g_c, &b1_answer);
|
||||
AddAssign::<&E::G1>::add_assign(&mut g_c, &h.wait()?);
|
||||
AddAssign::<&E::G1>::add_assign(&mut g_c, &l.wait()?);
|
||||
|
|
|
@ -367,6 +367,7 @@ impl Engine for DummyEngine {
|
|||
|
||||
impl Group for Fr {
|
||||
type Subgroup = Fr;
|
||||
type Scalar = Fr;
|
||||
|
||||
fn random<R: RngCore + ?Sized>(rng: &mut R) -> Self {
|
||||
<Fr as Field>::random(rng)
|
||||
|
@ -394,7 +395,6 @@ impl PrimeGroup for Fr {}
|
|||
impl CurveProjective for Fr {
|
||||
type Affine = Fr;
|
||||
type Base = Fr;
|
||||
type Scalar = Fr;
|
||||
|
||||
fn batch_normalization(_: &mut [Self]) {}
|
||||
|
||||
|
@ -402,12 +402,6 @@ impl CurveProjective for Fr {
|
|||
true
|
||||
}
|
||||
|
||||
fn mul_assign<S: Into<<Self::Scalar as PrimeField>::Repr>>(&mut self, other: S) {
|
||||
let tmp = Fr::from_repr(other.into()).unwrap();
|
||||
|
||||
MulAssign::mul_assign(self, &tmp);
|
||||
}
|
||||
|
||||
fn into_affine(&self) -> Fr {
|
||||
*self
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue