Skip to content
This repository has been archived by the owner on Nov 15, 2023. It is now read-only.

Commit

Permalink
fix try-on-runtime-upgrade return weight (#14793)
Browse files Browse the repository at this point in the history
  • Loading branch information
liamaharon authored Aug 21, 2023
1 parent 94be94b commit b382462
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions frame/support/src/traits/hooks.rs
Original file line number Diff line number Diff line change
Expand Up @@ -164,13 +164,13 @@ impl OnRuntimeUpgrade for Tuple {
/// that occur.
#[cfg(feature = "try-runtime")]
fn try_on_runtime_upgrade(checks: bool) -> Result<Weight, TryRuntimeError> {
let mut weight = Weight::zero();
let mut cumulative_weight = Weight::zero();

let mut errors = Vec::new();

for_tuples!(#(
match Tuple::try_on_runtime_upgrade(checks) {
Ok(weight) => { weight.saturating_add(weight); },
Ok(weight) => { cumulative_weight.saturating_accrue(weight); },
Err(err) => { errors.push(err); },
}
)*);
Expand All @@ -194,7 +194,7 @@ impl OnRuntimeUpgrade for Tuple {
return Err("Detected multiple errors while executing `try_on_runtime_upgrade`, check the logs!".into())
}

Ok(weight)
Ok(cumulative_weight)
}

/// [`OnRuntimeUpgrade::pre_upgrade`] should not be used on a tuple.
Expand Down

0 comments on commit b382462

Please sign in to comment.