mithril_aggregator/services/signer_registration/
error.rs

1use thiserror::Error;
2
3use mithril_common::{
4    entities::{Epoch, SignerWithStake},
5    StdError,
6};
7
8use mithril_common::chain_observer::ChainObserverError;
9
10/// Error type for signer registerer service.
11#[derive(Error, Debug)]
12pub enum SignerRegistrationError {
13    /// No signer registration round opened yet
14    #[error("a signer registration round is not opened yet, please try again later")]
15    RegistrationRoundNotYetOpened,
16
17    /// Registration round for unexpected epoch
18    #[error("unexpected signer registration round epoch: current_round_epoch: {current_round_epoch}, received_epoch: {received_epoch}")]
19    RegistrationRoundUnexpectedEpoch {
20        /// Epoch of the current round
21        current_round_epoch: Epoch,
22        /// Epoch of the received signer registration
23        received_epoch: Epoch,
24    },
25
26    /// Chain observer error.
27    #[error("chain observer error")]
28    ChainObserver(#[from] ChainObserverError),
29
30    /// Signer is already registered.
31    #[error("signer already registered")]
32    ExistingSigner(Box<SignerWithStake>),
33
34    /// Store.
35    #[error("store error")]
36    Store(#[source] StdError),
37
38    /// Epoch service.
39    #[error("epoch service error")]
40    EpochService(#[source] StdError),
41
42    /// Signer registration failed.
43    #[error("signer registration failed")]
44    FailedSignerRegistration(#[source] StdError),
45
46    /// Signer recorder failed.
47    #[error("signer recorder failed: '{0}'")]
48    FailedSignerRecorder(String),
49
50    /// Signer registration is always closed on a follower aggregator.
51    #[error("signer registration is always closed on a follower aggregator")]
52    RegistrationRoundAlwaysClosedOnFollowerAggregator,
53
54    /// Signer synchronization is not available on a leader aggregator.
55    #[error("signer synchronization is not available on a leader aggregator")]
56    SignerSynchronizationUnavailableOnLeaderAggregator,
57
58    /// Failed fetching leader aggregator epoch settings.
59    #[error("failed fetching leader aggregator epoch settings: '{0}'")]
60    FailedFetchingLeaderAggregatorEpochSettings(#[source] StdError),
61}