Skip to content

Commit 907be17

Browse files
committed
feature(protocol-config): add Epoch input parameter for get_network_configuration
1 parent d189cb8 commit 907be17

File tree

3 files changed

+16
-7
lines changed

3 files changed

+16
-7
lines changed

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

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,8 @@ use anyhow::anyhow;
44
use async_trait::async_trait;
55
use std::{sync::Arc, time::Duration};
66

7-
use mithril_common::StdResult;
87
use mithril_common::api_version::APIVersionProvider;
8+
use mithril_common::{StdResult, entities::Epoch};
99

1010
use crate::{
1111
aggregator_client::{AggregatorClient, AggregatorHTTPClient, HTTP_REQUEST_TIMEOUT_DURATION},
@@ -40,7 +40,10 @@ impl HttpMithrilNetworkConfigurationProvider {
4040

4141
#[async_trait]
4242
impl MithrilNetworkConfigurationProvider for HttpMithrilNetworkConfigurationProvider {
43-
async fn get_network_configuration(&self) -> StdResult<MithrilNetworkConfiguration> {
43+
async fn get_network_configuration(
44+
&self,
45+
epoch: Epoch, //TODO
46+
) -> StdResult<MithrilNetworkConfiguration> {
4447
let Some(epoch_settings) = self.aggregator_client.retrieve_epoch_settings().await? else {
4548
return Err(anyhow!("Failed to retrieve epoch settings"));
4649
};
Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,16 @@
11
//! Interface definition for Mithril Protocol Configuration provider.
22
33
use async_trait::async_trait;
4-
use mithril_common::StdResult;
4+
use mithril_common::{StdResult, entities::Epoch};
55

66
use crate::model::MithrilNetworkConfiguration;
77

88
/// A provider for the Mithril network configuration of the current epoch.
99
#[async_trait]
1010
pub trait MithrilNetworkConfigurationProvider: Sync + Send {
1111
/// Get the Mithril network configuration for the current epoch.
12-
async fn get_network_configuration(&self) -> StdResult<MithrilNetworkConfiguration>;
12+
async fn get_network_configuration(
13+
&self,
14+
epoch: Epoch,
15+
) -> StdResult<MithrilNetworkConfiguration>;
1316
}

internal/mithril-protocol-config/src/test/double/configuration_provider.rs

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ use crate::{
1010
use async_trait::async_trait;
1111
use mithril_common::{
1212
StdResult,
13-
entities::{ProtocolParameters, SignedEntityTypeDiscriminants},
13+
entities::{Epoch, ProtocolParameters, SignedEntityTypeDiscriminants},
1414
};
1515
use mithril_ticker::TickerService;
1616

@@ -57,7 +57,10 @@ impl FakeMithrilNetworkConfigurationProvider {
5757
#[cfg_attr(target_family = "wasm", async_trait(?Send))]
5858
#[cfg_attr(not(target_family = "wasm"), async_trait)]
5959
impl MithrilNetworkConfigurationProvider for FakeMithrilNetworkConfigurationProvider {
60-
async fn get_network_configuration(&self) -> StdResult<MithrilNetworkConfiguration> {
60+
async fn get_network_configuration(
61+
&self,
62+
epoch: Epoch, //TODO
63+
) -> StdResult<MithrilNetworkConfiguration> {
6164
let time_point = self.ticker_service.get_current_time_point().await?;
6265
let available_signed_entity_types = self.available_signed_entity_types.read().await;
6366

@@ -133,7 +136,7 @@ mod tests {
133136
);
134137

135138
let actual_config = mithril_network_configuration_provider
136-
.get_network_configuration()
139+
.get_network_configuration(Epoch(1)) //TODO
137140
.await
138141
.unwrap();
139142

0 commit comments

Comments
 (0)