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, ClosedKeyReg, Index, Stake, StmClerk, StmParameters, StmSigner,
8};
9
10use blake2::{digest::consts::U32, Blake2b};
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::StmParameters](struct@mithril_stm::StmParameters).
28pub type ProtocolParameters = StmParameters;
29
30/// Alias of [MithrilStm::Index](type@mithril_stm::Index).
31pub type ProtocolLotteryIndex = Index;
32
33/// Alias of [MithrilStm:StmSigner](struct@mithril_stm::StmSigner).
34pub type ProtocolSigner = StmSigner<D>;
35
36/// Alias of a wrapper of [MithrilStm:StmInitializer](struct@mithril_stm::StmInitializer).
37pub type ProtocolInitializer = StmInitializerWrapper;
38
39/// Alias of [MithrilStm:StmClerk](struct@mithril_stm::StmClerk).
40pub type ProtocolClerk = StmClerk<D>;
41
42/// Alias of a wrapper of [MithrilStm:KeyReg](struct@mithril_stm::KeyReg).
43pub type ProtocolKeyRegistration = KeyRegWrapper;
44
45/// Alias of a wrapper of [MithrilStm:ClosedKeyReg](struct@mithril_stm::KeyReg).
46pub type ProtocolClosedKeyRegistration = ClosedKeyReg<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;