diff --git a/crates/bin/pd/src/main.rs b/crates/bin/pd/src/main.rs index 7f2ead78ca..35815c7d5a 100644 --- a/crates/bin/pd/src/main.rs +++ b/crates/bin/pd/src/main.rs @@ -19,8 +19,8 @@ use pd::{ join::network_join, }, }; -use penumbra_app::app_version::assert_latest_app_version; -use penumbra_app::SUBSTORE_PREFIXES; +use penumbra_app::app_version::check_and_update_app_version; +use penumbra_app::{APP_VERSION, SUBSTORE_PREFIXES}; use rand::Rng; use rand_core::OsRng; use tendermint_config::net::Address as TendermintAddress; @@ -103,9 +103,10 @@ async fn main() -> anyhow::Result<()> { .context( "Unable to initialize RocksDB storage - is there another `pd` process running?", )?; - assert_latest_app_version(storage.clone()).await?; + check_and_update_app_version(storage.clone()).await?; tracing::info!( + APP_VERSION, ?abci_bind, ?grpc_bind, ?grpc_auto_https, diff --git a/crates/core/app/src/app_version.rs b/crates/core/app/src/app_version.rs index 93ad9afc47..276d64b471 100644 --- a/crates/core/app/src/app_version.rs +++ b/crates/core/app/src/app_version.rs @@ -5,6 +5,6 @@ pub const APP_VERSION: u64 = 8; cfg_if::cfg_if! { if #[cfg(feature="component")] { mod component; - pub use component::{assert_latest_app_version, migrate_app_version}; + pub use component::{check_and_update_app_version, migrate_app_version}; } } diff --git a/crates/core/app/src/app_version/component.rs b/crates/core/app/src/app_version/component.rs index 5111e36fe1..ff38395027 100644 --- a/crates/core/app/src/app_version/component.rs +++ b/crates/core/app/src/app_version/component.rs @@ -26,11 +26,14 @@ enum CheckContext { Migration, } +/// Check that the expected version matches the found version, if it set. +/// This will return an error if the versions do not match. fn check_version(ctx: CheckContext, expected: u64, found: Option) -> anyhow::Result<()> { - let found = match (expected, found) { - (x, Some(y)) if x != y => y, - _ => return Ok(()), - }; + let found = found.unwrap_or(expected); + if found == expected { + return Ok(()); + } + match ctx { CheckContext::Running => { let expected_name = version_to_software_version(expected);