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

Commit b382462

Browse files
authored
fix try-on-runtime-upgrade return weight (#14793)
1 parent 94be94b commit b382462

1 file changed

Lines changed: 3 additions & 3 deletions

File tree

frame/support/src/traits/hooks.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -164,13 +164,13 @@ impl OnRuntimeUpgrade for Tuple {
164164
/// that occur.
165165
#[cfg(feature = "try-runtime")]
166166
fn try_on_runtime_upgrade(checks: bool) -> Result<Weight, TryRuntimeError> {
167-
let mut weight = Weight::zero();
167+
let mut cumulative_weight = Weight::zero();
168168

169169
let mut errors = Vec::new();
170170

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

197-
Ok(weight)
197+
Ok(cumulative_weight)
198198
}
199199

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

0 commit comments

Comments
 (0)