From 0550afd5b2c6a1d750f4b3bd5f18236fe7f2d1ed Mon Sep 17 00:00:00 2001 From: PG Herveou Date: Wed, 17 Dec 2025 16:17:20 +0100 Subject: [PATCH] revive: fix revive post_upgrade assert (#10680) Fix post_upgrade assertion logic in revive v2 migration --------- Co-authored-by: cmd[bot] <41898282+github-actions[bot]@users.noreply.github.com> (cherry picked from commit 95b300fbd8fe043267e0974babbd3960a2e7d1a9) --- prdoc/pr_10680.prdoc | 7 +++++++ substrate/frame/revive/src/migrations/v2.rs | 4 ++-- 2 files changed, 9 insertions(+), 2 deletions(-) create mode 100644 prdoc/pr_10680.prdoc diff --git a/prdoc/pr_10680.prdoc b/prdoc/pr_10680.prdoc new file mode 100644 index 0000000000000..f5befc3724686 --- /dev/null +++ b/prdoc/pr_10680.prdoc @@ -0,0 +1,7 @@ +title: 'revive: fix revive post_upgrade assert' +doc: +- audience: Runtime Dev + description: Fix post_upgrade assertion logic in revive v2 migration +crates: +- name: pallet-revive + bump: patch diff --git a/substrate/frame/revive/src/migrations/v2.rs b/substrate/frame/revive/src/migrations/v2.rs index 803283c6ab343..687adf6a5fd9a 100644 --- a/substrate/frame/revive/src/migrations/v2.rs +++ b/substrate/frame/revive/src/migrations/v2.rs @@ -184,10 +184,10 @@ impl SteppedMigration for Migration { "Migration failed: the number of items in the storage after the migration is not the same as before" ); - let deposit_sum: crate::BalanceOf = Zero::zero(); + let mut deposit_sum: crate::BalanceOf = Zero::zero(); for (code_hash, old_code_info) in prev_map { - deposit_sum.saturating_add(old_code_info.deposit); + deposit_sum = deposit_sum.saturating_add(old_code_info.deposit); Self::assert_migrated_code_info(code_hash, &old_code_info); }