diff --git a/ferveo/src/lib.rs b/ferveo/src/lib.rs index a6b1703d..b5cbc990 100644 --- a/ferveo/src/lib.rs +++ b/ferveo/src/lib.rs @@ -499,7 +499,7 @@ mod test_dkg_full { // Now, we're going to refresh the shares and check that the shared secret is the same // Dealer computes a new random polynomial with constant term x_r = 0 - let polynomial = make_random_polynomial_at::( + let polynomial = make_random_polynomial_with_root::( dkg.dkg_params.security_threshold as usize, &Fr::zero(), rng, diff --git a/ferveo/src/refresh.rs b/ferveo/src/refresh.rs index 9493f8af..dc104e54 100644 --- a/ferveo/src/refresh.rs +++ b/ferveo/src/refresh.rs @@ -61,7 +61,7 @@ pub fn recover_share_from_updated_private_shares( } } -pub fn make_random_polynomial_at( +pub fn make_random_polynomial_with_root( threshold: usize, root: &E::ScalarField, rng: &mut impl RngCore, @@ -78,6 +78,7 @@ pub fn make_random_polynomial_at( let d_i_0 = E::ScalarField::zero() - threshold_poly.evaluate(root); threshold_poly[0] = d_i_0; + // Evaluating the polynomial at the root should result in 0 debug_assert!(threshold_poly.evaluate(root) == E::ScalarField::zero()); debug_assert!(threshold_poly.coeffs.len() == threshold); @@ -120,7 +121,7 @@ mod tests_refresh { type ScalarField = ::ScalarField; use crate::{ - make_random_polynomial_at, prepare_share_updates_for_recovery, + make_random_polynomial_with_root, prepare_share_updates_for_recovery, recover_share_from_updated_private_shares, refresh_private_key_share, update_share_for_recovery, }; @@ -359,7 +360,7 @@ mod tests_refresh { // Now, we're going to refresh the shares and check that the shared secret is the same // Dealer computes a new random polynomial with constant term x_r - let polynomial = make_random_polynomial_at::( + let polynomial = make_random_polynomial_with_root::( threshold, &ScalarField::zero(), rng, diff --git a/tpke/benches/arkworks.rs b/tpke/benches/arkworks.rs index a1f6a50f..957f5fc4 100644 --- a/tpke/benches/arkworks.rs +++ b/tpke/benches/arkworks.rs @@ -14,7 +14,7 @@ use ark_ff::{BigInteger256, Field, One, UniformRand, Zero}; use criterion::{ black_box, criterion_group, criterion_main, BenchmarkId, Criterion, }; -use group_threshold_cryptography_pre_release::make_random_polynomial_at; +use group_threshold_cryptography_pre_release::make_random_polynomial_with_root; use itertools::izip; use rand::prelude::StdRng; use rand_core::{RngCore, SeedableRng}; @@ -219,7 +219,7 @@ pub fn bench_random_poly(c: &mut Criterion) { result } - pub fn naive_make_random_polynomial_at( + pub fn naive_make_random_polynomial_with_root( threshold: usize, root: &Fr, rng: &mut impl RngCore, @@ -248,7 +248,7 @@ pub fn bench_random_poly(c: &mut Criterion) { let mut ark = { let mut rng = rng.clone(); move || { - black_box(make_random_polynomial_at::( + black_box(make_random_polynomial_with_root::( threshold, &Fr::zero(), &mut rng, @@ -258,7 +258,7 @@ pub fn bench_random_poly(c: &mut Criterion) { let mut naive = { let mut rng = rng.clone(); move || { - black_box(naive_make_random_polynomial_at::( + black_box(naive_make_random_polynomial_with_root::( threshold, &Fr::zero(), &mut rng, diff --git a/tpke/benches/tpke.rs b/tpke/benches/tpke.rs index c6ad85ae..69ddb848 100644 --- a/tpke/benches/tpke.rs +++ b/tpke/benches/tpke.rs @@ -552,7 +552,7 @@ pub fn bench_refresh_shares(c: &mut Criterion) { let setup = SetupSimple::new(shares_num, msg_size, rng); let threshold = setup.shared.threshold; let polynomial = - make_random_polynomial_at::(threshold, &Fr::zero(), rng); + make_random_polynomial_with_root::(threshold, &Fr::zero(), rng); let p = setup.contexts[0].clone(); group.bench_function( BenchmarkId::new("refresh_private_key_share", shares_num),