diff --git a/Cargo.lock b/Cargo.lock index 66e87bac87b..fb09294e4fc 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -3588,7 +3588,7 @@ dependencies = [ [[package]] name = "mithril-aggregator" -version = "0.5.116" +version = "0.5.117" dependencies = [ "anyhow", "async-trait", @@ -3745,7 +3745,7 @@ dependencies = [ [[package]] name = "mithril-common" -version = "0.4.90" +version = "0.4.91" dependencies = [ "anyhow", "async-trait", @@ -3859,7 +3859,7 @@ dependencies = [ [[package]] name = "mithril-persistence" -version = "0.2.38" +version = "0.2.39" dependencies = [ "anyhow", "async-trait", diff --git a/internal/mithril-persistence/Cargo.toml b/internal/mithril-persistence/Cargo.toml index 80a09521fe8..5895258e6e9 100644 --- a/internal/mithril-persistence/Cargo.toml +++ b/internal/mithril-persistence/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "mithril-persistence" -version = "0.2.38" +version = "0.2.39" description = "Common types, interfaces, and utilities to persist data for Mithril nodes." authors = { workspace = true } edition = { workspace = true } diff --git a/internal/mithril-persistence/src/sqlite/connection_builder.rs b/internal/mithril-persistence/src/sqlite/connection_builder.rs index eb0e9eb0a59..3685a17ce88 100644 --- a/internal/mithril-persistence/src/sqlite/connection_builder.rs +++ b/internal/mithril-persistence/src/sqlite/connection_builder.rs @@ -81,7 +81,7 @@ impl ConnectionBuilder { pub fn build(self) -> StdResult { let logger = self.base_logger.new_with_component_name::(); - debug!(logger, "Opening SQLite connection"; "path" => self.connection_path.display()); + debug!(logger, "Opening SQLite connection"; "path" => self.connection_path.display(), "options" => ?self.options); let connection = Connection::open_thread_safe(&self.connection_path).with_context(|| { format!( @@ -94,14 +94,12 @@ impl ConnectionBuilder { .options .contains(&ConnectionOptions::EnableWriteAheadLog) { - debug!(logger, "Enabling SQLite Write Ahead Log journal mode"); connection .execute("pragma journal_mode = wal; pragma synchronous = normal;") .with_context(|| "SQLite initialization: could not enable WAL.")?; } if self.options.contains(&ConnectionOptions::EnableForeignKeys) { - debug!(logger, "Enabling SQLite foreign key support"); connection .execute("pragma foreign_keys=true") .with_context(|| "SQLite initialization: could not enable FOREIGN KEY support.")?; @@ -113,7 +111,6 @@ impl ConnectionBuilder { .options .contains(&ConnectionOptions::ForceDisableForeignKeys) { - debug!(logger, "Force disabling SQLite foreign key support"); connection .execute("pragma foreign_keys=false") .with_context(|| "SQLite initialization: could not disable FOREIGN KEY support.")?; diff --git a/mithril-aggregator/Cargo.toml b/mithril-aggregator/Cargo.toml index 39379c7acf1..d0ba4bd719e 100644 --- a/mithril-aggregator/Cargo.toml +++ b/mithril-aggregator/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "mithril-aggregator" -version = "0.5.116" +version = "0.5.117" description = "A Mithril Aggregator server" authors = { workspace = true } edition = { workspace = true } diff --git a/mithril-aggregator/src/http_server/routes/status.rs b/mithril-aggregator/src/http_server/routes/status.rs index bc9f8f72e38..0ab34bcb57c 100644 --- a/mithril-aggregator/src/http_server/routes/status.rs +++ b/mithril-aggregator/src/http_server/routes/status.rs @@ -24,12 +24,16 @@ fn status( .and(middlewares::extract_config(router_state, |config| { config.cardano_node_version.clone() })) + .and(middlewares::extract_config(router_state, |config| { + config.network.to_string() + })) .and_then(handlers::status) } async fn get_aggregator_status_message( epoch_service: EpochServiceWrapper, cardano_node_version: String, + cardano_network: String, ) -> StdResult { let epoch_service = epoch_service.read().await; @@ -49,6 +53,7 @@ async fn get_aggregator_status_message( let message = AggregatorStatusMessage { epoch, cardano_era, + cardano_network, mithril_era, cardano_node_version, aggregator_node_version, @@ -81,9 +86,11 @@ mod handlers { logger: Logger, epoch_service: EpochServiceWrapper, cardano_node_version: String, + cardano_network: String, ) -> Result { let aggregator_status_message = - get_aggregator_status_message(epoch_service, cardano_node_version).await; + get_aggregator_status_message(epoch_service, cardano_node_version, cardano_network) + .await; match aggregator_status_message { Ok(message) => Ok(reply::json(&message, StatusCode::OK)), @@ -211,11 +218,11 @@ mod tests { ..FakeEpochServiceBuilder::dummy(Epoch(3)) } .build(); + let epoch_service = Arc::new(RwLock::new(epoch_service)); - let message = - get_aggregator_status_message(Arc::new(RwLock::new(epoch_service)), String::new()) - .await - .unwrap(); + let message = get_aggregator_status_message(epoch_service, String::new(), String::new()) + .await + .unwrap(); assert_eq!( message.protocol_parameters, @@ -240,7 +247,7 @@ mod tests { .build(); let epoch_service = Arc::new(RwLock::new(epoch_service)); - let message = get_aggregator_status_message(epoch_service.clone(), String::new()) + let message = get_aggregator_status_message(epoch_service, String::new(), String::new()) .await .unwrap(); @@ -266,11 +273,28 @@ mod tests { .build(); let epoch_service = Arc::new(RwLock::new(epoch_service)); - let message = get_aggregator_status_message(epoch_service.clone(), String::new()) + let message = get_aggregator_status_message(epoch_service, String::new(), String::new()) .await .unwrap(); assert_eq!(message.total_stakes_signers, total_stakes_signers); assert_eq!(message.total_next_stakes_signers, total_next_stakes_signers); } + + #[tokio::test] + async fn retrieves_node_version_and_network_from_parameters() { + let epoch_service = FakeEpochServiceBuilder::dummy(Epoch(3)).build(); + let epoch_service = Arc::new(RwLock::new(epoch_service)); + + let message = get_aggregator_status_message( + epoch_service, + "1.0.4".to_string(), + "network".to_string(), + ) + .await + .unwrap(); + + assert_eq!(message.cardano_node_version, "1.0.4"); + assert_eq!(message.cardano_network, "network"); + } } diff --git a/mithril-common/Cargo.toml b/mithril-common/Cargo.toml index 8b1fce85b28..a7ef80fff1a 100644 --- a/mithril-common/Cargo.toml +++ b/mithril-common/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "mithril-common" -version = "0.4.90" +version = "0.4.91" description = "Common types, interfaces, and utilities for Mithril nodes." authors = { workspace = true } edition = { workspace = true } diff --git a/mithril-common/src/messages/aggregator_status.rs b/mithril-common/src/messages/aggregator_status.rs index 3f8fe8c851e..7971bb3f54b 100644 --- a/mithril-common/src/messages/aggregator_status.rs +++ b/mithril-common/src/messages/aggregator_status.rs @@ -14,6 +14,9 @@ pub struct AggregatorStatusMessage { /// Current Cardano era pub cardano_era: CardanoEra, + /// Cardano network + pub cardano_network: String, + /// Current Mithril era pub mithril_era: SupportedEra, @@ -57,6 +60,7 @@ mod tests { const ACTUAL_JSON: &str = r#"{ "epoch": 48, "cardano_era": "conway", + "cardano_network": "mainnet", "mithril_era": "pythagoras", "cardano_node_version": "1.2.3", "aggregator_node_version": "4.5.6", @@ -74,6 +78,7 @@ mod tests { AggregatorStatusMessage { epoch: Epoch(48), cardano_era: "conway".to_string(), + cardano_network: "mainnet".to_string(), mithril_era: SupportedEra::Pythagoras, cardano_node_version: "1.2.3".to_string(), aggregator_node_version: "4.5.6".to_string(), diff --git a/mithril-explorer/package-lock.json b/mithril-explorer/package-lock.json index 027ccdf4c7a..d192ef88507 100644 --- a/mithril-explorer/package-lock.json +++ b/mithril-explorer/package-lock.json @@ -1,12 +1,12 @@ { "name": "mithril-explorer", - "version": "0.7.19", + "version": "0.7.20", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "mithril-explorer", - "version": "0.7.19", + "version": "0.7.20", "dependencies": { "@mithril-dev/mithril-client-wasm": "file:../mithril-client-wasm/dist/web", "@popperjs/core": "^2.11.8", diff --git a/mithril-explorer/package.json b/mithril-explorer/package.json index 20f2e00305b..e0e680d5250 100644 --- a/mithril-explorer/package.json +++ b/mithril-explorer/package.json @@ -1,6 +1,6 @@ { "name": "mithril-explorer", - "version": "0.7.19", + "version": "0.7.20", "private": true, "scripts": { "dev": "next dev", diff --git a/mithril-explorer/src/components/ControlPanel/AggregatorStatus/index.js b/mithril-explorer/src/components/ControlPanel/AggregatorStatus/index.js index 3c11b632408..f76677b7417 100644 --- a/mithril-explorer/src/components/ControlPanel/AggregatorStatus/index.js +++ b/mithril-explorer/src/components/ControlPanel/AggregatorStatus/index.js @@ -31,10 +31,10 @@ function InfoGroupCard({ children, title, ...props }) { ); } -function InfoRow({ label, children, ...props }) { +function InfoRow({ label, children, className, ...props }) { return ( <> -
+
{label}:
@@ -120,10 +120,6 @@ export default function AggregatorStatus({ showContent = true }) { return ((value / total) * 100).toFixed(0); } - function capitalizeFirstLetter(string) { - return string.charAt(0).toUpperCase() + string.slice(1); - } - return fallbackToEpochSetting ? ( @@ -138,11 +134,12 @@ export default function AggregatorStatus({ showContent = true }) {
+ + {aggregatorStatus.cardano_network} + {aggregatorStatus.cardano_era} - - {aggregatorStatus.mithril_era - ? capitalizeFirstLetter(aggregatorStatus.mithril_era) - : ""} + + {aggregatorStatus.mithril_era} diff --git a/openapi.yaml b/openapi.yaml index 3f244a6fbb1..b78d2ba54e3 100644 --- a/openapi.yaml +++ b/openapi.yaml @@ -4,7 +4,7 @@ info: # `mithril-common/src/lib.rs` file. If you plan to update it # here to reflect changes in the API, please also update the constant in the # Rust file. - version: 0.1.37 + version: 0.1.38 title: Mithril Aggregator Server description: | The REST API provided by a Mithril Aggregator Node in a Mithril network. @@ -667,6 +667,7 @@ components: required: - epoch - cardano_era + - cardano_network - mithril_era - cardano_node_version - aggregator_node_version @@ -684,6 +685,9 @@ components: cardano_era: description: Cardano era type: string + cardano_network: + description: Cardano network of the aggregator + type: string mithril_era: description: Mithril era type: string @@ -725,6 +729,7 @@ components: { "epoch": 329, "cardano_era": "Conway", + "cardano_network": "mainnet", "mithril_era": "pythagoras", "cardano_node_version": "1.2.3", "aggregator_node_version": "4.5.6",