mithril_common/crypto_helper/types/alias.rs
1use crate::crypto_helper::cardano::{
2 KeyRegWrapper, ProtocolInitializerErrorWrapper, ProtocolRegistrationErrorWrapper,
3 StmInitializerWrapper,
4};
5
6use mithril_stm::{
7 AggregationError, Clerk, ClosedKeyRegistration, Index, Parameters, Signer, Stake,
8};
9
10use blake2::{Blake2b, digest::consts::U32};
11
12/// A protocol version
13pub type ProtocolVersion<'a> = &'a str;
14
15// Protocol types alias
16pub(crate) type D = Blake2b<U32>;
17
18/// The id of a mithril party.
19pub type ProtocolPartyId = String;
20
21/// Alias of [MithrilStm:Stake](type@mithril_stm::Stake).
22pub type ProtocolStake = Stake;
23
24/// A list of [Party Id][ProtocolPartyId] associated with its [Stake][ProtocolStake].
25pub type ProtocolStakeDistribution = Vec<(ProtocolPartyId, ProtocolStake)>;
26
27/// Alias of [MithrilStm::Parameters](struct@mithril_stm::Parameters).
28pub type ProtocolParameters = Parameters;
29
30/// Alias of [MithrilStm::Index](type@mithril_stm::Index).
31pub type ProtocolLotteryIndex = Index;
32
33/// Alias of [MithrilStm:Signer](struct@mithril_stm::Signer).
34pub type ProtocolSigner = Signer<D>;
35
36/// Alias of a wrapper of [MithrilStm:Initializer](struct@mithril_stm::Initializer).
37pub type ProtocolInitializer = StmInitializerWrapper;
38
39/// Alias of [MithrilStm:Clerk](struct@mithril_stm::Clerk).
40pub type ProtocolClerk = Clerk<D>;
41
42/// Alias of a wrapper of [MithrilStm:KeyRegistration](struct@mithril_stm::KeyRegistration).
43pub type ProtocolKeyRegistration = KeyRegWrapper;
44
45/// Alias of a wrapper of [MithrilStm:ClosedKeyRegistration](struct@mithril_stm::ClosedKeyRegistration).
46pub type ProtocolClosedKeyRegistration = ClosedKeyRegistration<D>;
47
48// Error alias
49/// Alias of a wrapper of [MithrilCommon:ProtocolRegistrationErrorWrapper](enum@ProtocolRegistrationErrorWrapper).
50pub type ProtocolRegistrationError = ProtocolRegistrationErrorWrapper;
51
52/// Alias of a wrapper of [MithrilCommon:ProtocolInitializerErrorWrapper](enum@ProtocolInitializerErrorWrapper).
53pub type ProtocolInitializerError = ProtocolInitializerErrorWrapper;
54
55/// Alias of [MithrilStm:AggregationError](enum@mithril_stm::AggregationError).
56pub type ProtocolAggregationError = AggregationError;