referrerpolicy=no-referrer-when-downgrade

Trait pallet_contracts::migration::MigrateSequence

source ·
pub trait MigrateSequence: Sealed {
    const VERSION_RANGE: (u16, u16);

    // Required methods
    fn new(version: StorageVersion) -> Cursor;
    fn steps(
        version: StorageVersion,
        cursor: &[u8],
        meter: &mut WeightMeter,
    ) -> StepResult;
    fn integrity_test(max_block_weight: Weight);

    // Provided methods
    fn pre_upgrade_step(
        _version: StorageVersion,
    ) -> Result<Vec<u8>, TryRuntimeError> { ... }
    fn post_upgrade_step(
        _version: StorageVersion,
        _state: Vec<u8>,
    ) -> Result<(), TryRuntimeError> { ... }
    fn is_upgrade_supported(
        in_storage: StorageVersion,
        target: StorageVersion,
    ) -> bool { ... }
}
Expand description

Defines a sequence of migrations.

The sequence must be defined by a tuple of migrations, each of which must implement the MigrationStep trait. Migrations must be ordered by their versions with no gaps.

Required Associated Constants§

source

const VERSION_RANGE: (u16, u16)

Returns the range of versions that this migrations sequence can handle. Migrations must be ordered by their versions with no gaps.

The following code will fail to compile:

	let _ = <(NoopMigration<1>, NoopMigration<3>)>::VERSION_RANGE;

The following code will compile:

	let _ = <(NoopMigration<1>, NoopMigration<2>)>::VERSION_RANGE;

Required Methods§

source

fn new(version: StorageVersion) -> Cursor

Returns the default cursor for the given version.

source

fn steps( version: StorageVersion, cursor: &[u8], meter: &mut WeightMeter, ) -> StepResult

Execute the migration step until the available weight is consumed.

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.

Provided Methods§

source

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

source

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

source

fn is_upgrade_supported( in_storage: StorageVersion, target: StorageVersion, ) -> bool

Returns whether migrating from in_storage to target is supported.

A migration is supported if VERSION_RANGE is (in_storage + 1, target).

Object Safety§

This trait is not object safe.

Implementations on Foreign Types§

source§

impl MigrateSequence for ()

source§

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

Execute the pre-checks of the step associated with this version.

source§

fn post_upgrade_step( version: StorageVersion, state: Vec<u8>, ) -> Result<(), TryRuntimeError>

Execute the post-checks of the step associated with this version.

source§

const VERSION_RANGE: (u16, u16) = _

source§

fn new(version: StorageVersion) -> Cursor

source§

fn steps( version: StorageVersion, cursor: &[u8], meter: &mut WeightMeter, ) -> StepResult

source§

fn integrity_test(max_block_weight: Weight)

source§

impl<TupleElement0: MigrationStep> MigrateSequence for (TupleElement0,)

source§

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

Execute the pre-checks of the step associated with this version.

source§

fn post_upgrade_step( version: StorageVersion, state: Vec<u8>, ) -> Result<(), TryRuntimeError>

Execute the post-checks of the step associated with this version.

source§

const VERSION_RANGE: (u16, u16) = _

source§

fn new(version: StorageVersion) -> Cursor

source§

fn steps( version: StorageVersion, cursor: &[u8], meter: &mut WeightMeter, ) -> StepResult

source§

fn integrity_test(max_block_weight: Weight)

source§

impl<TupleElement0: MigrationStep, TupleElement1: MigrationStep> MigrateSequence for (TupleElement0, TupleElement1)

source§

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

Execute the pre-checks of the step associated with this version.

source§

fn post_upgrade_step( version: StorageVersion, state: Vec<u8>, ) -> Result<(), TryRuntimeError>

Execute the post-checks of the step associated with this version.

source§

const VERSION_RANGE: (u16, u16) = _

source§

fn new(version: StorageVersion) -> Cursor

source§

fn steps( version: StorageVersion, cursor: &[u8], meter: &mut WeightMeter, ) -> StepResult

source§

fn integrity_test(max_block_weight: Weight)

source§

impl<TupleElement0: MigrationStep, TupleElement1: MigrationStep, TupleElement2: MigrationStep> MigrateSequence for (TupleElement0, TupleElement1, TupleElement2)

source§

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

Execute the pre-checks of the step associated with this version.

source§

fn post_upgrade_step( version: StorageVersion, state: Vec<u8>, ) -> Result<(), TryRuntimeError>

Execute the post-checks of the step associated with this version.

source§

const VERSION_RANGE: (u16, u16) = _

source§

fn new(version: StorageVersion) -> Cursor

source§

fn steps( version: StorageVersion, cursor: &[u8], meter: &mut WeightMeter, ) -> StepResult

source§

fn integrity_test(max_block_weight: Weight)

source§

impl<TupleElement0: MigrationStep, TupleElement1: MigrationStep, TupleElement2: MigrationStep, TupleElement3: MigrationStep> MigrateSequence for (TupleElement0, TupleElement1, TupleElement2, TupleElement3)

source§

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

Execute the pre-checks of the step associated with this version.

source§

fn post_upgrade_step( version: StorageVersion, state: Vec<u8>, ) -> Result<(), TryRuntimeError>

Execute the post-checks of the step associated with this version.

source§

const VERSION_RANGE: (u16, u16) = _

source§

fn new(version: StorageVersion) -> Cursor

source§

fn steps( version: StorageVersion, cursor: &[u8], meter: &mut WeightMeter, ) -> StepResult

source§

fn integrity_test(max_block_weight: Weight)

source§

impl<TupleElement0: MigrationStep, TupleElement1: MigrationStep, TupleElement2: MigrationStep, TupleElement3: MigrationStep, TupleElement4: MigrationStep> MigrateSequence for (TupleElement0, TupleElement1, TupleElement2, TupleElement3, TupleElement4)

source§

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

Execute the pre-checks of the step associated with this version.

source§

fn post_upgrade_step( version: StorageVersion, state: Vec<u8>, ) -> Result<(), TryRuntimeError>

Execute the post-checks of the step associated with this version.

source§

const VERSION_RANGE: (u16, u16) = _

source§

fn new(version: StorageVersion) -> Cursor

source§

fn steps( version: StorageVersion, cursor: &[u8], meter: &mut WeightMeter, ) -> StepResult

source§

fn integrity_test(max_block_weight: Weight)

source§

impl<TupleElement0: MigrationStep, TupleElement1: MigrationStep, TupleElement2: MigrationStep, TupleElement3: MigrationStep, TupleElement4: MigrationStep, TupleElement5: MigrationStep> MigrateSequence for (TupleElement0, TupleElement1, TupleElement2, TupleElement3, TupleElement4, TupleElement5)

source§

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

Execute the pre-checks of the step associated with this version.

source§

fn post_upgrade_step( version: StorageVersion, state: Vec<u8>, ) -> Result<(), TryRuntimeError>

Execute the post-checks of the step associated with this version.

source§

const VERSION_RANGE: (u16, u16) = _

source§

fn new(version: StorageVersion) -> Cursor

source§

fn steps( version: StorageVersion, cursor: &[u8], meter: &mut WeightMeter, ) -> StepResult

source§

fn integrity_test(max_block_weight: Weight)

source§

impl<TupleElement0: MigrationStep, TupleElement1: MigrationStep, TupleElement2: MigrationStep, TupleElement3: MigrationStep, TupleElement4: MigrationStep, TupleElement5: MigrationStep, TupleElement6: MigrationStep> MigrateSequence for (TupleElement0, TupleElement1, TupleElement2, TupleElement3, TupleElement4, TupleElement5, TupleElement6)

source§

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

Execute the pre-checks of the step associated with this version.

source§

fn post_upgrade_step( version: StorageVersion, state: Vec<u8>, ) -> Result<(), TryRuntimeError>

Execute the post-checks of the step associated with this version.

source§

const VERSION_RANGE: (u16, u16) = _

source§

fn new(version: StorageVersion) -> Cursor

source§

fn steps( version: StorageVersion, cursor: &[u8], meter: &mut WeightMeter, ) -> StepResult

source§

fn integrity_test(max_block_weight: Weight)

source§

impl<TupleElement0: MigrationStep, TupleElement1: MigrationStep, TupleElement2: MigrationStep, TupleElement3: MigrationStep, TupleElement4: MigrationStep, TupleElement5: MigrationStep, TupleElement6: MigrationStep, TupleElement7: MigrationStep> MigrateSequence for (TupleElement0, TupleElement1, TupleElement2, TupleElement3, TupleElement4, TupleElement5, TupleElement6, TupleElement7)

source§

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

Execute the pre-checks of the step associated with this version.

source§

fn post_upgrade_step( version: StorageVersion, state: Vec<u8>, ) -> Result<(), TryRuntimeError>

Execute the post-checks of the step associated with this version.

source§

const VERSION_RANGE: (u16, u16) = _

source§

fn new(version: StorageVersion) -> Cursor

source§

fn steps( version: StorageVersion, cursor: &[u8], meter: &mut WeightMeter, ) -> StepResult

source§

fn integrity_test(max_block_weight: Weight)

source§

impl<TupleElement0: MigrationStep, TupleElement1: MigrationStep, TupleElement2: MigrationStep, TupleElement3: MigrationStep, TupleElement4: MigrationStep, TupleElement5: MigrationStep, TupleElement6: MigrationStep, TupleElement7: MigrationStep, TupleElement8: MigrationStep> MigrateSequence for (TupleElement0, TupleElement1, TupleElement2, TupleElement3, TupleElement4, TupleElement5, TupleElement6, TupleElement7, TupleElement8)

source§

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

Execute the pre-checks of the step associated with this version.

source§

fn post_upgrade_step( version: StorageVersion, state: Vec<u8>, ) -> Result<(), TryRuntimeError>

Execute the post-checks of the step associated with this version.

source§

const VERSION_RANGE: (u16, u16) = _

source§

fn new(version: StorageVersion) -> Cursor

source§

fn steps( version: StorageVersion, cursor: &[u8], meter: &mut WeightMeter, ) -> StepResult

source§

fn integrity_test(max_block_weight: Weight)

source§

impl<TupleElement0: MigrationStep, TupleElement1: MigrationStep, TupleElement2: MigrationStep, TupleElement3: MigrationStep, TupleElement4: MigrationStep, TupleElement5: MigrationStep, TupleElement6: MigrationStep, TupleElement7: MigrationStep, TupleElement8: MigrationStep, TupleElement9: MigrationStep> MigrateSequence for (TupleElement0, TupleElement1, TupleElement2, TupleElement3, TupleElement4, TupleElement5, TupleElement6, TupleElement7, TupleElement8, TupleElement9)

source§

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

Execute the pre-checks of the step associated with this version.

source§

fn post_upgrade_step( version: StorageVersion, state: Vec<u8>, ) -> Result<(), TryRuntimeError>

Execute the post-checks of the step associated with this version.

source§

const VERSION_RANGE: (u16, u16) = _

source§

fn new(version: StorageVersion) -> Cursor

source§

fn steps( version: StorageVersion, cursor: &[u8], meter: &mut WeightMeter, ) -> StepResult

source§

fn integrity_test(max_block_weight: Weight)

Implementors§