Skip to content

Commit b19074d

Browse files
authored
Merge pull request #571 from input-output-hk/greg/562/database_migration
application version stored in database
2 parents 0bff212 + c5d2dfe commit b19074d

File tree

18 files changed

+1024
-80
lines changed

18 files changed

+1024
-80
lines changed

Cargo.lock

Lines changed: 67 additions & 59 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

mithril-aggregator/Cargo.toml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[package]
22
name = "mithril-aggregator"
3-
version = "0.1.1"
3+
version = "0.1.2"
44
description = "A Mithril Aggregator server"
55
authors = { workspace = true }
66
edition = { workspace = true }
@@ -26,6 +26,7 @@ slog = { version = "2.7.0", features = ["max_level_trace", "release_max_level_de
2626
slog-async = "2.7.0"
2727
slog-bunyan = "2.4.0"
2828
slog-scope = "4.4.0"
29+
sqlite = "0.28"
2930
tar = "0.4.38"
3031
thiserror = "1.0.31"
3132
tokio = { version = "1.17.0", features = ["full"] }

mithril-aggregator/src/command_args.rs

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ use tokio::time::Duration;
1212
use mithril_common::certificate_chain::MithrilCertificateVerifier;
1313
use mithril_common::chain_observer::{CardanoCliRunner, ChainObserver};
1414
use mithril_common::crypto_helper::ProtocolGenesisVerifier;
15+
use mithril_common::database::{ApplicationNodeType, ApplicationVersionChecker};
1516
use mithril_common::digesters::{CardanoImmutableDigester, ImmutableFileSystemObserver};
1617
use mithril_common::entities::{Epoch, HexEncodedGenesisSecretKey};
1718
use mithril_common::store::adapter::SQLiteAdapter;
@@ -36,6 +37,13 @@ fn setup_genesis_dependencies(
3637
config: &GenesisConfiguration,
3738
) -> Result<GenesisToolsDependency, Box<dyn std::error::Error>> {
3839
let sqlite_db_path = Some(config.get_sqlite_file());
40+
ApplicationVersionChecker::new(
41+
slog_scope::logger(),
42+
ApplicationNodeType::Aggregator,
43+
config.get_sqlite_file(),
44+
)
45+
.check(env!("CARGO_PKG_VERSION"))?;
46+
3947
let chain_observer = Arc::new(
4048
mithril_common::chain_observer::CardanoCliChainObserver::new(Box::new(
4149
CardanoCliRunner::new(
@@ -295,12 +303,18 @@ impl ServeCommand {
295303
.try_deserialize()
296304
.map_err(|e| format!("configuration deserialize error: {}", e))?;
297305
debug!("SERVE command"; "config" => format!("{:?}", config));
306+
let sqlite_db_path = Some(config.get_sqlite_file());
307+
ApplicationVersionChecker::new(
308+
slog_scope::logger(),
309+
ApplicationNodeType::Aggregator,
310+
config.get_sqlite_file(),
311+
)
312+
.check(env!("CARGO_PKG_VERSION"))?;
313+
298314
// Init dependencies
299315
let snapshot_store = config.build_snapshot_store()?;
300316
let snapshot_uploader = config.build_snapshot_uploader()?;
301317

302-
let sqlite_db_path = Some(config.get_sqlite_file());
303-
304318
let certificate_pending_store = Arc::new(CertificatePendingStore::new(Box::new(
305319
SQLiteAdapter::new("pending_certificate", sqlite_db_path.clone())?,
306320
)));

mithril-aggregator/src/main.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ async fn main() -> Result<(), Box<dyn Error>> {
2626
let result = args.execute().await;
2727

2828
if result.is_err() {
29-
eprintln!("ERROR: application ends abnormaly.");
29+
eprintln!("ERROR: application ends abnormaly: {:?}", result);
3030
}
3131

3232
result

mithril-common/Cargo.toml

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[package]
22
name = "mithril-common"
3-
version = "0.1.1"
3+
version = "0.1.2"
44
authors = { workspace = true }
55
edition = { workspace = true }
66
documentation = { workspace = true }
@@ -28,14 +28,15 @@ nom = "7.1"
2828
rand-chacha-dalek-compat = { package = "rand_chacha", version = "0.2" }
2929
rand_chacha = "0.3.1"
3030
rand_core = "0.6.3"
31+
semver = "1.0"
3132
serde = { version = "1.0", features = ["derive"] }
3233
serde_bytes = "0.11.7"
3334
serde_cbor = "0.11.2"
3435
serde_json = "1.0"
3536
serde_yaml = "0.9.10"
3637
sha2 = "0.10.2"
3738
slog = { version = "2.7.0", features = ["max_level_trace", "release_max_level_debug"] }
38-
sqlite = "0.27.0"
39+
sqlite = "0.28"
3940
thiserror = "1.0.31"
4041
tokio = { version = "1.17.0", features = ["full"] }
4142
walkdir = "2"

0 commit comments

Comments
 (0)