Skip to content

Commit ec454ba

Browse files
committed
feature(mithril-network-config): initialize the interface and http implementation
1 parent 48062b8 commit ec454ba

File tree

6 files changed

+52
-4
lines changed

6 files changed

+52
-4
lines changed

Cargo.lock

Lines changed: 3 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,12 @@
11
[package]
22
name = "mithril-network-config"
33
version = "0.1.0"
4-
description = "Common services to access data through the mithril network
4+
description = "Common services to access data through the mithril network"
55
authors = { workspace = true }
66
edition = { workspace = true }
77
homepage = { workspace = true }
88
license = { workspace = true }
99
repository = { workspace = true }
1010

1111
[dependencies]
12+
mithril-common = { path = "../../mithril-common" }

internal/mithril-network-config/src/http.rs

Whitespace-only changes.
Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
use mithril_common::StdResult;
2+
use mithril_common::entities::{
3+
CardanoDbBeacon, CardanoTransactionsSigningConfig, Epoch, ProtocolParameters,
4+
SignedEntityTypeDiscriminants,
5+
};
6+
use std::collections::BTreeSet;
7+
8+
/// Signed entity type specific configurations
9+
enum SignedEntityTypeConfiguration {
10+
/// Mithril stake distribution
11+
MithrilStakeDistribution(Epoch),
12+
13+
/// Cardano Stake Distribution
14+
CardanoStakeDistribution(Epoch),
15+
16+
/// Full Cardano Immutable Files
17+
CardanoImmutableFilesFull(CardanoDbBeacon),
18+
19+
/// Cardano Database
20+
CardanoDatabase(CardanoDbBeacon),
21+
22+
/// Cardano Transactions
23+
CardanoTransactions(CardanoTransactionsSigningConfig),
24+
}
25+
26+
/// A Mithril network configuration
27+
struct MithrilNetworkConfiguration {
28+
/// Epoch
29+
epoch: Epoch,
30+
31+
/// Cryptographic protocol parameters (`k`, `m` and `phi_f`)
32+
signer_registration_protocol_parameters: ProtocolParameters,
33+
34+
/// List of available types of certifications (`CardanoDatabase`, `CardanoTransactions`, `CardanoStakeDistribution`, ...)
35+
available_signed_entity_types: BTreeSet<SignedEntityTypeDiscriminants>,
36+
37+
/// Custom configurations for signed entity types (e.g. `cardano_transactions_signing_config` for `CardanoTransactions`)
38+
signed_entity_types_config: Vec<SignedEntityTypeConfiguration>, //or HashMap<SignedEntityTypeDiscriminant, SignedEntityTypeConfiguration>
39+
}
40+
41+
/// Trait to provide the current Mithril network configuration.
42+
pub trait MithrilNetworkConfigurationProvider: Sync + Send {
43+
/// Get the Mithril network configuration for the current epoch.
44+
async fn get(&self) -> StdResult<MithrilNetworkConfiguration>;
45+
}
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
pub mod http;
2+
pub mod interface;

internal/mithril-network-config/src/main.rs

Lines changed: 0 additions & 3 deletions
This file was deleted.

0 commit comments

Comments
 (0)