Skip to content

Commit 683ac9e

Browse files
Add polynomial commitment for multilinear polynomial (#66)
* add multilinear_pc barebones * add multilinear extension commitment scheme * add unit tests * temporarily change dependency * change dependency * add trim * remove `get_key` * use `format` from ark_std * fmt * revert prev two * tweak * fmt * Slightly tune the comments * fmt Co-authored-by: Weikeng Chen <w.k@berkeley.edu>
1 parent 74c9e7a commit 683ac9e

File tree

3 files changed

+419
-0
lines changed

3 files changed

+419
-0
lines changed

src/lib.rs

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -97,6 +97,14 @@ pub mod sonic_pc;
9797
/// [pcdas]: https://eprint.iacr.org/2020/499
9898
pub mod ipa_pc;
9999

100+
/// A multilinear polynomial commitment scheme that converts n-variate multilinear polynomial into
101+
/// n quotient UV polynomial. This scheme is based on hardness of the discrete logarithm
102+
/// in prime-order groups. Construction is detailed in [[XZZPD19]][xzzpd19] and [[ZGKPP18]][zgkpp18]
103+
///
104+
/// [xzzpd19]: https://eprint.iacr.org/2019/317
105+
/// [zgkpp]: https://ieeexplore.ieee.org/document/8418645
106+
pub mod multilinear_pc;
107+
100108
/// Multivariate polynomial commitment based on the construction in
101109
/// [[PST13]][pst] with batching and (optional) hiding property inspired
102110
/// by the univariate scheme in [[CHMMVW20, "Marlin"]][marlin]
Lines changed: 70 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,70 @@
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

Comments
 (0)