Skip to content

Commit

Permalink
Merge pull request #134 from piotr-roslaniec/remove-ftt-opt
Browse files Browse the repository at this point in the history
  • Loading branch information
piotr-roslaniec committed Jul 6, 2023
2 parents e24d2cf + 2c20efb commit 2338213
Show file tree
Hide file tree
Showing 15 changed files with 363 additions and 295 deletions.
1 change: 0 additions & 1 deletion ferveo-python/ferveo/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@
ValidatorMessage,
FerveoVariant,
ThresholdEncryptionError,
InvalidShareNumberParameter,
InvalidDkgStateToDeal,
InvalidDkgStateToAggregate,
InvalidDkgStateToVerify,
Expand Down
4 changes: 0 additions & 4 deletions ferveo-python/ferveo/__init__.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -209,10 +209,6 @@ class ThresholdEncryptionError(Exception):
pass


class InvalidShareNumberParameter(Exception):
pass


class InvalidDkgStateToDeal(Exception):
pass

Expand Down
1 change: 1 addition & 0 deletions ferveo/benches/bench_main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,4 +7,5 @@ criterion_main! {
// bench_batch_inverse,
// benchmarks::pairing::ec,
benchmarks::validity_checks::validity_checks,
benchmarks::eval_domain::eval_domain,
}
57 changes: 57 additions & 0 deletions ferveo/benches/benchmarks/eval_domain.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
#![allow(clippy::redundant_closure)]
#![allow(clippy::unit_arg)]

pub use ark_bls12_381::Bls12_381 as EllipticCurve;
use ark_ff::Field;
use ark_poly::EvaluationDomain;
use criterion::{black_box, criterion_group, BenchmarkId, Criterion};
use digest::crypto_common::rand_core::SeedableRng;
use ferveo_pre_release::*;
use rand::prelude::StdRng;

const NUM_SHARES_CASES: [usize; 6] = [2, 4, 8, 16, 32, 64];

pub fn bench_eval_domain(c: &mut Criterion) {
let mut group = c.benchmark_group("EVAL DOMAIN");
group.sample_size(10);

let rng = &mut StdRng::seed_from_u64(0);
let s = ark_bls12_381::Fr::from_random_bytes(&[0u8; 32]).unwrap();

for shares_num in NUM_SHARES_CASES {
let eval_radix2_eval_domain = {
let domain =
ark_poly::GeneralEvaluationDomain::new(shares_num).unwrap();
let phi = SecretPolynomial::<ark_bls12_381::Bls12_381>::new(
&s, shares_num, rng,
);

move || {
black_box(phi.0.evaluate_over_domain_by_ref(domain));
}
};

let eval_mixed_eval_domain = {
let domain =
ark_poly::GeneralEvaluationDomain::new(shares_num).unwrap();
let phi = SecretPolynomial::<ark_bls12_381::Bls12_381>::new(
&s, shares_num, rng,
);

move || {
black_box(phi.0.evaluate_over_domain_by_ref(domain));
}
};

group.bench_function(
BenchmarkId::new("eval_radix2_eval_domain", shares_num),
|b| b.iter(|| eval_radix2_eval_domain()),
);
group.bench_function(
BenchmarkId::new("eval_mixed_eval_domain", shares_num),
|b| b.iter(|| eval_mixed_eval_domain()),
);
}
}

criterion_group!(eval_domain, bench_eval_domain);
1 change: 1 addition & 0 deletions ferveo/benches/benchmarks/mod.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
//pub mod block_proposer;
// pub mod pairing;
pub mod eval_domain;
pub mod validity_checks;
Loading

0 comments on commit 2338213

Please sign in to comment.