mina_curves/pasta/curves/
vesta.rs1use crate::pasta::*;
2use ark_ec::{
3 models::short_weierstrass::{Affine, Projective, SWCurveConfig},
4 CurveConfig,
5};
6use ark_ff::{MontFp, Zero};
7
8pub const G_GENERATOR_X: Fq = MontFp!("1");
11
12pub const G_GENERATOR_Y: Fq =
15 MontFp!("11426906929455361843568202299992114520848200991084027513389447476559454104162");
16
17#[derive(Debug, Clone, Default, PartialEq, Eq)]
18pub struct VestaParameters;
19
20impl CurveConfig for VestaParameters {
21 type BaseField = Fq;
22 type ScalarField = Fp;
23
24 const COFACTOR: &'static [u64] = &[0x1];
26
27 const COFACTOR_INV: Fp = MontFp!("1");
29}
30
31pub type Vesta = Affine<VestaParameters>;
32pub type ProjectiveVesta = Projective<VestaParameters>;
33
34impl SWCurveConfig for VestaParameters {
35 const COEFF_A: Fq = MontFp!("0");
37
38 const COEFF_B: Fq = MontFp!("5");
40
41 const GENERATOR: Affine<Self> = Affine::new_unchecked(G_GENERATOR_X, G_GENERATOR_Y);
43}
44
45impl VestaParameters {
46 #[inline(always)]
47 pub fn mul_by_a(
48 _: &<VestaParameters as CurveConfig>::BaseField,
49 ) -> <VestaParameters as CurveConfig>::BaseField {
50 <VestaParameters as CurveConfig>::BaseField::zero()
51 }
52}
53
54#[derive(Copy, Clone, Default, PartialEq, Eq)]
56pub struct LegacyVestaParameters;
57
58impl CurveConfig for LegacyVestaParameters {
59 type BaseField = <VestaParameters as CurveConfig>::BaseField;
60 type ScalarField = <VestaParameters as CurveConfig>::ScalarField;
61 const COFACTOR: &'static [u64] = <VestaParameters as CurveConfig>::COFACTOR;
62 const COFACTOR_INV: Self::ScalarField = <VestaParameters as CurveConfig>::COFACTOR_INV;
63}
64
65impl SWCurveConfig for LegacyVestaParameters {
66 const COEFF_A: Self::BaseField = <VestaParameters as SWCurveConfig>::COEFF_A;
67 const COEFF_B: Self::BaseField = <VestaParameters as SWCurveConfig>::COEFF_B;
68 const GENERATOR: Affine<Self> = Affine::new_unchecked(G_GENERATOR_X, G_GENERATOR_Y);
69}
70
71pub type LegacyVesta = Affine<LegacyVestaParameters>;