mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-05-30 18:41:03 +00:00
Ensure all StorageVersions on Rococo/Westend are correct and migration hooks pass (#7251)
* set fastunstake storage version * fix configration migration hooks * set missing rococo versions * remove child bounties version set * future proof this configuration migration * simplify rococo migration * simplify westend version migration * typo * restore missing comments * set configuration storage version correctly * remove redundant preupgrade version check * fix version checks * remove redundant comment
This commit is contained in:
@@ -473,8 +473,20 @@ impl WeightInfo for TestWeightInfo {
|
||||
pub mod pallet {
|
||||
use super::*;
|
||||
|
||||
/// The current storage version.
|
||||
///
|
||||
/// v0-v1: <https://github.com/paritytech/polkadot/pull/3575>
|
||||
/// v1-v2: <https://github.com/paritytech/polkadot/pull/4420>
|
||||
/// v2-v3: <https://github.com/paritytech/polkadot/pull/6091>
|
||||
/// v3-v4: <https://github.com/paritytech/polkadot/pull/6345>
|
||||
/// v4-v5: <https://github.com/paritytech/polkadot/pull/6937>
|
||||
/// + <https://github.com/paritytech/polkadot/pull/6961>
|
||||
/// + <https://github.com/paritytech/polkadot/pull/6934>
|
||||
/// v5-v6: <https://github.com/paritytech/polkadot/pull/6271> (remove UMP dispatch queue)
|
||||
const STORAGE_VERSION: StorageVersion = StorageVersion::new(6);
|
||||
|
||||
#[pallet::pallet]
|
||||
#[pallet::storage_version(migration::STORAGE_VERSION)]
|
||||
#[pallet::storage_version(STORAGE_VERSION)]
|
||||
#[pallet::without_storage_info]
|
||||
pub struct Pallet<T>(_);
|
||||
|
||||
|
||||
@@ -16,20 +16,7 @@
|
||||
|
||||
//! A module that is responsible for migration of storage.
|
||||
|
||||
use frame_support::traits::StorageVersion;
|
||||
use primitives::ExecutorParams;
|
||||
|
||||
/// The current storage version.
|
||||
///
|
||||
/// v0-v1: <https://github.com/paritytech/polkadot/pull/3575>
|
||||
/// v1-v2: <https://github.com/paritytech/polkadot/pull/4420>
|
||||
/// v2-v3: <https://github.com/paritytech/polkadot/pull/6091>
|
||||
/// v3-v4: <https://github.com/paritytech/polkadot/pull/6345>
|
||||
/// v4-v5: <https://github.com/paritytech/polkadot/pull/6937>
|
||||
/// + <https://github.com/paritytech/polkadot/pull/6961>
|
||||
/// + <https://github.com/paritytech/polkadot/pull/6934>
|
||||
/// v5-v6: <https://github.com/paritytech/polkadot/pull/6271> (remove UMP dispatch queue)
|
||||
pub const STORAGE_VERSION: StorageVersion = StorageVersion::new(6);
|
||||
|
||||
pub mod v5;
|
||||
pub mod v6;
|
||||
|
||||
@@ -262,8 +262,6 @@ impl<T: Config> OnRuntimeUpgrade for MigrateToV5<T> {
|
||||
#[cfg(feature = "try-runtime")]
|
||||
fn pre_upgrade() -> Result<Vec<u8>, sp_runtime::TryRuntimeError> {
|
||||
log::trace!(target: crate::configuration::LOG_TARGET, "Running pre_upgrade()");
|
||||
|
||||
ensure!(StorageVersion::get::<Pallet<T>>() == 4, "The migration requires version 4");
|
||||
Ok(Vec::new())
|
||||
}
|
||||
|
||||
@@ -285,8 +283,8 @@ impl<T: Config> OnRuntimeUpgrade for MigrateToV5<T> {
|
||||
fn post_upgrade(_state: Vec<u8>) -> Result<(), sp_runtime::TryRuntimeError> {
|
||||
log::trace!(target: crate::configuration::LOG_TARGET, "Running post_upgrade()");
|
||||
ensure!(
|
||||
StorageVersion::get::<Pallet<T>>() == 5,
|
||||
"Storage version should be 5 after the migration"
|
||||
StorageVersion::get::<Pallet<T>>() >= 5,
|
||||
"Storage version should be greater or equal to 5 after the migration"
|
||||
);
|
||||
|
||||
Ok(())
|
||||
|
||||
@@ -61,8 +61,6 @@ impl<T: Config> OnRuntimeUpgrade for MigrateToV6<T> {
|
||||
#[cfg(feature = "try-runtime")]
|
||||
fn pre_upgrade() -> Result<Vec<u8>, sp_runtime::TryRuntimeError> {
|
||||
log::trace!(target: crate::configuration::LOG_TARGET, "Running pre_upgrade()");
|
||||
|
||||
ensure!(StorageVersion::get::<Pallet<T>>() == 5, "The migration requires version 4");
|
||||
Ok(Vec::new())
|
||||
}
|
||||
|
||||
@@ -84,8 +82,8 @@ impl<T: Config> OnRuntimeUpgrade for MigrateToV6<T> {
|
||||
fn post_upgrade(_state: Vec<u8>) -> Result<(), sp_runtime::TryRuntimeError> {
|
||||
log::trace!(target: crate::configuration::LOG_TARGET, "Running post_upgrade()");
|
||||
ensure!(
|
||||
StorageVersion::get::<Pallet<T>>() == 6,
|
||||
"Storage version should be 6 after the migration"
|
||||
StorageVersion::get::<Pallet<T>>() >= 6,
|
||||
"Storage version should be >= 6 after the migration"
|
||||
);
|
||||
|
||||
Ok(())
|
||||
|
||||
Reference in New Issue
Block a user