diff --git a/ferveo-python/ferveo/__init__.py b/ferveo-python/ferveo/__init__.py index fbaab504..3f0b872e 100644 --- a/ferveo-python/ferveo/__init__.py +++ b/ferveo-python/ferveo/__init__.py @@ -16,7 +16,6 @@ SharedSecret, ValidatorMessage, ThresholdEncryptionError, - InvalidShareNumberParameter, InvalidDkgStateToDeal, InvalidDkgStateToAggregate, InvalidDkgStateToVerify, diff --git a/ferveo-python/ferveo/__init__.pyi b/ferveo-python/ferveo/__init__.pyi index b648301e..0dff36ae 100644 --- a/ferveo-python/ferveo/__init__.pyi +++ b/ferveo-python/ferveo/__init__.pyi @@ -201,10 +201,6 @@ class ThresholdEncryptionError(Exception): pass -class InvalidShareNumberParameter(Exception): - pass - - class InvalidDkgStateToDeal(Exception): pass diff --git a/ferveo/src/bindings_python.rs b/ferveo/src/bindings_python.rs index 614b3608..3bf8f219 100644 --- a/ferveo/src/bindings_python.rs +++ b/ferveo/src/bindings_python.rs @@ -34,9 +34,6 @@ impl From for PyErr { Error::ThresholdEncryptionError(err) => { ThresholdEncryptionError::new_err(err.to_string()) } - Error::InvalidShareNumberParameter(actual) => { - InvalidShareNumberParameter::new_err(actual.to_string()) - } Error::InvalidDkgStateToDeal => { InvalidDkgStateToDeal::new_err("") } @@ -111,7 +108,6 @@ impl Debug for FerveoPythonError { } create_exception!(exceptions, ThresholdEncryptionError, PyException); -create_exception!(exceptions, InvalidShareNumberParameter, PyValueError); create_exception!(exceptions, InvalidDkgStateToDeal, PyRuntimeError); create_exception!(exceptions, InvalidDkgStateToAggregate, PyRuntimeError); create_exception!(exceptions, InvalidDkgStateToVerify, PyRuntimeError); @@ -596,10 +592,6 @@ pub fn make_ferveo_py_module(py: Python<'_>, m: &PyModule) -> PyResult<()> { "ThresholdEncryptionError", py.get_type::(), )?; - m.add( - "InvalidShareNumberParameter", - py.get_type::(), - )?; m.add( "InvalidDkgStateToDeal", py.get_type::(), diff --git a/ferveo/src/dkg.rs b/ferveo/src/dkg.rs index 9607718f..666e68df 100644 --- a/ferveo/src/dkg.rs +++ b/ferveo/src/dkg.rs @@ -9,10 +9,8 @@ use serde::{de::DeserializeOwned, Deserialize, Serialize}; use serde_with::serde_as; use crate::{ - aggregate, - utils::{is_power_of_2, is_sorted}, - AggregatedPvss, Error, EthereumAddress, PubliclyVerifiableParams, - PubliclyVerifiableSS, Pvss, Result, Validator, + aggregate, utils::is_sorted, AggregatedPvss, Error, EthereumAddress, + PubliclyVerifiableParams, PubliclyVerifiableSS, Pvss, Result, Validator, }; #[derive(Copy, Clone, Debug, Serialize, Deserialize)] @@ -78,12 +76,6 @@ impl PubliclyVerifiableDkg { dkg_params: &DkgParams, me: &Validator, ) -> Result { - // Make sure that the number of shares is a power of 2 for the FFT to work (Radix-2 FFT domain is being used) - if !is_power_of_2(dkg_params.shares_num) { - return Err(Error::InvalidShareNumberParameter( - dkg_params.shares_num, - )); - } let domain = ark_poly::MixedRadixEvaluationDomain::::new( dkg_params.shares_num as usize, diff --git a/ferveo/src/lib.rs b/ferveo/src/lib.rs index 7e1b3657..c520b3f3 100644 --- a/ferveo/src/lib.rs +++ b/ferveo/src/lib.rs @@ -31,10 +31,6 @@ pub enum Error { #[error(transparent)] ThresholdEncryptionError(#[from] tpke::Error), - /// Number of shares parameter must be a power of two - #[error("Number of shares parameter must be a power of two. Got {0}")] - InvalidShareNumberParameter(u32), - /// DKG is not in a valid state to deal PVSS shares #[error("Invalid DKG state to deal PVSS shares")] InvalidDkgStateToDeal, diff --git a/ferveo/src/utils.rs b/ferveo/src/utils.rs index 62277430..b8b67b10 100644 --- a/ferveo/src/utils.rs +++ b/ferveo/src/utils.rs @@ -1,7 +1,3 @@ -pub fn is_power_of_2(n: u32) -> bool { - n != 0 && (n & (n - 1)) == 0 -} - pub fn is_sorted(data: I) -> bool where I: IntoIterator,