Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add missing storage version setting for Shibuya governance #1286

Merged
merged 2 commits into from
Jul 3, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
41 changes: 40 additions & 1 deletion runtime/shibuya/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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::<pallet_membership::Pallet<Runtime, MainCouncilMembershipInst>>();
membership_storage_version
.put::<pallet_membership::Pallet<Runtime, TechnicalCommitteeCollectiveInst>>();
membership_storage_version
.put::<pallet_membership::Pallet<Runtime, CommunityCouncilMembershipInst>>();

// 2. Collective pallet instances
let collective_storage_version = pallet_collective::Pallet::<
Runtime,
MainCouncilCollectiveInst,
>::current_storage_version();

collective_storage_version
.put::<pallet_collective::Pallet<Runtime, MainCouncilCollectiveInst>>();
collective_storage_version
.put::<pallet_collective::Pallet<Runtime, TechnicalCommitteeCollectiveInst>>();
collective_storage_version
.put::<pallet_collective::Pallet<Runtime, CommunityCouncilCollectiveInst>>();

// 3. Democracy pallet
let democracy_storage_version =
pallet_democracy::Pallet::<Runtime>::current_storage_version();
democracy_storage_version.put::<pallet_democracy::Pallet<Runtime>>();

<Runtime as frame_system::Config>::DbWeight::get().writes(7)
}
}

type EventRecord = frame_system::EventRecord<
<Runtime as frame_system::Config>::RuntimeEvent,
Expand Down
Loading