Skip to content

Commit 48612b6

Browse files
turmelclemAlenar
authored andcommitted
feature(aggregator): inform_epoch is now reading data from network_configuration_provider, and persist signer resigration epoch configuration
1 parent cfc99d7 commit 48612b6

File tree

3 files changed

+152
-118
lines changed

3 files changed

+152
-118
lines changed

mithril-aggregator/src/dependency_injection/builder/enablers/epoch.rs

Lines changed: 6 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,9 @@
1-
use mithril_protocol_config::http_client::http_impl::HttpMithrilNetworkConfigurationProvider;
21
use std::sync::Arc;
32
use tokio::sync::RwLock;
43

5-
use mithril_protocol_config::interface::MithrilNetworkConfigurationProvider;
4+
use mithril_protocol_config::{
5+
http::HttpMithrilNetworkConfigurationProvider, interface::MithrilNetworkConfigurationProvider,
6+
};
67

78
use crate::dependency_injection::{DependenciesBuilder, EpochServiceWrapper, Result};
89
use crate::get_dependency;
@@ -22,8 +23,8 @@ impl DependenciesBuilder {
2223
.compute_allowed_signed_entity_types_discriminants()?;
2324

2425
let epoch_service = Arc::new(RwLock::new(MithrilEpochService::new(
25-
self.get_mithril_network_configuration_provider().await?,
2626
EpochServiceDependencies::new(
27+
self.get_mithril_network_configuration_provider().await?,
2728
epoch_settings_storer,
2829
verification_key_store,
2930
chain_observer,
@@ -59,6 +60,8 @@ impl DependenciesBuilder {
5960
))
6061
};
6162

63+
//TODO handle discrepency here
64+
6265
Ok(network_configuration_provider)
6366
}
6467

@@ -69,17 +72,3 @@ impl DependenciesBuilder {
6972
get_dependency!(self.mithril_network_configuration_provider)
7073
}
7174
}
72-
73-
// Todo remove after rebase with shared aggregator client:
74-
#[async_trait::async_trait]
75-
impl mithril_protocol_config::http_client::http_impl::ProtocolConfigurationRetrieverFromAggregator
76-
for crate::services::AggregatorHTTPClient
77-
{
78-
/// Retrieves protocol configuration for a given epoch from the aggregator
79-
async fn retrieve_protocol_configuration(
80-
&self,
81-
_epoch: mithril_common::entities::Epoch,
82-
) -> mithril_common::StdResult<mithril_common::messages::ProtocolConfigurationMessage> {
83-
unimplemented!()
84-
}
85-
}

mithril-aggregator/src/entities/aggregator_epoch_settings.rs

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,3 +9,31 @@ pub struct AggregatorEpochSettings {
99
/// Cardano transactions signing configuration
1010
pub cardano_transactions_signing_config: CardanoTransactionsSigningConfig,
1111
}
12+
13+
#[cfg(test)]
14+
mod 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: Some(self.cardano_transactions_signing_config),
35+
},
36+
}
37+
}
38+
}
39+
}

0 commit comments

Comments
 (0)