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