diff --git a/substrate/frame/bounties/src/lib.rs b/substrate/frame/bounties/src/lib.rs index e7a3e2053c065795806a98ab2c3ad7dc7e7dc06f..14f7b45cb9aa19f25559ebdcb9d31734ed0e29ff 100644 --- a/substrate/frame/bounties/src/lib.rs +++ b/substrate/frame/bounties/src/lib.rs @@ -187,7 +187,10 @@ pub trait ChildBountyManager<Balance> { pub mod pallet { use super::*; + const STORAGE_VERSION: StorageVersion = StorageVersion::new(4); + #[pallet::pallet] + #[pallet::storage_version(STORAGE_VERSION)] pub struct Pallet<T, I = ()>(_); #[pallet::config] diff --git a/substrate/frame/support/procedural/src/pallet/expand/hooks.rs b/substrate/frame/support/procedural/src/pallet/expand/hooks.rs index df07040b82b1da89f0c4bcac785ed52fb55ab745..d7d8bbded95d6c2c3271f6bfe40bf30e7a30e55a 100644 --- a/substrate/frame/support/procedural/src/pallet/expand/hooks.rs +++ b/substrate/frame/support/procedural/src/pallet/expand/hooks.rs @@ -121,7 +121,7 @@ pub fn expand_hooks(def: &mut Def) -> proc_macro2::TokenStream { #frame_support::log::error!( target: #frame_support::LOG_TARGET, - "{}: On chain storage version {:?} is set to non zero,\ + "{}: On chain storage version {:?} is set to non zero, \ while the pallet is missing the `#[pallet::storage_version(VERSION)]` attribute.", pallet_name, on_chain_version, diff --git a/substrate/frame/support/src/traits/hooks.rs b/substrate/frame/support/src/traits/hooks.rs index 5fea98ee036b5e140c9475e1df1fd75e529875ec..a4c6776572face79db2d2f4e9c21d3d7a0f4e39c 100644 --- a/substrate/frame/support/src/traits/hooks.rs +++ b/substrate/frame/support/src/traits/hooks.rs @@ -203,7 +203,35 @@ impl OnRuntimeUpgrade for Tuple { #[cfg(feature = "try-runtime")] fn try_on_runtime_upgrade(checks: bool) -> Result<Weight, &'static str> { let mut weight = Weight::zero(); - for_tuples!( #( weight = weight.saturating_add(Tuple::try_on_runtime_upgrade(checks)?); )* ); + + let mut errors = Vec::new(); + + for_tuples!(#( + match Tuple::try_on_runtime_upgrade(checks) { + Ok(weight) => { weight.saturating_add(weight); }, + Err(err) => { errors.push(err); }, + } + )*); + + if errors.len() == 1 { + return Err(errors[0]) + } else if !errors.is_empty() { + log::error!( + target: "try-runtime", + "Detected multiple errors while executing `try_on_runtime_upgrade`:", + ); + + errors.iter().for_each(|err| { + log::error!( + target: "try-runtime", + "{}", + err + ); + }); + + return Err("Detected multiple errors while executing `try_on_runtime_upgrade`, check the logs!") + } + Ok(weight) } }