From a25a527c5eab67363f588632d894cfe86e456a42 Mon Sep 17 00:00:00 2001 From: Piotr Roslaniec Date: Mon, 26 Feb 2024 17:37:20 +0100 Subject: [PATCH] feature: remove deprecated exceptions --- ferveo-python/ferveo/__init__.py | 4 ---- ferveo-python/ferveo/__init__.pyi | 21 --------------------- ferveo/src/bindings_python.rs | 22 ---------------------- ferveo/src/lib.rs | 30 ------------------------------ 4 files changed, 77 deletions(-) diff --git a/ferveo-python/ferveo/__init__.py b/ferveo-python/ferveo/__init__.py index 209741b2..7f63fa66 100644 --- a/ferveo-python/ferveo/__init__.py +++ b/ferveo-python/ferveo/__init__.py @@ -18,10 +18,6 @@ ValidatorMessage, FerveoVariant, ThresholdEncryptionError, - InvalidDkgStateToDeal, - InvalidDkgStateToAggregate, - InvalidDkgStateToVerify, - InvalidDkgStateToIngest, DealerNotInValidatorSet, UnknownDealer, DuplicateDealer, diff --git a/ferveo-python/ferveo/__init__.pyi b/ferveo-python/ferveo/__init__.pyi index e738f2ab..69c77488 100644 --- a/ferveo-python/ferveo/__init__.pyi +++ b/ferveo-python/ferveo/__init__.pyi @@ -158,18 +158,6 @@ def decrypt_with_shared_secret( class ThresholdEncryptionError(Exception): pass -class InvalidDkgStateToDeal(Exception): - pass - -class InvalidDkgStateToAggregate(Exception): - pass - -class InvalidDkgStateToVerify(Exception): - pass - -class InvalidDkgStateToIngest(Exception): - pass - class DealerNotInValidatorSet(Exception): pass @@ -182,12 +170,6 @@ class DuplicateDealer(Exception): class InvalidPvssTranscript(Exception): pass -class InsufficientTranscriptsForAggregate(Exception): - pass - -class InvalidDkgPublicKey(Exception): - pass - class InsufficientValidators(Exception): pass @@ -221,9 +203,6 @@ class NoTranscriptsToAggregate(Exception): class InvalidAggregateVerificationParameters(Exception): pass -class UnknownValidator(Exception): - pass - class TooManyTranscripts(Exception): pass diff --git a/ferveo/src/bindings_python.rs b/ferveo/src/bindings_python.rs index 8505ae42..ecdb9e56 100644 --- a/ferveo/src/bindings_python.rs +++ b/ferveo/src/bindings_python.rs @@ -37,18 +37,6 @@ impl From for PyErr { Error::ThresholdEncryptionError(err) => { ThresholdEncryptionError::new_err(err.to_string()) } - Error::InvalidDkgStateToDeal => { - InvalidDkgStateToDeal::new_err("") - } - Error::InvalidDkgStateToAggregate => { - InvalidDkgStateToAggregate::new_err("") - } - Error::InvalidDkgStateToVerify => { - InvalidDkgStateToVerify::new_err("") - } - Error::InvalidDkgStateToIngest => { - InvalidDkgStateToIngest::new_err("") - } Error::DealerNotInValidatorSet(dealer) => { DealerNotInValidatorSet::new_err(dealer.to_string()) } @@ -61,13 +49,6 @@ impl From for PyErr { Error::InvalidPvssTranscript(validator_addr) => { InvalidPvssTranscript::new_err(validator_addr.to_string()) } - Error::InsufficientTranscriptsForAggregate( - expected, - actual, - ) => InsufficientTranscriptsForAggregate::new_err(format!( - "expected: {expected}, actual: {actual}" - )), - Error::InvalidDkgPublicKey => InvalidDkgPublicKey::new_err(""), Error::InsufficientValidators(expected, actual) => { InsufficientValidators::new_err(format!( "expected: {expected}, actual: {actual}" @@ -121,9 +102,6 @@ impl From for PyErr { "validators_num: {validators_num}, messages_num: {messages_num}" )) }, - Error::UnknownValidator(validator) => { - UnknownValidator::new_err(validator.to_string()) - }, Error::TooManyTranscripts(expected, received) => { TooManyTranscripts::new_err(format!( "expected: {expected}, received: {received}" diff --git a/ferveo/src/lib.rs b/ferveo/src/lib.rs index 9a43b1f2..832f0564 100644 --- a/ferveo/src/lib.rs +++ b/ferveo/src/lib.rs @@ -30,22 +30,6 @@ pub enum Error { #[error(transparent)] ThresholdEncryptionError(#[from] ferveo_tdec::Error), - /// DKG is not in a valid state to deal PVSS shares - #[error("Invalid DKG state to deal PVSS shares")] - InvalidDkgStateToDeal, - - /// DKG is not in a valid state to aggregate PVSS transcripts - #[error("Invalid DKG state to aggregate PVSS transcripts")] - InvalidDkgStateToAggregate, - - /// DKG is not in a valid state to verify PVSS transcripts - #[error("Invalid DKG state to verify PVSS transcripts")] - InvalidDkgStateToVerify, - - /// DKG is not in a valid state to ingest PVSS transcripts - #[error("Invalid DKG state to ingest PVSS transcripts")] - InvalidDkgStateToIngest, - /// DKG validator set must contain the validator with the given address #[error("Expected validator to be a part of the DKG validator set: {0}")] DealerNotInValidatorSet(EthereumAddress), @@ -62,16 +46,6 @@ pub enum Error { #[error("DKG received an invalid transcript from validator: {0}")] InvalidPvssTranscript(EthereumAddress), - /// Aggregation failed because the DKG did not receive enough PVSS transcripts - #[error( - "Insufficient transcripts for aggregation (expected {0}, got {1})" - )] - InsufficientTranscriptsForAggregate(u32, u32), - - /// Failed to derive a valid final key for the DKG - #[error("Failed to derive a valid final key for the DKG")] - InvalidDkgPublicKey, - /// Not enough validators to perform the DKG for a given number of shares #[error("Not enough validators (expected {0}, got {1})")] InsufficientValidators(u32, u32), @@ -122,10 +96,6 @@ pub enum Error { #[error("Invalid aggregate verification parameters: number of validators {0}, number of messages: {1}")] InvalidAggregateVerificationParameters(u32, u32), - /// Validator not found in the DKG set of validators - #[error("Validator not found: {0}")] - UnknownValidator(EthereumAddress), - /// Too many transcripts received by the DKG #[error("Too many transcripts. Expected: {0}, got: {1}")] TooManyTranscripts(u32, u32),