From a05bed2cc46a965e4b554f3a6f6040830ba158d8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bastian=20K=C3=B6cher?= Date: Wed, 28 Feb 2024 11:51:14 +0100 Subject: [PATCH 1/3] Enable elastic scaling node side feature on Kusama This feature is required for Kusama to ensure that Parachains that have multiple cores assigned, still be able to include at least one block. --- relay/kusama/src/lib.rs | 19 +++++++++++++++++-- 1 file changed, 17 insertions(+), 2 deletions(-) diff --git a/relay/kusama/src/lib.rs b/relay/kusama/src/lib.rs index bc813a2457..392a726998 100644 --- a/relay/kusama/src/lib.rs +++ b/relay/kusama/src/lib.rs @@ -1710,9 +1710,11 @@ pub type Migrations = migrations::Unreleased; #[allow(deprecated, missing_docs)] pub mod migrations { use super::{ - coretime, parachains_configuration, parachains_scheduler, slots, BlockNumber, LeasePeriod, - Leaser, ParaId, Runtime, + coretime, parachains_configuration, parachains_scheduler, slots, BlockNumber, + Configuration, LeasePeriod, Leaser, ParaId, Runtime, Weight, }; + use frame_support::traits::OnRuntimeUpgrade; + use frame_system::RawOrigin; // We don't have a limit in the Relay Chain. const IDENTITY_MIGRATION_KEY_LIMIT: u64 = u64::MAX; @@ -1735,6 +1737,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); + Weight::from_parts(1, 0) + } + } + /// Unreleased migrations. Add new ones here: pub type Unreleased = ( pallet_nomination_pools::migration::versioned::V7ToV8, @@ -1751,6 +1765,7 @@ pub mod migrations { crate::xcm_config::XcmRouter, GetLegacyLeaseImpl, >, + EnableElasticScalingNodeFeature, ); } From 3e50b80980fca50d6efe50630381ad3b40ee6dd4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bastian=20K=C3=B6cher?= Date: Wed, 28 Feb 2024 11:59:15 +0100 Subject: [PATCH 2/3] Adds Changelog entry + fixes review comment --- CHANGELOG.md | 1 + relay/kusama/src/lib.rs | 5 +++-- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index ca331bdf94..d92bcd9a42 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -14,6 +14,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/). - 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) +- Enable Elastic Scaling node side feature for Kusama ([polkadot-fellows/runtimes#205](https://github.com/polkadot-fellows/runtimes/pull/205)) ### Changed diff --git a/relay/kusama/src/lib.rs b/relay/kusama/src/lib.rs index 392a726998..14395ceed1 100644 --- a/relay/kusama/src/lib.rs +++ b/relay/kusama/src/lib.rs @@ -1710,11 +1710,12 @@ pub type Migrations = migrations::Unreleased; #[allow(deprecated, missing_docs)] pub mod migrations { use super::{ - coretime, parachains_configuration, parachains_scheduler, slots, BlockNumber, + coretime, parachains_configuration, parachains_scheduler, slots, weights, BlockNumber, Configuration, LeasePeriod, Leaser, ParaId, Runtime, Weight, }; use frame_support::traits::OnRuntimeUpgrade; use frame_system::RawOrigin; + use runtime_parachains::configuration::WeightInfo; // We don't have a limit in the Relay Chain. const IDENTITY_MIGRATION_KEY_LIMIT: u64 = u64::MAX; @@ -1745,7 +1746,7 @@ pub mod migrations { impl OnRuntimeUpgrade for EnableElasticScalingNodeFeature { fn on_runtime_upgrade() -> Weight { let _ = Configuration::set_node_feature(RawOrigin::Root.into(), 1, true); - Weight::from_parts(1, 0) + weights::runtime_parachains_configuration::WeightInfo::::set_node_feature() } } From 91a139e2e732bb829a42815ab8465556197fc3e6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bastian=20K=C3=B6cher?= Date: Sat, 9 Mar 2024 09:28:14 +0100 Subject: [PATCH 3/3] Fixes --- relay/kusama/src/lib.rs | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/relay/kusama/src/lib.rs b/relay/kusama/src/lib.rs index 26b41633b0..6c9f821d80 100644 --- a/relay/kusama/src/lib.rs +++ b/relay/kusama/src/lib.rs @@ -1744,13 +1744,12 @@ pub type Migrations = (migrations::Unreleased, migrations::Permanent); /// The runtime migrations per release. #[allow(deprecated, missing_docs)] pub mod migrations { - use frame_support::traits::OnRuntimeUpgrade; - use frame_system::RawOrigin; - use runtime_parachains::configuration::WeightInfo; 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; @@ -1796,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 {