From 2c20efb59d7d1075d6b1413b2ae7fbb55c422143 Mon Sep 17 00:00:00 2001
From: Piotr Roslaniec
Date: Thu, 6 Jul 2023 13:46:07 +0200
Subject: [PATCH] use general evaluation domain
---
ferveo/benches/benchmarks/eval_domain.rs | 4 ++--
ferveo/src/api.rs | 4 ++--
ferveo/src/dkg.rs | 11 +++++------
ferveo/src/pvss.rs | 4 ++--
subproductdomain/src/lib.rs | 4 ++--
tpke/src/combine.rs | 5 ++---
tpke/src/lib.rs | 8 ++++----
7 files changed, 19 insertions(+), 21 deletions(-)
diff --git a/ferveo/benches/benchmarks/eval_domain.rs b/ferveo/benches/benchmarks/eval_domain.rs
index 6a583f16..23cd8065 100644
--- a/ferveo/benches/benchmarks/eval_domain.rs
+++ b/ferveo/benches/benchmarks/eval_domain.rs
@@ -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::MixedRadixEvaluationDomain::new(shares_num).unwrap();
+ ark_poly::GeneralEvaluationDomain::new(shares_num).unwrap();
let phi = SecretPolynomial::::new(
&s, shares_num, rng,
);
@@ -33,7 +33,7 @@ pub fn bench_eval_domain(c: &mut Criterion) {
let eval_mixed_eval_domain = {
let domain =
- ark_poly::MixedRadixEvaluationDomain::new(shares_num).unwrap();
+ ark_poly::GeneralEvaluationDomain::new(shares_num).unwrap();
let phi = SecretPolynomial::::new(
&s, shares_num, rng,
);
diff --git a/ferveo/src/api.rs b/ferveo/src/api.rs
index 8f5ebe87..77db4870 100644
--- a/ferveo/src/api.rs
+++ b/ferveo/src/api.rs
@@ -1,6 +1,6 @@
use std::io;
-use ark_poly::{EvaluationDomain, MixedRadixEvaluationDomain};
+use ark_poly::{EvaluationDomain, GeneralEvaluationDomain};
use ark_serialize::{CanonicalDeserialize, CanonicalSerialize};
use ark_std::UniformRand;
use bincode;
@@ -204,7 +204,7 @@ impl AggregatedTranscript {
messages: &[ValidatorMessage],
) -> Result {
let pvss_params = PubliclyVerifiableParams::::default();
- let domain = MixedRadixEvaluationDomain::::new(shares_num as usize)
+ let domain = GeneralEvaluationDomain::::new(shares_num as usize)
.expect("Unable to construct an evaluation domain");
let is_valid_optimistic = self.0.verify_optimistic();
diff --git a/ferveo/src/dkg.rs b/ferveo/src/dkg.rs
index 666e68df..07dee015 100644
--- a/ferveo/src/dkg.rs
+++ b/ferveo/src/dkg.rs
@@ -59,7 +59,7 @@ pub struct PubliclyVerifiableDkg {
pub pvss_params: PubliclyVerifiableParams,
pub validators: ValidatorsMap,
pub vss: PVSSMap,
- pub domain: ark_poly::MixedRadixEvaluationDomain,
+ pub domain: ark_poly::GeneralEvaluationDomain,
pub me: DkgValidator,
pub state: DkgState,
}
@@ -76,11 +76,10 @@ impl PubliclyVerifiableDkg {
dkg_params: &DkgParams,
me: &Validator,
) -> Result {
- let domain =
- ark_poly::MixedRadixEvaluationDomain::::new(
- dkg_params.shares_num as usize,
- )
- .expect("unable to construct domain");
+ let domain = ark_poly::GeneralEvaluationDomain::::new(
+ dkg_params.shares_num as usize,
+ )
+ .expect("unable to construct domain");
// Sort the validators to verify a global ordering
if !is_sorted(validators) {
diff --git a/ferveo/src/pvss.rs b/ferveo/src/pvss.rs
index cfc47925..0d6433fd 100644
--- a/ferveo/src/pvss.rs
+++ b/ferveo/src/pvss.rs
@@ -224,7 +224,7 @@ pub fn do_verify_full(
pvss_encrypted_shares: &[E::G2Affine],
pvss_params: &PubliclyVerifiableParams,
validators: &[Validator],
- domain: &ark_poly::MixedRadixEvaluationDomain,
+ domain: &ark_poly::GeneralEvaluationDomain,
) -> bool {
let mut commitment = batch_to_projective_g1::(pvss_coefficients);
domain.fft_in_place(&mut commitment);
@@ -256,7 +256,7 @@ pub fn do_verify_aggregation(
pvss_agg_encrypted_shares: &[E::G2Affine],
pvss_params: &PubliclyVerifiableParams,
validators: &[Validator],
- domain: &ark_poly::MixedRadixEvaluationDomain,
+ domain: &ark_poly::GeneralEvaluationDomain,
vss: &PVSSMap,
) -> Result {
let is_valid = do_verify_full(
diff --git a/subproductdomain/src/lib.rs b/subproductdomain/src/lib.rs
index d1bc5fd0..4fa52900 100644
--- a/subproductdomain/src/lib.rs
+++ b/subproductdomain/src/lib.rs
@@ -9,7 +9,7 @@ use ark_ec::{
use ark_ff::{FftField, Field, Zero};
use ark_poly::{
univariate::DensePolynomial, DenseUVPolynomial, EvaluationDomain,
- MixedRadixEvaluationDomain, Polynomial,
+ GeneralEvaluationDomain, Polynomial,
};
/// Compute a fast multiexp of many scalars times the same base
@@ -342,7 +342,7 @@ pub fn toeplitz_mul(
let m = polynomial.coeffs.len() - 1;
let size = ark_std::cmp::max(size, m);
- let domain = MixedRadixEvaluationDomain::::new(2 * size)
+ let domain = GeneralEvaluationDomain::::new(2 * size)
.ok_or_else(|| {
anyhow::anyhow!("toeplitz multiplication on too large a domain")
})?;
diff --git a/tpke/src/combine.rs b/tpke/src/combine.rs
index dced0df5..a46477fb 100644
--- a/tpke/src/combine.rs
+++ b/tpke/src/combine.rs
@@ -161,14 +161,13 @@ mod tests {
use ark_poly::EvaluationDomain;
use ark_std::One;
let fft_domain =
- ark_poly::MixedRadixEvaluationDomain::::new(500)
- .unwrap();
+ ark_poly::GeneralEvaluationDomain::::new(500).unwrap();
let mut domain = Vec::with_capacity(500);
let mut point = ScalarField::one();
for _ in 0..500 {
domain.push(point);
- point *= fft_domain.group_gen;
+ point *= fft_domain.group_gen();
}
let mut lagrange_n_0 = domain.iter().product::();
diff --git a/tpke/src/lib.rs b/tpke/src/lib.rs
index fcd35e9a..651935ae 100644
--- a/tpke/src/lib.rs
+++ b/tpke/src/lib.rs
@@ -94,7 +94,7 @@ pub mod test_common {
DensePolynomial::::rand(threshold - 1, rng);
// Domain, or omega Ω
let fft_domain =
- ark_poly::MixedRadixEvaluationDomain::::new(
+ ark_poly::GeneralEvaluationDomain::::new(
shares_num,
)
.unwrap();
@@ -123,9 +123,9 @@ pub mod test_common {
for _ in 0..shares_num {
domain_points.push(point); // 1, t, t^2, t^3, ...; where t is a scalar generator fft_domain.group_gen
- point *= fft_domain.group_gen;
+ point *= fft_domain.group_gen();
domain_points_inv.push(point_inv);
- point_inv *= fft_domain.group_gen_inv;
+ point_inv *= fft_domain.group_gen_inv();
}
let mut private_contexts = vec![];
@@ -195,7 +195,7 @@ pub mod test_common {
DensePolynomial::::rand(threshold - 1, rng);
// Domain, or omega Ω
let fft_domain =
- ark_poly::MixedRadixEvaluationDomain::::new(
+ ark_poly::GeneralEvaluationDomain::::new(
shares_num,
)
.unwrap();