From f5aeb7e8cc024a17a42ca547645f25f2ae28e4f4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bastian=20K=C3=B6cher?= Date: Sat, 9 Mar 2024 10:04:54 +0100 Subject: [PATCH] Enable elastic scaling node side feature on Kusama (#205) This feature is required for Kusama to ensure that Parachains that have multiple cores assigned, still be able to include at least one block. The relay chain itself doesn't support Parachains with multiple cores assigned right now, but this will come in later updates. - [ ] Does not require a CHANGELOG entry --- CHANGELOG.md | 5 +++-- relay/kusama/src/lib.rs | 17 ++++++++++++++++- 2 files changed, 19 insertions(+), 3 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index f649e0f923..7b989e6b71 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -13,8 +13,9 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/). 0022-adopt-encointer-runtime.md) ([polkadot-fellows/runtimes#80](https://github.com/polkadot-fellows/runtimes/pull/80)) - Feature for enabling debug prints in the Polkadot and Kusama runtime ([polkadot-fellows/runtimes#85](https://github.com/polkadot-fellows/runtimes/pull/85)) - Added new "Wish for Change" track ([polkadot-fellows/runtimes#184](https://github.com/polkadot-fellows/runtimes/pull/184)) -- Enable Coretime and on-demand on Kusama ([polkadot-fellows/runtimes#159](https://github.com/polkadot-fellows/runtimes/pull/159) -- Cancel Parachain Auctions [polkadot-fellows/runtimes#215](https://github.com/polkadot-fellows/runtimes/pull/215) +- Enable Coretime and on-demand on Kusama ([polkadot-fellows/runtimes#159](https://github.com/polkadot-fellows/runtimes/pull/159)) +- Enable Elastic Scaling node side feature for Kusama ([polkadot-fellows/runtimes#205](https://github.com/polkadot-fellows/runtimes/pull/205)) +- Cancel Parachain Auctions ([polkadot-fellows/runtimes#215](https://github.com/polkadot-fellows/runtimes/pull/215)) ### Changed diff --git a/relay/kusama/src/lib.rs b/relay/kusama/src/lib.rs index d55f079cc4..6c9f821d80 100644 --- a/relay/kusama/src/lib.rs +++ b/relay/kusama/src/lib.rs @@ -1746,8 +1746,10 @@ pub type Migrations = (migrations::Unreleased, migrations::Permanent); pub mod migrations { use super::*; use frame_support::traits::OnRuntimeUpgrade; + use frame_system::RawOrigin; use pallet_scheduler::WeightInfo as SchedulerWeightInfo; use runtime_common::auctions::WeightInfo as AuctionsWeightInfo; + use runtime_parachains::configuration::WeightInfo; #[cfg(feature = "try-runtime")] use sp_core::crypto::ByteArray; @@ -1772,6 +1774,18 @@ pub mod migrations { } } + /// Enable the elastic scaling node side feature. + /// + /// This is required for Coretime to ensure the relay chain processes parachains that are + /// assigned to multiple cores. + pub struct EnableElasticScalingNodeFeature; + impl OnRuntimeUpgrade for EnableElasticScalingNodeFeature { + fn on_runtime_upgrade() -> Weight { + let _ = Configuration::set_node_feature(RawOrigin::Root.into(), 1, true); + weights::runtime_parachains_configuration::WeightInfo::::set_node_feature() + } + } + parameter_types! { pub const ImOnlinePalletName: &'static str = "ImOnline"; } @@ -1781,7 +1795,7 @@ pub mod migrations { pub struct UpgradeSessionKeys; const UPGRADE_SESSION_KEYS_FROM_SPEC: u32 = 1001002; - impl frame_support::traits::OnRuntimeUpgrade for UpgradeSessionKeys { + impl OnRuntimeUpgrade for UpgradeSessionKeys { #[cfg(feature = "try-runtime")] fn pre_upgrade() -> Result, sp_runtime::TryRuntimeError> { if System::last_runtime_upgrade_spec_version() > UPGRADE_SESSION_KEYS_FROM_SPEC { @@ -1903,6 +1917,7 @@ pub mod migrations { crate::xcm_config::XcmRouter, GetLegacyLeaseImpl, >, + EnableElasticScalingNodeFeature, // Upgrade `SessionKeys` to exclude `ImOnline` UpgradeSessionKeys, // Remove `im-online` pallet on-chain storage