mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-05-31 18:01:03 +00:00
Add Coretime to Westend (#3319)
Adds the coretime and on demand pallets to enable Coretime on Westend. In order for the migration to run successfully, we need the Broker/Coretime parachain to be live. TODO: - [ ] Broker parachain is live https://github.com/paritytech/polkadot-sdk/pull/3272 --------- Co-authored-by: command-bot <> Co-authored-by: Bastian Köcher <info@kchr.de>
This commit is contained in:
committed by
GitHub
parent
435e339261
commit
320863a847
@@ -61,12 +61,16 @@ use runtime_common::{
|
|||||||
impls::{
|
impls::{
|
||||||
LocatableAssetConverter, ToAuthor, VersionedLocatableAsset, VersionedLocationConverter,
|
LocatableAssetConverter, ToAuthor, VersionedLocatableAsset, VersionedLocationConverter,
|
||||||
},
|
},
|
||||||
paras_registrar, paras_sudo_wrapper, prod_or_fast, slots, BalanceToU256, BlockHashCount,
|
paras_registrar, paras_sudo_wrapper, prod_or_fast, slots,
|
||||||
BlockLength, CurrencyToVote, SlowAdjustingFeeUpdate, U256ToBalance,
|
traits::Leaser,
|
||||||
|
BalanceToU256, BlockHashCount, BlockLength, CurrencyToVote, SlowAdjustingFeeUpdate,
|
||||||
|
U256ToBalance,
|
||||||
};
|
};
|
||||||
use runtime_parachains::{
|
use runtime_parachains::{
|
||||||
|
assigner_coretime as parachains_assigner_coretime,
|
||||||
|
assigner_on_demand as parachains_assigner_on_demand,
|
||||||
assigner_parachains as parachains_assigner_parachains,
|
assigner_parachains as parachains_assigner_parachains,
|
||||||
configuration as parachains_configuration, disputes as parachains_disputes,
|
configuration as parachains_configuration, coretime, disputes as parachains_disputes,
|
||||||
disputes::slashing as parachains_slashing,
|
disputes::slashing as parachains_slashing,
|
||||||
dmp as parachains_dmp, hrmp as parachains_hrmp, inclusion as parachains_inclusion,
|
dmp as parachains_dmp, hrmp as parachains_hrmp, inclusion as parachains_inclusion,
|
||||||
inclusion::{AggregateMessageOrigin, UmpQueueId},
|
inclusion::{AggregateMessageOrigin, UmpQueueId},
|
||||||
@@ -147,7 +151,7 @@ pub const VERSION: RuntimeVersion = RuntimeVersion {
|
|||||||
spec_name: create_runtime_str!("westend"),
|
spec_name: create_runtime_str!("westend"),
|
||||||
impl_name: create_runtime_str!("parity-westend"),
|
impl_name: create_runtime_str!("parity-westend"),
|
||||||
authoring_version: 2,
|
authoring_version: 2,
|
||||||
spec_version: 1_007_000,
|
spec_version: 1_007_001,
|
||||||
impl_version: 0,
|
impl_version: 0,
|
||||||
apis: RUNTIME_API_VERSIONS,
|
apis: RUNTIME_API_VERSIONS,
|
||||||
transaction_version: 24,
|
transaction_version: 24,
|
||||||
@@ -1143,7 +1147,7 @@ impl parachains_paras::Config for Runtime {
|
|||||||
type QueueFootprinter = ParaInclusion;
|
type QueueFootprinter = ParaInclusion;
|
||||||
type NextSessionRotation = Babe;
|
type NextSessionRotation = Babe;
|
||||||
type OnNewHead = ();
|
type OnNewHead = ();
|
||||||
type AssignCoretime = ();
|
type AssignCoretime = CoretimeAssignmentProvider;
|
||||||
}
|
}
|
||||||
|
|
||||||
parameter_types! {
|
parameter_types! {
|
||||||
@@ -1212,20 +1216,42 @@ impl parachains_paras_inherent::Config for Runtime {
|
|||||||
impl parachains_scheduler::Config for Runtime {
|
impl parachains_scheduler::Config for Runtime {
|
||||||
// If you change this, make sure the `Assignment` type of the new provider is binary compatible,
|
// If you change this, make sure the `Assignment` type of the new provider is binary compatible,
|
||||||
// otherwise provide a migration.
|
// otherwise provide a migration.
|
||||||
type AssignmentProvider = ParachainsAssignmentProvider;
|
type AssignmentProvider = CoretimeAssignmentProvider;
|
||||||
}
|
}
|
||||||
|
|
||||||
parameter_types! {
|
parameter_types! {
|
||||||
pub const BrokerId: u32 = BROKER_ID;
|
pub const BrokerId: u32 = BROKER_ID;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
impl coretime::Config for Runtime {
|
||||||
|
type RuntimeOrigin = RuntimeOrigin;
|
||||||
|
type RuntimeEvent = RuntimeEvent;
|
||||||
|
type Currency = Balances;
|
||||||
|
type BrokerId = BrokerId;
|
||||||
|
type WeightInfo = weights::runtime_parachains_coretime::WeightInfo<Runtime>;
|
||||||
|
type SendXcm = crate::xcm_config::XcmRouter;
|
||||||
|
}
|
||||||
|
|
||||||
|
parameter_types! {
|
||||||
|
pub const OnDemandTrafficDefaultValue: FixedU128 = FixedU128::from_u32(1);
|
||||||
|
}
|
||||||
|
|
||||||
|
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<Runtime>;
|
||||||
|
}
|
||||||
|
|
||||||
impl parachains_assigner_parachains::Config for Runtime {}
|
impl parachains_assigner_parachains::Config for Runtime {}
|
||||||
|
|
||||||
|
impl parachains_assigner_coretime::Config for Runtime {}
|
||||||
|
|
||||||
impl parachains_initializer::Config for Runtime {
|
impl parachains_initializer::Config for Runtime {
|
||||||
type Randomness = pallet_babe::RandomnessFromOneEpochAgo<Runtime>;
|
type Randomness = pallet_babe::RandomnessFromOneEpochAgo<Runtime>;
|
||||||
type ForceOrigin = EnsureRoot<AccountId>;
|
type ForceOrigin = EnsureRoot<AccountId>;
|
||||||
type WeightInfo = weights::runtime_parachains_initializer::WeightInfo<Runtime>;
|
type WeightInfo = weights::runtime_parachains_initializer::WeightInfo<Runtime>;
|
||||||
type CoretimeOnNewSession = ();
|
type CoretimeOnNewSession = Coretime;
|
||||||
}
|
}
|
||||||
|
|
||||||
impl paras_sudo_wrapper::Config for Runtime {}
|
impl paras_sudo_wrapper::Config for Runtime {}
|
||||||
@@ -1480,6 +1506,8 @@ construct_runtime! {
|
|||||||
ParasDisputes: parachains_disputes = 53,
|
ParasDisputes: parachains_disputes = 53,
|
||||||
ParasSlashing: parachains_slashing = 54,
|
ParasSlashing: parachains_slashing = 54,
|
||||||
ParachainsAssignmentProvider: parachains_assigner_parachains = 55,
|
ParachainsAssignmentProvider: parachains_assigner_parachains = 55,
|
||||||
|
OnDemandAssignmentProvider: parachains_assigner_on_demand = 56,
|
||||||
|
CoretimeAssignmentProvider: parachains_assigner_coretime = 57,
|
||||||
|
|
||||||
// Parachain Onboarding Pallets. Start indices at 60 to leave room.
|
// Parachain Onboarding Pallets. Start indices at 60 to leave room.
|
||||||
Registrar: paras_registrar = 60,
|
Registrar: paras_registrar = 60,
|
||||||
@@ -1488,6 +1516,7 @@ construct_runtime! {
|
|||||||
Auctions: auctions = 63,
|
Auctions: auctions = 63,
|
||||||
Crowdloan: crowdloan = 64,
|
Crowdloan: crowdloan = 64,
|
||||||
AssignedSlots: assigned_slots = 65,
|
AssignedSlots: assigned_slots = 65,
|
||||||
|
Coretime: coretime = 66,
|
||||||
|
|
||||||
// Pallet for sending XCM.
|
// Pallet for sending XCM.
|
||||||
XcmPallet: pallet_xcm = 99,
|
XcmPallet: pallet_xcm = 99,
|
||||||
@@ -1555,6 +1584,24 @@ pub mod migrations {
|
|||||||
#[cfg(feature = "try-runtime")]
|
#[cfg(feature = "try-runtime")]
|
||||||
use sp_core::crypto::ByteArray;
|
use sp_core::crypto::ByteArray;
|
||||||
|
|
||||||
|
pub struct GetLegacyLeaseImpl;
|
||||||
|
impl coretime::migration::GetLegacyLease<BlockNumber> for GetLegacyLeaseImpl {
|
||||||
|
fn get_parachain_lease_in_blocks(para: ParaId) -> Option<BlockNumber> {
|
||||||
|
let now = frame_system::Pallet::<Runtime>::block_number();
|
||||||
|
let lease = slots::Pallet::<Runtime>::lease(para);
|
||||||
|
if lease.is_empty() {
|
||||||
|
return None
|
||||||
|
}
|
||||||
|
// Lease not yet started, ignore:
|
||||||
|
if lease.iter().any(Option::is_none) {
|
||||||
|
return None
|
||||||
|
}
|
||||||
|
let (index, _) =
|
||||||
|
<slots::Pallet<Runtime> as Leaser<BlockNumber>>::lease_period_index(now)?;
|
||||||
|
Some(index.saturating_add(lease.len() as u32).saturating_mul(LeasePeriod::get()))
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
parameter_types! {
|
parameter_types! {
|
||||||
pub const ImOnlinePalletName: &'static str = "ImOnline";
|
pub const ImOnlinePalletName: &'static str = "ImOnline";
|
||||||
}
|
}
|
||||||
@@ -1658,6 +1705,12 @@ pub mod migrations {
|
|||||||
parachains_configuration::migration::v11::MigrateToV11<Runtime>,
|
parachains_configuration::migration::v11::MigrateToV11<Runtime>,
|
||||||
// permanent
|
// permanent
|
||||||
pallet_xcm::migration::MigrateToLatestXcmVersion<Runtime>,
|
pallet_xcm::migration::MigrateToLatestXcmVersion<Runtime>,
|
||||||
|
// Migrate from legacy lease to coretime. Needs to run after configuration v11
|
||||||
|
coretime::migration::MigrateToCoretime<
|
||||||
|
Runtime,
|
||||||
|
crate::xcm_config::XcmRouter,
|
||||||
|
GetLegacyLeaseImpl,
|
||||||
|
>,
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1696,6 +1749,8 @@ mod benches {
|
|||||||
[runtime_parachains::initializer, Initializer]
|
[runtime_parachains::initializer, Initializer]
|
||||||
[runtime_parachains::paras, Paras]
|
[runtime_parachains::paras, Paras]
|
||||||
[runtime_parachains::paras_inherent, ParaInherent]
|
[runtime_parachains::paras_inherent, ParaInherent]
|
||||||
|
[runtime_parachains::assigner_on_demand, OnDemandAssignmentProvider]
|
||||||
|
[runtime_parachains::coretime, Coretime]
|
||||||
// Substrate
|
// Substrate
|
||||||
[pallet_bags_list, VoterList]
|
[pallet_bags_list, VoterList]
|
||||||
[pallet_balances, Balances]
|
[pallet_balances, Balances]
|
||||||
|
|||||||
@@ -16,11 +16,11 @@
|
|||||||
|
|
||||||
//! Autogenerated weights for `runtime_parachains::coretime`
|
//! Autogenerated weights for `runtime_parachains::coretime`
|
||||||
//!
|
//!
|
||||||
//! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 4.0.0-dev
|
//! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 32.0.0
|
||||||
//! DATE: 2023-12-01, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]`
|
//! DATE: 2024-02-15, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]`
|
||||||
//! WORST CASE MAP SIZE: `1000000`
|
//! WORST CASE MAP SIZE: `1000000`
|
||||||
//! HOSTNAME: `runner-r43aesjn-project-674-concurrent-0`, CPU: `Intel(R) Xeon(R) CPU @ 2.60GHz`
|
//! HOSTNAME: `runner-bn-ce5rx-project-674-concurrent-0`, CPU: `Intel(R) Xeon(R) CPU @ 2.60GHz`
|
||||||
//! WASM-EXECUTION: `Compiled`, CHAIN: `Some("rococo-dev")`, DB CACHE: 1024
|
//! WASM-EXECUTION: `Compiled`, CHAIN: `Some("westend-dev")`, DB CACHE: 1024
|
||||||
|
|
||||||
// Executed Command:
|
// Executed Command:
|
||||||
// target/production/polkadot
|
// target/production/polkadot
|
||||||
@@ -32,10 +32,10 @@
|
|||||||
// --wasm-execution=compiled
|
// --wasm-execution=compiled
|
||||||
// --heap-pages=4096
|
// --heap-pages=4096
|
||||||
// --json-file=/builds/parity/mirrors/polkadot-sdk/.git/.artifacts/bench.json
|
// --json-file=/builds/parity/mirrors/polkadot-sdk/.git/.artifacts/bench.json
|
||||||
// --pallet=runtime_common::coretime
|
// --pallet=runtime_parachains::coretime
|
||||||
// --chain=rococo-dev
|
// --chain=westend-dev
|
||||||
// --header=./polkadot/file_header.txt
|
// --header=./polkadot/file_header.txt
|
||||||
// --output=./polkadot/runtime/rococo/src/weights/
|
// --output=./polkadot/runtime/westend/src/weights/
|
||||||
|
|
||||||
#![cfg_attr(rustfmt, rustfmt_skip)]
|
#![cfg_attr(rustfmt, rustfmt_skip)]
|
||||||
#![allow(unused_parens)]
|
#![allow(unused_parens)]
|
||||||
@@ -45,28 +45,39 @@
|
|||||||
use frame_support::{traits::Get, weights::Weight};
|
use frame_support::{traits::Get, weights::Weight};
|
||||||
use core::marker::PhantomData;
|
use core::marker::PhantomData;
|
||||||
|
|
||||||
use runtime_parachains::configuration::{self, WeightInfo as ConfigWeightInfo};
|
/// Weight functions for `runtime_parachains::coretime`.
|
||||||
|
|
||||||
/// Weight functions for `runtime_common::coretime`.
|
|
||||||
pub struct WeightInfo<T>(PhantomData<T>);
|
pub struct WeightInfo<T>(PhantomData<T>);
|
||||||
impl<T: frame_system::Config + configuration::Config> runtime_parachains::coretime::WeightInfo for WeightInfo<T> {
|
impl<T: frame_system::Config> runtime_parachains::coretime::WeightInfo for WeightInfo<T> {
|
||||||
|
/// 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 {
|
fn request_core_count() -> Weight {
|
||||||
<T as configuration::Config>::WeightInfo::set_config_with_u32()
|
// Proof Size summary in bytes:
|
||||||
|
// Measured: `151`
|
||||||
|
// Estimated: `1636`
|
||||||
|
// Minimum execution time: 7_486_000 picoseconds.
|
||||||
|
Weight::from_parts(7_889_000, 0)
|
||||||
|
.saturating_add(Weight::from_parts(0, 1636))
|
||||||
|
.saturating_add(T::DbWeight::get().reads(3))
|
||||||
|
.saturating_add(T::DbWeight::get().writes(1))
|
||||||
}
|
}
|
||||||
/// Storage: `CoreTimeAssignmentProvider::CoreDescriptors` (r:1 w:1)
|
/// Storage: `CoretimeAssignmentProvider::CoreDescriptors` (r:1 w:1)
|
||||||
/// Proof: `CoreTimeAssignmentProvider::CoreDescriptors` (`max_values`: None, `max_size`: None, mode: `Measured`)
|
/// Proof: `CoretimeAssignmentProvider::CoreDescriptors` (`max_values`: None, `max_size`: None, mode: `Measured`)
|
||||||
/// Storage: `CoreTimeAssignmentProvider::CoreSchedules` (r:0 w:1)
|
/// Storage: `CoretimeAssignmentProvider::CoreSchedules` (r:0 w:1)
|
||||||
/// Proof: `CoreTimeAssignmentProvider::CoreSchedules` (`max_values`: None, `max_size`: None, mode: `Measured`)
|
/// Proof: `CoretimeAssignmentProvider::CoreSchedules` (`max_values`: None, `max_size`: None, mode: `Measured`)
|
||||||
/// The range of component `s` is `[1, 100]`.
|
/// The range of component `s` is `[1, 100]`.
|
||||||
fn assign_core(s: u32, ) -> Weight {
|
fn assign_core(s: u32, ) -> Weight {
|
||||||
// Proof Size summary in bytes:
|
// Proof Size summary in bytes:
|
||||||
// Measured: `76`
|
// Measured: `147`
|
||||||
// Estimated: `3541`
|
// Estimated: `3612`
|
||||||
// Minimum execution time: 6_275_000 picoseconds.
|
// Minimum execution time: 9_409_000 picoseconds.
|
||||||
Weight::from_parts(6_883_543, 0)
|
Weight::from_parts(10_177_115, 0)
|
||||||
.saturating_add(Weight::from_parts(0, 3541))
|
.saturating_add(Weight::from_parts(0, 3612))
|
||||||
// Standard Error: 202
|
// Standard Error: 259
|
||||||
.saturating_add(Weight::from_parts(15_028, 0).saturating_mul(s.into()))
|
.saturating_add(Weight::from_parts(13_932, 0).saturating_mul(s.into()))
|
||||||
.saturating_add(T::DbWeight::get().reads(1))
|
.saturating_add(T::DbWeight::get().reads(1))
|
||||||
.saturating_add(T::DbWeight::get().writes(2))
|
.saturating_add(T::DbWeight::get().writes(2))
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -115,11 +115,13 @@ parameter_types! {
|
|||||||
pub Collectives: Location = Parachain(COLLECTIVES_ID).into_location();
|
pub Collectives: Location = Parachain(COLLECTIVES_ID).into_location();
|
||||||
pub BridgeHub: Location = Parachain(BRIDGE_HUB_ID).into_location();
|
pub BridgeHub: Location = Parachain(BRIDGE_HUB_ID).into_location();
|
||||||
pub People: Location = Parachain(PEOPLE_ID).into_location();
|
pub People: Location = Parachain(PEOPLE_ID).into_location();
|
||||||
|
pub Broker: Location = Parachain(BROKER_ID).into_location();
|
||||||
pub Wnd: AssetFilter = Wild(AllOf { fun: WildFungible, id: AssetId(TokenLocation::get()) });
|
pub Wnd: AssetFilter = Wild(AllOf { fun: WildFungible, id: AssetId(TokenLocation::get()) });
|
||||||
pub WndForAssetHub: (AssetFilter, Location) = (Wnd::get(), AssetHub::get());
|
pub WndForAssetHub: (AssetFilter, Location) = (Wnd::get(), AssetHub::get());
|
||||||
pub WndForCollectives: (AssetFilter, Location) = (Wnd::get(), Collectives::get());
|
pub WndForCollectives: (AssetFilter, Location) = (Wnd::get(), Collectives::get());
|
||||||
pub WndForBridgeHub: (AssetFilter, Location) = (Wnd::get(), BridgeHub::get());
|
pub WndForBridgeHub: (AssetFilter, Location) = (Wnd::get(), BridgeHub::get());
|
||||||
pub WndForPeople: (AssetFilter, Location) = (Wnd::get(), People::get());
|
pub WndForPeople: (AssetFilter, Location) = (Wnd::get(), People::get());
|
||||||
|
pub WndForBroker: (AssetFilter, Location) = (Wnd::get(), Broker::get());
|
||||||
pub MaxInstructions: u32 = 100;
|
pub MaxInstructions: u32 = 100;
|
||||||
pub MaxAssetsIntoHolding: u32 = 64;
|
pub MaxAssetsIntoHolding: u32 = 64;
|
||||||
}
|
}
|
||||||
@@ -129,6 +131,7 @@ pub type TrustedTeleporters = (
|
|||||||
xcm_builder::Case<WndForCollectives>,
|
xcm_builder::Case<WndForCollectives>,
|
||||||
xcm_builder::Case<WndForBridgeHub>,
|
xcm_builder::Case<WndForBridgeHub>,
|
||||||
xcm_builder::Case<WndForPeople>,
|
xcm_builder::Case<WndForPeople>,
|
||||||
|
xcm_builder::Case<WndForBroker>,
|
||||||
);
|
);
|
||||||
|
|
||||||
pub struct OnlyParachains;
|
pub struct OnlyParachains;
|
||||||
|
|||||||
@@ -1134,7 +1134,10 @@ impl<RuntimeCall> TryFrom<NewInstruction<RuntimeCall>> for Instruction<RuntimeCa
|
|||||||
max_response_weight: max_response_weight.ref_time(),
|
max_response_weight: max_response_weight.ref_time(),
|
||||||
},
|
},
|
||||||
UnsubscribeVersion => Self::UnsubscribeVersion,
|
UnsubscribeVersion => Self::UnsubscribeVersion,
|
||||||
_ => return Err(()),
|
i => {
|
||||||
|
log::debug!(target: "xcm::v3tov2", "`{i:?}` not supported by v2");
|
||||||
|
return Err(());
|
||||||
|
},
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,11 @@
|
|||||||
|
# Schema: Polkadot SDK PRDoc Schema (prdoc) v1.0.0
|
||||||
|
# See doc at https://raw.githubusercontent.com/paritytech/polkadot-sdk/master/prdoc/schema_user.json
|
||||||
|
|
||||||
|
title: Add Coretime to Westend
|
||||||
|
|
||||||
|
doc:
|
||||||
|
- audience: Runtime User
|
||||||
|
description: |
|
||||||
|
Add the on demand and coretime assigners and migrate from legacy parachain auctions to coretime.
|
||||||
|
|
||||||
|
crates: [ ]
|
||||||
Reference in New Issue
Block a user