pub trait OnRuntimeUpgrade {
    fn on_runtime_upgrade() -> Weight { ... }
    fn try_on_runtime_upgrade(checks: bool) -> Result<Weight, &'static str> { ... }
    fn pre_upgrade() -> Result<Vec<u8>, &'static str> { ... }
    fn post_upgrade(_state: Vec<u8>) -> Result<(), &'static str> { ... }
}
Expand description

The runtime upgrade trait.

Implementing this lets you express what should happen when the runtime upgrades, and changes may need to occur to your module.

Provided Methods

Perform a module upgrade.

Warning

This function will be called before we initialized any runtime state, aka on_initialize wasn’t called yet. So, information like the block number and any other block local data are not accessible.

Return the non-negotiable weight consumed for runtime upgrade.

Same as on_runtime_upgrade, but perform the optional pre_upgrade and post_upgrade as well.

Execute some pre-checks prior to a runtime upgrade.

Return a Vec<u8> that can contain arbitrary encoded data (usually some pre-upgrade state), which will be passed to post_upgrade after upgrading for post-check. An empty vector should be returned if there is no such need.

This hook is never meant to be executed on-chain but is meant to be used by testing tools.

This hook must not write to any state, as it would make the main on_runtime_upgrade path inaccurate.

Execute some post-checks after a runtime upgrade.

The state parameter is the Vec<u8> returned by pre_upgrade before upgrading, which can be used for post-check. NOTE: if pre_upgrade is not implemented an empty vector will be passed in, in such case post_upgrade should ignore it.

This hook is never meant to be executed on-chain but is meant to be used by testing tools.

This hook must not write to any state, as it would make the main on_runtime_upgrade path inaccurate.

Implementations on Foreign Types

We are executing pre- and post-checks sequentially in order to be able to test several consecutive migrations for the same pallet without errors. Therefore pre and post upgrade hooks for tuples are a noop.

We are executing pre- and post-checks sequentially in order to be able to test several consecutive migrations for the same pallet without errors. Therefore pre and post upgrade hooks for tuples are a noop.

We are executing pre- and post-checks sequentially in order to be able to test several consecutive migrations for the same pallet without errors. Therefore pre and post upgrade hooks for tuples are a noop.

We are executing pre- and post-checks sequentially in order to be able to test several consecutive migrations for the same pallet without errors. Therefore pre and post upgrade hooks for tuples are a noop.

We are executing pre- and post-checks sequentially in order to be able to test several consecutive migrations for the same pallet without errors. Therefore pre and post upgrade hooks for tuples are a noop.

We are executing pre- and post-checks sequentially in order to be able to test several consecutive migrations for the same pallet without errors. Therefore pre and post upgrade hooks for tuples are a noop.

We are executing pre- and post-checks sequentially in order to be able to test several consecutive migrations for the same pallet without errors. Therefore pre and post upgrade hooks for tuples are a noop.

We are executing pre- and post-checks sequentially in order to be able to test several consecutive migrations for the same pallet without errors. Therefore pre and post upgrade hooks for tuples are a noop.

We are executing pre- and post-checks sequentially in order to be able to test several consecutive migrations for the same pallet without errors. Therefore pre and post upgrade hooks for tuples are a noop.

We are executing pre- and post-checks sequentially in order to be able to test several consecutive migrations for the same pallet without errors. Therefore pre and post upgrade hooks for tuples are a noop.

We are executing pre- and post-checks sequentially in order to be able to test several consecutive migrations for the same pallet without errors. Therefore pre and post upgrade hooks for tuples are a noop.

We are executing pre- and post-checks sequentially in order to be able to test several consecutive migrations for the same pallet without errors. Therefore pre and post upgrade hooks for tuples are a noop.

We are executing pre- and post-checks sequentially in order to be able to test several consecutive migrations for the same pallet without errors. Therefore pre and post upgrade hooks for tuples are a noop.

We are executing pre- and post-checks sequentially in order to be able to test several consecutive migrations for the same pallet without errors. Therefore pre and post upgrade hooks for tuples are a noop.

We are executing pre- and post-checks sequentially in order to be able to test several consecutive migrations for the same pallet without errors. Therefore pre and post upgrade hooks for tuples are a noop.

We are executing pre- and post-checks sequentially in order to be able to test several consecutive migrations for the same pallet without errors. Therefore pre and post upgrade hooks for tuples are a noop.

We are executing pre- and post-checks sequentially in order to be able to test several consecutive migrations for the same pallet without errors. Therefore pre and post upgrade hooks for tuples are a noop.

We are executing pre- and post-checks sequentially in order to be able to test several consecutive migrations for the same pallet without errors. Therefore pre and post upgrade hooks for tuples are a noop.

We are executing pre- and post-checks sequentially in order to be able to test several consecutive migrations for the same pallet without errors. Therefore pre and post upgrade hooks for tuples are a noop.

We are executing pre- and post-checks sequentially in order to be able to test several consecutive migrations for the same pallet without errors. Therefore pre and post upgrade hooks for tuples are a noop.

We are executing pre- and post-checks sequentially in order to be able to test several consecutive migrations for the same pallet without errors. Therefore pre and post upgrade hooks for tuples are a noop.

We are executing pre- and post-checks sequentially in order to be able to test several consecutive migrations for the same pallet without errors. Therefore pre and post upgrade hooks for tuples are a noop.

We are executing pre- and post-checks sequentially in order to be able to test several consecutive migrations for the same pallet without errors. Therefore pre and post upgrade hooks for tuples are a noop.

We are executing pre- and post-checks sequentially in order to be able to test several consecutive migrations for the same pallet without errors. Therefore pre and post upgrade hooks for tuples are a noop.

We are executing pre- and post-checks sequentially in order to be able to test several consecutive migrations for the same pallet without errors. Therefore pre and post upgrade hooks for tuples are a noop.

We are executing pre- and post-checks sequentially in order to be able to test several consecutive migrations for the same pallet without errors. Therefore pre and post upgrade hooks for tuples are a noop.

We are executing pre- and post-checks sequentially in order to be able to test several consecutive migrations for the same pallet without errors. Therefore pre and post upgrade hooks for tuples are a noop.

We are executing pre- and post-checks sequentially in order to be able to test several consecutive migrations for the same pallet without errors. Therefore pre and post upgrade hooks for tuples are a noop.

We are executing pre- and post-checks sequentially in order to be able to test several consecutive migrations for the same pallet without errors. Therefore pre and post upgrade hooks for tuples are a noop.

We are executing pre- and post-checks sequentially in order to be able to test several consecutive migrations for the same pallet without errors. Therefore pre and post upgrade hooks for tuples are a noop.

We are executing pre- and post-checks sequentially in order to be able to test several consecutive migrations for the same pallet without errors. Therefore pre and post upgrade hooks for tuples are a noop.

We are executing pre- and post-checks sequentially in order to be able to test several consecutive migrations for the same pallet without errors. Therefore pre and post upgrade hooks for tuples are a noop.

We are executing pre- and post-checks sequentially in order to be able to test several consecutive migrations for the same pallet without errors. Therefore pre and post upgrade hooks for tuples are a noop.

We are executing pre- and post-checks sequentially in order to be able to test several consecutive migrations for the same pallet without errors. Therefore pre and post upgrade hooks for tuples are a noop.

We are executing pre- and post-checks sequentially in order to be able to test several consecutive migrations for the same pallet without errors. Therefore pre and post upgrade hooks for tuples are a noop.

We are executing pre- and post-checks sequentially in order to be able to test several consecutive migrations for the same pallet without errors. Therefore pre and post upgrade hooks for tuples are a noop.

We are executing pre- and post-checks sequentially in order to be able to test several consecutive migrations for the same pallet without errors. Therefore pre and post upgrade hooks for tuples are a noop.

We are executing pre- and post-checks sequentially in order to be able to test several consecutive migrations for the same pallet without errors. Therefore pre and post upgrade hooks for tuples are a noop.

We are executing pre- and post-checks sequentially in order to be able to test several consecutive migrations for the same pallet without errors. Therefore pre and post upgrade hooks for tuples are a noop.

We are executing pre- and post-checks sequentially in order to be able to test several consecutive migrations for the same pallet without errors. Therefore pre and post upgrade hooks for tuples are a noop.

We are executing pre- and post-checks sequentially in order to be able to test several consecutive migrations for the same pallet without errors. Therefore pre and post upgrade hooks for tuples are a noop.

We are executing pre- and post-checks sequentially in order to be able to test several consecutive migrations for the same pallet without errors. Therefore pre and post upgrade hooks for tuples are a noop.

We are executing pre- and post-checks sequentially in order to be able to test several consecutive migrations for the same pallet without errors. Therefore pre and post upgrade hooks for tuples are a noop.

We are executing pre- and post-checks sequentially in order to be able to test several consecutive migrations for the same pallet without errors. Therefore pre and post upgrade hooks for tuples are a noop.

We are executing pre- and post-checks sequentially in order to be able to test several consecutive migrations for the same pallet without errors. Therefore pre and post upgrade hooks for tuples are a noop.

We are executing pre- and post-checks sequentially in order to be able to test several consecutive migrations for the same pallet without errors. Therefore pre and post upgrade hooks for tuples are a noop.

We are executing pre- and post-checks sequentially in order to be able to test several consecutive migrations for the same pallet without errors. Therefore pre and post upgrade hooks for tuples are a noop.

We are executing pre- and post-checks sequentially in order to be able to test several consecutive migrations for the same pallet without errors. Therefore pre and post upgrade hooks for tuples are a noop.

We are executing pre- and post-checks sequentially in order to be able to test several consecutive migrations for the same pallet without errors. Therefore pre and post upgrade hooks for tuples are a noop.

We are executing pre- and post-checks sequentially in order to be able to test several consecutive migrations for the same pallet without errors. Therefore pre and post upgrade hooks for tuples are a noop.

We are executing pre- and post-checks sequentially in order to be able to test several consecutive migrations for the same pallet without errors. Therefore pre and post upgrade hooks for tuples are a noop.

We are executing pre- and post-checks sequentially in order to be able to test several consecutive migrations for the same pallet without errors. Therefore pre and post upgrade hooks for tuples are a noop.

We are executing pre- and post-checks sequentially in order to be able to test several consecutive migrations for the same pallet without errors. Therefore pre and post upgrade hooks for tuples are a noop.

We are executing pre- and post-checks sequentially in order to be able to test several consecutive migrations for the same pallet without errors. Therefore pre and post upgrade hooks for tuples are a noop.

We are executing pre- and post-checks sequentially in order to be able to test several consecutive migrations for the same pallet without errors. Therefore pre and post upgrade hooks for tuples are a noop.

We are executing pre- and post-checks sequentially in order to be able to test several consecutive migrations for the same pallet without errors. Therefore pre and post upgrade hooks for tuples are a noop.

We are executing pre- and post-checks sequentially in order to be able to test several consecutive migrations for the same pallet without errors. Therefore pre and post upgrade hooks for tuples are a noop.

We are executing pre- and post-checks sequentially in order to be able to test several consecutive migrations for the same pallet without errors. Therefore pre and post upgrade hooks for tuples are a noop.

We are executing pre- and post-checks sequentially in order to be able to test several consecutive migrations for the same pallet without errors. Therefore pre and post upgrade hooks for tuples are a noop.

We are executing pre- and post-checks sequentially in order to be able to test several consecutive migrations for the same pallet without errors. Therefore pre and post upgrade hooks for tuples are a noop.

We are executing pre- and post-checks sequentially in order to be able to test several consecutive migrations for the same pallet without errors. Therefore pre and post upgrade hooks for tuples are a noop.

We are executing pre- and post-checks sequentially in order to be able to test several consecutive migrations for the same pallet without errors. Therefore pre and post upgrade hooks for tuples are a noop.

We are executing pre- and post-checks sequentially in order to be able to test several consecutive migrations for the same pallet without errors. Therefore pre and post upgrade hooks for tuples are a noop.

We are executing pre- and post-checks sequentially in order to be able to test several consecutive migrations for the same pallet without errors. Therefore pre and post upgrade hooks for tuples are a noop.

We are executing pre- and post-checks sequentially in order to be able to test several consecutive migrations for the same pallet without errors. Therefore pre and post upgrade hooks for tuples are a noop.

We are executing pre- and post-checks sequentially in order to be able to test several consecutive migrations for the same pallet without errors. Therefore pre and post upgrade hooks for tuples are a noop.

We are executing pre- and post-checks sequentially in order to be able to test several consecutive migrations for the same pallet without errors. Therefore pre and post upgrade hooks for tuples are a noop.

We are executing pre- and post-checks sequentially in order to be able to test several consecutive migrations for the same pallet without errors. Therefore pre and post upgrade hooks for tuples are a noop.

We are executing pre- and post-checks sequentially in order to be able to test several consecutive migrations for the same pallet without errors. Therefore pre and post upgrade hooks for tuples are a noop.

We are executing pre- and post-checks sequentially in order to be able to test several consecutive migrations for the same pallet without errors. Therefore pre and post upgrade hooks for tuples are a noop.

We are executing pre- and post-checks sequentially in order to be able to test several consecutive migrations for the same pallet without errors. Therefore pre and post upgrade hooks for tuples are a noop.

We are executing pre- and post-checks sequentially in order to be able to test several consecutive migrations for the same pallet without errors. Therefore pre and post upgrade hooks for tuples are a noop.

We are executing pre- and post-checks sequentially in order to be able to test several consecutive migrations for the same pallet without errors. Therefore pre and post upgrade hooks for tuples are a noop.

We are executing pre- and post-checks sequentially in order to be able to test several consecutive migrations for the same pallet without errors. Therefore pre and post upgrade hooks for tuples are a noop.

We are executing pre- and post-checks sequentially in order to be able to test several consecutive migrations for the same pallet without errors. Therefore pre and post upgrade hooks for tuples are a noop.