Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,11 @@ As a minor extension, we have adopted a slightly different versioning convention

- Implement the `/status` route on the aggregator's REST API to provide information about its current status.

- Deprecate the `network` field in all messages that contain a `CardanoDbBeacon` field.

- **BREAKING** Remove the `network` field from the internal `CardanoDbBeacon` struct, Certificates of types `CardanoImmutableFilesFull`
must have their hashes recomputed in order to stay valid (procedure detailed in the [`recompute-certificates-hash`](./docs/runbook/recompute-certificates-hash) runbook).

- Crates versions:

| Crate | Version |
Expand Down
12 changes: 6 additions & 6 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 docs/website/root/glossary.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ Below is a comprehensive list of definitions for some common terms used in the M

## Beacon

A beacon represents a point of the blockchain for which a [Mithril certificate](#certificate) is created. It embeds at least the version of the [Cardano network](#cardano-network) that is targeted, the associated [epoch](#epoch), and the [immutable file number](#immutable-file-number).
A beacon represents a point of the blockchain for which a [Mithril certificate](#certificate) is created. It embeds the [epoch](#epoch) of the [Cardano network](#cardano-network) that is targeted, and either the block number or the [immutable file number](#immutable-file-number).

## Cardano network

Expand Down
520 changes: 300 additions & 220 deletions docs/website/root/manual/develop/run-mithril-devnet.md

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion internal/mithril-persistence/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "mithril-persistence"
version = "0.2.33"
version = "0.2.34"
description = "Common types, interfaces, and utilities to persist data for Mithril nodes."
authors = { workspace = true }
edition = { workspace = true }
Expand Down
2 changes: 1 addition & 1 deletion internal/mithril-persistence/src/database/hydrator.rs
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ impl Hydrator {
column_index: U,
) -> String {
// We need to check first that the cell can be read as a string first
// (e.g. when beacon json is '{"network": "dev", "epoch": 1, "immutable_file_number": 2}').
// (e.g. when beacon json is '{"epoch": 1, "immutable_file_number": 2}').
// If it fails, we fallback on reading the cell as an integer (e.g. when beacon json is '5').
// TODO: Maybe there is a better way of doing this.
match row.try_read::<&str, _>(column_index.clone()) {
Expand Down
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.110"
version = "0.5.111"
description = "A Mithril Aggregator server"
authors = { workspace = true }
edition = { workspace = true }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -256,7 +256,7 @@ mod tests {
#[tokio::test]
async fn snapshot_archive_name_after_beacon_values() {
let network = fake_data::network();
let beacon = CardanoDbBeacon::new("network".to_string(), 20, 145);
let beacon = CardanoDbBeacon::new(20, 145);
let digest = "test+digest";

let cardano_immutable_files_full_artifact_builder =
Expand Down
1 change: 0 additions & 1 deletion mithril-aggregator/src/database/record/certificate.rs
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,6 @@ impl CertificateRecord {
parent_id,
epoch,
SignedEntityType::CardanoImmutableFilesFull(CardanoDbBeacon::new(
fake_data::network(),
*epoch,
immutable_file_number,
)),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -183,7 +183,7 @@ mod tests {

for signed_entity_type in [
SignedEntityType::MithrilStakeDistribution(epoch),
SignedEntityType::CardanoImmutableFilesFull(CardanoDbBeacon::new("devnet", *epoch, 1)),
SignedEntityType::CardanoImmutableFilesFull(CardanoDbBeacon::new(*epoch, 1)),
SignedEntityType::CardanoTransactions(epoch, BlockNumber(100)),
] {
repository
Expand Down
2 changes: 0 additions & 2 deletions mithril-aggregator/src/dependency_injection/builder.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1260,7 +1260,6 @@ impl DependenciesBuilder {
let era_checker = self.get_era_checker().await?;
let stake_distribution_service = self.get_stake_distribution_service().await?;
let epoch_settings = self.get_epoch_settings_configuration()?;
let network = self.configuration.get_network()?;
let allowed_discriminants = self.get_allowed_signed_entity_types_discriminants()?;

let epoch_service = Arc::new(RwLock::new(MithrilEpochService::new(
Expand All @@ -1272,7 +1271,6 @@ impl DependenciesBuilder {
era_checker,
stake_distribution_service,
),
network,
allowed_discriminants,
self.root_logger(),
)));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -458,7 +458,7 @@ mod tests {
let signed_entity = create_signed_entity(
SignedEntityType::CardanoImmutableFilesFull(CardanoDbBeacon::default()),
Snapshot {
beacon: CardanoDbBeacon::new(network, 1, 10),
beacon: CardanoDbBeacon::new(1, 10),
..fake_data::snapshots(1)[0].clone()
},
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ mod tests {
#[test]
fn adapt_on_other_than_cardano_immutable_files_full_signed_entity_type_ok() {
let mut certificate_pending = fake_data::certificate_pending();
let beacon = CardanoDbBeacon::new("", 0, 0);
let beacon = CardanoDbBeacon::new(0, 0);
certificate_pending.signed_entity_type =
SignedEntityType::MithrilStakeDistribution(Epoch(15));

Expand Down
24 changes: 12 additions & 12 deletions mithril-aggregator/src/services/certifier/certifier_service.rs
Original file line number Diff line number Diff line change
Expand Up @@ -470,7 +470,7 @@ mod tests {

#[tokio::test]
async fn should_clean_epoch_when_inform_epoch() {
let beacon = CardanoDbBeacon::new("devnet".to_string(), 1, 1);
let beacon = CardanoDbBeacon::new(1, 1);
let signed_entity_type = SignedEntityType::CardanoImmutableFilesFull(beacon.clone());
let protocol_message = ProtocolMessage::new();
let epoch = beacon.epoch;
Expand All @@ -491,7 +491,7 @@ mod tests {

#[tokio::test]
async fn should_mark_open_message_expired_when_exists() {
let beacon = CardanoDbBeacon::new("devnet".to_string(), 3, 1);
let beacon = CardanoDbBeacon::new(3, 1);
let signed_entity_type = SignedEntityType::CardanoImmutableFilesFull(beacon.clone());
let protocol_message = ProtocolMessage::new();
let epochs_with_signers = (1..=5).map(Epoch).collect::<Vec<_>>();
Expand Down Expand Up @@ -523,7 +523,7 @@ mod tests {

#[tokio::test]
async fn should_not_mark_open_message_expired_when_does_not_expire() {
let beacon = CardanoDbBeacon::new("devnet".to_string(), 3, 1);
let beacon = CardanoDbBeacon::new(3, 1);
let signed_entity_type = SignedEntityType::CardanoImmutableFilesFull(beacon.clone());
let protocol_message = ProtocolMessage::new();
let epochs_with_signers = (1..=5).map(Epoch).collect::<Vec<_>>();
Expand All @@ -550,7 +550,7 @@ mod tests {

#[tokio::test]
async fn should_not_mark_open_message_expired_when_has_not_expired_yet() {
let beacon = CardanoDbBeacon::new("devnet".to_string(), 3, 1);
let beacon = CardanoDbBeacon::new(3, 1);
let signed_entity_type = SignedEntityType::CardanoImmutableFilesFull(beacon.clone());
let protocol_message = ProtocolMessage::new();
let epochs_with_signers = (1..=5).map(Epoch).collect::<Vec<_>>();
Expand All @@ -577,7 +577,7 @@ mod tests {

#[tokio::test]
async fn should_register_valid_single_signature() {
let beacon = CardanoDbBeacon::new("devnet".to_string(), 3, 1);
let beacon = CardanoDbBeacon::new(3, 1);
let signed_entity_type = SignedEntityType::CardanoImmutableFilesFull(beacon.clone());
let protocol_message = ProtocolMessage::new();
let epochs_with_signers = (1..=3).map(Epoch).collect::<Vec<_>>();
Expand Down Expand Up @@ -610,7 +610,7 @@ mod tests {

#[tokio::test]
async fn should_not_register_invalid_single_signature() {
let beacon = CardanoDbBeacon::new("devnet".to_string(), 3, 1);
let beacon = CardanoDbBeacon::new(3, 1);
let signed_entity_type = SignedEntityType::CardanoImmutableFilesFull(beacon.clone());
let mut protocol_message = ProtocolMessage::new();
let epochs_with_signers = (1..=5).map(Epoch).collect::<Vec<_>>();
Expand Down Expand Up @@ -650,7 +650,7 @@ mod tests {

#[tokio::test]
async fn should_not_register_single_signature_for_certified_open_message() {
let beacon = CardanoDbBeacon::new("devnet".to_string(), 3, 1);
let beacon = CardanoDbBeacon::new(3, 1);
let signed_entity_type = SignedEntityType::CardanoImmutableFilesFull(beacon.clone());
let protocol_message = ProtocolMessage::new();
let epochs_with_signers = (1..=5).map(Epoch).collect::<Vec<_>>();
Expand Down Expand Up @@ -682,7 +682,7 @@ mod tests {

#[tokio::test]
async fn should_not_register_single_signature_for_expired_open_message() {
let beacon = CardanoDbBeacon::new("devnet".to_string(), 3, 1);
let beacon = CardanoDbBeacon::new(3, 1);
let signed_entity_type = SignedEntityType::CardanoImmutableFilesFull(beacon.clone());
let protocol_message = ProtocolMessage::new();
let epochs_with_signers = (1..=5).map(Epoch).collect::<Vec<_>>();
Expand Down Expand Up @@ -715,7 +715,7 @@ mod tests {
#[tokio::test]
async fn should_create_certificate_when_multi_signature_produced() {
let network = fake_data::network();
let beacon = CardanoDbBeacon::new(network, 3, 1);
let beacon = CardanoDbBeacon::new(3, 1);
let signed_entity_type = SignedEntityType::CardanoImmutableFilesFull(beacon.clone());
let protocol_message = ProtocolMessage::new();
let epochs_with_signers = (1..=3).map(Epoch).collect::<Vec<_>>();
Expand Down Expand Up @@ -789,7 +789,7 @@ mod tests {

#[tokio::test]
async fn should_not_create_certificate_for_open_message_not_created() {
let beacon = CardanoDbBeacon::new("devnet".to_string(), 1, 1);
let beacon = CardanoDbBeacon::new(1, 1);
let signed_entity_type = SignedEntityType::CardanoImmutableFilesFull(beacon.clone());
let epochs_with_signers = (1..=5).map(Epoch).collect::<Vec<_>>();
let fixture = MithrilFixtureBuilder::default().with_signers(5).build();
Expand All @@ -802,7 +802,7 @@ mod tests {

#[tokio::test]
async fn should_not_create_certificate_for_open_message_already_certified() {
let beacon = CardanoDbBeacon::new("devnet".to_string(), 1, 1);
let beacon = CardanoDbBeacon::new(1, 1);
let signed_entity_type = SignedEntityType::CardanoImmutableFilesFull(beacon.clone());
let protocol_message = ProtocolMessage::new();
let epoch = beacon.epoch;
Expand All @@ -826,7 +826,7 @@ mod tests {
mock_multi_signer
.expect_create_multi_signature()
.return_once(move |_| Ok(None));
let beacon = CardanoDbBeacon::new("devnet".to_string(), 1, 1);
let beacon = CardanoDbBeacon::new(1, 1);
let signed_entity_type = SignedEntityType::CardanoImmutableFilesFull(beacon.clone());
let protocol_message = ProtocolMessage::new();
let epochs_with_signers = (1..=5).map(Epoch).collect::<Vec<_>>();
Expand Down
13 changes: 1 addition & 12 deletions mithril-aggregator/src/services/epoch_service.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ use mithril_common::entities::{
};
use mithril_common::logging::LoggerExtensions;
use mithril_common::protocol::{MultiSigner as ProtocolMultiSigner, SignerBuilder};
use mithril_common::{CardanoNetwork, StdResult};
use mithril_common::StdResult;

use crate::{
entities::AggregatorEpochSettings, services::StakeDistributionService, EpochSettingsStorer,
Expand Down Expand Up @@ -188,7 +188,6 @@ pub struct MithrilEpochService {
chain_observer: Arc<dyn ChainObserver>,
era_checker: Arc<EraChecker>,
stake_distribution_service: Arc<dyn StakeDistributionService>,
network: CardanoNetwork,
allowed_signed_entity_discriminants: BTreeSet<SignedEntityTypeDiscriminants>,
logger: Logger,
}
Expand All @@ -198,7 +197,6 @@ impl MithrilEpochService {
pub fn new(
future_epoch_settings: AggregatorEpochSettings,
dependencies: EpochServiceDependencies,
network: CardanoNetwork,
allowed_discriminants: BTreeSet<SignedEntityTypeDiscriminants>,
logger: Logger,
) -> Self {
Expand All @@ -211,7 +209,6 @@ impl MithrilEpochService {
chain_observer: dependencies.chain_observer,
era_checker: dependencies.era_checker,
stake_distribution_service: dependencies.stake_distribution_service,
network,
allowed_signed_entity_discriminants: allowed_discriminants,
logger: logger.new_with_component_name::<Self>(),
}
Expand Down Expand Up @@ -346,7 +343,6 @@ impl EpochService for MithrilEpochService {

let signed_entity_config = SignedEntityConfig {
allowed_discriminants: self.allowed_signed_entity_discriminants.clone(),
network: self.network,
cardano_transactions_signing_config: current_epoch_settings
.cardano_transactions_signing_config
.clone(),
Expand Down Expand Up @@ -932,7 +928,6 @@ mod tests {
struct EpochServiceBuilder {
cardano_transactions_signing_config: CardanoTransactionsSigningConfig,
future_protocol_parameters: ProtocolParameters,
network: CardanoNetwork,
allowed_discriminants: BTreeSet<SignedEntityTypeDiscriminants>,
cardano_era: CardanoEra,
mithril_era: SupportedEra,
Expand All @@ -951,7 +946,6 @@ mod tests {
Self {
cardano_transactions_signing_config: CardanoTransactionsSigningConfig::dummy(),
future_protocol_parameters: epoch_fixture.protocol_parameters(),
network: CardanoNetwork::TestNet(0),
allowed_discriminants: BTreeSet::new(),
cardano_era: String::new(),
mithril_era: SupportedEra::dummy(),
Expand Down Expand Up @@ -1041,7 +1035,6 @@ mod tests {
Arc::new(era_checker),
Arc::new(stake_distribution_service),
),
self.network,
self.allowed_discriminants,
TestLogger::stdout(),
)
Expand All @@ -1068,7 +1061,6 @@ mod tests {
protocol_parameters: signer_registration_protocol_parameters.clone(),
..AggregatorEpochSettings::dummy()
},
network: SignedEntityConfig::dummy().network,
allowed_discriminants: SignedEntityConfig::dummy().allowed_discriminants,
cardano_era: "CardanoEra".to_string(),
mithril_era: SupportedEra::eras()[1],
Expand Down Expand Up @@ -1122,14 +1114,12 @@ mod tests {

let cardano_transactions_signing_config =
CardanoTransactionsSigningConfig::new(BlockNumber(29), BlockNumber(986));
let network = CardanoNetwork::TestNet(27);
let allowed_discriminants = BTreeSet::from([
SignedEntityTypeDiscriminants::CardanoTransactions,
SignedEntityTypeDiscriminants::CardanoImmutableFilesFull,
]);

let mut service = EpochServiceBuilder {
network,
allowed_discriminants: allowed_discriminants.clone(),
stored_current_epoch_settings: AggregatorEpochSettings {
cardano_transactions_signing_config: cardano_transactions_signing_config.clone(),
Expand All @@ -1153,7 +1143,6 @@ mod tests {
signed_entity_config.clone(),
SignedEntityConfig {
allowed_discriminants,
network,
cardano_transactions_signing_config,
}
);
Expand Down
Loading