1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
//! Constants used for poseidon.

use crate::curve::KimchiCurve;
use ark_ff::Field;
use mina_poseidon::poseidon::ArithmeticSpongeParams;

#[derive(Debug, Clone)]
pub struct Constants<F: Field> {
    pub poseidon: ArithmeticSpongeParams<F>,
    pub endo: F,
    pub base: (F, F),
}

impl<F> Constants<F>
where
    F: Field,
{
    pub fn new<Curve: KimchiCurve<ScalarField = F>>() -> Self {
        let poseidon = Curve::sponge_params().clone();
        let endo_q = Curve::other_curve_endo();
        let base = Curve::other_curve_generator();

        Self {
            poseidon,
            endo: *endo_q,
            base,
        }
    }
}