-
Notifications
You must be signed in to change notification settings - Fork 130
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'ligero-uni-and-ml' into brakedown
- Loading branch information
Showing
50 changed files
with
2,582 additions
and
527 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
use ark_pcs_bench_templates::*; | ||
use ark_poly::{DenseMultilinearExtension, MultilinearExtension}; | ||
|
||
use ark_bn254::{Fr, G1Affine}; | ||
use ark_ff::PrimeField; | ||
use ark_poly_commit::hyrax::HyraxPC; | ||
|
||
use rand_chacha::ChaCha20Rng; | ||
|
||
// Hyrax PCS over BN254 | ||
type Hyrax254 = HyraxPC<G1Affine, DenseMultilinearExtension<Fr>>; | ||
|
||
fn rand_poly_hyrax<F: PrimeField>( | ||
num_vars: usize, | ||
rng: &mut ChaCha20Rng, | ||
) -> DenseMultilinearExtension<F> { | ||
DenseMultilinearExtension::rand(num_vars, rng) | ||
} | ||
|
||
fn rand_point_hyrax<F: PrimeField>(num_vars: usize, rng: &mut ChaCha20Rng) -> Vec<F> { | ||
(0..num_vars).map(|_| F::rand(rng)).collect() | ||
} | ||
|
||
const MIN_NUM_VARS: usize = 12; | ||
const MAX_NUM_VARS: usize = 22; | ||
|
||
bench!(Hyrax254, rand_poly_hyrax, rand_point_hyrax); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
use ark_crypto_primitives::{ | ||
crh::{sha256::Sha256, CRHScheme, TwoToOneCRHScheme}, | ||
merkle_tree::{ByteDigestConverter, Config}, | ||
}; | ||
use ark_pcs_bench_templates::*; | ||
use ark_poly::{DenseMultilinearExtension, MultilinearExtension}; | ||
|
||
use ark_bn254::Fr; | ||
use ark_ff::PrimeField; | ||
|
||
use ark_poly_commit::linear_codes::{LinearCodePCS, MultilinearLigero}; | ||
use blake2::Blake2s256; | ||
use rand_chacha::ChaCha20Rng; | ||
|
||
// Ligero PCS over BN254 | ||
struct MerkleTreeParams; | ||
type LeafH = LeafIdentityHasher; | ||
type CompressH = Sha256; | ||
impl Config for MerkleTreeParams { | ||
type Leaf = Vec<u8>; | ||
|
||
type LeafDigest = <LeafH as CRHScheme>::Output; | ||
type LeafInnerDigestConverter = ByteDigestConverter<Self::LeafDigest>; | ||
type InnerDigest = <CompressH as TwoToOneCRHScheme>::Output; | ||
|
||
type LeafHash = LeafH; | ||
type TwoToOneHash = CompressH; | ||
} | ||
|
||
pub type MLE<F> = DenseMultilinearExtension<F>; | ||
type MTConfig = MerkleTreeParams; | ||
type ColHasher<F> = FieldToBytesColHasher<F, Blake2s256>; | ||
type Ligero<F> = LinearCodePCS< | ||
MultilinearLigero<F, MTConfig, MLE<F>, ColHasher<F>>, | ||
F, | ||
MLE<F>, | ||
MTConfig, | ||
ColHasher<F>, | ||
>; | ||
|
||
fn rand_poly_ligero_ml<F: PrimeField>( | ||
num_vars: usize, | ||
rng: &mut ChaCha20Rng, | ||
) -> DenseMultilinearExtension<F> { | ||
DenseMultilinearExtension::rand(num_vars, rng) | ||
} | ||
|
||
fn rand_point_ligero_ml<F: PrimeField>(num_vars: usize, rng: &mut ChaCha20Rng) -> Vec<F> { | ||
(0..num_vars).map(|_| F::rand(rng)).collect() | ||
} | ||
|
||
const MIN_NUM_VARS: usize = 12; | ||
const MAX_NUM_VARS: usize = 22; | ||
|
||
bench!(Ligero<Fr>, rand_poly_ligero_ml, rand_point_ligero_ml); |
Oops, something went wrong.