Move `PalletVersion` away from the crate version (#9165)
* Move `PalletVersion` away from the crate version Before this pr, `PalletVersion` was referring to the crate version that hosted the pallet. This pr introduces a custom `package.metadata.frame` section in the `Cargo.toml` that can contain a `pallet-version` key value pair. While the value is expected to be a valid u16. If this key/value pair isn't given, the version is set to 1. It also changes the `PalletVersion` declaration. We now only have one `u16` that represents the version. Not a major/minor/patch version. As the old `PalletVersion` was starting with the `u16` major, decoding the old values will work. * Overhaul the entire implementation - Drop PalletVersion - Introduce StorageVersion - StorageVersion needs to be set in the crate and set for the macros - Added migration * Fix migrations * Review feedback * Remove unneeded dep * remove pub consts * Brings back logging and implements `GetStorageVersion` * Return weight from migration * Fmt and remove unused import * Update frame/support/src/dispatch.rs Co-authored-by:Guillaume Thiolliere <gui.thiolliere@gmail.com> * Update frame/support/src/traits/metadata.rs Co-authored-by:
Guillaume Thiolliere <gui.thiolliere@gmail.com> Co-authored-by:
Guillaume Thiolliere <gui.thiolliere@gmail.com>
parent
988c3999
Showing
- substrate/frame/contracts/src/lib.rs 5 additions, 1 deletionsubstrate/frame/contracts/src/lib.rs
- substrate/frame/contracts/src/migration.rs 6 additions, 11 deletionssubstrate/frame/contracts/src/migration.rs
- substrate/frame/elections-phragmen/src/lib.rs 5 additions, 1 deletionsubstrate/frame/elections-phragmen/src/lib.rs
- substrate/frame/elections-phragmen/src/migrations/v3.rs 23 additions, 22 deletionssubstrate/frame/elections-phragmen/src/migrations/v3.rs
- substrate/frame/elections-phragmen/src/migrations/v4.rs 25 additions, 27 deletionssubstrate/frame/elections-phragmen/src/migrations/v4.rs
- substrate/frame/grandpa/src/lib.rs 5 additions, 1 deletionsubstrate/frame/grandpa/src/lib.rs
- substrate/frame/grandpa/src/migrations.rs 2 additions, 2 deletionssubstrate/frame/grandpa/src/migrations.rs
- substrate/frame/grandpa/src/migrations/v4.rs 20 additions, 29 deletionssubstrate/frame/grandpa/src/migrations/v4.rs
- substrate/frame/offences/src/migration.rs 1 addition, 1 deletionsubstrate/frame/offences/src/migration.rs
- substrate/frame/support/procedural/src/lib.rs 0 additions, 8 deletionssubstrate/frame/support/procedural/src/lib.rs
- substrate/frame/support/procedural/src/pallet/expand/hooks.rs 7 additions, 15 deletions...trate/frame/support/procedural/src/pallet/expand/hooks.rs
- substrate/frame/support/procedural/src/pallet/expand/pallet_struct.rs 15 additions, 13 deletions...ame/support/procedural/src/pallet/expand/pallet_struct.rs
- substrate/frame/support/procedural/src/pallet/parse/pallet_struct.rs 29 additions, 1 deletion...rame/support/procedural/src/pallet/parse/pallet_struct.rs
- substrate/frame/support/procedural/src/pallet_version.rs 0 additions, 64 deletionssubstrate/frame/support/procedural/src/pallet_version.rs
- substrate/frame/support/src/dispatch.rs 179 additions, 53 deletionssubstrate/frame/support/src/dispatch.rs
- substrate/frame/support/src/lib.rs 16 additions, 17 deletionssubstrate/frame/support/src/lib.rs
- substrate/frame/support/src/migrations.rs 73 additions, 0 deletionssubstrate/frame/support/src/migrations.rs
- substrate/frame/support/src/traits.rs 2 additions, 2 deletionssubstrate/frame/support/src/traits.rs
- substrate/frame/support/src/traits/hooks.rs 0 additions, 15 deletionssubstrate/frame/support/src/traits/hooks.rs
- substrate/frame/support/src/traits/metadata.rs 79 additions, 61 deletionssubstrate/frame/support/src/traits/metadata.rs
Please register or sign in to comment