diff --git a/pallets/flexible-fee/src/migrations/v3.rs b/pallets/flexible-fee/src/migrations/v3.rs index f381014f2..3aee0ee54 100644 --- a/pallets/flexible-fee/src/migrations/v3.rs +++ b/pallets/flexible-fee/src/migrations/v3.rs @@ -116,3 +116,33 @@ impl OnRuntimeUpgrade for MigrateToV3 { Ok(()) } } + +pub struct PolkadotMigrateToV3(sp_std::marker::PhantomData); +impl OnRuntimeUpgrade for PolkadotMigrateToV3 { + fn on_runtime_upgrade() -> frame_support::weights::Weight { + // Check the storage version + let onchain_version = Pallet::::on_chain_storage_version(); + if onchain_version < 3 { + log::info!(target: LOG_TARGET, "In the Polkadot environment, no migration will be performed; only the version number will be updated.."); + + // Update the storage version + StorageVersion::new(3).put::>(); + + // Return the consumed weight + Weight::from(T::DbWeight::get().reads_writes(1, 1)) + } else { + // We don't do anything here. + Weight::zero() + } + } + + #[cfg(feature = "try-runtime")] + fn pre_upgrade() -> Result, TryRuntimeError> { + Ok(sp_std::vec![]) + } + + #[cfg(feature = "try-runtime")] + fn post_upgrade(_cnt: Vec) -> Result<(), TryRuntimeError> { + Ok(()) + } +} diff --git a/runtime/bifrost-polkadot/src/lib.rs b/runtime/bifrost-polkadot/src/lib.rs index 149ad6d0d..dbe2121f4 100644 --- a/runtime/bifrost-polkadot/src/lib.rs +++ b/runtime/bifrost-polkadot/src/lib.rs @@ -1904,6 +1904,7 @@ pub mod migrations { pallet_xcm::migration::MigrateToLatestXcmVersion, bifrost_parachain_staking::migrations::InitGenesisMigration, frame_support::migrations::RemovePallet, + bifrost_flexible_fee::migrations::v3::PolkadotMigrateToV3, ); }