Skip to content

Commit 0247776

Browse files
committed
move struct and enum used in interface to a model file
1 parent 487142a commit 0247776

File tree

4 files changed

+30
-26
lines changed

4 files changed

+30
-26
lines changed

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

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,8 @@ use std::{collections::BTreeSet, sync::Arc, time::Duration};
44
use crate::{
55
HTTP_REQUEST_TIMEOUT_DURATION,
66
http::aggregator_client::{AggregatorClient, AggregatorHTTPClient},
7-
interface::{MithrilNetworkConfiguration, MithrilNetworkConfigurationProvider},
7+
interface::MithrilNetworkConfigurationProvider,
8+
model::MithrilNetworkConfiguration,
89
};
910
use async_trait::async_trait;
1011
use mithril_common::StdResult;
@@ -44,7 +45,7 @@ impl MithrilNetworkConfigurationProvider for HttpMithrilNetworkConfigurationProv
4445
return Err(anyhow!("Failed to retrieve epoch settings"));
4546
};
4647

47-
let available_signed_entity_types = BTreeSet::new(); // To be implemented
48+
let available_signed_entity_types = BTreeSet::new(); // To be implemented to be retrieve from /aggreagator-features from aggregator_client.rs
4849
let signed_entity_types_config = vec![]; // To be implemented
4950

5051
Ok(MithrilNetworkConfiguration {

internal/mithril-protocol-config/src/interface.rs

Lines changed: 1 addition & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -1,30 +1,7 @@
11
use async_trait::async_trait;
22
use mithril_common::StdResult;
3-
use mithril_common::entities::{
4-
CardanoTransactionsSigningConfig, Epoch, ProtocolParameters, SignedEntityTypeDiscriminants,
5-
};
6-
use std::collections::BTreeSet;
73

8-
/// Signed entity type specific configurations
9-
pub enum SignedEntityTypeConfiguration {
10-
/// Cardano Transactions
11-
CardanoTransactions(CardanoTransactionsSigningConfig),
12-
}
13-
14-
/// A Mithril network configuration
15-
pub struct MithrilNetworkConfiguration {
16-
/// Epoch
17-
pub epoch: Epoch,
18-
19-
/// Cryptographic protocol parameters (`k`, `m` and `phi_f`)
20-
pub signer_registration_protocol_parameters: ProtocolParameters,
21-
22-
/// List of available types of certifications (`CardanoDatabase`, `CardanoTransactions`, `CardanoStakeDistribution`, ...)
23-
pub available_signed_entity_types: BTreeSet<SignedEntityTypeDiscriminants>,
24-
25-
/// Custom configurations for signed entity types (e.g. `cardano_transactions_signing_config` for `CardanoTransactions`)
26-
pub signed_entity_types_config: Vec<SignedEntityTypeConfiguration>, //or HashMap<SignedEntityTypeDiscriminant, SignedEntityTypeConfiguration>
27-
}
4+
use crate::model::MithrilNetworkConfiguration;
285

296
/// Trait to provide the current Mithril network configuration.
307
#[async_trait]

internal/mithril-protocol-config/src/lib.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
const HTTP_REQUEST_TIMEOUT_DURATION: u64 = 30000;
33
pub mod http;
44
pub mod interface;
5+
pub mod model;
56
pub mod signer_epoch_settings;
67

78
#[cfg(test)]
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
use std::collections::BTreeSet;
2+
3+
use mithril_common::entities::{
4+
CardanoTransactionsSigningConfig, Epoch, ProtocolParameters, SignedEntityTypeDiscriminants,
5+
};
6+
7+
pub enum SignedEntityTypeConfiguration {
8+
/// Cardano Transactions
9+
CardanoTransactions(CardanoTransactionsSigningConfig),
10+
}
11+
12+
/// A Mithril network configuration
13+
pub struct MithrilNetworkConfiguration {
14+
/// Epoch
15+
pub epoch: Epoch,
16+
17+
/// Cryptographic protocol parameters (`k`, `m` and `phi_f`)
18+
pub signer_registration_protocol_parameters: ProtocolParameters,
19+
20+
/// List of available types of certifications (`CardanoDatabase`, `CardanoTransactions`, `CardanoStakeDistribution`, ...)
21+
pub available_signed_entity_types: BTreeSet<SignedEntityTypeDiscriminants>,
22+
23+
/// Custom configurations for signed entity types (e.g. `cardano_transactions_signing_config` for `CardanoTransactions`)
24+
pub signed_entity_types_config: Vec<SignedEntityTypeConfiguration>, //or HashMap<SignedEntityTypeDiscriminant, SignedEntityTypeConfiguration>
25+
}

0 commit comments

Comments
 (0)