From 3e2533e7aaa1b5d16d77715f5d32e33da8925b4c Mon Sep 17 00:00:00 2001 From: Dino Pacandi Date: Wed, 3 Jul 2024 12:26:07 +0200 Subject: [PATCH 1/2] Add missing storage version setting for Shibuya governance --- runtime/shibuya/src/lib.rs | 41 +++++++++++++++++++++++++++++++++++++- 1 file changed, 40 insertions(+), 1 deletion(-) diff --git a/runtime/shibuya/src/lib.rs b/runtime/shibuya/src/lib.rs index 0a8955618c..84cc74a006 100644 --- a/runtime/shibuya/src/lib.rs +++ b/runtime/shibuya/src/lib.rs @@ -1561,7 +1561,46 @@ pub type Executive = frame_executive::Executive< /// All migrations that will run on the next runtime upgrade. /// /// Once done, migrations should be removed from the tuple. -pub type Migrations = (); +pub type Migrations = (GovernancePalletsVersionSetting,); + +use frame_support::traits::{GetStorageVersion, OnRuntimeUpgrade}; +pub struct GovernancePalletsVersionSetting; +impl OnRuntimeUpgrade for GovernancePalletsVersionSetting { + fn on_runtime_upgrade() -> Weight { + // 1. Membership pallet instances + let membership_storage_version = pallet_membership::Pallet::< + Runtime, + MainCouncilMembershipInst, + >::current_storage_version(); + + membership_storage_version + .put::>(); + membership_storage_version + .put::>(); + membership_storage_version + .put::>(); + + // 2. Collective pallet instances + let collective_storage_version = pallet_collective::Pallet::< + Runtime, + MainCouncilCollectiveInst, + >::current_storage_version(); + + collective_storage_version + .put::>(); + collective_storage_version + .put::>(); + collective_storage_version + .put::>(); + + // 3. Democracy pallet + let democracy_storage_version = + pallet_democracy::Pallet::::current_storage_version(); + democracy_storage_version.put::>(); + + ::DbWeight::get().writes(6) + } +} type EventRecord = frame_system::EventRecord< ::RuntimeEvent, From 083f2773e4d0e24a4c679534a9233122f9253728 Mon Sep 17 00:00:00 2001 From: Dino Pacandi Date: Wed, 3 Jul 2024 12:33:57 +0200 Subject: [PATCH 2/2] Fix sum --- runtime/shibuya/src/lib.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/runtime/shibuya/src/lib.rs b/runtime/shibuya/src/lib.rs index 84cc74a006..3b190a910b 100644 --- a/runtime/shibuya/src/lib.rs +++ b/runtime/shibuya/src/lib.rs @@ -1598,7 +1598,7 @@ impl OnRuntimeUpgrade for GovernancePalletsVersionSetting { pallet_democracy::Pallet::::current_storage_version(); democracy_storage_version.put::>(); - ::DbWeight::get().writes(6) + ::DbWeight::get().writes(7) } }