|
| 1 | +use mithril_common::StdResult; |
| 2 | +use mithril_common::entities::{ |
| 3 | + CardanoDbBeacon, CardanoTransactionsSigningConfig, Epoch, ProtocolParameters, |
| 4 | + SignedEntityTypeDiscriminants, |
| 5 | +}; |
| 6 | +use std::collections::BTreeSet; |
| 7 | + |
| 8 | +/// Signed entity type specific configurations |
| 9 | +enum SignedEntityTypeConfiguration { |
| 10 | + /// Mithril stake distribution |
| 11 | + MithrilStakeDistribution(Epoch), |
| 12 | + |
| 13 | + /// Cardano Stake Distribution |
| 14 | + CardanoStakeDistribution(Epoch), |
| 15 | + |
| 16 | + /// Full Cardano Immutable Files |
| 17 | + CardanoImmutableFilesFull(CardanoDbBeacon), |
| 18 | + |
| 19 | + /// Cardano Database |
| 20 | + CardanoDatabase(CardanoDbBeacon), |
| 21 | + |
| 22 | + /// Cardano Transactions |
| 23 | + CardanoTransactions(CardanoTransactionsSigningConfig), |
| 24 | +} |
| 25 | + |
| 26 | +/// A Mithril network configuration |
| 27 | +struct MithrilNetworkConfiguration { |
| 28 | + /// Epoch |
| 29 | + epoch: Epoch, |
| 30 | + |
| 31 | + /// Cryptographic protocol parameters (`k`, `m` and `phi_f`) |
| 32 | + signer_registration_protocol_parameters: ProtocolParameters, |
| 33 | + |
| 34 | + /// List of available types of certifications (`CardanoDatabase`, `CardanoTransactions`, `CardanoStakeDistribution`, ...) |
| 35 | + available_signed_entity_types: BTreeSet<SignedEntityTypeDiscriminants>, |
| 36 | + |
| 37 | + /// Custom configurations for signed entity types (e.g. `cardano_transactions_signing_config` for `CardanoTransactions`) |
| 38 | + signed_entity_types_config: Vec<SignedEntityTypeConfiguration>, //or HashMap<SignedEntityTypeDiscriminant, SignedEntityTypeConfiguration> |
| 39 | +} |
| 40 | + |
| 41 | +/// Trait to provide the current Mithril network configuration. |
| 42 | +pub trait MithrilNetworkConfigurationProvider: Sync + Send { |
| 43 | + /// Get the Mithril network configuration for the current epoch. |
| 44 | + async fn get(&self) -> StdResult<MithrilNetworkConfiguration>; |
| 45 | +} |
0 commit comments