mithril_stm/protocol/
error.rs

1use crate::{RegistrationEntry, VerificationKeyForConcatenation};
2
3#[cfg(feature = "future_snark")]
4use crate::VerificationKeyForSnark;
5
6/// Errors which can be outputted by key registration.
7#[derive(Debug, Clone, thiserror::Error, PartialEq, Eq)]
8pub enum RegisterError {
9    /// This key has already been registered by a participant
10    #[error("This key has already been registered.")]
11    EntryAlreadyRegistered(Box<RegistrationEntry>),
12
13    /// Cannot register if the registration is closed.
14    #[error("Cannot register if the registration is closed.")]
15    RegistrationClosed,
16
17    /// Registration is not closed. Cannot create a signer.
18    #[error("Registration is not closed. Cannot create a signer")]
19    RegistrationIsNotClosed,
20
21    /// The supplied concatenation key is not valid
22    #[error("The verification of correctness of the supplied concatenation key is invalid.")]
23    ConcatenationKeyInvalid(Box<VerificationKeyForConcatenation>),
24
25    #[cfg(feature = "future_snark")]
26    /// The supplied snark key is not valid
27    #[error("The verification of correctness of the supplied SNARK key is invalid.")]
28    SnarkKeyInvalid(Box<VerificationKeyForSnark>),
29
30    /// Serialization error
31    #[error("Serialization error")]
32    SerializationError,
33
34    /// UnregisteredInitializer error
35    #[error("Initializer not registered. Cannot participate as a signer.")]
36    UnregisteredInitializer,
37
38    /// No registration found for the given index.
39    #[error("No registration found for the given index.")]
40    UnregisteredIndex,
41
42    #[cfg(feature = "future_snark")]
43    /// Snark key is none
44    #[error("The verification key for snark is undefined.")]
45    SnarkKeyUndefined,
46
47    #[cfg(feature = "future_snark")]
48    /// Lottery target value is none
49    #[error("The lottery target value is undefined.")]
50    LotteryTargetValueUndefined,
51}