Skip to content

Commit f8cf4f3

Browse files
committed
remove unused error enums
1 parent d9f6182 commit f8cf4f3

File tree

6 files changed

+18
-67
lines changed

6 files changed

+18
-67
lines changed

mithril-stm/README.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -141,13 +141,13 @@ match msig {
141141
println!("Not enough signatures");
142142
assert!(n < &params.k && k == &params.k)
143143
},
144-
Some(AggregationError::UsizeConversionInvalid) => {
145-
println!("Invalid usize conversion");
146-
},
144+
// Some(AggregationError::UsizeConversionInvalid) => {
145+
// println!("Invalid usize conversion");
146+
// },
147147
Some(AggregationError::UnsupportedProofSystem(aggregate_signature_type)) => {
148148
println!("Unsupported proof system: {:?}", aggregate_signature_type);
149149
},
150-
None => {
150+
_ => {
151151
println!("Unexpected error during aggregation: {:?}", error);
152152
}
153153
},

mithril-stm/src/aggregate_signature/basic_verifier.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,8 @@ use crate::bls_multi_signature::{BlsSignature, BlsVerificationKey};
55
use crate::key_registration::RegisteredParty;
66
use crate::merkle_tree::MerkleTreeLeaf;
77
use crate::{
8-
AggregationError, CoreVerifierError, Index, Parameters, SingleSignature,
9-
SingleSignatureWithRegisteredParty, Stake, StmResult,
8+
AggregationError, Index, Parameters, SingleSignature, SingleSignatureWithRegisteredParty,
9+
Stake, StmResult,
1010
};
1111

1212
/// Full node verifier including the list of eligible signers and the total stake of the system.
@@ -73,10 +73,10 @@ impl BasicVerifier {
7373
}
7474

7575
if nr_indices != unique_indices.len() {
76-
return Err(anyhow!(CoreVerifierError::IndexNotUnique));
76+
return Err(anyhow!(AggregationError::IndexNotUnique));
7777
}
7878
if (nr_indices as u64) < parameters.k {
79-
return Err(anyhow!(CoreVerifierError::NoQuorum(
79+
return Err(anyhow!(AggregationError::NotEnoughSignatures(
8080
nr_indices as u64,
8181
parameters.k
8282
)));

mithril-stm/src/aggregate_signature/mod.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -267,13 +267,13 @@ mod tests {
267267
println!("Not enough signatures");
268268
assert!(n < &params.k && k == &params.k)
269269
},
270-
Some(AggregationError::UsizeConversionInvalid) => {
271-
println!("Invalid usize conversion");
272-
},
270+
// Some(AggregationError::UsizeConversionInvalid) => {
271+
// println!("Invalid usize conversion");
272+
// },
273273
Some(AggregationError::UnsupportedProofSystem(aggregate_signature_type)) => {
274274
println!("Unsupported proof system: {:?}", aggregate_signature_type);
275275
},
276-
None => {
276+
_ => {
277277
println!("Unexpected error during aggregation: {:?}", error);
278278
}
279279
},

mithril-stm/src/error.rs

Lines changed: 0 additions & 49 deletions
Original file line numberDiff line numberDiff line change
@@ -63,22 +63,10 @@ pub enum StmSignatureError {
6363
#[error("Received index, {0}, is higher than what the security parameter allows, {1}.")]
6464
IndexBoundFailed(u64, u64),
6565

66-
/// MSP.Eval was computed incorrectly
67-
#[error("The claimed evaluation of function phi is incorrect.")]
68-
EvalInvalid([u8; 64]),
69-
7066
/// The lottery was actually lost for the signature
7167
#[error("Lottery for this epoch was lost.")]
7268
LotteryLost,
7369

74-
/// A party submitted an invalid signature
75-
#[error("A provided signature is invalid")]
76-
SignatureInvalid(BlsSignature),
77-
78-
/// Batch verification of STM signatures failed
79-
#[error("Batch verification of STM signatures failed")]
80-
BatchInvalid,
81-
8270
/// This error occurs when the the serialization of the raw bytes failed
8371
#[error("Invalid bytes")]
8472
SerializationError,
@@ -91,58 +79,25 @@ pub enum AggregationError {
9179
#[error("Not enough signatures. Got only {0} out of {1}.")]
9280
NotEnoughSignatures(u64, u64),
9381

94-
/// This error happens when we try to convert a u64 to a usize and it does not fit
95-
#[error("Invalid usize conversion")]
96-
UsizeConversionInvalid,
97-
98-
/// The proof system used in the aggregate signature is not supported
9982
#[error("Unsupported proof system: {0}")]
10083
UnsupportedProofSystem(AggregateSignatureType),
101-
}
102-
103-
/// Errors which can be output by `CoreVerifier`.
104-
#[derive(Debug, Clone, thiserror::Error)]
105-
pub enum CoreVerifierError {
106-
/// No quorum was found
107-
#[error("No Quorum was found. Expected {0} signatures but got {1}")]
108-
NoQuorum(u64, u64),
10984

11085
/// There is a duplicate index
11186
#[error("Indices are not unique.")]
11287
IndexNotUnique,
113-
114-
/// The aggregated signature is invalid
115-
#[error("Aggregate signature is invalid")]
116-
AggregateSignatureInvalid,
117-
118-
/// One of the aggregated signatures is invalid
119-
#[error("Individual signature is invalid: {0}")]
120-
IndividualSignatureInvalid(#[source] StmSignatureError),
12188
}
12289

12390
/// Errors which can be output by Mithril aggregate verification.
12491
#[derive(Debug, Clone, thiserror::Error)]
12592
pub enum StmAggregateSignatureError {
126-
/// The IVK is invalid after aggregating the keys
127-
#[error("Aggregated key does not correspond to the expected key.")]
128-
IvkInvalid(Box<BlsVerificationKey>),
129-
13093
/// This error occurs when the the serialization of the raw bytes failed
13194
#[error("Invalid bytes")]
13295
SerializationError,
13396

134-
/// Invalid merkle batch path
135-
#[error("Batch path does not verify against root")]
136-
PathInvalid(Vec<u8>),
137-
13897
/// Batch verification of STM aggregate signatures failed
13998
#[error("Batch verification of STM aggregate signatures failed")]
14099
BatchInvalid,
141100

142-
/// `CoreVerifier` check failed
143-
#[error("Core verification error: {0}")]
144-
CoreVerificationError(#[source] CoreVerifierError),
145-
146101
/// The proof system used in the aggregate signature is not supported
147102
#[error("Unsupported proof system: {0}")]
148103
UnsupportedProofSystem(AggregateSignatureType),
@@ -155,10 +110,6 @@ pub enum RegisterError {
155110
#[error("This key has already been registered.")]
156111
KeyRegistered(Box<BlsVerificationKey>),
157112

158-
/// Verification key is the infinity
159-
#[error("Verification key is the infinity")]
160-
VerificationKeyInfinity(Box<BlsVerificationKey>),
161-
162113
/// The supplied key is not valid
163114
#[error("The verification of correctness of the supplied key is invalid.")]
164115
KeyInvalid(Box<BlsVerificationKeyProofOfPossession>),

mithril-stm/src/lib.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -125,8 +125,8 @@ pub use aggregate_signature::{
125125
AggregateSignature, AggregateSignatureType, AggregateVerificationKey, BasicVerifier, Clerk,
126126
};
127127
pub use error::{
128-
AggregationError, CoreVerifierError, MultiSignatureError, RegisterError,
129-
StmAggregateSignatureError, StmSignatureError,
128+
AggregationError, MultiSignatureError, RegisterError, StmAggregateSignatureError,
129+
StmSignatureError,
130130
};
131131
pub use key_registration::{ClosedKeyRegistration, KeyRegistration};
132132
pub use parameters::Parameters;

mithril-stm/tests/stm_protocol.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -39,13 +39,13 @@ fn test_full_protocol() {
3939
println!("Not enough signatures");
4040
assert!(n < &params.k && k == &params.k)
4141
}
42-
Some(AggregationError::UsizeConversionInvalid) => {
43-
println!("Invalid usize conversion");
44-
}
42+
// Some(AggregationError::UsizeConversionInvalid) => {
43+
// println!("Invalid usize conversion");
44+
// }
4545
Some(AggregationError::UnsupportedProofSystem(aggregate_signature_type)) => {
4646
println!("Unsupported proof system: {:?}", aggregate_signature_type);
4747
}
48-
None => {
48+
_ => {
4949
println!("Unexpected error during aggregation: {:?}", error);
5050
}
5151
},

0 commit comments

Comments
 (0)