-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Init System Parachain storage versions and add migration check jobs to CI #1344
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 41 commits
65e5720
b20dea3
136b150
663b2a8
2bff174
ffecc69
0ce9882
5826d24
74d2e32
f4f4843
6af3482
4547517
8f03362
7000648
b9a3da8
52a9955
e1ea5db
f2323ba
f797e33
73d94c0
8d1c121
f546958
93980b7
d2126d3
874eb13
d6feb43
e865aff
b199330
898b12c
e0facd5
b6bb996
43a13c3
9bf5394
715642d
5c5b3e4
e2fc388
c659135
3dc6b44
ee12159
08c85f1
51a731e
25db974
33d181d
0f3a8ba
f2ac8ce
1edd597
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -856,8 +856,46 @@ pub type Migrations = ( | |
| pallet_collator_selection::migration::v1::MigrateToV1<Runtime>, | ||
| // unreleased | ||
| migrations::NativeAssetParents0ToParents1Migration<Runtime>, | ||
| // unreleased | ||
| pallet_multisig::migrations::v1::MigrateToV1<Runtime>, | ||
| // unreleased | ||
| InitStorageVersions, | ||
| ); | ||
|
|
||
| /// Migration to initialize storage versions for pallets added after genesis. | ||
| /// | ||
| /// Ideally this would be done automatically (see | ||
| /// <https://github.com/paritytech/polkadot-sdk/pull/1297>), but it probably won't be ready for some | ||
| /// time and it's beneficial to get try-runtime-cli on-runtime-upgrade checks into the CI, so we're | ||
| /// doing it manually. | ||
| pub struct InitStorageVersions; | ||
|
|
||
| impl frame_support::traits::OnRuntimeUpgrade for InitStorageVersions { | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Why is e.g. NFTs/Uniques needed in other networks but not here?
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Probably because NFT/Unique pallets were in this runtime at genesis, so the on-chain storage version was set |
||
| fn on_runtime_upgrade() -> Weight { | ||
| use frame_support::traits::{GetStorageVersion, StorageVersion}; | ||
| use sp_runtime::traits::Saturating; | ||
|
|
||
| let mut writes = 0; | ||
|
|
||
| if PolkadotXcm::on_chain_storage_version() == StorageVersion::new(0) { | ||
| PolkadotXcm::current_storage_version().put::<PolkadotXcm>(); | ||
| writes.saturating_inc(); | ||
| } | ||
|
|
||
| if ForeignAssets::on_chain_storage_version() == StorageVersion::new(0) { | ||
| ForeignAssets::current_storage_version().put::<ForeignAssets>(); | ||
| writes.saturating_inc(); | ||
| } | ||
|
|
||
| if PoolAssets::on_chain_storage_version() == StorageVersion::new(0) { | ||
| PoolAssets::current_storage_version().put::<PoolAssets>(); | ||
| writes.saturating_inc(); | ||
| } | ||
|
|
||
| <Runtime as frame_system::Config>::DbWeight::get().reads_writes(3, writes) | ||
| } | ||
| } | ||
|
|
||
| /// Executive: handles dispatch to the various modules. | ||
| pub type Executive = frame_executive::Executive< | ||
| Runtime, | ||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.