Make sure pallet versions are set at genesis (#7451)
* Make sure pallet versions are set at genesis This pr ensures that pallet versions are also set at genesis. It does this by hooking into the runtime `GenesisConfig` which means that it will only work when the storage is setup using this genesis config. So, the version will not be set in pallet local tests. However, I think this isn't such a problem. The genesis config will call `on_genesis` on all pallets. This function comes from the new trait `OnGenesis`. Currently the user is not able to provide any custom implementation of this trait. Besides that it also implements `Clone` and `Copy` for the pallet version struct. This pr also moves the macro for generating the runtime genesis config to `frame-support` as most of the other FRAME related macros. * Reduce line width * Update frame/support/src/traits.rs Co-authored-by:Alexander Popiak <alexander.popiak@parity.io> Co-authored-by:
Alexander Popiak <alexander.popiak@parity.io>
Showing
- substrate/frame/support/procedural/src/construct_runtime/mod.rs 6 additions, 2 deletions...ate/frame/support/procedural/src/construct_runtime/mod.rs
- substrate/frame/support/src/dispatch.rs 14 additions, 10 deletionssubstrate/frame/support/src/dispatch.rs
- substrate/frame/support/src/genesis_config.rs 141 additions, 0 deletionssubstrate/frame/support/src/genesis_config.rs
- substrate/frame/support/src/lib.rs 2 additions, 0 deletionssubstrate/frame/support/src/lib.rs
- substrate/frame/support/src/traits.rs 38 additions, 5 deletionssubstrate/frame/support/src/traits.rs
- substrate/frame/support/test/tests/pallet_version.rs 17 additions, 2 deletionssubstrate/frame/support/test/tests/pallet_version.rs
- substrate/primitives/runtime/src/lib.rs 0 additions, 110 deletionssubstrate/primitives/runtime/src/lib.rs
Please register or sign in to comment