mithril_aggregator/entities/
aggregator_epoch_settings.rs

1use mithril_common::entities::{CardanoTransactionsSigningConfig, ProtocolParameters};
2
3/// AggregatorEpochSettings represents the settings of an epoch
4#[derive(Clone, Debug, PartialEq)]
5pub struct AggregatorEpochSettings {
6    /// Protocol parameters
7    pub protocol_parameters: ProtocolParameters,
8
9    /// Cardano transactions signing configuration
10    pub cardano_transactions_signing_config: Option<CardanoTransactionsSigningConfig>,
11}
12
13#[cfg(test)]
14mod test_utils {
15    use std::collections::BTreeSet;
16
17    use mithril_common::entities::SignedEntityTypeDiscriminants;
18    use mithril_protocol_config::model::{
19        MithrilNetworkConfigurationForEpoch, SignedEntityTypeConfiguration,
20    };
21
22    use super::*;
23
24    impl AggregatorEpochSettings {
25        /// Convert this epoch setting into a [MithrilNetworkConfigurationForEpoch]
26        pub fn into_network_configuration_for_epoch(
27            self,
28            enabled_signed_entity_types: BTreeSet<SignedEntityTypeDiscriminants>,
29        ) -> MithrilNetworkConfigurationForEpoch {
30            MithrilNetworkConfigurationForEpoch {
31                protocol_parameters: self.protocol_parameters,
32                enabled_signed_entity_types,
33                signed_entity_types_config: SignedEntityTypeConfiguration {
34                    cardano_transactions: self.cardano_transactions_signing_config,
35                },
36            }
37        }
38    }
39}