Skip to main content

kimchi_msm/
lib.rs

1use mina_poseidon::{
2    constants::PlonkSpongeConstantsKimchi,
3    pasta::FULL_ROUNDS,
4    sponge::{DefaultFqSponge, DefaultFrSponge},
5};
6use poly_commitment::kzg::KZGProof;
7
8pub use logup::{
9    Logup, LogupWitness, LookupProof as LogupProof, LookupTable as LogupTable,
10    LookupTableID as LogupTableID, LookupTableID,
11};
12
13pub mod circuit_design;
14pub mod column_env;
15pub mod columns;
16pub mod expr;
17pub mod logup;
18/// Instantiations of Logups for the MSM project
19// REMOVEME. The different interpreters must define their own tables.
20pub mod lookups;
21pub mod precomputed_srs;
22pub mod proof;
23pub mod prover;
24pub mod verifier;
25pub mod witness;
26
27pub mod fec;
28pub mod ffa;
29pub mod serialization;
30pub mod test;
31
32/// Define the maximum degree we support for the evaluations.
33/// For instance, it can be used to split the looked-up functions into partial
34/// sums.
35const MAX_SUPPORTED_DEGREE: usize = 8;
36
37/// Domain size for the MSM project, equal to the BN254 SRS size.
38pub const DOMAIN_SIZE: usize = 1 << 15;
39
40// @volhovm: maybe move these to the FF circuits module later.
41/// Bitsize of the foreign field limb representation.
42pub const LIMB_BITSIZE: usize = 15;
43
44/// Number of limbs representing one foreign field element (either
45/// [`Ff1`] or [`Ff2`]).
46pub const N_LIMBS: usize = 17;
47
48pub type BN254 = ark_ec::bn::Bn<ark_bn254::Config>;
49pub type BN254G1Affine = <BN254 as ark_ec::pairing::Pairing>::G1Affine;
50pub type BN254G2Affine = <BN254 as ark_ec::pairing::Pairing>::G2Affine;
51
52/// The native field we are working with.
53pub type Fp = ark_bn254::Fr;
54
55/// The foreign field we are emulating (one of the two)
56pub type Ff1 = mina_curves::pasta::Fp;
57pub type Ff2 = mina_curves::pasta::Fq;
58
59pub type SpongeParams = PlonkSpongeConstantsKimchi;
60pub type BaseSponge = DefaultFqSponge<ark_bn254::g1::Config, SpongeParams, FULL_ROUNDS>;
61pub type ScalarSponge = DefaultFrSponge<Fp, SpongeParams, FULL_ROUNDS>;
62pub type OpeningProof = KZGProof<BN254>;