Skip to content

Commit

Permalink
Enable elastic scaling node side feature on Kusama (#205)
Browse files Browse the repository at this point in the history
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.

<!-- Remember that you can run `/merge` to enable auto-merge in the PR
-->

<!-- Remember to modify the changelog. If you don't need to modify it,
you can check the following box.
Instead, if you have already modified it, simply delete the following
line. -->

- [ ] Does not require a CHANGELOG entry
  • Loading branch information
bkchr authored Mar 9, 2024
1 parent 6d56c21 commit f5aeb7e
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 3 deletions.
5 changes: 3 additions & 2 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
17 changes: 16 additions & 1 deletion relay/kusama/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand All @@ -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::<Runtime>::set_node_feature()
}
}

parameter_types! {
pub const ImOnlinePalletName: &'static str = "ImOnline";
}
Expand All @@ -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<Vec<u8>, sp_runtime::TryRuntimeError> {
if System::last_runtime_upgrade_spec_version() > UPGRADE_SESSION_KEYS_FROM_SPEC {
Expand Down Expand Up @@ -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
Expand Down

0 comments on commit f5aeb7e

Please sign in to comment.