diff --git a/src/lib.nr b/src/lib.nr index 86342ec..2aa4a8c 100644 --- a/src/lib.nr +++ b/src/lib.nr @@ -3,6 +3,7 @@ mod test; mod bjj; pub use crate::scalar_field::ScalarField; +use std::ops::{Add, Neg, Sub}; pub struct Curve { x: Field, @@ -23,23 +24,10 @@ trait TECurveParameterTrait { } /// Defines methods that a valid Curve implementation must satisfy -trait CurveTrait: std::ops::Add + std::ops::Sub + std::cmp::Eq + std::ops::Neg { - fn default() -> Self { - std::default::Default::default() - } +trait CurveTrait: Add + Sub + Eq + Neg + Default { fn new(x: Field, y: Field) -> Self; fn zero() -> Self; fn one() -> Self; - - fn add(self, x: Self) -> Self { - self + x - } - fn sub(self, x: Self) -> Self { - self - x - } - fn neg(self) -> Self { - std::ops::Neg::neg(self) - } fn dbl(self) -> Self; fn mul(self, x: ScalarField) -> Self; fn msm( diff --git a/src/test.nr b/src/test.nr index 8f218f1..0aab732 100644 --- a/src/test.nr +++ b/src/test.nr @@ -2,6 +2,7 @@ use crate::bjj::BabyJubJubParams; use crate::Curve; use crate::scalar_field::ScalarField; +use crate::CurveTrait; use ec::{consts::te::baby_jubjub, tecurve::affine::Point as TEPoint}; type BabyJubJub = Curve;