referrerpolicy=no-referrer-when-downgrade
polkadot_runtime_parachains::inclusion::migration

Type Alias MigrateToV1

Source
pub type MigrateToV1<T> = VersionedMigration<0, 1, VersionUncheckedMigrateToV1<T>, Pallet<T>, <T as Config>::DbWeight>;
Expand description

Migrate to v1 inclusion module storage.

  • merges the PendingAvailabilityCommitments into the CandidatePendingAvailability storage
  • removes the AvailabilityBitfields storage, which was never read.

Aliased Type§

struct MigrateToV1<T> { /* 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>,

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>

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

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>

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>

The expected and default behavior of this method is to handle executing pre_upgrade -> on_runtime_upgrade -> post_upgrade hooks for a migration. Read more