|
1 | | -//! API for mithril key certification. |
2 | | -//! Includes the wrappers for StmInitializer and KeyReg, and ProtocolRegistrationErrorWrapper. |
| 1 | +//! API for mithril key certification. |
| 2 | +//! Includes the wrappers for StmInitializer and KeyReg, and ProtocolRegistrationErrorWrapper. |
| 3 | +//! These wrappers allows keeping mithril-core agnostic to Cardano, while providing some |
| 4 | +//! guarantees that mithril-core will not be misused in the context of Cardano. |
3 | 5 |
|
4 | 6 | use crate::crypto_helper::cardano::{OpCert, ParseError, SerDeShelleyFileFormat}; |
5 | 7 | use crate::crypto_helper::types::{ |
@@ -63,15 +65,21 @@ pub enum ProtocolRegistrationErrorWrapper { |
63 | 65 | CoreRegister(#[from] RegisterError), |
64 | 66 | } |
65 | 67 |
|
66 | | -// Wrapper structures to reduce library misuse in the Cardano context |
67 | 68 | /// Wrapper structure for [MithrilCore:StmInitializer](https://mithril.network/mithril-core/doc/mithril/stm/struct.StmInitializer.html). |
| 69 | +/// It now obtains a KES signature over the Mithril key. This allows the signers prove |
| 70 | +/// their correct identity with respect to a Cardano PoolID. |
68 | 71 | #[derive(Debug, Clone, Serialize, Deserialize)] |
69 | 72 | pub struct StmInitializerWrapper { |
70 | 73 | stm_initializer: StmInitializer, |
71 | 74 | kes_signature: Option<ProtocolSignerVerificationKeySignature>, // todo: The option is ONLY for a smooth transition. We have to remove this. |
72 | 75 | } |
73 | 76 |
|
74 | 77 | /// Wrapper structure for [MithrilCore:KeyReg](https://mithril.network/mithril-core/doc/mithril/key_reg/struct.KeyReg.html). |
| 78 | +/// The wrapper not only contains a map between `Mithril vkey <-> Stake`, but also |
| 79 | +/// a map `PoolID <-> Stake`. This information is recovered from the node state, and |
| 80 | +/// is used to verify the identity of a Mithril signer. Furthermore, the `register` function |
| 81 | +/// of the wrapper forces the registrar to check that the KES signature over the Mithril key |
| 82 | +/// is valid with respect to the PoolID. |
75 | 83 | #[derive(Debug, Clone)] |
76 | 84 | pub struct KeyRegWrapper { |
77 | 85 | stm_key_reg: KeyReg, |
|
0 commit comments