Crate pallet_example_mbm
source ·Expand description
§Multi-Block Migrations Example Pallet
This pallet serves as a minimal example of a pallet that uses the Multi-Block Migrations
Framework. You can observe how to configure it in a runtime in the
kitchensink-runtime
crate.
§Introduction and Purpose
The primary purpose of this pallet is to demonstrate the concept of Multi-Block Migrations in
Substrate. It showcases the migration of values from in the
MyMap
storage map a u32
to a u64
data type using the
SteppedMigration
implementation from the
migrations::v1
module.
The MyMap
storage item is defined in this pallet
, and is
aliased to v0::MyMap
in the migrations::v1
module.
§How to Read the Documentation
To access and navigate this documentation in your browser, use the following command:
cargo doc --package pallet-example-mbm --open
This documentation is organized to help you understand the pallet’s components, features, and migration process.
§Example Usage
To use this pallet and understand multi-block migrations, you can refer to the
migrations::v1
module, which contains a step-by-step migration example.
§Pallet Structure
The pallet is structured as follows:
migrations
: Contains migration-related modules and migration logic.v1
: Demonstrates the migration process for changing the data type in the storage map.
pallet
: Defines the pallet configuration and storage items.
§Migration Safety
When working with migrations, it’s crucial to ensure the safety of your migrations. The
preferred tool to test migrations is
try-runtime-cli
. Support will be added to
dry-run MBMs once they are stable
(tracked: https://github.com/paritytech/try-runtime-cli/issues/17).
Re-exports§
pub use pallet::*;
Modules§
- The
pallet
module in each FRAME pallet hosts the most important items needed to construct this pallet.