ark_poly_commit/multilinear_pc/
data_structures.rs

1use ark_ec::pairing::Pairing;
2use ark_serialize::{CanonicalDeserialize, CanonicalSerialize};
3#[cfg(not(feature = "std"))]
4use ark_std::vec::Vec;
5#[allow(type_alias_bounds)]
6/// Evaluations over {0,1}^n for G1
7pub type EvaluationHyperCubeOnG1<E: Pairing> = Vec<E::G1Affine>;
8#[allow(type_alias_bounds)]
9/// Evaluations over {0,1}^n for G2
10pub type EvaluationHyperCubeOnG2<E: Pairing> = Vec<E::G2Affine>;
11
12/// Public Parameter used by prover
13#[derive(CanonicalSerialize, CanonicalDeserialize, Clone, Debug)]
14pub struct UniversalParams<E: Pairing> {
15    /// number of variables
16    pub num_vars: usize,
17    /// `pp_{num_vars}`, `pp_{num_vars - 1}`, `pp_{num_vars - 2}`, ..., defined by XZZPD19
18    pub powers_of_g: Vec<EvaluationHyperCubeOnG1<E>>,
19    /// `pp_{num_vars}`, `pp_{num_vars - 1}`, `pp_{num_vars - 2}`, ..., defined by XZZPD19
20    pub powers_of_h: Vec<EvaluationHyperCubeOnG2<E>>,
21    /// generator for G1
22    pub g: E::G1Affine,
23    /// generator for G2
24    pub h: E::G2Affine,
25    /// g^randomness
26    pub g_mask: Vec<E::G1Affine>,
27}
28
29/// Public Parameter used by prover
30#[derive(CanonicalSerialize, CanonicalDeserialize, Clone, Debug)]
31pub struct CommitterKey<E: Pairing> {
32    /// number of variables
33    pub nv: usize,
34    /// pp_k defined by libra
35    pub powers_of_g: Vec<EvaluationHyperCubeOnG1<E>>,
36    /// pp_h defined by libra
37    pub powers_of_h: Vec<EvaluationHyperCubeOnG2<E>>,
38    /// generator for G1
39    pub g: E::G1Affine,
40    /// generator for G2
41    pub h: E::G2Affine,
42}
43
44/// Public Parameter used by prover
45#[derive(CanonicalSerialize, CanonicalDeserialize, Clone, Debug)]
46pub struct VerifierKey<E: Pairing> {
47    /// number of variables
48    pub nv: usize,
49    /// generator of G1
50    pub g: E::G1Affine,
51    /// generator of G2
52    pub h: E::G2Affine,
53    /// g^t1, g^t2, ...
54    pub g_mask_random: Vec<E::G1Affine>,
55}
56
57#[derive(CanonicalSerialize, CanonicalDeserialize, Clone, Debug)]
58/// commitment
59pub struct Commitment<E: Pairing> {
60    /// number of variables
61    pub nv: usize,
62    /// product of g as described by the vRAM paper
63    pub g_product: E::G1Affine,
64}
65
66#[derive(CanonicalSerialize, CanonicalDeserialize, Clone, Debug)]
67/// proof of opening
68pub struct Proof<E: Pairing> {
69    /// Evaluation of quotients
70    pub proofs: Vec<E::G2Affine>,
71}