-
Notifications
You must be signed in to change notification settings - Fork 1.6k
Remove state migration from westend runtime. #6737
Remove state migration from westend runtime. #6737
Conversation
bkchr
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The pallet stored data? We should write some cleanup function.
|
Oh, did not think about it 👍 . The data stored is small though (just the current position) so could make sense to keep it just to know it was migrated. But I think I will clean it up. |
This reverts commit b1d55c6.
|
I did write a clean up function, but did not find a good way to also remove the dependency from the runtime. |
|
I am hesitant to just hardcode the trie storage key of the storage value items (and remove directly with the storage api) and remove the module. |
runtime/westend/src/lib.rs
Outdated
| MigrationProcess::<Runtime>::kill(); | ||
| AutoLimits::<Runtime>::kill(); | ||
| SignedMigrationMaxLimits::<Runtime>::kill(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You can use storage_alias to have the definition of them without including the pallet.
runtime/westend/src/lib.rs
Outdated
| struct Pallet<T>(sp_std::marker::PhantomData<T>); | ||
|
|
||
| impl<T> frame_support::traits::PalletInfoAccess for Pallet<T> { | ||
| fn index() -> usize { | ||
| 35 | ||
| } | ||
| fn name() -> &'static str { | ||
| "StateTrieMigration" | ||
| } | ||
| fn module_name() -> &'static str { | ||
| "pallet_state_trie_migration" | ||
| } | ||
| fn crate_version() -> frame_support::traits::CrateVersion { | ||
| frame_support::traits::CrateVersion { major: 4u16, minor: 0u8, patch: 0u8 } | ||
| } | ||
| } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| struct Pallet<T>(sp_std::marker::PhantomData<T>); | |
| impl<T> frame_support::traits::PalletInfoAccess for Pallet<T> { | |
| fn index() -> usize { | |
| 35 | |
| } | |
| fn name() -> &'static str { | |
| "StateTrieMigration" | |
| } | |
| fn module_name() -> &'static str { | |
| "pallet_state_trie_migration" | |
| } | |
| fn crate_version() -> frame_support::traits::CrateVersion { | |
| frame_support::traits::CrateVersion { major: 4u16, minor: 0u8, patch: 0u8 } | |
| } | |
| } |
runtime/westend/src/lib.rs
Outdated
| } | ||
|
|
||
| #[storage_alias] | ||
| type AutoLimits<T> = StorageValue<Pallet<T>, Option<MigrationLimits>, ValueQuery>; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| type AutoLimits<T> = StorageValue<Pallet<T>, Option<MigrationLimits>, ValueQuery>; | |
| type AutoLimits = StorageValue<StateTrieMigration, Option<MigrationLimits>, ValueQuery>; |
runtime/westend/src/lib.rs
Outdated
| type MigrationProcess<T> = StorageValue<Pallet<T>, u32, ValueQuery>; | ||
|
|
||
| #[storage_alias] | ||
| type SignedMigrationMaxLimits<T> = StorageValue<Pallet<T>, MigrationLimits, OptionQuery>; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| type MigrationProcess<T> = StorageValue<Pallet<T>, u32, ValueQuery>; | |
| #[storage_alias] | |
| type SignedMigrationMaxLimits<T> = StorageValue<Pallet<T>, MigrationLimits, OptionQuery>; | |
| type MigrationProcess = StorageValue<StateTrieMigration, u32, ValueQuery>; | |
| #[storage_alias] | |
| type SignedMigrationMaxLimits = StorageValue<StateTrieMigration, MigrationLimits, OptionQuery>; |
| // one to avoid the trait constraint on T. | ||
| // Since we only use `kill` it is fine. | ||
| #[storage_alias] | ||
| type MigrationProcess = StorageValue<StateTrieMigration, u32, ValueQuery>; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think you can also just delete the pallet prefix instead of defining each alias but this also works obviously.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the tip, did not think about this approach, with 3 value only I will still keep this version.
|
bot merge |
* master: (98 commits) Ensure max_weight is assigned properly in AllowTopPaidExecutionFrom (#6787) Explicitly Handling ProvisionableData Cases (#6757) Companion for Substrate#12520 (#6730) Revert back to bare metal runners for weights generation (#6762) Improve XCM fuzzer (#6190) Corrected weight trader comment (#6752) clean up executed migrations (#6763) Remove state migration from westend runtime. (#6737) polkadot companion #12608 (Pools claim permissions) (#6753) Add Turboflakes bootnodes to Polkadot, Kusama and Westend (#6628) Companion for substrate#13284 (#6653) Companion for Substrate #13410: Introduce EnsureOrigin to democracy.propose (#6750) `BlockId` removal: `BlockBuilderProvider::new_block_at` (#6734) Companion PR for PR#13119 (#6683) Companion for Substrate#13411: frame/beefy: prune entries in set id session mapping (#6743) `BlockId` removal: refactor of runtime API (#6721) Fix auction bench (#6747) Use PVF code paired with executor params wherever possible (#6742) Retire `OldV1SessionInfo` (#6744) Companion for substrate #13121 - BEEFY Equivocations support (#6593) ...
State migration did pass on westend and can be remove from the runtime.