Skip to content

Commit

Permalink
Improve log messages
Browse files Browse the repository at this point in the history
  • Loading branch information
dmitrylavrenov committed Nov 8, 2024
1 parent ebeb35f commit f6884d7
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions crates/humanode-runtime/src/init_storage_version.rs
Original file line number Diff line number Diff line change
Expand Up @@ -27,13 +27,22 @@ where
let mut weight = R::DbWeight::get().reads(1);

if onchain_storage_version == 0 && current_storage_version != 0 {
info!(
"{}: Initializing onchain storage version to {:?}",
P::name(),
current_storage_version,
);

// Set new storage version.
current_storage_version.put::<P>();

// Write the onchain storage version.
weight = weight.saturating_add(R::DbWeight::get().writes(1));
} else {
info!("Nothing to do. This runtime upgrade probably should be removed");
info!(
"{}: Nothing to do. This runtime upgrade probably should be removed.",
P::name(),
);
}

weight
Expand All @@ -48,7 +57,6 @@ where
#[cfg(feature = "try-runtime")]
fn post_upgrade(_state: Vec<u8>) -> Result<(), &'static str> {
assert_eq!(P::on_chain_storage_version(), P::current_storage_version());

Ok(())
}
}

0 comments on commit f6884d7

Please sign in to comment.