Skip to content

Commit

Permalink
replace radix2 eval domain to mixed radix eval domain in ferveo
Browse files Browse the repository at this point in the history
  • Loading branch information
piotr-roslaniec committed Jun 26, 2023
1 parent af97093 commit 339bd63
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 10 deletions.
2 changes: 1 addition & 1 deletion ferveo/benches/benchmarks/eval_domain.rs
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ pub fn bench_eval_domain(c: &mut Criterion) {
for shares_num in NUM_SHARES_CASES {
let eval_radix2_eval_domain = {
let domain =
ark_poly::Radix2EvaluationDomain::new(shares_num).unwrap();
ark_poly::MixedRadixEvaluationDomain::new(shares_num).unwrap();
let phi = SecretPolynomial::<ark_bls12_381::Bls12_381>::new(
&s, shares_num, rng,
);
Expand Down
4 changes: 2 additions & 2 deletions ferveo/src/api.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
use std::io;

use ark_poly::{EvaluationDomain, Radix2EvaluationDomain};
use ark_poly::{EvaluationDomain, MixedRadixEvaluationDomain};
use ark_serialize::{CanonicalDeserialize, CanonicalSerialize};
use ark_std::UniformRand;
use bincode;
Expand Down Expand Up @@ -199,7 +199,7 @@ impl AggregatedTranscript {
messages: &[ValidatorMessage],
) -> Result<bool> {
let pvss_params = crate::pvss::PubliclyVerifiableParams::<E>::default();
let domain = Radix2EvaluationDomain::<Fr>::new(shares_num as usize)
let domain = MixedRadixEvaluationDomain::<Fr>::new(shares_num as usize)
.expect("Unable to construct an evaluation domain");

let is_valid_optimistic = self.0.verify_optimistic();
Expand Down
11 changes: 6 additions & 5 deletions ferveo/src/dkg.rs
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ pub struct PubliclyVerifiableDkg<E: Pairing> {
pub pvss_params: PubliclyVerifiableParams<E>,
pub validators: ValidatorsMap<E>,
pub vss: PVSSMap<E>,
pub domain: ark_poly::Radix2EvaluationDomain<E::ScalarField>,
pub domain: ark_poly::MixedRadixEvaluationDomain<E::ScalarField>,
pub me: DkgValidator<E>,
pub state: DkgState<E>,
}
Expand All @@ -84,10 +84,11 @@ impl<E: Pairing> PubliclyVerifiableDkg<E> {
dkg_params.shares_num,
));
}
let domain = ark_poly::Radix2EvaluationDomain::<E::ScalarField>::new(
dkg_params.shares_num as usize,
)
.expect("unable to construct domain");
let domain =
ark_poly::MixedRadixEvaluationDomain::<E::ScalarField>::new(
dkg_params.shares_num as usize,
)
.expect("unable to construct domain");

// Sort the validators to verify a global ordering
if !is_sorted(validators) {
Expand Down
4 changes: 2 additions & 2 deletions ferveo/src/pvss.rs
Original file line number Diff line number Diff line change
Expand Up @@ -224,7 +224,7 @@ pub fn do_verify_full<E: Pairing>(
pvss_encrypted_shares: &[E::G2Affine],
pvss_params: &PubliclyVerifiableParams<E>,
validators: &[Validator<E>],
domain: &ark_poly::Radix2EvaluationDomain<E::ScalarField>,
domain: &ark_poly::MixedRadixEvaluationDomain<E::ScalarField>,
) -> bool {
let mut commitment = batch_to_projective_g1::<E>(pvss_coefficients);
domain.fft_in_place(&mut commitment);
Expand Down Expand Up @@ -256,7 +256,7 @@ pub fn do_verify_aggregation<E: Pairing>(
pvss_agg_encrypted_shares: &[E::G2Affine],
pvss_params: &PubliclyVerifiableParams<E>,
validators: &[Validator<E>],
domain: &ark_poly::Radix2EvaluationDomain<E::ScalarField>,
domain: &ark_poly::MixedRadixEvaluationDomain<E::ScalarField>,
vss: &PVSSMap<E>,
) -> Result<bool> {
let is_valid = do_verify_full(
Expand Down

0 comments on commit 339bd63

Please sign in to comment.