mithril_common/crypto_helper/types/
alias.rs

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