mithril_aggregator/entities/
leader_aggregator_epoch_settings.rs

1use mithril_common::entities::{
2    CardanoTransactionsSigningConfig, Epoch, ProtocolParameters, Signer,
3};
4
5/// LeaderAggregatorEpochSettings represents the settings of an epoch
6#[derive(Clone, Debug, PartialEq)]
7pub struct LeaderAggregatorEpochSettings {
8    /// Current Epoch
9    pub epoch: Epoch,
10
11    /// Registration protocol parameters
12    pub registration_protocol_parameters: ProtocolParameters,
13
14    /// Current Signers
15    pub current_signers: Vec<Signer>,
16
17    /// Signers that will be able to sign on the next epoch
18    pub next_signers: Vec<Signer>,
19
20    /// Cardano transactions signing configuration for the current epoch
21    pub cardano_transactions_signing_config: Option<CardanoTransactionsSigningConfig>,
22
23    /// Cardano transactions signing configuration for the next epoch
24    pub next_cardano_transactions_signing_config: Option<CardanoTransactionsSigningConfig>,
25}
26
27impl LeaderAggregatorEpochSettings {
28    #[cfg(test)]
29    /// Create a dummy LeaderAggregatorEpochSettings
30    pub fn dummy() -> LeaderAggregatorEpochSettings {
31        use mithril_common::test_utils::fake_data;
32
33        // Beacon
34        let beacon = fake_data::beacon();
35
36        // Registration protocol parameters
37        let registration_protocol_parameters = fake_data::protocol_parameters();
38
39        // Signers
40        let signers = fake_data::signers(5);
41        let current_signers = signers[1..3].to_vec();
42        let next_signers = signers[2..5].to_vec();
43
44        // Cardano transactions signing configuration
45        let cardano_transactions_signing_config = Some(CardanoTransactionsSigningConfig::dummy());
46        let next_cardano_transactions_signing_config =
47            Some(CardanoTransactionsSigningConfig::dummy());
48
49        // Signer Epoch settings
50        LeaderAggregatorEpochSettings {
51            epoch: beacon.epoch,
52            registration_protocol_parameters,
53            current_signers,
54            next_signers,
55            cardano_transactions_signing_config,
56            next_cardano_transactions_signing_config,
57        }
58    }
59}