Skip to content

Commit 12cd9c8

Browse files
authored
Merge pull request #2385 from input-output-hk/djo/2384/aggregator/remove_configuration_from_dep_container
refactor(aggregator): remove deprecated `configuration` field from `DependencyContainer`
2 parents 2fbe826 + 82b0239 commit 12cd9c8

File tree

7 files changed

+31
-20
lines changed

7 files changed

+31
-20
lines changed

Cargo.lock

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

mithril-aggregator/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[package]
22
name = "mithril-aggregator"
3-
version = "0.7.21"
3+
version = "0.7.22"
44
description = "A Mithril Aggregator server"
55
authors = { workspace = true }
66
edition = { workspace = true }

mithril-aggregator/src/dependency_injection/builder/mod.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -327,7 +327,6 @@ impl DependenciesBuilder {
327327
pub async fn build_dependency_container(&mut self) -> Result<DependencyContainer> {
328328
#[allow(deprecated)]
329329
let dependency_manager = DependencyContainer {
330-
config: self.configuration.clone(),
331330
root_logger: self.root_logger(),
332331
sqlite_connection: self.get_sqlite_connection().await?,
333332
sqlite_connection_cardano_transaction_pool: self

mithril-aggregator/src/dependency_injection/containers.rs

Lines changed: 7 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,6 @@ use mithril_persistence::{
2626
use mithril_signed_entity_lock::SignedEntityTypeLock;
2727

2828
use crate::{
29-
configuration::*,
3029
database::repository::{
3130
CertificateRepository, OpenMessageRepository, SignedEntityStorer, SignerGetter,
3231
StakePoolStore,
@@ -49,11 +48,6 @@ pub type EpochServiceWrapper = Arc<RwLock<dyn EpochService>>;
4948

5049
/// DependencyManager handles the dependencies
5150
pub struct DependencyContainer {
52-
/// Configuration structure.
53-
// TODO: remove this field and only use the `Configuration` in the dependencies builder
54-
#[deprecated]
55-
pub config: Configuration,
56-
5751
/// Application root logger
5852
pub root_logger: Logger,
5953

@@ -209,17 +203,19 @@ impl DependencyContainer {
209203
///
210204
/// Fill the stores of a [DependencyManager] in a way to simulate an aggregator state
211205
/// using the data from a precomputed fixture.
212-
pub async fn init_state_from_fixture(&self, fixture: &MithrilFixture, target_epochs: &[Epoch]) {
206+
pub async fn init_state_from_fixture(
207+
&self,
208+
fixture: &MithrilFixture,
209+
cardano_transactions_signing_config: &CardanoTransactionsSigningConfig,
210+
target_epochs: &[Epoch],
211+
) {
213212
for epoch in target_epochs {
214213
self.epoch_settings_storer
215214
.save_epoch_settings(
216215
*epoch,
217-
#[allow(deprecated)]
218216
AggregatorEpochSettings {
219217
protocol_parameters: fixture.protocol_parameters(),
220-
cardano_transactions_signing_config: self
221-
.config
222-
.cardano_transactions_signing_config
218+
cardano_transactions_signing_config: cardano_transactions_signing_config
223219
.clone(),
224220
},
225221
)

mithril-aggregator/src/runtime/runner.rs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -532,7 +532,8 @@ pub mod tests {
532532
use async_trait::async_trait;
533533
use chrono::{DateTime, Utc};
534534
use mithril_common::entities::{
535-
ChainPoint, Epoch, SignedEntityConfig, SignedEntityTypeDiscriminants,
535+
CardanoTransactionsSigningConfig, ChainPoint, Epoch, SignedEntityConfig,
536+
SignedEntityTypeDiscriminants,
536537
};
537538
use mithril_common::temp_dir;
538539
use mithril_common::{
@@ -575,6 +576,7 @@ pub mod tests {
575576
.unwrap();
576577
deps.init_state_from_fixture(
577578
&fixture,
579+
&CardanoTransactionsSigningConfig::dummy(),
578580
&[
579581
current_epoch.offset_to_signer_retrieval_epoch().unwrap(),
580582
current_epoch,

mithril-aggregator/src/services/certifier/certifier_service.rs

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -439,6 +439,8 @@ mod tests {
439439
current_epoch: Option<Epoch>,
440440
) -> MithrilCertifierService {
441441
let configuration = Configuration::new_sample(snapshot_directory);
442+
let cardano_transactions_signing_config =
443+
configuration.cardano_transactions_signing_config.clone();
442444
let mut dependency_builder = DependenciesBuilder::new_with_stdout_logger(configuration);
443445
if let Some(epoch) = current_epoch {
444446
dependency_builder.epoch_service = Some(Arc::new(RwLock::new(
@@ -451,7 +453,11 @@ mod tests {
451453
.await
452454
.unwrap();
453455
dependency_manager
454-
.init_state_from_fixture(fixture, epochs_with_signers)
456+
.init_state_from_fixture(
457+
fixture,
458+
&cardano_transactions_signing_config,
459+
epochs_with_signers,
460+
)
455461
.await;
456462

457463
MithrilCertifierService::from_deps(network, dependency_builder).await

mithril-aggregator/tests/test_extensions/runtime_tester.rs

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -17,9 +17,9 @@ use mithril_common::{
1717
crypto_helper::ProtocolGenesisSigner,
1818
digesters::{DumbImmutableDigester, DumbImmutableFileObserver},
1919
entities::{
20-
BlockNumber, Certificate, CertificateSignature, ChainPoint, Epoch, ImmutableFileNumber,
21-
SignedEntityType, SignedEntityTypeDiscriminants, SingleSignatureAuthenticationStatus,
22-
SlotNumber, Snapshot, StakeDistribution, TimePoint,
20+
BlockNumber, CardanoTransactionsSigningConfig, Certificate, CertificateSignature,
21+
ChainPoint, Epoch, ImmutableFileNumber, SignedEntityType, SignedEntityTypeDiscriminants,
22+
SingleSignatureAuthenticationStatus, SlotNumber, Snapshot, StakeDistribution, TimePoint,
2323
},
2424
era::{adapters::EraReaderDummyAdapter, EraMarker, EraReader, SupportedEra},
2525
test_utils::{
@@ -105,6 +105,7 @@ macro_rules! assert_metrics_eq {
105105

106106
pub struct RuntimeTester {
107107
pub network: String,
108+
pub cardano_transactions_signing_config: CardanoTransactionsSigningConfig,
108109
pub snapshot_uploader: Arc<DumbUploader>,
109110
pub chain_observer: Arc<FakeObserver>,
110111
pub immutable_file_observer: Arc<DumbImmutableFileObserver>,
@@ -134,6 +135,8 @@ impl RuntimeTester {
134135
let logger = build_logger();
135136
let global_logger = slog_scope::set_global_logger(logger.clone());
136137
let network = configuration.network.clone();
138+
let cardano_transactions_signing_config =
139+
configuration.cardano_transactions_signing_config.clone();
137140
let snapshot_uploader = Arc::new(DumbUploader::default());
138141
let immutable_file_observer = Arc::new(DumbImmutableFileObserver::new());
139142
immutable_file_observer
@@ -173,6 +176,7 @@ impl RuntimeTester {
173176

174177
Self {
175178
network,
179+
cardano_transactions_signing_config,
176180
snapshot_uploader,
177181
chain_observer,
178182
immutable_file_observer,
@@ -237,7 +241,11 @@ impl RuntimeTester {
237241
// Init the stores needed for a genesis certificate
238242
let genesis_epochs = self.dependencies.get_genesis_epochs().await;
239243
self.dependencies
240-
.init_state_from_fixture(fixture, &[genesis_epochs.0, genesis_epochs.1])
244+
.init_state_from_fixture(
245+
fixture,
246+
&self.cardano_transactions_signing_config,
247+
&[genesis_epochs.0, genesis_epochs.1],
248+
)
241249
.await;
242250
Ok(())
243251
}

0 commit comments

Comments
 (0)