Fix migrations and add CI check for new system chains (#2336)

Westend Collectives migration CI check can be fixed once we have
https://github.com/paritytech/try-runtime-cli/pull/58, will open another
PR once it is available.

- [x] Remove deprecated `DmpQueue` pallet from Rococo Contracts, the
migration is complete
- [x] Fix Asset Hub Rococo storage versions
- [x] Add migration check CI for Asset Hub Rococo and Westend Bridge Hub
This commit is contained in:
Liam Aharon
2023-11-17 20:14:45 +04:00
committed by GitHub
parent 9e34163aca
commit 82912acb33
4 changed files with 82 additions and 9 deletions
+25
View File
@@ -151,6 +151,31 @@ check-runtime-migration-asset-hub-westend:
PACKAGE: "asset-hub-westend-runtime" PACKAGE: "asset-hub-westend-runtime"
WASM: "asset_hub_westend_runtime.compact.compressed.wasm" WASM: "asset_hub_westend_runtime.compact.compressed.wasm"
URI: "wss://westend-asset-hub-rpc.polkadot.io:443" URI: "wss://westend-asset-hub-rpc.polkadot.io:443"
check-runtime-migration-asset-hub-rococo:
stage: check
extends:
- .docker-env
- .test-pr-refs
- .check-runtime-migration
variables:
NETWORK: "asset-hub-rococo"
PACKAGE: "asset-hub-rococo-runtime"
WASM: "asset_hub_rococo_runtime.compact.compressed.wasm"
URI: "wss://rococo-asset-hub-rpc.polkadot.io:443"
# Check runtime migrations for Parity managed bridge hub chains
check-runtime-migration-bridge-hub-westend:
stage: check
extends:
- .docker-env
- .test-pr-refs
- .check-runtime-migration
variables:
NETWORK: "bridge-hub-westend"
PACKAGE: "bridge-hub-westend-runtime"
WASM: "bridge_hub_westend_runtime.compact.compressed.wasm"
URI: "wss://westend-bridge-hub-rpc.polkadot.io:443"
check-runtime-migration-bridge-hub-rococo: check-runtime-migration-bridge-hub-rococo:
stage: check stage: check
@@ -39,7 +39,9 @@ use sp_api::impl_runtime_apis;
use sp_core::{crypto::KeyTypeId, OpaqueMetadata}; use sp_core::{crypto::KeyTypeId, OpaqueMetadata};
use sp_runtime::{ use sp_runtime::{
create_runtime_str, generic, impl_opaque_keys, create_runtime_str, generic, impl_opaque_keys,
traits::{AccountIdConversion, AccountIdLookup, BlakeTwo256, Block as BlockT, Verify}, traits::{
AccountIdConversion, AccountIdLookup, BlakeTwo256, Block as BlockT, Saturating, Verify,
},
transaction_validity::{TransactionSource, TransactionValidity}, transaction_validity::{TransactionSource, TransactionValidity},
ApplyExtrinsicResult, Permill, ApplyExtrinsicResult, Permill,
}; };
@@ -959,7 +961,60 @@ pub type SignedExtra = (
pub type UncheckedExtrinsic = pub type UncheckedExtrinsic =
generic::UncheckedExtrinsic<Address, RuntimeCall, Signature, SignedExtra>; generic::UncheckedExtrinsic<Address, RuntimeCall, Signature, SignedExtra>;
/// Migrations to apply on runtime upgrade. /// Migrations to apply on runtime upgrade.
pub type Migrations = (pallet_collator_selection::migration::v1::MigrateToV1<Runtime>,); pub type Migrations =
(pallet_collator_selection::migration::v1::MigrateToV1<Runtime>, InitStorageVersions);
/// Migration to initialize storage versions for pallets added after genesis.
///
/// This is now done automatically (see <https://github.com/paritytech/polkadot-sdk/pull/1297>),
/// but some pallets had made it in and had storage set in them for this parachain before it was
/// merged.
pub struct InitStorageVersions;
impl frame_support::traits::OnRuntimeUpgrade for InitStorageVersions {
fn on_runtime_upgrade() -> Weight {
use frame_support::traits::{GetStorageVersion, StorageVersion};
let mut writes = 0;
if PolkadotXcm::on_chain_storage_version() == StorageVersion::new(0) {
PolkadotXcm::current_storage_version().put::<PolkadotXcm>();
writes.saturating_inc();
}
if Multisig::on_chain_storage_version() == StorageVersion::new(0) {
Multisig::current_storage_version().put::<Multisig>();
writes.saturating_inc();
}
if Assets::on_chain_storage_version() == StorageVersion::new(0) {
Assets::current_storage_version().put::<Assets>();
writes.saturating_inc();
}
if Uniques::on_chain_storage_version() == StorageVersion::new(0) {
Uniques::current_storage_version().put::<Uniques>();
writes.saturating_inc();
}
if Nfts::on_chain_storage_version() == StorageVersion::new(0) {
Nfts::current_storage_version().put::<Nfts>();
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(7, writes)
}
}
/// Executive: handles dispatch to the various modules. /// Executive: handles dispatch to the various modules.
pub type Executive = frame_executive::Executive< pub type Executive = frame_executive::Executive<
@@ -405,7 +405,6 @@ construct_runtime!(
XcmpQueue: cumulus_pallet_xcmp_queue::{Pallet, Call, Storage, Event<T>} = 30, XcmpQueue: cumulus_pallet_xcmp_queue::{Pallet, Call, Storage, Event<T>} = 30,
PolkadotXcm: pallet_xcm::{Pallet, Call, Storage, Event<T>, Origin, Config<T>} = 31, PolkadotXcm: pallet_xcm::{Pallet, Call, Storage, Event<T>, Origin, Config<T>} = 31,
CumulusXcm: cumulus_pallet_xcm::{Pallet, Event<T>, Origin} = 32, CumulusXcm: cumulus_pallet_xcm::{Pallet, Event<T>, Origin} = 32,
DmpQueue: cumulus_pallet_dmp_queue::{Pallet, Call, Storage, Event<T>} = 33,
MessageQueue: pallet_message_queue::{Pallet, Call, Storage, Event<T>} = 34, MessageQueue: pallet_message_queue::{Pallet, Call, Storage, Event<T>} = 34,
// Smart Contracts. // Smart Contracts.
@@ -304,9 +304,3 @@ impl cumulus_pallet_xcmp_queue::Config for Runtime {
parameter_types! { parameter_types! {
pub const RelayOrigin: AggregateMessageOrigin = AggregateMessageOrigin::Parent; pub const RelayOrigin: AggregateMessageOrigin = AggregateMessageOrigin::Parent;
} }
impl cumulus_pallet_dmp_queue::Config for Runtime {
type WeightInfo = cumulus_pallet_dmp_queue::weights::SubstrateWeight<Runtime>;
type RuntimeEvent = crate::RuntimeEvent;
type DmpSink = frame_support::traits::EnqueueWithOrigin<crate::MessageQueue, RelayOrigin>;
}