Skip to content
This repository has been archived by the owner on May 21, 2024. It is now read-only.

Commit

Permalink
Fix Uniques pallet's on-chain storage version (currently 0, but shoul…
Browse files Browse the repository at this point in the history
…d be 1).
  • Loading branch information
Steve Degosserie committed Dec 30, 2023
1 parent 4e41b8e commit bd689f8
Showing 1 changed file with 26 additions and 1 deletion.
27 changes: 26 additions & 1 deletion runtime/trappist/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -122,14 +122,39 @@ type EventRecord = frame_system::EventRecord<
<Runtime as frame_system::Config>::Hash,
>;

pub struct FixStorageVersions;

impl frame_support::traits::OnRuntimeUpgrade for FixStorageVersions {
fn on_runtime_upgrade() -> Weight {
use frame_support::traits::{GetStorageVersion, StorageVersion};
use sp_runtime::traits::Saturating;

let mut writes = 0;

/// trappist-rococo runtime v.11000 has an incorrect on-chain storage version of 0 for the Uniques pallet
/// Set the Uniques pallet's storage version to 1 as expected.
if Uniques::on_chain_storage_version() == StorageVersion::new(0) {
Uniques::current_storage_version().put::<Uniques>();
writes.saturating_inc();
}

<Runtime as frame_system::Config>::DbWeight::get().reads_writes(4, writes)
}
}

pub type Migrations = (
pallet_contracts::Migration<Runtime>,
FixStorageVersions,
);

/// Executive: handles dispatch to the various modules.
pub type Executive = frame_executive::Executive<
Runtime,
Block,
frame_system::ChainContext<Runtime>,
Runtime,
AllPalletsWithSystem,
pallet_contracts::Migration<Runtime>,
Migrations,
>;

impl_opaque_keys! {
Expand Down

0 comments on commit bd689f8

Please sign in to comment.