Skip to content

Commit

Permalink
rename
Browse files Browse the repository at this point in the history
  • Loading branch information
Pratyush committed Dec 26, 2023
1 parent 58a8a2d commit 8b3bc0d
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 28 deletions.
44 changes: 21 additions & 23 deletions src/groups/curves/short_weierstrass/mod.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
use ark_ec::{
short_weierstrass::{
Affine as SWAffine, Projective as SWProjective, SWCurveConfig as SWModelParameters,
},
short_weierstrass::{Affine as SWAffine, Projective as SWProjective, SWCurveConfig},
AffineRepr, CurveConfig, CurveGroup,
};
use ark_ff::{AdditiveGroup, BitIteratorBE, Field, One, PrimeField, Zero};
Expand Down Expand Up @@ -43,7 +41,7 @@ type BasePrimeField<P> = <<P as CurveConfig>::BaseField as Field>::BasePrimeFiel
#[derive(Derivative)]
#[derivative(Debug, Clone)]
#[must_use]
pub struct ProjectiveVar<P: SWModelParameters, F: FieldVar<P::BaseField, BasePrimeField<P>>>
pub struct ProjectiveVar<P: SWCurveConfig, F: FieldVar<P::BaseField, BasePrimeField<P>>>
where
for<'a> &'a F: FieldOpsBounds<'a, P::BaseField, F>,
{
Expand All @@ -61,7 +59,7 @@ where
#[derive(Derivative)]
#[derivative(Debug(bound = "F: ark_std::fmt::Debug"), Clone(bound = "F: Clone"))]
#[must_use]
pub struct AffineVar<P: SWModelParameters, F: FieldVar<P::BaseField, BasePrimeField<P>>>
pub struct AffineVar<P: SWCurveConfig, F: FieldVar<P::BaseField, BasePrimeField<P>>>
where
for<'a> &'a F: FieldOpsBounds<'a, P::BaseField, F>,
{
Expand All @@ -77,7 +75,7 @@ where

impl<P, F> AffineVar<P, F>
where
P: SWModelParameters,
P: SWCurveConfig,
F: FieldVar<P::BaseField, BasePrimeField<P>>,
for<'a> &'a F: FieldOpsBounds<'a, P::BaseField, F>,
{
Expand All @@ -102,7 +100,7 @@ where

impl<P, F> ToConstraintFieldGadget<BasePrimeField<P>> for AffineVar<P, F>
where
P: SWModelParameters,
P: SWCurveConfig,
F: FieldVar<P::BaseField, BasePrimeField<P>>,
for<'a> &'a F: FieldOpsBounds<'a, P::BaseField, F>,
F: ToConstraintFieldGadget<BasePrimeField<P>>,
Expand All @@ -120,7 +118,7 @@ where

impl<P, F> R1CSVar<BasePrimeField<P>> for ProjectiveVar<P, F>
where
P: SWModelParameters,
P: SWCurveConfig,
F: FieldVar<P::BaseField, BasePrimeField<P>>,
for<'a> &'a F: FieldOpsBounds<'a, P::BaseField, F>,
{
Expand All @@ -141,7 +139,7 @@ where
}
}

impl<P: SWModelParameters, F: FieldVar<P::BaseField, BasePrimeField<P>>> ProjectiveVar<P, F>
impl<P: SWCurveConfig, F: FieldVar<P::BaseField, BasePrimeField<P>>> ProjectiveVar<P, F>
where
for<'a> &'a F: FieldOpsBounds<'a, P::BaseField, F>,
{
Expand Down Expand Up @@ -370,7 +368,7 @@ where

impl<P, F> CurveVar<SWProjective<P>, BasePrimeField<P>> for ProjectiveVar<P, F>
where
P: SWModelParameters,
P: SWCurveConfig,
F: FieldVar<P::BaseField, BasePrimeField<P>>,
for<'a> &'a F: FieldOpsBounds<'a, P::BaseField, F>,
{
Expand Down Expand Up @@ -575,7 +573,7 @@ where

impl<P, F> ToConstraintFieldGadget<BasePrimeField<P>> for ProjectiveVar<P, F>
where
P: SWModelParameters,
P: SWCurveConfig,
F: FieldVar<P::BaseField, BasePrimeField<P>>,
for<'a> &'a F: FieldOpsBounds<'a, P::BaseField, F>,
F: ToConstraintFieldGadget<BasePrimeField<P>>,
Expand All @@ -585,7 +583,7 @@ where
}
}

fn mul_by_coeff_a<P: SWModelParameters, F: FieldVar<P::BaseField, BasePrimeField<P>>>(f: &F) -> F
fn mul_by_coeff_a<P: SWCurveConfig, F: FieldVar<P::BaseField, BasePrimeField<P>>>(f: &F) -> F
where
for<'a> &'a F: FieldOpsBounds<'a, P::BaseField, F>,
{
Expand Down Expand Up @@ -670,7 +668,7 @@ impl_bounded_ops!(
|this: &'a ProjectiveVar<P, F>, other: SWProjective<P>| {
this + ProjectiveVar::constant(other)
},
(F: FieldVar<P::BaseField, BasePrimeField<P>>, P: SWModelParameters),
(F: FieldVar<P::BaseField, BasePrimeField<P>>, P: SWCurveConfig),
for <'b> &'b F: FieldOpsBounds<'b, P::BaseField, F>,
);

Expand All @@ -683,7 +681,7 @@ impl_bounded_ops!(
sub_assign,
|this: &'a ProjectiveVar<P, F>, other: &'a ProjectiveVar<P, F>| this + other.negate().unwrap(),
|this: &'a ProjectiveVar<P, F>, other: SWProjective<P>| this - ProjectiveVar::constant(other),
(F: FieldVar<P::BaseField, BasePrimeField<P>>, P: SWModelParameters),
(F: FieldVar<P::BaseField, BasePrimeField<P>>, P: SWCurveConfig),
for <'b> &'b F: FieldOpsBounds<'b, P::BaseField, F>
);

Expand All @@ -706,29 +704,29 @@ impl_bounded_ops_diff!(
}
},
|this: &'a ProjectiveVar<P, F>, other: P::ScalarField| this * NonNativeFieldVar::constant(other),
(F: FieldVar<P::BaseField, BasePrimeField<P>>, P: SWModelParameters),
(F: FieldVar<P::BaseField, BasePrimeField<P>>, P: SWCurveConfig),
for <'b> &'b F: FieldOpsBounds<'b, P::BaseField, F>,
);

impl<'a, P, F> GroupOpsBounds<'a, SWProjective<P>, ProjectiveVar<P, F>> for ProjectiveVar<P, F>
where
P: SWModelParameters,
P: SWCurveConfig,
F: FieldVar<P::BaseField, BasePrimeField<P>>,
for<'b> &'b F: FieldOpsBounds<'b, P::BaseField, F>,
{
}

impl<'a, P, F> GroupOpsBounds<'a, SWProjective<P>, ProjectiveVar<P, F>> for &'a ProjectiveVar<P, F>
where
P: SWModelParameters,
P: SWCurveConfig,
F: FieldVar<P::BaseField, BasePrimeField<P>>,
for<'b> &'b F: FieldOpsBounds<'b, P::BaseField, F>,
{
}

impl<P, F> CondSelectGadget<BasePrimeField<P>> for ProjectiveVar<P, F>
where
P: SWModelParameters,
P: SWCurveConfig,
F: FieldVar<P::BaseField, BasePrimeField<P>>,
for<'a> &'a F: FieldOpsBounds<'a, P::BaseField, F>,
{
Expand All @@ -749,7 +747,7 @@ where

impl<P, F> EqGadget<BasePrimeField<P>> for ProjectiveVar<P, F>
where
P: SWModelParameters,
P: SWCurveConfig,
F: FieldVar<P::BaseField, BasePrimeField<P>>,
for<'a> &'a F: FieldOpsBounds<'a, P::BaseField, F>,
{
Expand Down Expand Up @@ -795,7 +793,7 @@ where

impl<P, F> AllocVar<SWAffine<P>, BasePrimeField<P>> for ProjectiveVar<P, F>
where
P: SWModelParameters,
P: SWCurveConfig,
F: FieldVar<P::BaseField, BasePrimeField<P>>,
for<'a> &'a F: FieldOpsBounds<'a, P::BaseField, F>,
{
Expand All @@ -814,7 +812,7 @@ where

impl<P, F> AllocVar<SWProjective<P>, BasePrimeField<P>> for ProjectiveVar<P, F>
where
P: SWModelParameters,
P: SWCurveConfig,
F: FieldVar<P::BaseField, BasePrimeField<P>>,
for<'a> &'a F: FieldOpsBounds<'a, P::BaseField, F>,
{
Expand Down Expand Up @@ -924,7 +922,7 @@ fn div2(limbs: &mut [u64]) {

impl<P, F> ToBitsGadget<BasePrimeField<P>> for ProjectiveVar<P, F>
where
P: SWModelParameters,
P: SWCurveConfig,
F: FieldVar<P::BaseField, BasePrimeField<P>>,
for<'a> &'a F: FieldOpsBounds<'a, P::BaseField, F>,
{
Expand All @@ -951,7 +949,7 @@ where

impl<P, F> ToBytesGadget<BasePrimeField<P>> for ProjectiveVar<P, F>
where
P: SWModelParameters,
P: SWCurveConfig,
F: FieldVar<P::BaseField, BasePrimeField<P>>,
for<'a> &'a F: FieldOpsBounds<'a, P::BaseField, F>,
{
Expand Down
10 changes: 5 additions & 5 deletions src/groups/curves/short_weierstrass/non_zero_affine.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ use ark_std::ops::Add;
#[derivative(Debug, Clone)]
#[must_use]
pub struct NonZeroAffineVar<
P: SWModelParameters,
P: SWCurveConfig,
F: FieldVar<P::BaseField, <P::BaseField as Field>::BasePrimeField>,
> where
for<'a> &'a F: FieldOpsBounds<'a, P::BaseField, F>,
Expand All @@ -23,7 +23,7 @@ pub struct NonZeroAffineVar<

impl<P, F> NonZeroAffineVar<P, F>
where
P: SWModelParameters,
P: SWCurveConfig,
F: FieldVar<P::BaseField, <P::BaseField as Field>::BasePrimeField>,
for<'a> &'a F: FieldOpsBounds<'a, P::BaseField, F>,
{
Expand Down Expand Up @@ -140,7 +140,7 @@ where

impl<P, F> R1CSVar<<P::BaseField as Field>::BasePrimeField> for NonZeroAffineVar<P, F>
where
P: SWModelParameters,
P: SWCurveConfig,
F: FieldVar<P::BaseField, <P::BaseField as Field>::BasePrimeField>,
for<'a> &'a F: FieldOpsBounds<'a, P::BaseField, F>,
{
Expand All @@ -157,7 +157,7 @@ where

impl<P, F> CondSelectGadget<<P::BaseField as Field>::BasePrimeField> for NonZeroAffineVar<P, F>
where
P: SWModelParameters,
P: SWCurveConfig,
F: FieldVar<P::BaseField, <P::BaseField as Field>::BasePrimeField>,
for<'a> &'a F: FieldOpsBounds<'a, P::BaseField, F>,
{
Expand All @@ -177,7 +177,7 @@ where

impl<P, F> EqGadget<<P::BaseField as Field>::BasePrimeField> for NonZeroAffineVar<P, F>
where
P: SWModelParameters,
P: SWCurveConfig,
F: FieldVar<P::BaseField, <P::BaseField as Field>::BasePrimeField>,
for<'a> &'a F: FieldOpsBounds<'a, P::BaseField, F>,
{
Expand Down

0 comments on commit 8b3bc0d

Please sign in to comment.