Skip to content

Commit 3a02191

Browse files
committed
feature(protocol-config): build MithrilNetworkConfiguration result with available signe entity type and config
1 parent 2755f3e commit 3a02191

File tree

1 file changed

+15
-9
lines changed
  • internal/mithril-protocol-config/src/http_client

1 file changed

+15
-9
lines changed

internal/mithril-protocol-config/src/http_client/http_impl.rs

Lines changed: 15 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,15 @@
11
use anyhow::anyhow;
2-
use std::{
3-
collections::{BTreeSet, HashMap},
4-
sync::Arc,
5-
time::Duration,
6-
};
2+
use std::{collections::HashMap, sync::Arc, time::Duration};
73

84
use crate::{
95
HTTP_REQUEST_TIMEOUT_DURATION,
106
http_client::aggregator_client::{AggregatorClient, AggregatorHTTPClient},
117
interface::MithrilNetworkConfigurationProvider,
12-
model::MithrilNetworkConfiguration,
8+
model::{MithrilNetworkConfiguration, SignedEntityTypeConfiguration},
139
};
1410
use async_trait::async_trait;
15-
use mithril_common::StdResult;
1611
use mithril_common::api_version::APIVersionProvider;
12+
use mithril_common::{StdResult, entities::SignedEntityTypeDiscriminants};
1713

1814
struct HttpMithrilNetworkConfigurationProvider {
1915
aggregator_client: AggregatorHTTPClient,
@@ -49,8 +45,18 @@ impl MithrilNetworkConfigurationProvider for HttpMithrilNetworkConfigurationProv
4945
return Err(anyhow!("Failed to retrieve epoch settings"));
5046
};
5147

52-
let available_signed_entity_types = BTreeSet::new(); // To be implemented to be retrieve from /aggreagator-features from aggregator_client.rs
53-
let signed_entity_types_config = HashMap::new(); // To be implemented
48+
let aggregator_features = self.aggregator_client.retrieve_aggregator_features().await?;
49+
let available_signed_entity_types = aggregator_features.capabilities.signed_entity_types;
50+
51+
let mut signed_entity_types_config = HashMap::new();
52+
signed_entity_types_config.insert(
53+
SignedEntityTypeDiscriminants::CardanoTransactions,
54+
SignedEntityTypeConfiguration::CardanoTransactions(
55+
epoch_settings.cardano_transactions_signing_config.ok_or_else(|| {
56+
anyhow!("Cardano transactions signing config is missing in epoch settings")
57+
})?,
58+
),
59+
);
5460

5561
Ok(MithrilNetworkConfiguration {
5662
epoch: epoch_settings.epoch,

0 commit comments

Comments
 (0)