mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-04-26 18:07:58 +00:00
Improve try-runtime::on_runtime_upgrade and fix some storage version issues (#14083)
We now run all `try_on_runtime_upgrade` and collect the errors, instead of bailing on the first error. This makes it easier to see directly all the things that are failing instead of fixing one, recompiling and then checking the next one. Then this pr also sets the correct storage version for `pallet-bounties` that was already correctly set in the storage with the appropriate migration.
This commit is contained in:
@@ -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)
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user