Remove `FieldExt` trait

One, two! One, two! And through and through
    The vorpal blade went snicker-snack!
He left it dead, and with its head
    He went galumphing back.

Closes zcash/pasta_curves#42.
This commit is contained in:
Jack Grigg 2022-11-24 20:51:46 +00:00
parent 56b73e32ce
commit 825cb944de
6 changed files with 8 additions and 18 deletions

View File

@ -11,6 +11,7 @@ and this project adheres to Rust's notion of
### Removed
- `pasta_curves::arithmetic`:
- `FieldExt` (use `ff::PrimeField` or `ff::WithSmallOrderMulGroup` instead).
- `Group`
- `SqrtRatio` (use `ff::Field::{sqrt_ratio, sqrt_alt}` instead).
- `SqrtTables` (from public API, as it isn't suitable for generic usage).

View File

@ -8,4 +8,4 @@ mod curves;
mod fields;
pub use curves::*;
pub use fields::*;
pub(crate) use fields::*;

View File

@ -6,9 +6,6 @@ use group::prime::{PrimeCurve, PrimeCurveAffine};
#[cfg(feature = "alloc")]
use subtle::{Choice, ConditionallySelectable, ConstantTimeEq, CtOption};
#[cfg(feature = "alloc")]
use super::FieldExt;
#[cfg(feature = "alloc")]
use alloc::boxed::Box;
#[cfg(feature = "alloc")]
@ -30,9 +27,9 @@ pub trait CurveExt:
+ From<<Self as PrimeCurve>::Affine>
{
/// The scalar field of this elliptic curve.
type ScalarExt: FieldExt;
type ScalarExt: ff::WithSmallOrderMulGroup<3>;
/// The base field over which this elliptic curve is constructed.
type Base: FieldExt;
type Base: ff::WithSmallOrderMulGroup<3>;
/// The affine version of the curve
type AffineExt: CurveAffine<CurveExt = Self, ScalarExt = <Self as CurveExt>::ScalarExt>
+ Mul<Self::ScalarExt, Output = Self>
@ -102,9 +99,9 @@ pub trait CurveAffine:
+ From<<Self as PrimeCurveAffine>::Curve>
{
/// The scalar field of this elliptic curve.
type ScalarExt: FieldExt + Ord;
type ScalarExt: ff::WithSmallOrderMulGroup<3> + Ord;
/// The base field over which this elliptic curve is constructed.
type Base: FieldExt + Ord;
type Base: ff::WithSmallOrderMulGroup<3> + Ord;
/// The projective form of the curve
type CurveExt: CurveExt<AffineExt = Self, ScalarExt = <Self as CurveAffine>::ScalarExt>;

View File

@ -28,10 +28,6 @@ pub(crate) trait SqrtTableHelpers: ff::PrimeField {
fn get_lower_32(&self) -> u32;
}
/// This trait is a common interface for dealing with elements of a finite
/// field.
pub trait FieldExt: ff::WithSmallOrderMulGroup<3> {}
/// Parameters for a perfect hash function used in square root computation.
#[cfg(feature = "sqrt-table")]
#[cfg_attr(docsrs, doc(cfg(feature = "sqrt-table")))]

View File

@ -11,7 +11,7 @@ use lazy_static::lazy_static;
#[cfg(feature = "bits")]
use ff::{FieldBits, PrimeFieldBits};
use crate::arithmetic::{adc, mac, sbb, FieldExt, SqrtTableHelpers};
use crate::arithmetic::{adc, mac, sbb, SqrtTableHelpers};
#[cfg(feature = "sqrt-table")]
use crate::arithmetic::SqrtTables;
@ -728,8 +728,6 @@ impl SqrtTableHelpers for Fp {
}
}
impl FieldExt for Fp {}
impl WithSmallOrderMulGroup<3> for Fp {
const ZETA: Self = Fp::from_raw([
0x1dad5ebdfdfe4ab9,

View File

@ -11,7 +11,7 @@ use lazy_static::lazy_static;
#[cfg(feature = "bits")]
use ff::{FieldBits, PrimeFieldBits};
use crate::arithmetic::{adc, mac, sbb, FieldExt, SqrtTableHelpers};
use crate::arithmetic::{adc, mac, sbb, SqrtTableHelpers};
#[cfg(feature = "sqrt-table")]
use crate::arithmetic::SqrtTables;
@ -727,8 +727,6 @@ impl SqrtTableHelpers for Fq {
}
}
impl FieldExt for Fq {}
impl WithSmallOrderMulGroup<3> for Fq {
const ZETA: Self = Fq::from_raw([
0x2aa9d2e050aa0e4f,