-
Notifications
You must be signed in to change notification settings - Fork 33
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
4867d69
commit a6117bf
Showing
12 changed files
with
1,142 additions
and
2 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
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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 |
---|---|---|
|
@@ -20,7 +20,6 @@ members = [ | |
] | ||
resolver = "2" | ||
|
||
|
||
[workspace.dependencies] | ||
ark-std = "0.4" | ||
ark-bn254 = "0.4.0" | ||
|
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,114 @@ | ||
use std::{hint::black_box, ops::Mul}; | ||
|
||
use arith::{Field, FieldSerde, SimdField}; | ||
use ark_std::test_rng; | ||
use criterion::{criterion_group, criterion_main, BenchmarkId, Criterion}; | ||
use gf2::{GF2x128, GF2x8, GF2}; | ||
use gf2_128::GF2_128; | ||
use poly_commit::{OrionPublicParams, ORION_CODE_PARAMETER_INSTANCE}; | ||
use polynomials::MultiLinearPoly; | ||
use transcript::{BytesHashTranscript, Keccak256hasher, Transcript}; | ||
use tynm::type_name; | ||
|
||
fn committing_benchmark_helper<F, EvalF, ComPackF, OpenPackF, T>( | ||
c: &mut Criterion, | ||
lowest_num_vars: usize, | ||
highest_num_vars: usize, | ||
) where | ||
F: Field + FieldSerde, | ||
EvalF: Field + FieldSerde + From<F> + Mul<F, Output = EvalF>, | ||
ComPackF: SimdField<Scalar = F>, | ||
OpenPackF: SimdField<Scalar = F>, | ||
T: Transcript<EvalF>, | ||
{ | ||
let mut group = c.benchmark_group(format!( | ||
"Orion PCS committing benchmarking: F = {}, ComPackF = {}", | ||
type_name::<F>(), | ||
type_name::<ComPackF>(), | ||
)); | ||
|
||
let mut rng = test_rng(); | ||
|
||
for num_vars in lowest_num_vars..=highest_num_vars { | ||
let random_poly = MultiLinearPoly::<F>::random(num_vars, &mut rng); | ||
|
||
let orion_pp = | ||
OrionPublicParams::from_random::<F>(num_vars, ORION_CODE_PARAMETER_INSTANCE, &mut rng); | ||
|
||
group | ||
.bench_function( | ||
BenchmarkId::new(format!("{num_vars} variables"), num_vars), | ||
|b| b.iter(|| _ = black_box(orion_pp.commit::<F, ComPackF>(&random_poly).unwrap())), | ||
) | ||
.sample_size(10); | ||
} | ||
} | ||
|
||
fn orion_committing_benchmark(c: &mut Criterion) { | ||
committing_benchmark_helper::< | ||
GF2, | ||
GF2_128, | ||
GF2x128, | ||
GF2x8, | ||
BytesHashTranscript<_, Keccak256hasher>, | ||
>(c, 19, 30); | ||
} | ||
|
||
fn opening_benchmark_helper<F, EvalF, ComPackF, OpenPackF, T>( | ||
c: &mut Criterion, | ||
lowest_num_vars: usize, | ||
highest_num_vars: usize, | ||
) where | ||
F: Field + FieldSerde, | ||
EvalF: Field + FieldSerde + From<F> + Mul<F, Output = EvalF>, | ||
ComPackF: SimdField<Scalar = F>, | ||
OpenPackF: SimdField<Scalar = F>, | ||
T: Transcript<EvalF>, | ||
{ | ||
let mut group = c.benchmark_group(format!( | ||
"Orion PCS opening benchmarking: F = {}, EvalF = {}, ComPackF = {}", | ||
type_name::<F>(), | ||
type_name::<EvalF>(), | ||
type_name::<ComPackF>(), | ||
)); | ||
|
||
let mut rng = test_rng(); | ||
let mut transcript = T::new(); | ||
|
||
for num_vars in lowest_num_vars..=highest_num_vars { | ||
let random_poly = MultiLinearPoly::<F>::random(num_vars, &mut rng); | ||
let random_point: Vec<_> = (0..num_vars) | ||
.map(|_| EvalF::random_unsafe(&mut rng)) | ||
.collect(); | ||
|
||
let orion_pp = | ||
OrionPublicParams::from_random::<F>(num_vars, ORION_CODE_PARAMETER_INSTANCE, &mut rng); | ||
|
||
let commitment_with_data = orion_pp.commit::<F, ComPackF>(&random_poly).unwrap(); | ||
|
||
group | ||
.bench_function( | ||
BenchmarkId::new(format!("{num_vars} variables"), num_vars), | ||
|b| { | ||
b.iter(|| { | ||
_ = black_box(orion_pp.open::<F, EvalF, ComPackF, OpenPackF, T>( | ||
&random_poly, | ||
&commitment_with_data, | ||
&random_point, | ||
&mut transcript, | ||
)) | ||
}) | ||
}, | ||
) | ||
.sample_size(10); | ||
} | ||
} | ||
|
||
fn orion_opening_benchmark(c: &mut Criterion) { | ||
opening_benchmark_helper::<GF2, GF2_128, GF2x128, GF2x8, BytesHashTranscript<_, Keccak256hasher>>( | ||
c, 19, 30, | ||
); | ||
} | ||
|
||
criterion_group!(bench, orion_committing_benchmark, orion_opening_benchmark); | ||
criterion_main!(bench); |
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,11 @@ | ||
mod utils; | ||
pub use utils::{OrionPCSError, OrionResult, SubsetSumLUTs}; | ||
|
||
mod linear_code; | ||
pub use linear_code::{OrionCodeParameter, ORION_CODE_PARAMETER_INSTANCE}; | ||
|
||
mod pcs_impl; | ||
pub use pcs_impl::{OrionCommitment, OrionCommitmentWithData, OrionProof, OrionPublicParams}; | ||
|
||
#[cfg(test)] | ||
mod tests; |
Oops, something went wrong.