pub trait MigrationStep: Codec + MaxEncodedLen + Default {
    const VERSION: u16;

    // Required methods
    fn max_step_weight() -> Weight;
    fn step(&mut self) -> (IsFinished, Weight);

    // Provided methods
    fn integrity_test(max_block_weight: Weight) { ... }
    fn pre_upgrade_step() -> Result<Vec<u8>, TryRuntimeError> { ... }
    fn post_upgrade_step(_state: Vec<u8>) -> Result<(), TryRuntimeError> { ... }
}
Expand description

A trait that allows to migrate storage from one version to another.

The migration is done in steps. The migration is finished when step() returns IsFinished::Yes.

Required Associated Constants§

source

const VERSION: u16

Returns the version of the migration.

Required Methods§

source

fn max_step_weight() -> Weight

Returns the maximum weight that can be consumed in a single step.

source

fn step(&mut self) -> (IsFinished, Weight)

Process one step of the migration.

Returns whether the migration is finished and the weight consumed.

Provided Methods§

source

fn integrity_test(max_block_weight: Weight)

Verify that the migration step fits into Cursor, and that max_step_weight is not greater than max_block_weight.

source

fn pre_upgrade_step() -> Result<Vec<u8>, TryRuntimeError>

Execute some pre-checks prior to running the first step of this migration.

source

fn post_upgrade_step(_state: Vec<u8>) -> Result<(), TryRuntimeError>

Execute some post-checks after running the last step of this migration.

Implementors§

source§

impl<T, OldCurrency> MigrationStep for pallet_contracts::migration::v14::Migration<T, OldCurrency>where T: Config, OldCurrency: 'static + ReservableCurrency<<T as Config>::AccountId>, <<T as Config>::Currency as Inspect<<T as Config>::AccountId>>::Balance: From<OldCurrency::Balance>,

source§

const VERSION: u16 = 14u16

source§

impl<T: Config> MigrationStep for pallet_contracts::migration::v09::Migration<T>

source§

const VERSION: u16 = 9u16

source§

impl<T: Config> MigrationStep for pallet_contracts::migration::v11::Migration<T>

source§

const VERSION: u16 = 11u16

source§

impl<T: Config> MigrationStep for pallet_contracts::migration::v13::Migration<T>

source§

const VERSION: u16 = 13u16

source§

impl<T: Config> MigrationStep for pallet_contracts::migration::v15::Migration<T>

source§

const VERSION: u16 = 15u16

source§

impl<T: Config, OldCurrency> MigrationStep for pallet_contracts::migration::v10::Migration<T, OldCurrency>where OldCurrency: ReservableCurrency<<T as Config>::AccountId> + Inspect<<T as Config>::AccountId, Balance = <OldCurrency as Currency<<T as Config>::AccountId>>::Balance> + 'static,

source§

const VERSION: u16 = 10u16

source§

impl<T: Config, OldCurrency> MigrationStep for pallet_contracts::migration::v12::Migration<T, OldCurrency>where OldCurrency: ReservableCurrency<<T as Config>::AccountId> + 'static, OldCurrency::Balance: From<<<T as Config>::Currency as Inspect<<T as Config>::AccountId>>::Balance>,

source§

const VERSION: u16 = 12u16