Skip to content

Commit 78aa1d7

Browse files
mmagicianAntonio95autquisPratyushCesar199999
authored
Add Ligero univariate and multilinear PCS (#132)
* added hyrax PCS * Add univariate and multilinear Ligero PCS Co-authored-by: Hossein Moghaddas <[email protected]> Co-authored-by: Antonio Mejías Gil <[email protected]> * adapt the scheme to arkworks-rs/algebra#691 * move tests shared across univariate and ML ligero to utils * remove unused no-std import * adapt the scheme to arkworks-rs/algebra#691 * remove unused code in hyrax * Improve the choice of dimensions for polynomial matrix * Update comments * parallelised row encoding and col-to-leaf hashing; significant performance gains * expanded on Future Optimisations section * fixed GH action failures: formatted and added feature flag * remove Prepared data types from `PolynomialCommitment` trait * Remove Prepared data types from `PolynomialCommitment` trait impl * added necessary dependencies overwritten by previous merge commit * fixed hashbrown version * Add back the cfg dependency for no-std build * fixed hashbrown version * pulled * created separate benchmark files * fixed duplicate dependency to match other branches * patched bn254 dep * restructured benchmark macros to accept ML schemes; benches working * moved hashing structures to bench-templates crate, started ligero bench coding * completed ligero benchmarks * added ligero benchmark file * Hyrax fix bench (#42) * fix bench call * set num vars from 12-20 * Ligero fix benches (#40) * fix bench call * set num vars from 12-20 * Hyrax parallel `commit` (#39) * Enable parallel commitment in hyrax amend * make `rand` optional * remove dead code * Make Hyrax hiding again (#43) * removed evaluation randomness from proof and ignored claimed value in check to make scheme hiding * fmt * removed unnecessary usage of argument in check, added _ * Fix tests: sponge config for univariate ligero * Delete `IOPTranscript`, update with master (#50) (aka Hyrax++) * Add the trait bounds * Add `CommitmentState` * Update benches for the new type * Fix the name of local variable * Merge `PCCommitmentState` with `PCRandomness` * Update `README.md` * Fix a bug * Change `Randomness` to `CommitmentState` * Maybe `empty` not return `Self` * Make `empty` return `Self` * Rename `rand` to `state` * Partially integrate the new design into Hyrax * Update Hyrax with the shared state * Rename nonnative to emulated, as in `r1cs-std` (#137) * Rename nonnative to emulated, as in `r1cs-std` * Run `fmt` * Temporarily change `Cargo.toml` * Revert `Cargo.toml` * Refactor `FoldedPolynomialStream` partially * Substitute `ChallengeGenerator` by the generic sponge (#139) * Rename nonnative to emulated, as in `r1cs-std` * Run `fmt` * Temporarily change `Cargo.toml` * Substitute `ChallengeGenerator` with the generic sponge * Run `fmt` * Remove the extra file * Update modules * Delete the unnecessary loop * Revert `Cargo.toml` * Refactor `FoldedPolynomialStream` partially * Update README * Make the diff more readable * Bring the whitespace back * Make diff more readable, 2 * Fix according to breaking changes in `ark-ec` (#141) * Fix for KZG10 * Fix the breaking changes in `ark-ec` * Remove the extra loop * Fix the loop range * re-use the preprocessing table * also re-use the preprocessing table for multilinear_pc --------- Co-authored-by: mmagician <[email protected]> * Auxiliary opening data (#134) * Add the trait bounds * Add `CommitmentState` * Update benches for the new type * Fix the name of local variable * Merge `PCCommitmentState` with `PCRandomness` * Update `README.md` * Fix a bug * Put `Randomness` in `CommitmentState` * Add a comment * Remove the extra loop * Update the comment for `CommitmentState` Co-authored-by: Marcin <[email protected]> * cargo fmt --------- Co-authored-by: Marcin <[email protected]> * `batch_mul_with_preprocessing` no longer takes `self` as argument (#142) * batch_mul_with_preprocessing no longer takes `self` as argument * Apply suggestions from code review Co-authored-by: Pratyush Mishra <[email protected]> * fix variable name --------- Co-authored-by: Pratyush Mishra <[email protected]> * Remove ChallengeGenerator for Ligero (#56) * Squash and merge `delete-chalgen` onto here * Fix for `ChallengeGenerator` * Delete `IOPTranscript` for Hyrax (#55) * Use the sponge generic and rearrange `use`s * Use sponge instead of `IOPTransript` * Fix benches * Remove the extra loop --------- Co-authored-by: mmagician <[email protected]> Co-authored-by: Pratyush Mishra <[email protected]> * Delete `IOPTranscript`, update with master (#51) (aka Ligero++) * Add the trait bounds * Add `CommitmentState` * Update benches for the new type * Fix the name of local variable * Merge `PCCommitmentState` with `PCRandomness` * Update `README.md` * Fix a bug * Simplify `hash_column` * Delete comments * Add `CommitmentState` * Make `fmt` happy * Refactor, remove `hash_columns` * Rename all params * Maybe `empty` not return `Self` * Make `empty` return `Self` * Rename `rand` to `state` * Add type `Randomness` * Ligero+++ (#46) * conversion to `into_iter` is a no-op * remove explicit casts to vecs * rename to use singular of `labeled_commitment` * simplify the iterators even further by zipping two iters * Apply suggestions from code review * Fix tests: sponge config for univariate ligero * Rename nonnative to emulated, as in `r1cs-std` (#137) * Rename nonnative to emulated, as in `r1cs-std` * Run `fmt` * Temporarily change `Cargo.toml` * Revert `Cargo.toml` * Refactor `FoldedPolynomialStream` partially * Substitute `ChallengeGenerator` by the generic sponge (#139) * Rename nonnative to emulated, as in `r1cs-std` * Run `fmt` * Temporarily change `Cargo.toml` * Substitute `ChallengeGenerator` with the generic sponge * Run `fmt` * Remove the extra file * Update modules * Delete the unnecessary loop * Revert `Cargo.toml` * Refactor `FoldedPolynomialStream` partially * Update README * Make the diff more readable * Bring the whitespace back * Make diff more readable, 2 * Fix according to breaking changes in `ark-ec` (#141) * Fix for KZG10 * Fix the breaking changes in `ark-ec` * Remove the extra loop * Fix the loop range * re-use the preprocessing table * also re-use the preprocessing table for multilinear_pc --------- Co-authored-by: mmagician <[email protected]> * Auxiliary opening data (#134) * Add the trait bounds * Add `CommitmentState` * Update benches for the new type * Fix the name of local variable * Merge `PCCommitmentState` with `PCRandomness` * Update `README.md` * Fix a bug * Put `Randomness` in `CommitmentState` * Add a comment * Remove the extra loop * Update the comment for `CommitmentState` Co-authored-by: Marcin <[email protected]> * cargo fmt --------- Co-authored-by: Marcin <[email protected]> * `batch_mul_with_preprocessing` no longer takes `self` as argument (#142) * batch_mul_with_preprocessing no longer takes `self` as argument * Apply suggestions from code review Co-authored-by: Pratyush Mishra <[email protected]> * fix variable name --------- Co-authored-by: Pratyush Mishra <[email protected]> * Remove `ChallengeGenerator` and `IOPTranscript` for Ligero (#57) * Squash and merge `delete-chalgen` onto here * Fix Ligero for `ChallengeGenerator` and `AsRef` for Merkle tree * Fix tests: sponge config for univariate ligero * Delete `IOPTranscript` for Ligero (#54) * Replace the `IOPTranscript` with `CryptographicSponge` * Delete extra comments * Run fmt * Fix tests: sponge config for univariate ligero * Delete TODOs and do not absorb what you just squeezed * Fix unused import * Revert "Fix unused import" This reverts commit e85af90. * Try to fix * Remove the extra loop --------- Co-authored-by: mmagician <[email protected]> Co-authored-by: Pratyush Mishra <[email protected]> * Add a few comments and update `Cargo.toml` * Remove extra `cfg_iter!` Co-authored-by: Pratyush Mishra <[email protected]> * Change `pedersen_commit` and add `cfg_into_iter!` * Hash and absorb * added Sync trait bound Co-authored-by: Cesar Descalzo <[email protected]> * removed TODO * Fixed error whereby boolean value returned by path.verify was neglected Co-authored-by: Cesar Descalzo <[email protected]> Co-authored-by: mmagician <[email protected]> * removed unnecessary qualification which linter didn't like * changed potential panic to returning Err, stopping early Co-authored-by: Cesar Descalzo <[email protected]> * removed unnecessary function defined inside check() Co-authored-by: Cesar Descalzo <[email protected]> * various minor fixes * Add `ark-std` to patch * Reorder Hyrax checks Co-authored-by: Antonio Mejías Gil <[email protected]> * Add `ark-std` to patch * Downgrade `hashbrown` * Fix breaking change from algebra/poly (#72) * Reorder deps * Add dummy doc for nightly * Fix `hashbrown` + Replace Blake2 by Blake3 * Revert to Blake2 * Fix merging issues * Test if CI is happy * Revert and cleanup * Delete dummy doc * Bring back `num_traits` * Add `/` to Cargo.toml --------- Co-authored-by: Antonio Mejías Gil <[email protected]> Co-authored-by: Hossein Moghaddas <[email protected]> Co-authored-by: Pratyush Mishra <[email protected]> Co-authored-by: Cesar Descalzo <[email protected]> Co-authored-by: Cesar199999 <[email protected]>
1 parent 77de8eb commit 78aa1d7

File tree

15 files changed

+2063
-19
lines changed

15 files changed

+2063
-19
lines changed

Cargo.toml

+1-1
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ ark-ec = { git = "https://github.com/arkworks-rs/algebra/" }
3434
ark-serialize = { git = "https://github.com/arkworks-rs/algebra/" }
3535
ark-poly = { git = "https://github.com/arkworks-rs/algebra/" }
3636

37-
ark-crypto-primitives = { git = "https://github.com/arkworks-rs/crypto-primitives" }
37+
ark-crypto-primitives = { git = "https://github.com/arkworks-rs/crypto-primitives/" }
3838
ark-r1cs-std = { git = "https://github.com/arkworks-rs/r1cs-std/" }
3939

4040
ark-bls12-377 = { git = "https://github.com/arkworks-rs/algebra/" }

bench-templates/src/lib.rs

+66-6
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,23 @@
1-
use ark_crypto_primitives::sponge::{
2-
poseidon::{PoseidonConfig, PoseidonSponge},
3-
CryptographicSponge,
1+
use ark_crypto_primitives::{
2+
crh::{sha256::digest::Digest, CRHScheme},
3+
sponge::{
4+
poseidon::{PoseidonConfig, PoseidonSponge},
5+
CryptographicSponge,
6+
},
47
};
58
use ark_ff::PrimeField;
69
use ark_poly::Polynomial;
710
use ark_serialize::{CanonicalSerialize, Compress};
811
use ark_std::{test_rng, UniformRand};
9-
use rand_chacha::{rand_core::SeedableRng, ChaCha20Rng};
12+
use rand_chacha::{
13+
rand_core::{RngCore, SeedableRng},
14+
ChaCha20Rng,
15+
};
1016

1117
use core::time::Duration;
12-
use std::time::Instant;
18+
use std::{borrow::Borrow, marker::PhantomData, time::Instant};
1319

14-
use ark_poly_commit::{LabeledPolynomial, PolynomialCommitment};
20+
use ark_poly_commit::{to_bytes, LabeledPolynomial, PolynomialCommitment};
1521

1622
pub use criterion::*;
1723
pub use paste::paste;
@@ -276,3 +282,57 @@ macro_rules! bench {
276282
}
277283
};
278284
}
285+
286+
/**** Auxiliary methods for linear-code-based PCSs ****/
287+
288+
/// Needed for benches and tests.
289+
pub struct LeafIdentityHasher;
290+
291+
impl CRHScheme for LeafIdentityHasher {
292+
type Input = Vec<u8>;
293+
type Output = Vec<u8>;
294+
type Parameters = ();
295+
296+
fn setup<R: RngCore>(_: &mut R) -> Result<Self::Parameters, ark_crypto_primitives::Error> {
297+
Ok(())
298+
}
299+
300+
fn evaluate<T: Borrow<Self::Input>>(
301+
_: &Self::Parameters,
302+
input: T,
303+
) -> Result<Self::Output, ark_crypto_primitives::Error> {
304+
Ok(input.borrow().to_vec().into())
305+
}
306+
}
307+
308+
/// Needed for benches and tests.
309+
pub struct FieldToBytesColHasher<F, D>
310+
where
311+
F: PrimeField + CanonicalSerialize,
312+
D: Digest,
313+
{
314+
_phantom: PhantomData<(F, D)>,
315+
}
316+
317+
impl<F, D> CRHScheme for FieldToBytesColHasher<F, D>
318+
where
319+
F: PrimeField + CanonicalSerialize,
320+
D: Digest,
321+
{
322+
type Input = Vec<F>;
323+
type Output = Vec<u8>;
324+
type Parameters = ();
325+
326+
fn setup<R: RngCore>(_rng: &mut R) -> Result<Self::Parameters, ark_crypto_primitives::Error> {
327+
Ok(())
328+
}
329+
330+
fn evaluate<T: Borrow<Self::Input>>(
331+
_parameters: &Self::Parameters,
332+
input: T,
333+
) -> Result<Self::Output, ark_crypto_primitives::Error> {
334+
let mut dig = D::new();
335+
dig.update(to_bytes!(input.borrow()).unwrap());
336+
Ok(dig.finalize().to_vec())
337+
}
338+
}

poly-commit/Cargo.toml

+10-1
Original file line numberDiff line numberDiff line change
@@ -26,12 +26,19 @@ ark-r1cs-std = { version = "^0.4.0", default-features = false, optional = true }
2626
hashbrown = { version = "0.15", default-features = false, features = ["inline-more", "allocator-api2"], optional = true }
2727
rand = { version = "0.8.0", optional = true }
2828
rayon = { version = "1", optional = true }
29+
merlin = { version = "3.0.0", default-features = false }
2930

3031
[[bench]]
3132
name = "ipa_times"
3233
path = "benches/ipa_times.rs"
3334
harness = false
3435

36+
[[bench]]
37+
name = "ligero_ml_times"
38+
path = "benches/ligero_ml_times.rs"
39+
harness = false
40+
41+
3542
[[bench]]
3643
name = "hyrax_times"
3744
path = "benches/hyrax_times.rs"
@@ -53,10 +60,12 @@ ark-ed-on-bls12-381 = { version = "^0.4.0", default-features = false }
5360
ark-bls12-381 = { version = "^0.4.0", default-features = false, features = [ "curve" ] }
5461
ark-bls12-377 = { version = "^0.4.0", default-features = false, features = [ "curve" ] }
5562
ark-bn254 = { version = "^0.4.0", default-features = false, features = [ "curve" ] }
56-
5763
rand_chacha = { version = "0.3.0", default-features = false }
5864
ark-pcs-bench-templates = { path = "../bench-templates" }
5965

66+
[target.'cfg(target_arch = "aarch64")'.dependencies]
67+
num-traits = { version = "0.2", default-features = false, features = ["libm"] }
68+
6069
[features]
6170
default = [ "std", "parallel" ]
6271
std = [ "ark-ff/std", "ark-ec/std", "ark-poly/std", "ark-std/std", "ark-relations/std", "ark-serialize/std", "ark-crypto-primitives/std"]
+55
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
use ark_crypto_primitives::{
2+
crh::{sha256::Sha256, CRHScheme, TwoToOneCRHScheme},
3+
merkle_tree::{ByteDigestConverter, Config},
4+
};
5+
use ark_pcs_bench_templates::*;
6+
use ark_poly::{DenseMultilinearExtension, MultilinearExtension};
7+
8+
use ark_bn254::Fr;
9+
use ark_ff::PrimeField;
10+
11+
use ark_poly_commit::linear_codes::{LinearCodePCS, MultilinearLigero};
12+
use blake2::Blake2s256;
13+
use rand_chacha::ChaCha20Rng;
14+
15+
// Ligero PCS over BN254
16+
struct MerkleTreeParams;
17+
type LeafH = LeafIdentityHasher;
18+
type CompressH = Sha256;
19+
impl Config for MerkleTreeParams {
20+
type Leaf = Vec<u8>;
21+
22+
type LeafDigest = <LeafH as CRHScheme>::Output;
23+
type LeafInnerDigestConverter = ByteDigestConverter<Self::LeafDigest>;
24+
type InnerDigest = <CompressH as TwoToOneCRHScheme>::Output;
25+
26+
type LeafHash = LeafH;
27+
type TwoToOneHash = CompressH;
28+
}
29+
30+
pub type MLE<F> = DenseMultilinearExtension<F>;
31+
type MTConfig = MerkleTreeParams;
32+
type ColHasher<F> = FieldToBytesColHasher<F, Blake2s256>;
33+
type Ligero<F> = LinearCodePCS<
34+
MultilinearLigero<F, MTConfig, MLE<F>, ColHasher<F>>,
35+
F,
36+
MLE<F>,
37+
MTConfig,
38+
ColHasher<F>,
39+
>;
40+
41+
fn rand_poly_ligero_ml<F: PrimeField>(
42+
num_vars: usize,
43+
rng: &mut ChaCha20Rng,
44+
) -> DenseMultilinearExtension<F> {
45+
DenseMultilinearExtension::rand(num_vars, rng)
46+
}
47+
48+
fn rand_point_ligero_ml<F: PrimeField>(num_vars: usize, rng: &mut ChaCha20Rng) -> Vec<F> {
49+
(0..num_vars).map(|_| F::rand(rng)).collect()
50+
}
51+
52+
const MIN_NUM_VARS: usize = 12;
53+
const MAX_NUM_VARS: usize = 22;
54+
55+
bench!(Ligero<Fr>, rand_poly_ligero_ml, rand_point_ligero_ml);

poly-commit/src/ipa_pc/mod.rs

+5-10
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
use crate::{
2-
BTreeMap, BTreeSet, BatchLCProof, DenseUVPolynomial, Error, Evaluations, LabeledCommitment,
3-
LabeledPolynomial, LinearCombination, PCCommitmentState, PCCommitterKey, PCUniversalParams,
4-
PolynomialCommitment, QuerySet, CHALLENGE_SIZE,
2+
utils::inner_product, BTreeMap, BTreeSet, BatchLCProof, DenseUVPolynomial, Error, Evaluations,
3+
LabeledCommitment, LabeledPolynomial, LinearCombination, PCCommitmentState, PCCommitterKey,
4+
PCUniversalParams, PolynomialCommitment, QuerySet, CHALLENGE_SIZE,
55
};
66
use ark_crypto_primitives::sponge::CryptographicSponge;
77
use ark_ec::{AffineRepr, CurveGroup, VariableBaseMSM};
@@ -86,11 +86,6 @@ where
8686
challenge.unwrap()
8787
}
8888

89-
#[inline]
90-
fn inner_product(l: &[G::ScalarField], r: &[G::ScalarField]) -> G::ScalarField {
91-
ark_std::cfg_iter!(l).zip(r).map(|(li, ri)| *li * ri).sum()
92-
}
93-
9489
/// The succinct portion of `PC::check`. This algorithm runs in time
9590
/// O(log d), where d is the degree of the committed polynomials.
9691
fn succinct_check<'a>(
@@ -674,10 +669,10 @@ where
674669
let (key_proj_l, _) = key_proj.split_at_mut(n / 2);
675670

676671
let l = Self::cm_commit(key_l, coeffs_r, None, None)
677-
+ &h_prime.mul(Self::inner_product(coeffs_r, z_l));
672+
+ &h_prime.mul(inner_product(coeffs_r, z_l));
678673

679674
let r = Self::cm_commit(key_r, coeffs_l, None, None)
680-
+ &h_prime.mul(Self::inner_product(coeffs_l, z_r));
675+
+ &h_prime.mul(inner_product(coeffs_l, z_r));
681676

682677
let lr = G::Group::normalize_batch(&[l, r]);
683678
l_vec.push(lr[0]);

poly-commit/src/lib.rs

+5
Original file line numberDiff line numberDiff line change
@@ -128,6 +128,11 @@ pub use marlin::marlin_pst13_pc;
128128
/// [bdfg]: https://eprint.iacr.org/2020/081.pdf
129129
pub mod streaming_kzg;
130130

131+
/// Scheme based on the Ligero construction in [[Ligero]][ligero].
132+
///
133+
/// [ligero]: https://eprint.iacr.org/2022/1608
134+
pub mod linear_codes;
135+
131136
/// A polynomial commitment scheme based on the hardness of the
132137
/// discrete logarithm problem in prime-order groups. This is a
133138
/// Fiat-Shamired version of the PCS described in the Hyrax paper
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,124 @@
1+
use crate::{utils::Matrix, PCCommitment, PCCommitmentState};
2+
use ark_crypto_primitives::{
3+
crh::CRHScheme,
4+
merkle_tree::{Config, LeafParam, Path, TwoToOneParam},
5+
};
6+
use ark_ff::PrimeField;
7+
use ark_serialize::{CanonicalDeserialize, CanonicalSerialize};
8+
#[cfg(not(feature = "std"))]
9+
use ark_std::vec::Vec;
10+
use ark_std::{marker::PhantomData, rand::RngCore};
11+
12+
#[derive(Derivative, CanonicalSerialize, CanonicalDeserialize)]
13+
#[derivative(Clone(bound = ""), Debug(bound = ""))]
14+
/// The public parameters for Ligero PCS.
15+
pub struct LigeroPCParams<F: PrimeField, C: Config, H: CRHScheme> {
16+
pub(crate) _field: PhantomData<F>,
17+
/// The security parameter
18+
pub(crate) sec_param: usize,
19+
/// The inverse of the code rate.
20+
pub(crate) rho_inv: usize,
21+
/// This is a flag which determines if the random linear combination is done.
22+
pub(crate) check_well_formedness: bool,
23+
/// Parameters for hash function of Merkle tree leaves
24+
#[derivative(Debug = "ignore")]
25+
pub(crate) leaf_hash_param: LeafParam<C>,
26+
/// Parameters for hash function of Merke tree combining two nodes into one
27+
#[derivative(Debug = "ignore")]
28+
pub(crate) two_to_one_hash_param: TwoToOneParam<C>,
29+
// Parameters for obtaining leaf digest from leaf value.
30+
#[derivative(Debug = "ignore")]
31+
pub(crate) col_hash_params: H::Parameters,
32+
}
33+
34+
#[derive(Derivative, CanonicalSerialize, CanonicalDeserialize)]
35+
#[derivative(Default(bound = ""), Clone(bound = ""), Debug(bound = ""))]
36+
pub(crate) struct Metadata {
37+
pub(crate) n_rows: usize,
38+
pub(crate) n_cols: usize,
39+
pub(crate) n_ext_cols: usize,
40+
}
41+
42+
/// The commitment to a polynomial is a root of the merkle tree,
43+
/// where each node is a hash of the column of the encoded coefficient matrix U.
44+
#[derive(Derivative, CanonicalSerialize, CanonicalDeserialize)]
45+
#[derivative(Default(bound = ""), Clone(bound = ""), Debug(bound = ""))]
46+
pub struct LinCodePCCommitment<C: Config> {
47+
// number of rows resp. columns of the square matrix containing the coefficients of the polynomial
48+
pub(crate) metadata: Metadata,
49+
pub(crate) root: C::InnerDigest,
50+
}
51+
52+
impl<C: Config> PCCommitment for LinCodePCCommitment<C> {
53+
fn empty() -> Self {
54+
LinCodePCCommitment::default()
55+
}
56+
57+
fn has_degree_bound(&self) -> bool {
58+
false
59+
}
60+
}
61+
62+
#[derive(Derivative, CanonicalSerialize, CanonicalDeserialize)]
63+
#[derivative(Default(bound = ""), Clone(bound = ""), Debug(bound = ""))]
64+
pub struct LinCodePCCommitmentState<F, H>
65+
where
66+
F: PrimeField,
67+
H: CRHScheme,
68+
{
69+
pub(crate) mat: Matrix<F>,
70+
pub(crate) ext_mat: Matrix<F>,
71+
pub(crate) leaves: Vec<H::Output>,
72+
}
73+
74+
impl<F, H> PCCommitmentState for LinCodePCCommitmentState<F, H>
75+
where
76+
F: PrimeField,
77+
H: CRHScheme,
78+
{
79+
type Randomness = ();
80+
fn empty() -> Self {
81+
unimplemented!()
82+
}
83+
84+
fn rand<R: RngCore>(
85+
_num_queries: usize,
86+
_has_degree_bound: bool,
87+
_num_vars: Option<usize>,
88+
_rng: &mut R,
89+
) -> Self::Randomness {
90+
unimplemented!()
91+
}
92+
}
93+
94+
/// Proof of an individual linear code well-formedness check or opening
95+
#[derive(Derivative, CanonicalSerialize, CanonicalDeserialize)]
96+
#[derivative(Default(bound = ""), Clone(bound = ""), Debug(bound = ""))]
97+
pub(crate) struct LinCodePCProofSingle<F, C>
98+
where
99+
F: PrimeField,
100+
C: Config,
101+
{
102+
/// For each of the indices in q, `paths` contains the path from the root of the merkle tree to the leaf
103+
pub(crate) paths: Vec<Path<C>>,
104+
105+
/// v, s.t. E(v) = w
106+
pub(crate) v: Vec<F>,
107+
108+
pub(crate) columns: Vec<Vec<F>>,
109+
}
110+
111+
/// The Proof type for linear code PCS, which amounts to an array of individual proofs
112+
#[derive(Derivative, CanonicalSerialize, CanonicalDeserialize)]
113+
#[derivative(Default(bound = ""), Clone(bound = ""), Debug(bound = ""))]
114+
pub struct LinCodePCProof<F, C>
115+
where
116+
F: PrimeField,
117+
C: Config,
118+
{
119+
pub(crate) opening: LinCodePCProofSingle<F, C>,
120+
pub(crate) well_formedness: Option<Vec<F>>,
121+
}
122+
123+
// Multiple poly at one point
124+
pub(crate) type LPCPArray<F, C> = Vec<LinCodePCProof<F, C>>;

0 commit comments

Comments
 (0)