Type Alias pallet_broker::migration::MigrateV3ToV4
source · pub type MigrateV3ToV4<T, BlockConversion> = VersionedMigration<3, 4, MigrateToV4Impl<T, BlockConversion>, Pallet<T>, <T as Config>::DbWeight>;
Aliased Type§
struct MigrateV3ToV4<T, BlockConversion> { /* private fields */ }
Trait Implementations
§impl<const FROM: u16, const TO: u16, Inner, Pallet, DbWeight> OnRuntimeUpgrade for VersionedMigration<FROM, TO, Inner, Pallet, DbWeight>where
Inner: UncheckedOnRuntimeUpgrade,
Pallet: GetStorageVersion<InCodeStorageVersion = StorageVersion> + PalletInfoAccess,
DbWeight: Get<RuntimeDbWeight>,
impl<const FROM: u16, const TO: u16, Inner, Pallet, DbWeight> OnRuntimeUpgrade for VersionedMigration<FROM, TO, Inner, Pallet, DbWeight>where
Inner: UncheckedOnRuntimeUpgrade,
Pallet: GetStorageVersion<InCodeStorageVersion = StorageVersion> + PalletInfoAccess,
DbWeight: Get<RuntimeDbWeight>,
Implementation of the OnRuntimeUpgrade
trait for VersionedMigration
.
Its main function is to perform the runtime upgrade in on_runtime_upgrade
only if the on-chain
version of the pallets storage matches From
, and after the upgrade set the on-chain storage to
To
. If the versions do not match, it writes a log notifying the developer that the migration
is a noop.
§fn pre_upgrade() -> Result<Vec<u8>, DispatchError>
fn pre_upgrade() -> Result<Vec<u8>, DispatchError>
Executes pre_upgrade if the migration will run, and wraps the pre_upgrade bytes in
[VersionedPostUpgradeData
] before passing them to post_upgrade, so it knows whether the
migration ran or not.
§fn on_runtime_upgrade() -> Weight
fn on_runtime_upgrade() -> Weight
Executes the versioned runtime upgrade.
First checks if the pallets on-chain storage version matches the version of this upgrade. If
it matches, it calls Inner::on_runtime_upgrade
, updates the on-chain version, and returns
the weight. If it does not match, it writes a log notifying the developer that the migration
is a noop.
§fn post_upgrade(
versioned_post_upgrade_data_bytes: Vec<u8>,
) -> Result<(), DispatchError>
fn post_upgrade( versioned_post_upgrade_data_bytes: Vec<u8>, ) -> Result<(), DispatchError>
Executes Inner::post_upgrade
if the migration just ran.
pre_upgrade passes [VersionedPostUpgradeData::MigrationExecuted
] to post_upgrade if
the migration ran, and [VersionedPostUpgradeData::Noop
] otherwise.
§fn try_on_runtime_upgrade(checks: bool) -> Result<Weight, DispatchError>
fn try_on_runtime_upgrade(checks: bool) -> Result<Weight, DispatchError>
pre_upgrade
->
on_runtime_upgrade
-> post_upgrade
hooks for a migration. Read more