Skip to content

Commit

Permalink
Merge pull request #2146 from input-output-hk/dlachaume/2122/implemen…
Browse files Browse the repository at this point in the history
…t-signable-builder-for-incremental-cardano-db

Feat: implement signable builder for incremental Cardano DB
  • Loading branch information
dlachaume authored Dec 2, 2024
2 parents 60db5ce + f9b6de0 commit fe375dd
Show file tree
Hide file tree
Showing 23 changed files with 883 additions and 288 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ As a minor extension, we have adopted a slightly different versioning convention
- **UNSTABLE** Cardano database incremental certification:

- Implement the new signed entity type `CardanoDatabase`.
- Implement the signable builder for the signed entity type `CardanoDatabase`.

- Crates versions:

Expand Down
8 changes: 4 additions & 4 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion mithril-aggregator/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "mithril-aggregator"
version = "0.5.117"
version = "0.5.118"
description = "A Mithril Aggregator server"
authors = { workspace = true }
edition = { workspace = true }
Expand Down
35 changes: 25 additions & 10 deletions mithril-aggregator/src/dependency_injection/builder.rs
Original file line number Diff line number Diff line change
Expand Up @@ -35,9 +35,10 @@ use mithril_common::{
EraChecker, EraMarker, EraReader, EraReaderAdapter, SupportedEra,
},
signable_builder::{
CardanoImmutableFilesFullSignableBuilder, CardanoStakeDistributionSignableBuilder,
CardanoTransactionsSignableBuilder, MithrilSignableBuilderService,
MithrilStakeDistributionSignableBuilder, SignableBuilderService, SignableSeedBuilder,
CardanoDatabaseSignableBuilder, CardanoImmutableFilesFullSignableBuilder,
CardanoStakeDistributionSignableBuilder, CardanoTransactionsSignableBuilder,
MithrilSignableBuilderService, MithrilStakeDistributionSignableBuilder,
SignableBuilderService, SignableBuilderServiceDependencies, SignableSeedBuilder,
TransactionsImporter,
},
signed_entity_type_lock::SignedEntityTypeLock,
Expand Down Expand Up @@ -68,7 +69,8 @@ use crate::{
CardanoTransactionsImporter, CertifierService, EpochServiceDependencies, MessageService,
MithrilCertifierService, MithrilEpochService, MithrilMessageService, MithrilProverService,
MithrilSignedEntityService, MithrilStakeDistributionService, ProverService,
SignedEntityService, StakeDistributionService, UpkeepService, UsageReporter,
SignedEntityService, SignedEntityServiceArtifactsDependencies, StakeDistributionService,
UpkeepService, UsageReporter,
},
store::CertificatePendingStorer,
tools::{CExplorerSignerRetriever, GcpFileUploader, GenesisToolsDependency, SignersImporter},
Expand Down Expand Up @@ -1128,14 +1130,23 @@ impl DependenciesBuilder {
let cardano_stake_distribution_builder = Arc::new(
CardanoStakeDistributionSignableBuilder::new(self.get_stake_store().await?),
);
let cardano_database_signable_builder = Arc::new(CardanoDatabaseSignableBuilder::new(
self.get_immutable_digester().await?,
&self.configuration.db_directory,
self.root_logger(),
));
let era_checker = self.get_era_checker().await?;
let signable_builder_service = Arc::new(MithrilSignableBuilderService::new(
era_checker,
seed_signable_builder,
let signable_builders_dependencies = SignableBuilderServiceDependencies::new(
mithril_stake_distribution_builder,
immutable_signable_builder,
cardano_transactions_builder,
cardano_stake_distribution_builder,
cardano_database_signable_builder,
);
let signable_builder_service = Arc::new(MithrilSignableBuilderService::new(
era_checker,
seed_signable_builder,
signable_builders_dependencies,
self.root_logger(),
));

Expand Down Expand Up @@ -1197,13 +1208,17 @@ impl DependenciesBuilder {
let stake_store = self.get_stake_store().await?;
let cardano_stake_distribution_artifact_builder =
Arc::new(CardanoStakeDistributionArtifactBuilder::new(stake_store));
let signed_entity_service = Arc::new(MithrilSignedEntityService::new(
signed_entity_storer,
let dependencies = SignedEntityServiceArtifactsDependencies::new(
mithril_stake_distribution_artifact_builder,
cardano_immutable_files_full_artifact_builder,
cardano_transactions_artifact_builder,
self.get_signed_entity_lock().await?,
cardano_stake_distribution_artifact_builder,
);
let signed_entity_service = Arc::new(MithrilSignedEntityService::new(
signed_entity_storer,
dependencies,
self.get_signed_entity_lock().await?,
self.get_metrics_service().await?,
logger,
));

Expand Down
28 changes: 0 additions & 28 deletions mithril-aggregator/src/runtime/runner.rs
Original file line number Diff line number Diff line change
Expand Up @@ -172,32 +172,6 @@ impl AggregatorRunner {

Ok(unlocked_signed_entities)
}

fn increment_artifact_total_produced_metric_since_startup(
&self,
signed_entity_type: &SignedEntityType,
) {
let metrics = self.dependencies.metrics_service.clone();
let metric_counter = match signed_entity_type {
SignedEntityType::MithrilStakeDistribution(_) => {
metrics.get_artifact_mithril_stake_distribution_total_produced_since_startup()
}
SignedEntityType::CardanoImmutableFilesFull(_) => {
metrics.get_artifact_cardano_db_total_produced_since_startup()
}
SignedEntityType::CardanoStakeDistribution(_) => {
metrics.get_artifact_cardano_stake_distribution_total_produced_since_startup()
}
SignedEntityType::CardanoTransactions(_, _) => {
metrics.get_artifact_cardano_transaction_total_produced_since_startup()
}
SignedEntityType::CardanoDatabase(_) => {
metrics.get_artifact_cardano_database_total_produced_since_startup()
}
};

metric_counter.increment();
}
}

#[cfg_attr(test, mockall::automock)]
Expand Down Expand Up @@ -457,8 +431,6 @@ impl AggregatorRunnerTrait for AggregatorRunner {
)
})?;

self.increment_artifact_total_produced_metric_since_startup(signed_entity_type);

Ok(())
}

Expand Down
Loading

0 comments on commit fe375dd

Please sign in to comment.