group: Remove CurveProjective::Base and CurveAffine::Base

These associated types were completly unused. The only place we need
information about the base field of an elliptic curve is inside Jubjub
when operating over its coordinates to implement EC math inside the
circuit, and we can handle that either concretely, or with a future
trait specifically for that use-case.
This commit is contained in:
Jack Grigg 2020-05-21 09:55:05 +12:00
parent 5ff8562744
commit 5a40a0fe8f
4 changed files with 3 additions and 11 deletions

View File

@ -394,7 +394,6 @@ impl PrimeGroup for Fr {}
impl CurveProjective for Fr { impl CurveProjective for Fr {
type Affine = Fr; type Affine = Fr;
type Base = Fr;
fn batch_normalize(p: &[Self], q: &mut [Self::Affine]) { fn batch_normalize(p: &[Self], q: &mut [Self::Affine]) {
assert_eq!(p.len(), q.len()); assert_eq!(p.len(), q.len());
@ -436,7 +435,6 @@ impl CurveAffine for Fr {
type Compressed = FakePoint; type Compressed = FakePoint;
type Uncompressed = FakePoint; type Uncompressed = FakePoint;
type Projective = Fr; type Projective = Fr;
type Base = Fr;
type Scalar = Fr; type Scalar = Fr;
fn identity() -> Self { fn identity() -> Self {

View File

@ -1,7 +1,7 @@
// Catch documentation errors caused by code changes. // Catch documentation errors caused by code changes.
#![deny(intra_doc_link_resolution_failure)] #![deny(intra_doc_link_resolution_failure)]
use ff::{Field, PrimeField}; use ff::PrimeField;
use rand::RngCore; use rand::RngCore;
use std::fmt; use std::fmt;
use std::iter::Sum; use std::iter::Sum;
@ -97,7 +97,6 @@ pub trait CurveProjective:
+ GroupOps<<Self as CurveProjective>::Affine> + GroupOps<<Self as CurveProjective>::Affine>
+ GroupOpsOwned<<Self as CurveProjective>::Affine> + GroupOpsOwned<<Self as CurveProjective>::Affine>
{ {
type Base: Field;
type Affine: CurveAffine<Projective = Self, Scalar = Self::Scalar> type Affine: CurveAffine<Projective = Self, Scalar = Self::Scalar>
+ Mul<Self::Scalar, Output = Self> + Mul<Self::Scalar, Output = Self>
+ for<'r> Mul<Self::Scalar, Output = Self>; + for<'r> Mul<Self::Scalar, Output = Self>;
@ -136,7 +135,6 @@ pub trait CurveAffine:
+ for<'r> Mul<<Self as CurveAffine>::Scalar, Output = <Self as CurveAffine>::Projective> + for<'r> Mul<<Self as CurveAffine>::Scalar, Output = <Self as CurveAffine>::Projective>
{ {
type Scalar: PrimeField; type Scalar: PrimeField;
type Base: Field;
type Projective: CurveProjective<Affine = Self, Scalar = Self::Scalar>; type Projective: CurveProjective<Affine = Self, Scalar = Self::Scalar>;
type Uncompressed: Default + AsRef<[u8]> + AsMut<[u8]>; type Uncompressed: Default + AsRef<[u8]> + AsMut<[u8]>;
type Compressed: Default + AsRef<[u8]> + AsMut<[u8]>; type Compressed: Default + AsRef<[u8]> + AsMut<[u8]>;

View File

@ -200,7 +200,6 @@ macro_rules! curve_impl {
impl CurveAffine for $affine { impl CurveAffine for $affine {
type Scalar = $scalarfield; type Scalar = $scalarfield;
type Base = $basefield;
type Projective = $projective; type Projective = $projective;
type Uncompressed = $uncompressed; type Uncompressed = $uncompressed;
type Compressed = $compressed; type Compressed = $compressed;
@ -748,7 +747,6 @@ macro_rules! curve_impl {
impl PrimeGroup for $projective {} impl PrimeGroup for $projective {}
impl CurveProjective for $projective { impl CurveProjective for $projective {
type Base = $basefield;
type Affine = $affine; type Affine = $affine;
fn batch_normalize(p: &[Self], q: &mut [$affine]) { fn batch_normalize(p: &[Self], q: &mut [$affine]) {

View File

@ -30,7 +30,7 @@ use subtle::CtOption;
/// of prime order `r`, and are equipped with a bilinear pairing function. /// of prime order `r`, and are equipped with a bilinear pairing function.
pub trait Engine: ScalarEngine { pub trait Engine: ScalarEngine {
/// The projective representation of an element in G1. /// The projective representation of an element in G1.
type G1: CurveProjective<Base = Self::Fq, Scalar = Self::Fr, Affine = Self::G1Affine> type G1: CurveProjective<Scalar = Self::Fr, Affine = Self::G1Affine>
+ From<Self::G1Affine> + From<Self::G1Affine>
+ GroupOps<Self::G1Affine> + GroupOps<Self::G1Affine>
+ GroupOpsOwned<Self::G1Affine> + GroupOpsOwned<Self::G1Affine>
@ -39,7 +39,6 @@ pub trait Engine: ScalarEngine {
/// The affine representation of an element in G1. /// The affine representation of an element in G1.
type G1Affine: PairingCurveAffine< type G1Affine: PairingCurveAffine<
Base = Self::Fq,
Scalar = Self::Fr, Scalar = Self::Fr,
Projective = Self::G1, Projective = Self::G1,
Pair = Self::G2Affine, Pair = Self::G2Affine,
@ -49,7 +48,7 @@ pub trait Engine: ScalarEngine {
+ for<'a> Mul<&'a Self::Fr, Output = Self::G1>; + for<'a> Mul<&'a Self::Fr, Output = Self::G1>;
/// The projective representation of an element in G2. /// The projective representation of an element in G2.
type G2: CurveProjective<Base = Self::Fqe, Scalar = Self::Fr, Affine = Self::G2Affine> type G2: CurveProjective<Scalar = Self::Fr, Affine = Self::G2Affine>
+ From<Self::G2Affine> + From<Self::G2Affine>
+ GroupOps<Self::G2Affine> + GroupOps<Self::G2Affine>
+ GroupOpsOwned<Self::G2Affine> + GroupOpsOwned<Self::G2Affine>
@ -58,7 +57,6 @@ pub trait Engine: ScalarEngine {
/// The affine representation of an element in G2. /// The affine representation of an element in G2.
type G2Affine: PairingCurveAffine< type G2Affine: PairingCurveAffine<
Base = Self::Fqe,
Scalar = Self::Fr, Scalar = Self::Fr,
Projective = Self::G2, Projective = Self::G2,
Pair = Self::G1Affine, Pair = Self::G1Affine,