diff --git a/runtime/common/src/lib.rs b/runtime/common/src/lib.rs index 24858cefd4..b60e9580d6 100644 --- a/runtime/common/src/lib.rs +++ b/runtime/common/src/lib.rs @@ -58,7 +58,6 @@ use sp_std::{cmp::Ordering, marker::PhantomData, prelude::*}; pub use types::*; pub mod constants; -pub mod migration; mod weights; pub mod xcm_config; diff --git a/runtime/common/src/migration.rs b/runtime/common/src/migration.rs deleted file mode 100644 index 8b05ed895f..0000000000 --- a/runtime/common/src/migration.rs +++ /dev/null @@ -1,115 +0,0 @@ -use crate::{config::orml_asset_registry::StringLimit, Balance, TokenId}; -use frame_support::{ - traits::{Get, GetStorageVersion, OnRuntimeUpgrade, StorageVersion}, - weights::Weight, -}; -use log::info; -use mangata_types::assets::CustomMetadata; -use sp_std::marker::PhantomData; - -pub struct PalletsVersionsAlignment(PhantomData); - -impl OnRuntimeUpgrade for PalletsVersionsAlignment -where - T: orml_asset_registry::Config, - T: orml_tokens::Config, - T: pallet_maintenance::Config, - T: orml_unknown_tokens::Config, - T: pallet_xcm::Config, - T: pallet_bootstrap::Config, - T: pallet_crowdloan_rewards::Config, - T: pallet_fee_lock::Config, - T: cumulus_pallet_dmp_queue::Config, - T: cumulus_pallet_xcmp_queue::Config, -{ - fn on_runtime_upgrade() -> Weight { - info!( - target: "migration::versions-alignment", - "on_runtime_upgrade: Attempted to apply AssetRegistry migration" - ); - - let mut reads = 0; - let mut writes = 0; - - // Maintanance -> 0 - // currently set to null that defaults to 0 - StorageVersion::new(0).put::>(); - writes += 1; - - // AssetRegistry -> 2 - if orml_asset_registry::Pallet::::on_chain_storage_version() == 2 { - info!(target: "migration::asset-registry", "No migration applied, remove"); - reads += 1; - } else { - info!(target: "migration::asset-registry", "Migration applied"); - StorageVersion::new(2).put::>(); - reads += 1; - writes += 1; - }; - - //UnknwonTokens -> 2 - if orml_unknown_tokens::Pallet::::on_chain_storage_version() == 2 { - info!(target: "migration::unknown-tokens", "No migration applied, remove"); - reads += 1; - } else { - info!(target: "migration::unknown-tokens", "Migration applied"); - StorageVersion::new(2).put::>(); - reads += 1; - writes += 1; - }; - - // PolkadotXcm -> 1 - if pallet_xcm::Pallet::::on_chain_storage_version() == 1 { - info!(target: "migration::pallet_xcm", "No migration applied, remove"); - reads += 1; - } else { - info!(target: "migration::pallet_xcm", "Migration applied"); - StorageVersion::new(1).put::>(); - reads += 1; - writes += 1; - }; - - // Bootstrap -> 2 - if pallet_bootstrap::Pallet::::on_chain_storage_version() == 2 { - info!(target: "migration::pallet_bootstrap", "No migration applied, remove"); - reads += 1; - } else { - info!(target: "migration::pallet_bootstrap", "Migration applied"); - StorageVersion::new(2).put::>(); - reads += 1; - writes += 1; - }; - - // Crowdloan -> 1 - if pallet_crowdloan_rewards::Pallet::::on_chain_storage_version() == 1 { - info!(target: "migration::pallet_crowdloan_rewards", "No migration applied, remove"); - reads += 1; - } else { - info!(target: "migration::pallet_crowdloan_rewards", "Migration applied"); - StorageVersion::new(1).put::>(); - reads += 1; - writes += 1; - }; - - // FeeLock -> 0 - // currently set to null that defaults to 0 - StorageVersion::new(0).put::>(); - writes += 1; - - T::DbWeight::get().reads_writes(reads, writes) - } - - #[cfg(feature = "try-runtime")] - fn post_upgrade(_state: sp_std::vec::Vec) -> Result<(), sp_runtime::TryRuntimeError> { - assert_eq!(orml_asset_registry::Pallet::::on_chain_storage_version(), 2); - assert_eq!(pallet_maintenance::Pallet::::on_chain_storage_version(), 0); - assert_eq!(orml_unknown_tokens::Pallet::::on_chain_storage_version(), 2); - assert_eq!(pallet_bootstrap::Pallet::::on_chain_storage_version(), 2); - assert_eq!(pallet_crowdloan_rewards::Pallet::::on_chain_storage_version(), 1); - assert_eq!(pallet_fee_lock::Pallet::::on_chain_storage_version(), 0); - assert_eq!(cumulus_pallet_dmp_queue::Pallet::::on_chain_storage_version(), 2); - assert_eq!(cumulus_pallet_xcmp_queue::Pallet::::on_chain_storage_version(), 3); - assert_eq!(pallet_xcm::Pallet::::on_chain_storage_version(), 1); - Ok(()) - } -} diff --git a/runtime/mangata-kusama/src/lib.rs b/runtime/mangata-kusama/src/lib.rs index c9236454ce..e4717d3d2d 100644 --- a/runtime/mangata-kusama/src/lib.rs +++ b/runtime/mangata-kusama/src/lib.rs @@ -80,7 +80,7 @@ pub type Executive = frame_executive::Executive< Migrations, >; -type Migrations = (common_runtime::migration::PalletsVersionsAlignment,); +type Migrations = (); /// Opaque types. These are used by the CLI to instantiate machinery that don't need to know /// the specifics of the runtime. They can then be made to be agnostic over specific formats @@ -107,10 +107,10 @@ pub const VERSION: RuntimeVersion = RuntimeVersion { spec_name: create_runtime_str!("mangata-parachain"), impl_name: create_runtime_str!("mangata-parachain"), authoring_version: 15, - spec_version: 003200, + spec_version: 003400, impl_version: 0, apis: RUNTIME_API_VERSIONS, - transaction_version: 003200, + transaction_version: 003400, state_version: 0, }; diff --git a/runtime/mangata-rococo/src/lib.rs b/runtime/mangata-rococo/src/lib.rs index c8e4f36609..b0cd6b06d0 100644 --- a/runtime/mangata-rococo/src/lib.rs +++ b/runtime/mangata-rococo/src/lib.rs @@ -82,7 +82,7 @@ pub type Executive = frame_executive::Executive< Migrations, >; -type Migrations = (common_runtime::migration::PalletsVersionsAlignment,); +type Migrations = (); /// Opaque types. These are used by the CLI to instantiate machinery that don't need to know /// the specifics of the runtime. They can then be made to be agnostic over specific formats @@ -110,10 +110,10 @@ pub const VERSION: RuntimeVersion = RuntimeVersion { impl_name: create_runtime_str!("mangata-parachain"), authoring_version: 14, - spec_version: 003200, + spec_version: 003400, impl_version: 0, apis: RUNTIME_API_VERSIONS, - transaction_version: 003200, + transaction_version: 003400, state_version: 0, };