From edfd658b73dc2c987e2fa9b00d67ec85bdfccb18 Mon Sep 17 00:00:00 2001 From: Tsvetomir Dimitrov Date: Thu, 25 Jul 2024 17:40:07 +0300 Subject: [PATCH 01/19] Enable Coretime on Polkadot Applying https://github.com/polkadot-fellows/runtimes/pull/354 on top of 1.14 release Co-authored-by: eskimor --- CHANGELOG.md | 2 + relay/polkadot/constants/src/lib.rs | 13 +++ relay/polkadot/src/lib.rs | 173 +++++++++++++++++++++++++--- 3 files changed, 174 insertions(+), 14 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index f083d6a5bb..bb7602e920 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -15,6 +15,8 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/). - Core-Fellowship: new `promote_fast` call ([runtimes#381](https://github.com/polkadot-fellows/runtimes/pull/381), [SDK v1.14 #4877](https://github.com/paritytech/polkadot-sdk/pull/4877)). - Pallet ranked collective: max member count per rank ([runtimes#381](https://github.com/polkadot-fellows/runtimes/pull/381), [SDK v1.14 #4807](https://github.com/paritytech/polkadot-sdk/pull/4807)). - All runtimes: XcmPaymentApi and DryRunApi ([polkadot-fellows/runtimes#380](https://github.com/polkadot-fellows/runtimes/pull/380)) +- Enable Agile Coretime on Polkadot ([polkadot-fellows/runtimes#322](https://github.com/polkadot-fellows/runtimes/pull/322)) +- Enable Elastic Scaling node side feature for Polkadot ([polkadot-fellows/runtimes#322](https://github.com/polkadot-fellows/runtimes/pull/322)) #### From [#322](https://github.com/polkadot-fellows/runtimes/pull/322): diff --git a/relay/polkadot/constants/src/lib.rs b/relay/polkadot/constants/src/lib.rs index 58254291f5..9b490fb8b7 100644 --- a/relay/polkadot/constants/src/lib.rs +++ b/relay/polkadot/constants/src/lib.rs @@ -131,9 +131,22 @@ pub mod system_parachain { pub const BRIDGE_HUB_ID: u32 = 1002; /// People parachain ID. pub const PEOPLE_ID: u32 = 1004; + /// Brokerage parachain ID. + pub const BROKER_ID: u32 = 1005; // System parachains from Polkadot point of view. pub type SystemParachains = IsChildSystemParachain; + + /// Coretime constants + pub mod coretime { + /// Coretime timeslice period in blocks + /// WARNING: This constant is used across chains, so additional care should be taken + /// when changing it. + #[cfg(feature = "fast-runtime")] + pub const TIMESLICE_PERIOD: u32 = 20; + #[cfg(not(feature = "fast-runtime"))] + pub const TIMESLICE_PERIOD: u32 = 80; + } } /// Polkadot Treasury pallet instance. diff --git a/relay/polkadot/src/lib.rs b/relay/polkadot/src/lib.rs index 4fc780774e..b6a5e01834 100644 --- a/relay/polkadot/src/lib.rs +++ b/relay/polkadot/src/lib.rs @@ -31,10 +31,10 @@ use polkadot_runtime_common::{ }; use runtime_parachains::{ - assigner_parachains as parachains_assigner_parachains, - configuration as parachains_configuration, + assigner_coretime as parachains_assigner_coretime, + assigner_on_demand as parachains_assigner_on_demand, configuration as parachains_configuration, configuration::ActiveConfigHrmpChannelSizeAndCapacityRatio, - disputes as parachains_disputes, + coretime, disputes as parachains_disputes, disputes::slashing as parachains_slashing, dmp as parachains_dmp, hrmp as parachains_hrmp, inclusion as parachains_inclusion, inclusion::{AggregateMessageOrigin, UmpQueueId}, @@ -62,10 +62,10 @@ use frame_support::{ parameter_types, traits::{ fungible::HoldConsideration, ConstU32, Contains, EitherOf, EitherOfDiverse, EverythingBut, - Get, InstanceFilter, KeyOwnerProofSystem, LinearStoragePrice, PrivilegeCmp, ProcessMessage, - ProcessMessageError, WithdrawReasons, + Get, InstanceFilter, KeyOwnerProofSystem, LinearStoragePrice, OnRuntimeUpgrade, + PrivilegeCmp, ProcessMessage, ProcessMessageError, WithdrawReasons, }, - weights::{ConstantMultiplier, WeightMeter, WeightToFee as _}, + weights::{constants, ConstantMultiplier, WeightMeter, WeightToFee as _}, PalletId, }; use frame_system::EnsureRoot; @@ -87,8 +87,9 @@ use sp_runtime::{ curve::PiecewiseLinear, generic, impl_opaque_keys, traits::{ - AccountIdLookup, BlakeTwo256, Block as BlockT, ConvertInto, Extrinsic as ExtrinsicT, - IdentityLookup, Keccak256, OpaqueKeys, SaturatedConversion, Verify, + AccountIdConversion, AccountIdLookup, BlakeTwo256, Block as BlockT, ConvertInto, + Extrinsic as ExtrinsicT, IdentityLookup, Keccak256, OpaqueKeys, SaturatedConversion, + Verify, }, transaction_validity::{TransactionPriority, TransactionSource, TransactionValidity}, ApplyExtrinsicResult, FixedU128, KeyTypeId, Perbill, Percent, Permill, RuntimeDebug, @@ -118,7 +119,9 @@ pub use pallet_timestamp::Call as TimestampCall; pub use sp_runtime::BuildStorage; /// Constant values used within the runtime. -use polkadot_runtime_constants::{currency::*, fee::*, time::*, TREASURY_PALLET_ID}; +use polkadot_runtime_constants::{ + currency::*, fee::*, system_parachain, time::*, TREASURY_PALLET_ID, +}; // Weights used in the runtime. mod weights; @@ -1208,7 +1211,8 @@ impl InstanceFilter for ProxyType { matches!( c, RuntimeCall::Staking(..) | - RuntimeCall::Session(..) | RuntimeCall::Utility(..) | + RuntimeCall::Session(..) | + RuntimeCall::Utility(..) | RuntimeCall::FastUnstake(..) | RuntimeCall::VoterList(..) | RuntimeCall::NominationPools(..) @@ -1374,16 +1378,63 @@ impl parachains_paras_inherent::Config for Runtime { } impl parachains_scheduler::Config for Runtime { - type AssignmentProvider = ParaAssignmentProvider; + // If you change this, make sure the `Assignment` type of the new provider is binary compatible, + // otherwise provide a migration. + type AssignmentProvider = CoretimeAssignmentProvider; +} + +parameter_types! { + pub const BrokerId: u32 = system_parachain::BROKER_ID; + pub const BrokerPalletId: PalletId = PalletId(*b"py/broke"); + pub MaxXcmTransactWeight: Weight = Weight::from_parts(constants::WEIGHT_REF_TIME_PER_MILLIS, 20 * constants::WEIGHT_PROOF_SIZE_PER_KB); +} + +pub struct BrokerPot; +impl Get for BrokerPot { + fn get() -> InteriorLocation { + Junction::AccountId32 { network: None, id: BrokerPalletId::get().into_account_truncating() } + .into() + } +} + +impl coretime::Config for Runtime { + type RuntimeOrigin = RuntimeOrigin; + type RuntimeEvent = RuntimeEvent; + type Currency = Balances; + type BrokerId = BrokerId; + type WeightInfo = weights::runtime_parachains_coretime::WeightInfo; + type SendXcm = crate::xcm_config::XcmRouter; + type MaxXcmTransactWeight = MaxXcmTransactWeight; + type BrokerPotLocation = BrokerPot; + type AssetTransactor = crate::xcm_config::LocalAssetTransactor; + type AccountToLocation = xcm_builder::AliasesIntoAccountId32< + xcm_config::ThisNetwork, + ::AccountId, + >; +} + +parameter_types! { + pub const OnDemandTrafficDefaultValue: FixedU128 = FixedU128::from_u32(1); + pub const MaxHistoricalRevenue: BlockNumber = 2 * system_parachain::coretime::TIMESLICE_PERIOD; + pub const OnDemandPalletId: PalletId = PalletId(*b"py/ondmd"); +} + +impl parachains_assigner_on_demand::Config for Runtime { + type RuntimeEvent = RuntimeEvent; + type Currency = Balances; + type TrafficDefaultValue = OnDemandTrafficDefaultValue; + type WeightInfo = weights::runtime_parachains_assigner_on_demand::WeightInfo; + type MaxHistoricalRevenue = MaxHistoricalRevenue; + type PalletId = OnDemandPalletId; } -impl parachains_assigner_parachains::Config for Runtime {} +impl parachains_assigner_coretime::Config for Runtime {} impl parachains_initializer::Config for Runtime { type Randomness = pallet_babe::RandomnessFromOneEpochAgo; type ForceOrigin = EnsureRoot; type WeightInfo = weights::runtime_parachains_initializer::WeightInfo; - type CoretimeOnNewSession = (); + type CoretimeOnNewSession = Coretime; } impl parachains_disputes::Config for Runtime { @@ -1654,13 +1705,15 @@ construct_runtime! { ParaSessionInfo: parachains_session_info = 61, ParasDisputes: parachains_disputes = 62, ParasSlashing: parachains_slashing = 63, - ParaAssignmentProvider: parachains_assigner_parachains = 64, + OnDemandAssignmentProvider: parachains_assigner_on_demand = 64, + CoretimeAssignmentProvider: parachains_assigner_coretime = 65, // Parachain Onboarding Pallets. Start indices at 70 to leave room. Registrar: paras_registrar = 70, Slots: slots = 71, Auctions: auctions = 72, Crowdloan: crowdloan = 73, + Coretime: coretime = 74, // State trie migration pallet, only temporary. StateTrieMigration: pallet_state_trie_migration = 98, @@ -1726,13 +1779,103 @@ pub type Migrations = (migrations::Unreleased, migrations::Permanent); /// The runtime migrations per release. #[allow(deprecated, missing_docs)] pub mod migrations { + use polkadot_runtime_common::traits::Leaser; + use super::*; + pub struct GetLegacyLeaseImpl; + impl coretime::migration::GetLegacyLease for GetLegacyLeaseImpl { + fn get_parachain_lease_in_blocks(para: ParaId) -> Option { + let now = frame_system::Pallet::::block_number(); + let lease = slots::Leases::::get(para); + if lease.is_empty() { + return None + } + // Lease not yet started/or having holes, refund (coretime can't handle this): + if lease.iter().any(Option::is_none) { + if let Err(err) = slots::Pallet::::clear_all_leases( + frame_system::RawOrigin::Root.into(), + para, + ) { + log::error!( + target: "runtime", + "Clearing lease for para: {:?} failed, with error: {:?}", + para, + err + ); + }; + return None + } + let (index, _) = + as Leaser>::lease_period_index(now)?; + Some(index.saturating_add(lease.len() as u32).saturating_mul(LeasePeriod::get())) + } + } + + /// 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 { + use runtime_parachains::configuration::WeightInfo as _; + let _ = Configuration::set_node_feature(frame_system::RawOrigin::Root.into(), 1, true); + weights::runtime_parachains_configuration::WeightInfo::::set_node_feature() + } + } + + /// Cancel all ongoing auctions. + /// + /// Any leases that come into existence after coretime was launched will not be served. Yet, + /// any ongoing auctions must be cancelled. + /// + /// Safety: + /// + /// - After coretime is launched, there are no auctions anymore. So if this forgotten to + /// be removed after the runtime upgrade, running this again on the next one is harmless. + /// - I am assuming scheduler `TaskName`s are unique, so removal of the scheduled entry + /// multiple times should also be fine. + pub struct CancelAuctions; + impl OnRuntimeUpgrade for CancelAuctions { + fn on_runtime_upgrade() -> Weight { + if let Err(err) = Auctions::cancel_auction(frame_system::RawOrigin::Root.into()) { + log::debug!(target: "runtime", "Cancelling auctions failed: {:?}", err); + } + // Cancel scheduled auction as well: + if let Err(err) = Scheduler::cancel_named( + // TODO: Fix this key for Polkadot! + pallet_custom_origins::Origin::AuctionAdmin.into(), + [ + 0x5c, 0x68, 0xbf, 0x0c, 0x2d, 0x11, 0x04, 0x91, 0x6b, 0xa5, 0xa4, 0xde, 0xe6, + 0xb8, 0x14, 0xe8, 0x2b, 0x27, 0x93, 0x78, 0x4c, 0xb6, 0xe7, 0x69, 0x04, 0x00, + 0x1a, 0x59, 0x49, 0xc1, 0x63, 0xb1, + ], + ) { + log::debug!(target: "runtime", "Cancelling scheduled auctions failed: {:?}", err); + } + use pallet_scheduler::WeightInfo as _; + use polkadot_runtime_common::auctions::WeightInfo as _; + weights::polkadot_runtime_common_auctions::WeightInfo::::cancel_auction() + .saturating_add(weights::pallet_scheduler::WeightInfo::::cancel_named( + ::MaxScheduledPerBlock::get(), + )) + } + } + /// Unreleased migrations. Add new ones here: pub type Unreleased = ( parachains_configuration::migration::v12::MigrateToV12, parachains_inclusion::migration::MigrateToV1, pallet_staking::migrations::v15::MigrateV14ToV15, + // Migrate from legacy lease to coretime. Needs to run after configuration v11 + coretime::migration::MigrateToCoretime< + Runtime, + crate::xcm_config::XcmRouter, + GetLegacyLeaseImpl, + >, + EnableElasticScalingNodeFeature, + CancelAuctions, ); /// Migrations/checks that do not need to be versioned and can run on every update. @@ -1773,6 +1916,8 @@ mod benches { [runtime_parachains::initializer, Initializer] [runtime_parachains::paras, Paras] [runtime_parachains::paras_inherent, ParaInherent] + [runtime_parachains::assigner_on_demand, OnDemandAssignmentProvider] + [runtime_parachains::coretime, Coretime] // Substrate [pallet_bags_list, VoterList] [pallet_balances, Balances] From d726aa4c25dcbd63a8d978931f38e7bc7673a983 Mon Sep 17 00:00:00 2001 From: Tsvetomir Dimitrov Date: Thu, 25 Jul 2024 17:40:28 +0300 Subject: [PATCH 02/19] Dummy weights (copy-pasted from Kusama) --- relay/polkadot/src/weights/mod.rs | 2 + .../runtime_parachains_assigner_on_demand.rs | 89 ++++++++++++++++++ .../weights/runtime_parachains_coretime.rs | 92 +++++++++++++++++++ 3 files changed, 183 insertions(+) create mode 100644 relay/polkadot/src/weights/runtime_parachains_assigner_on_demand.rs create mode 100644 relay/polkadot/src/weights/runtime_parachains_coretime.rs diff --git a/relay/polkadot/src/weights/mod.rs b/relay/polkadot/src/weights/mod.rs index c4d8c00b0d..fdf965bf0a 100644 --- a/relay/polkadot/src/weights/mod.rs +++ b/relay/polkadot/src/weights/mod.rs @@ -48,7 +48,9 @@ pub mod polkadot_runtime_common_crowdloan; pub mod polkadot_runtime_common_identity_migrator; pub mod polkadot_runtime_common_paras_registrar; pub mod polkadot_runtime_common_slots; +pub mod runtime_parachains_assigner_on_demand; pub mod runtime_parachains_configuration; +pub mod runtime_parachains_coretime; pub mod runtime_parachains_disputes; pub mod runtime_parachains_disputes_slashing; pub mod runtime_parachains_hrmp; diff --git a/relay/polkadot/src/weights/runtime_parachains_assigner_on_demand.rs b/relay/polkadot/src/weights/runtime_parachains_assigner_on_demand.rs new file mode 100644 index 0000000000..2b17dc2b7a --- /dev/null +++ b/relay/polkadot/src/weights/runtime_parachains_assigner_on_demand.rs @@ -0,0 +1,89 @@ +// Copyright (C) Parity Technologies and the various Polkadot contributors, see Contributions.md +// for a list of specific contributors. +// SPDX-License-Identifier: Apache-2.0 + +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +//! Autogenerated weights for `runtime_parachains::assigner_on_demand` +//! +//! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 32.0.0 +//! DATE: 2024-03-10, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]` +//! WORST CASE MAP SIZE: `1000000` +//! HOSTNAME: `ggwpez-ref-hw`, CPU: `Intel(R) Xeon(R) CPU @ 2.60GHz` +//! WASM-EXECUTION: `Compiled`, CHAIN: `Some("./kusama-chain-spec.json")`, DB CACHE: 1024 + +// Executed Command: +// ./target/production/polkadot +// benchmark +// pallet +// --chain=./kusama-chain-spec.json +// --steps=50 +// --repeat=20 +// --pallet=runtime_parachains::assigner_on_demand +// --extrinsic=* +// --wasm-execution=compiled +// --heap-pages=4096 +// --output=./kusama-weights/ +// --header=./file_header.txt + +#![cfg_attr(rustfmt, rustfmt_skip)] +#![allow(unused_parens)] +#![allow(unused_imports)] +#![allow(missing_docs)] + +use frame_support::{traits::Get, weights::Weight}; +use core::marker::PhantomData; + +/// Weight functions for `runtime_parachains::assigner_on_demand`. +pub struct WeightInfo(PhantomData); +impl runtime_parachains::assigner_on_demand::WeightInfo for WeightInfo { + /// Storage: `OnDemandAssignmentProvider::SpotTraffic` (r:1 w:0) + /// Proof: `OnDemandAssignmentProvider::SpotTraffic` (`max_values`: Some(1), `max_size`: None, mode: `Measured`) + /// Storage: `Paras::ParaLifecycles` (r:1 w:0) + /// Proof: `Paras::ParaLifecycles` (`max_values`: None, `max_size`: None, mode: `Measured`) + /// Storage: `OnDemandAssignmentProvider::OnDemandQueue` (r:1 w:1) + /// Proof: `OnDemandAssignmentProvider::OnDemandQueue` (`max_values`: Some(1), `max_size`: None, mode: `Measured`) + /// The range of component `s` is `[1, 9999]`. + fn place_order_keep_alive(s: u32, ) -> Weight { + // Proof Size summary in bytes: + // Measured: `330 + s * (4 ±0)` + // Estimated: `3795 + s * (4 ±0)` + // Minimum execution time: 25_690_000 picoseconds. + Weight::from_parts(21_232_109, 0) + .saturating_add(Weight::from_parts(0, 3795)) + // Standard Error: 137 + .saturating_add(Weight::from_parts(13_682, 0).saturating_mul(s.into())) + .saturating_add(T::DbWeight::get().reads(3)) + .saturating_add(T::DbWeight::get().writes(1)) + .saturating_add(Weight::from_parts(0, 4).saturating_mul(s.into())) + } + /// Storage: `OnDemandAssignmentProvider::SpotTraffic` (r:1 w:0) + /// Proof: `OnDemandAssignmentProvider::SpotTraffic` (`max_values`: Some(1), `max_size`: None, mode: `Measured`) + /// Storage: `Paras::ParaLifecycles` (r:1 w:0) + /// Proof: `Paras::ParaLifecycles` (`max_values`: None, `max_size`: None, mode: `Measured`) + /// Storage: `OnDemandAssignmentProvider::OnDemandQueue` (r:1 w:1) + /// Proof: `OnDemandAssignmentProvider::OnDemandQueue` (`max_values`: Some(1), `max_size`: None, mode: `Measured`) + /// The range of component `s` is `[1, 9999]`. + fn place_order_allow_death(s: u32, ) -> Weight { + // Proof Size summary in bytes: + // Measured: `330 + s * (4 ±0)` + // Estimated: `3795 + s * (4 ±0)` + // Minimum execution time: 25_648_000 picoseconds. + Weight::from_parts(21_383_327, 0) + .saturating_add(Weight::from_parts(0, 3795)) + // Standard Error: 136 + .saturating_add(Weight::from_parts(13_662, 0).saturating_mul(s.into())) + .saturating_add(T::DbWeight::get().reads(3)) + .saturating_add(T::DbWeight::get().writes(1)) + .saturating_add(Weight::from_parts(0, 4).saturating_mul(s.into())) + } +} diff --git a/relay/polkadot/src/weights/runtime_parachains_coretime.rs b/relay/polkadot/src/weights/runtime_parachains_coretime.rs new file mode 100644 index 0000000000..d141d340a3 --- /dev/null +++ b/relay/polkadot/src/weights/runtime_parachains_coretime.rs @@ -0,0 +1,92 @@ +// Copyright (C) Parity Technologies and the various Polkadot contributors, see Contributions.md +// for a list of specific contributors. +// SPDX-License-Identifier: Apache-2.0 + +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +//! Autogenerated weights for `runtime_parachains::coretime` +//! +//! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 32.0.0 +//! DATE: 2024-03-10, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]` +//! WORST CASE MAP SIZE: `1000000` +//! HOSTNAME: `ggwpez-ref-hw`, CPU: `Intel(R) Xeon(R) CPU @ 2.60GHz` +//! WASM-EXECUTION: `Compiled`, CHAIN: `Some("./kusama-chain-spec.json")`, DB CACHE: 1024 + +// Executed Command: +// ./target/production/polkadot +// benchmark +// pallet +// --chain=./kusama-chain-spec.json +// --steps=50 +// --repeat=20 +// --pallet=runtime_parachains::coretime +// --extrinsic=* +// --wasm-execution=compiled +// --heap-pages=4096 +// --output=./kusama-weights/ +// --header=./file_header.txt + +#![cfg_attr(rustfmt, rustfmt_skip)] +#![allow(unused_parens)] +#![allow(unused_imports)] +#![allow(missing_docs)] + +use frame_support::{traits::Get, weights::Weight}; +use core::marker::PhantomData; + +/// Weight functions for `runtime_parachains::coretime`. +pub struct WeightInfo(PhantomData); +impl runtime_parachains::coretime::WeightInfo for WeightInfo { + fn request_revenue_at() -> Weight { + // Proof Size summary in bytes: + // Measured: `2963` + // Estimated: `6428` + // Minimum execution time: 36_613_000 picoseconds. + Weight::from_parts(37_637_000, 0) + .saturating_add(Weight::from_parts(0, 6428)) + .saturating_add(T::DbWeight::get().reads(6)) + .saturating_add(T::DbWeight::get().writes(3)) + } + /// Storage: `Configuration::PendingConfigs` (r:1 w:1) + /// Proof: `Configuration::PendingConfigs` (`max_values`: Some(1), `max_size`: None, mode: `Measured`) + /// Storage: `Configuration::BypassConsistencyCheck` (r:1 w:0) + /// Proof: `Configuration::BypassConsistencyCheck` (`max_values`: Some(1), `max_size`: None, mode: `Measured`) + /// Storage: `ParasShared::CurrentSessionIndex` (r:1 w:0) + /// Proof: `ParasShared::CurrentSessionIndex` (`max_values`: Some(1), `max_size`: None, mode: `Measured`) + fn request_core_count() -> Weight { + // Proof Size summary in bytes: + // Measured: `155` + // Estimated: `1640` + // Minimum execution time: 7_573_000 picoseconds. + Weight::from_parts(7_884_000, 0) + .saturating_add(Weight::from_parts(0, 1640)) + .saturating_add(T::DbWeight::get().reads(3)) + .saturating_add(T::DbWeight::get().writes(1)) + } + /// Storage: `CoretimeAssignmentProvider::CoreDescriptors` (r:1 w:1) + /// Proof: `CoretimeAssignmentProvider::CoreDescriptors` (`max_values`: None, `max_size`: None, mode: `Measured`) + /// Storage: `CoretimeAssignmentProvider::CoreSchedules` (r:0 w:1) + /// Proof: `CoretimeAssignmentProvider::CoreSchedules` (`max_values`: None, `max_size`: None, mode: `Measured`) + /// The range of component `s` is `[1, 100]`. + fn assign_core(s: u32, ) -> Weight { + // Proof Size summary in bytes: + // Measured: `114` + // Estimated: `3579` + // Minimum execution time: 9_649_000 picoseconds. + Weight::from_parts(10_304_517, 0) + .saturating_add(Weight::from_parts(0, 3579)) + // Standard Error: 281 + .saturating_add(Weight::from_parts(13_646, 0).saturating_mul(s.into())) + .saturating_add(T::DbWeight::get().reads(1)) + .saturating_add(T::DbWeight::get().writes(2)) + } +} From 1ec40cf03fd726178cddd380a133566d01428c2a Mon Sep 17 00:00:00 2001 From: Tsvetomir Dimitrov Date: Fri, 26 Jul 2024 10:04:03 +0300 Subject: [PATCH 03/19] ElasticScaling is already enabled - remove it from migrations --- relay/polkadot/src/lib.rs | 13 ------------- 1 file changed, 13 deletions(-) diff --git a/relay/polkadot/src/lib.rs b/relay/polkadot/src/lib.rs index b6a5e01834..fd18050b65 100644 --- a/relay/polkadot/src/lib.rs +++ b/relay/polkadot/src/lib.rs @@ -1812,19 +1812,6 @@ 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 { - use runtime_parachains::configuration::WeightInfo as _; - let _ = Configuration::set_node_feature(frame_system::RawOrigin::Root.into(), 1, true); - weights::runtime_parachains_configuration::WeightInfo::::set_node_feature() - } - } - /// Cancel all ongoing auctions. /// /// Any leases that come into existence after coretime was launched will not be served. Yet, From f33e54667b3a6612310143b5b9103f292c6bf03a Mon Sep 17 00:00:00 2001 From: Tsvetomir Dimitrov Date: Fri, 26 Jul 2024 10:23:39 +0300 Subject: [PATCH 04/19] Also remove from migrations --- relay/polkadot/src/lib.rs | 1 - 1 file changed, 1 deletion(-) diff --git a/relay/polkadot/src/lib.rs b/relay/polkadot/src/lib.rs index fd18050b65..dd49930c3e 100644 --- a/relay/polkadot/src/lib.rs +++ b/relay/polkadot/src/lib.rs @@ -1861,7 +1861,6 @@ pub mod migrations { crate::xcm_config::XcmRouter, GetLegacyLeaseImpl, >, - EnableElasticScalingNodeFeature, CancelAuctions, ); From 4111d368f5e1deeea2ebc7a136dd33c3b0ed7c3a Mon Sep 17 00:00:00 2001 From: eskimor Date: Fri, 26 Jul 2024 09:41:22 +0200 Subject: [PATCH 05/19] Rename, auction key, parameter set --- relay/kusama/src/lib.rs | 4 ++-- relay/polkadot/src/lib.rs | 12 ++++++------ 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/relay/kusama/src/lib.rs b/relay/kusama/src/lib.rs index 0b6704edfd..f4df506107 100644 --- a/relay/kusama/src/lib.rs +++ b/relay/kusama/src/lib.rs @@ -1625,7 +1625,7 @@ construct_runtime! { ParaSessionInfo: parachains_session_info = 61, ParasDisputes: parachains_disputes = 62, ParasSlashing: parachains_slashing = 63, - OnDemandAssignmentProvider: parachains_assigner_on_demand = 64, + OnDemand: parachains_assigner_on_demand = 64, CoretimeAssignmentProvider: parachains_assigner_coretime = 65, // Parachain Onboarding Pallets. Start indices at 70 to leave room. @@ -1738,7 +1738,7 @@ mod benches { [runtime_parachains::initializer, Initializer] [runtime_parachains::paras_inherent, ParaInherent] [runtime_parachains::paras, Paras] - [runtime_parachains::assigner_on_demand, OnDemandAssignmentProvider] + [runtime_parachains::assigner_on_demand, OnDemand] [runtime_parachains::coretime, Coretime] // Substrate [pallet_balances, Native] diff --git a/relay/polkadot/src/lib.rs b/relay/polkadot/src/lib.rs index dd49930c3e..d2063623ab 100644 --- a/relay/polkadot/src/lib.rs +++ b/relay/polkadot/src/lib.rs @@ -1297,7 +1297,7 @@ impl parachains_paras::Config for Runtime { type QueueFootprinter = ParaInclusion; type NextSessionRotation = Babe; type OnNewHead = Registrar; - type AssignCoretime = (); + type AssignCoretime = CoretimeAssignmentProvider; } parameter_types! { @@ -1705,7 +1705,7 @@ construct_runtime! { ParaSessionInfo: parachains_session_info = 61, ParasDisputes: parachains_disputes = 62, ParasSlashing: parachains_slashing = 63, - OnDemandAssignmentProvider: parachains_assigner_on_demand = 64, + OnDemand: parachains_assigner_on_demand = 64, CoretimeAssignmentProvider: parachains_assigner_coretime = 65, // Parachain Onboarding Pallets. Start indices at 70 to leave room. @@ -1834,9 +1834,9 @@ pub mod migrations { // TODO: Fix this key for Polkadot! pallet_custom_origins::Origin::AuctionAdmin.into(), [ - 0x5c, 0x68, 0xbf, 0x0c, 0x2d, 0x11, 0x04, 0x91, 0x6b, 0xa5, 0xa4, 0xde, 0xe6, - 0xb8, 0x14, 0xe8, 0x2b, 0x27, 0x93, 0x78, 0x4c, 0xb6, 0xe7, 0x69, 0x04, 0x00, - 0x1a, 0x59, 0x49, 0xc1, 0x63, 0xb1, + 0x87, 0xa8, 0x71, 0xb4, 0xd6, 0x21, 0xf0, 0xb9, 0x73, 0x47, 0x5a, 0xaf, 0xcc, + 0x32, 0x61, 0x0b, 0xd7, 0x68, 0x8f, 0x15, 0x02, 0x33, 0x8a, 0xcd, 0x00, 0xee, + 0x48, 0x8a, 0xc3, 0x62, 0x0f, 0x4c, ], ) { log::debug!(target: "runtime", "Cancelling scheduled auctions failed: {:?}", err); @@ -1902,7 +1902,7 @@ mod benches { [runtime_parachains::initializer, Initializer] [runtime_parachains::paras, Paras] [runtime_parachains::paras_inherent, ParaInherent] - [runtime_parachains::assigner_on_demand, OnDemandAssignmentProvider] + [runtime_parachains::assigner_on_demand, OnDemand] [runtime_parachains::coretime, Coretime] // Substrate [pallet_bags_list, VoterList] From 3f14519b86dc85c72b887b16d3c07b07f01b6bd5 Mon Sep 17 00:00:00 2001 From: Tsvetomir Dimitrov Date: Fri, 26 Jul 2024 11:14:42 +0300 Subject: [PATCH 06/19] And remove elastic scaling from the changelog --- CHANGELOG.md | 1 - 1 file changed, 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index bb7602e920..a19ff5a6da 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -16,7 +16,6 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/). - Pallet ranked collective: max member count per rank ([runtimes#381](https://github.com/polkadot-fellows/runtimes/pull/381), [SDK v1.14 #4807](https://github.com/paritytech/polkadot-sdk/pull/4807)). - All runtimes: XcmPaymentApi and DryRunApi ([polkadot-fellows/runtimes#380](https://github.com/polkadot-fellows/runtimes/pull/380)) - Enable Agile Coretime on Polkadot ([polkadot-fellows/runtimes#322](https://github.com/polkadot-fellows/runtimes/pull/322)) -- Enable Elastic Scaling node side feature for Polkadot ([polkadot-fellows/runtimes#322](https://github.com/polkadot-fellows/runtimes/pull/322)) #### From [#322](https://github.com/polkadot-fellows/runtimes/pull/322): From f7624421a6c57d7a48e460dd0ecd5c86e89edb28 Mon Sep 17 00:00:00 2001 From: eskimor Date: Fri, 26 Jul 2024 11:19:10 +0200 Subject: [PATCH 07/19] Note on demand renaming in changelog --- CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index a19ff5a6da..25ac5517c3 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -46,6 +46,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/). ### Changed - Bounties: Remove payout delay ([polkadot-fellows/runtimes#386](https://github.com/polkadot-fellows/runtimes/pull/386)). +- Kusama, pallet OnDemandAssignmentProvider: renamed to Ondemand. - Polkadot System Chains: Reduce the base transaction fee by half ([polkadot-fellows/runtimes#398](https://github.com/polkadot-fellows/runtimes/pull/398)). #### From [#322](https://github.com/polkadot-fellows/runtimes/pull/322): From b1d09a9a3f9cb75d9ca911b958a5e760f58132bd Mon Sep 17 00:00:00 2001 From: eskimor Date: Fri, 26 Jul 2024 11:34:51 +0200 Subject: [PATCH 08/19] Add OnSwap --- relay/polkadot/src/lib.rs | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/relay/polkadot/src/lib.rs b/relay/polkadot/src/lib.rs index d2063623ab..a718ed44f8 100644 --- a/relay/polkadot/src/lib.rs +++ b/relay/polkadot/src/lib.rs @@ -1472,7 +1472,7 @@ impl paras_registrar::Config for Runtime { type RuntimeOrigin = RuntimeOrigin; type RuntimeEvent = RuntimeEvent; type Currency = Balances; - type OnSwap = (Crowdloan, Slots); + type OnSwap = (Crowdloan, Slots, SwapLeases); type ParaDeposit = ParaDeposit; type DataDepositPerByte = ParaDataByteDeposit; type WeightInfo = weights::polkadot_runtime_common_paras_registrar::WeightInfo; @@ -1622,6 +1622,13 @@ impl pallet_asset_rate::Config for Runtime { #[cfg(feature = "runtime-benchmarks")] type BenchmarkHelper = polkadot_runtime_common::impls::benchmarks::AssetRateArguments; } +// Notify `coretime` Pallet when a lease swap occurs +pub struct SwapLeases; +impl OnSwap for SwapLeases { + fn on_swap(one: ParaId, other: ParaId) { + coretime::Pallet::::on_legacy_lease_swap(one, other); + } +} construct_runtime! { pub enum Runtime @@ -1831,7 +1838,6 @@ pub mod migrations { } // Cancel scheduled auction as well: if let Err(err) = Scheduler::cancel_named( - // TODO: Fix this key for Polkadot! pallet_custom_origins::Origin::AuctionAdmin.into(), [ 0x87, 0xa8, 0x71, 0xb4, 0xd6, 0x21, 0xf0, 0xb9, 0x73, 0x47, 0x5a, 0xaf, 0xcc, From db45f012a21929759ce0a37d9e7ea76f5372adc6 Mon Sep 17 00:00:00 2001 From: eskimor Date: Fri, 26 Jul 2024 11:38:26 +0200 Subject: [PATCH 09/19] Don't drop leases with holes. --- relay/polkadot/src/lib.rs | 15 --------------- 1 file changed, 15 deletions(-) diff --git a/relay/polkadot/src/lib.rs b/relay/polkadot/src/lib.rs index a718ed44f8..791a7e0557 100644 --- a/relay/polkadot/src/lib.rs +++ b/relay/polkadot/src/lib.rs @@ -1798,21 +1798,6 @@ pub mod migrations { if lease.is_empty() { return None } - // Lease not yet started/or having holes, refund (coretime can't handle this): - if lease.iter().any(Option::is_none) { - if let Err(err) = slots::Pallet::::clear_all_leases( - frame_system::RawOrigin::Root.into(), - para, - ) { - log::error!( - target: "runtime", - "Clearing lease for para: {:?} failed, with error: {:?}", - para, - err - ); - }; - return None - } let (index, _) = as Leaser>::lease_period_index(now)?; Some(index.saturating_add(lease.len() as u32).saturating_mul(LeasePeriod::get())) From 472726569944d499859705e1117ca01c318abc7d Mon Sep 17 00:00:00 2001 From: Tsvetomir Dimitrov Date: Fri, 26 Jul 2024 15:28:44 +0300 Subject: [PATCH 10/19] Add missing import and format --- relay/polkadot/src/lib.rs | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/relay/polkadot/src/lib.rs b/relay/polkadot/src/lib.rs index 791a7e0557..5d72cbdef7 100644 --- a/relay/polkadot/src/lib.rs +++ b/relay/polkadot/src/lib.rs @@ -26,8 +26,9 @@ use polkadot_runtime_common::{ impls::{ DealWithFees, LocatableAssetConverter, VersionedLocatableAsset, VersionedLocationConverter, }, - paras_registrar, prod_or_fast, slots, BlockHashCount, BlockLength, CurrencyToVote, - SlowAdjustingFeeUpdate, + paras_registrar, prod_or_fast, slots, + traits::OnSwap, + BlockHashCount, BlockLength, CurrencyToVote, SlowAdjustingFeeUpdate, }; use runtime_parachains::{ @@ -1211,8 +1212,7 @@ impl InstanceFilter for ProxyType { matches!( c, RuntimeCall::Staking(..) | - RuntimeCall::Session(..) | - RuntimeCall::Utility(..) | + RuntimeCall::Session(..) | RuntimeCall::Utility(..) | RuntimeCall::FastUnstake(..) | RuntimeCall::VoterList(..) | RuntimeCall::NominationPools(..) From a27457675c91c002c0a69c38f111f9e171accb99 Mon Sep 17 00:00:00 2001 From: Tsvetomir Dimitrov Date: Fri, 26 Jul 2024 16:25:49 +0300 Subject: [PATCH 11/19] `OnDemandRename` - first try --- relay/polkadot/src/lib.rs | 23 ++++++++++++++++++++++- 1 file changed, 22 insertions(+), 1 deletion(-) diff --git a/relay/polkadot/src/lib.rs b/relay/polkadot/src/lib.rs index 5d72cbdef7..49803d1d87 100644 --- a/relay/polkadot/src/lib.rs +++ b/relay/polkadot/src/lib.rs @@ -1212,7 +1212,8 @@ impl InstanceFilter for ProxyType { matches!( c, RuntimeCall::Staking(..) | - RuntimeCall::Session(..) | RuntimeCall::Utility(..) | + RuntimeCall::Session(..) | + RuntimeCall::Utility(..) | RuntimeCall::FastUnstake(..) | RuntimeCall::VoterList(..) | RuntimeCall::NominationPools(..) @@ -1786,6 +1787,7 @@ pub type Migrations = (migrations::Unreleased, migrations::Permanent); /// The runtime migrations per release. #[allow(deprecated, missing_docs)] pub mod migrations { + use frame_support::migration::move_storage_from_pallet; use polkadot_runtime_common::traits::Leaser; use super::*; @@ -1841,8 +1843,27 @@ pub mod migrations { } } + // Migrate storage for pallet rename `OnDemandAssignmentProvider` -> `OnDemand` + pub struct OnDemandRename; + impl OnRuntimeUpgrade for OnDemandRename { + fn on_runtime_upgrade() -> Weight { + move_storage_from_pallet(b"Pallet", b"OnDemandAssignmentProvider", b"OnDemand"); + move_storage_from_pallet(b"ParaIdAffinity", b"OnDemandAssignmentProvider", b"OnDemand"); + move_storage_from_pallet(b"QueueStatus", b"OnDemandAssignmentProvider", b"OnDemand"); + move_storage_from_pallet(b"FreeEntries", b"OnDemandAssignmentProvider", b"OnDemand"); + move_storage_from_pallet( + b"AffinityEntries", + b"OnDemandAssignmentProvider", + b"OnDemand", + ); + move_storage_from_pallet(b"Revenue", b"OnDemandAssignmentProvider", b"OnDemand"); + ::DbWeight::get().reads_writes(0, 0) //todo + } + } + /// Unreleased migrations. Add new ones here: pub type Unreleased = ( + OnDemandRename, parachains_configuration::migration::v12::MigrateToV12, parachains_inclusion::migration::MigrateToV1, pallet_staking::migrations::v15::MigrateV14ToV15, From 0a53150b9bb3853fa57c5f5d836a0ba7cd73e7ac Mon Sep 17 00:00:00 2001 From: Tsvetomir Dimitrov Date: Tue, 30 Jul 2024 17:03:23 +0300 Subject: [PATCH 12/19] fmt --- relay/kusama/src/lib.rs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/relay/kusama/src/lib.rs b/relay/kusama/src/lib.rs index f4df506107..9fc31fb1d3 100644 --- a/relay/kusama/src/lib.rs +++ b/relay/kusama/src/lib.rs @@ -1115,7 +1115,8 @@ impl InstanceFilter for ProxyType { matches!( c, RuntimeCall::Staking(..) | - RuntimeCall::Session(..) | RuntimeCall::Utility(..) | + RuntimeCall::Session(..) | + RuntimeCall::Utility(..) | RuntimeCall::FastUnstake(..) | RuntimeCall::VoterList(..) | RuntimeCall::NominationPools(..) From c7acb91822261e272866f83c1df67645084c1347 Mon Sep 17 00:00:00 2001 From: Tsvetomir Dimitrov Date: Tue, 30 Jul 2024 17:14:07 +0300 Subject: [PATCH 13/19] fmt --- relay/kusama/src/lib.rs | 3 +-- relay/polkadot/src/lib.rs | 3 +-- 2 files changed, 2 insertions(+), 4 deletions(-) diff --git a/relay/kusama/src/lib.rs b/relay/kusama/src/lib.rs index 9fc31fb1d3..f4df506107 100644 --- a/relay/kusama/src/lib.rs +++ b/relay/kusama/src/lib.rs @@ -1115,8 +1115,7 @@ impl InstanceFilter for ProxyType { matches!( c, RuntimeCall::Staking(..) | - RuntimeCall::Session(..) | - RuntimeCall::Utility(..) | + RuntimeCall::Session(..) | RuntimeCall::Utility(..) | RuntimeCall::FastUnstake(..) | RuntimeCall::VoterList(..) | RuntimeCall::NominationPools(..) diff --git a/relay/polkadot/src/lib.rs b/relay/polkadot/src/lib.rs index 49803d1d87..1a2882fbd8 100644 --- a/relay/polkadot/src/lib.rs +++ b/relay/polkadot/src/lib.rs @@ -1212,8 +1212,7 @@ impl InstanceFilter for ProxyType { matches!( c, RuntimeCall::Staking(..) | - RuntimeCall::Session(..) | - RuntimeCall::Utility(..) | + RuntimeCall::Session(..) | RuntimeCall::Utility(..) | RuntimeCall::FastUnstake(..) | RuntimeCall::VoterList(..) | RuntimeCall::NominationPools(..) From 76fc5ede7714b732a5013704ec1d64461a096955 Mon Sep 17 00:00:00 2001 From: Tsvetomir Dimitrov Date: Fri, 2 Aug 2024 11:16:44 +0300 Subject: [PATCH 14/19] Undo `parachains_assigner_on_demand` pallet rename on Kusama --- CHANGELOG.md | 1 - relay/kusama/src/lib.rs | 2 +- relay/polkadot/src/lib.rs | 22 +--------------------- 3 files changed, 2 insertions(+), 23 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 25ac5517c3..a19ff5a6da 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -46,7 +46,6 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/). ### Changed - Bounties: Remove payout delay ([polkadot-fellows/runtimes#386](https://github.com/polkadot-fellows/runtimes/pull/386)). -- Kusama, pallet OnDemandAssignmentProvider: renamed to Ondemand. - Polkadot System Chains: Reduce the base transaction fee by half ([polkadot-fellows/runtimes#398](https://github.com/polkadot-fellows/runtimes/pull/398)). #### From [#322](https://github.com/polkadot-fellows/runtimes/pull/322): diff --git a/relay/kusama/src/lib.rs b/relay/kusama/src/lib.rs index f4df506107..6a238fc2b4 100644 --- a/relay/kusama/src/lib.rs +++ b/relay/kusama/src/lib.rs @@ -1625,7 +1625,7 @@ construct_runtime! { ParaSessionInfo: parachains_session_info = 61, ParasDisputes: parachains_disputes = 62, ParasSlashing: parachains_slashing = 63, - OnDemand: parachains_assigner_on_demand = 64, + OnDemandAssignmentProvider: parachains_assigner_on_demand = 64, CoretimeAssignmentProvider: parachains_assigner_coretime = 65, // Parachain Onboarding Pallets. Start indices at 70 to leave room. diff --git a/relay/polkadot/src/lib.rs b/relay/polkadot/src/lib.rs index 1a2882fbd8..b4122dc325 100644 --- a/relay/polkadot/src/lib.rs +++ b/relay/polkadot/src/lib.rs @@ -1786,7 +1786,6 @@ pub type Migrations = (migrations::Unreleased, migrations::Permanent); /// The runtime migrations per release. #[allow(deprecated, missing_docs)] pub mod migrations { - use frame_support::migration::move_storage_from_pallet; use polkadot_runtime_common::traits::Leaser; use super::*; @@ -1842,27 +1841,8 @@ pub mod migrations { } } - // Migrate storage for pallet rename `OnDemandAssignmentProvider` -> `OnDemand` - pub struct OnDemandRename; - impl OnRuntimeUpgrade for OnDemandRename { - fn on_runtime_upgrade() -> Weight { - move_storage_from_pallet(b"Pallet", b"OnDemandAssignmentProvider", b"OnDemand"); - move_storage_from_pallet(b"ParaIdAffinity", b"OnDemandAssignmentProvider", b"OnDemand"); - move_storage_from_pallet(b"QueueStatus", b"OnDemandAssignmentProvider", b"OnDemand"); - move_storage_from_pallet(b"FreeEntries", b"OnDemandAssignmentProvider", b"OnDemand"); - move_storage_from_pallet( - b"AffinityEntries", - b"OnDemandAssignmentProvider", - b"OnDemand", - ); - move_storage_from_pallet(b"Revenue", b"OnDemandAssignmentProvider", b"OnDemand"); - ::DbWeight::get().reads_writes(0, 0) //todo - } - } - /// Unreleased migrations. Add new ones here: pub type Unreleased = ( - OnDemandRename, parachains_configuration::migration::v12::MigrateToV12, parachains_inclusion::migration::MigrateToV1, pallet_staking::migrations::v15::MigrateV14ToV15, @@ -1913,7 +1893,7 @@ mod benches { [runtime_parachains::initializer, Initializer] [runtime_parachains::paras, Paras] [runtime_parachains::paras_inherent, ParaInherent] - [runtime_parachains::assigner_on_demand, OnDemand] + [runtime_parachains::assigner_on_demand, OnDemandAssignmentProvider] [runtime_parachains::coretime, Coretime] // Substrate [pallet_bags_list, VoterList] From 088cec4727300bf49ac4e97c3fbadb66c855f4eb Mon Sep 17 00:00:00 2001 From: Tsvetomir Dimitrov Date: Fri, 2 Aug 2024 12:52:09 +0300 Subject: [PATCH 15/19] Fix benches --- relay/kusama/src/lib.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/relay/kusama/src/lib.rs b/relay/kusama/src/lib.rs index 6a238fc2b4..0b6704edfd 100644 --- a/relay/kusama/src/lib.rs +++ b/relay/kusama/src/lib.rs @@ -1738,7 +1738,7 @@ mod benches { [runtime_parachains::initializer, Initializer] [runtime_parachains::paras_inherent, ParaInherent] [runtime_parachains::paras, Paras] - [runtime_parachains::assigner_on_demand, OnDemand] + [runtime_parachains::assigner_on_demand, OnDemandAssignmentProvider] [runtime_parachains::coretime, Coretime] // Substrate [pallet_balances, Native] From 0d6aa9ec52752432fa4fab25ee49fc9a72b86091 Mon Sep 17 00:00:00 2001 From: Tsvetomir Dimitrov Date: Fri, 2 Aug 2024 14:53:39 +0300 Subject: [PATCH 16/19] Fix benches for real --- relay/polkadot/src/lib.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/relay/polkadot/src/lib.rs b/relay/polkadot/src/lib.rs index b4122dc325..5d72cbdef7 100644 --- a/relay/polkadot/src/lib.rs +++ b/relay/polkadot/src/lib.rs @@ -1893,7 +1893,7 @@ mod benches { [runtime_parachains::initializer, Initializer] [runtime_parachains::paras, Paras] [runtime_parachains::paras_inherent, ParaInherent] - [runtime_parachains::assigner_on_demand, OnDemandAssignmentProvider] + [runtime_parachains::assigner_on_demand, OnDemand] [runtime_parachains::coretime, Coretime] // Substrate [pallet_bags_list, VoterList] From 50c8256e8f6b394c37b9b12959809f69626a0512 Mon Sep 17 00:00:00 2001 From: Tsvetomir Dimitrov Date: Mon, 5 Aug 2024 10:04:12 +0300 Subject: [PATCH 17/19] Apply suggestions from code review MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: Dónal Murray --- CHANGELOG.md | 2 +- relay/polkadot/constants/src/lib.rs | 2 +- relay/polkadot/src/lib.rs | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index a19ff5a6da..fc103389a2 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -15,7 +15,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/). - Core-Fellowship: new `promote_fast` call ([runtimes#381](https://github.com/polkadot-fellows/runtimes/pull/381), [SDK v1.14 #4877](https://github.com/paritytech/polkadot-sdk/pull/4877)). - Pallet ranked collective: max member count per rank ([runtimes#381](https://github.com/polkadot-fellows/runtimes/pull/381), [SDK v1.14 #4807](https://github.com/paritytech/polkadot-sdk/pull/4807)). - All runtimes: XcmPaymentApi and DryRunApi ([polkadot-fellows/runtimes#380](https://github.com/polkadot-fellows/runtimes/pull/380)) -- Enable Agile Coretime on Polkadot ([polkadot-fellows/runtimes#322](https://github.com/polkadot-fellows/runtimes/pull/322)) +- Enable Agile Coretime on Polkadot ([polkadot-fellows/runtimes#401](https://github.com/polkadot-fellows/runtimes/pull/401)) #### From [#322](https://github.com/polkadot-fellows/runtimes/pull/322): diff --git a/relay/polkadot/constants/src/lib.rs b/relay/polkadot/constants/src/lib.rs index 9b490fb8b7..3449d98884 100644 --- a/relay/polkadot/constants/src/lib.rs +++ b/relay/polkadot/constants/src/lib.rs @@ -131,7 +131,7 @@ pub mod system_parachain { pub const BRIDGE_HUB_ID: u32 = 1002; /// People parachain ID. pub const PEOPLE_ID: u32 = 1004; - /// Brokerage parachain ID. + /// Coretime Chain ID. pub const BROKER_ID: u32 = 1005; // System parachains from Polkadot point of view. diff --git a/relay/polkadot/src/lib.rs b/relay/polkadot/src/lib.rs index 5d72cbdef7..2343bb84ae 100644 --- a/relay/polkadot/src/lib.rs +++ b/relay/polkadot/src/lib.rs @@ -1796,7 +1796,7 @@ pub mod migrations { let now = frame_system::Pallet::::block_number(); let lease = slots::Leases::::get(para); if lease.is_empty() { - return None + return None; } let (index, _) = as Leaser>::lease_period_index(now)?; From 766a18887fcb6dc147dbd838fce72993433e8b64 Mon Sep 17 00:00:00 2001 From: Tsvetomir Dimitrov Date: Mon, 5 Aug 2024 11:36:51 +0300 Subject: [PATCH 18/19] Update `MaxXcmTransactWeight` --- relay/polkadot/src/lib.rs | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/relay/polkadot/src/lib.rs b/relay/polkadot/src/lib.rs index 2343bb84ae..040b04999b 100644 --- a/relay/polkadot/src/lib.rs +++ b/relay/polkadot/src/lib.rs @@ -66,7 +66,10 @@ use frame_support::{ Get, InstanceFilter, KeyOwnerProofSystem, LinearStoragePrice, OnRuntimeUpgrade, PrivilegeCmp, ProcessMessage, ProcessMessageError, WithdrawReasons, }, - weights::{constants, ConstantMultiplier, WeightMeter, WeightToFee as _}, + weights::{ + constants::{WEIGHT_PROOF_SIZE_PER_KB, WEIGHT_REF_TIME_PER_MICROS}, + ConstantMultiplier, WeightMeter, WeightToFee as _, + }, PalletId, }; use frame_system::EnsureRoot; @@ -1386,7 +1389,10 @@ impl parachains_scheduler::Config for Runtime { parameter_types! { pub const BrokerId: u32 = system_parachain::BROKER_ID; pub const BrokerPalletId: PalletId = PalletId(*b"py/broke"); - pub MaxXcmTransactWeight: Weight = Weight::from_parts(constants::WEIGHT_REF_TIME_PER_MILLIS, 20 * constants::WEIGHT_PROOF_SIZE_PER_KB); + pub MaxXcmTransactWeight: Weight = Weight::from_parts( + 250 * WEIGHT_REF_TIME_PER_MICROS, + 20 * WEIGHT_PROOF_SIZE_PER_KB + ); } pub struct BrokerPot; From e8ca5b92f3a468f75938a28c280061998aebb3a4 Mon Sep 17 00:00:00 2001 From: joe petrowski <25483142+joepetrowski@users.noreply.github.com> Date: Wed, 7 Aug 2024 18:49:40 +0200 Subject: [PATCH 19/19] Update relay/polkadot/src/lib.rs --- relay/polkadot/src/lib.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/relay/polkadot/src/lib.rs b/relay/polkadot/src/lib.rs index 05abc35658..8d1daaca2e 100644 --- a/relay/polkadot/src/lib.rs +++ b/relay/polkadot/src/lib.rs @@ -1563,7 +1563,7 @@ impl pallet_asset_rate::Config for Runtime { #[cfg(feature = "runtime-benchmarks")] type BenchmarkHelper = polkadot_runtime_common::impls::benchmarks::AssetRateArguments; } -// Notify `coretime` Pallet when a lease swap occurs +/// Notify the `coretime` pallet when a lease swap occurs. pub struct SwapLeases; impl OnSwap for SwapLeases { fn on_swap(one: ParaId, other: ParaId) {