mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-05-31 05:11:02 +00:00
Coretime Feature branch (relay chain) (#1694)
Also fixes: https://github.com/paritytech/polkadot-sdk/issues/1417 - [x] CoreIndex -> AssignmentProvider mapping will be able to change any time. - [x] Implement - [x] Provide Migrations - [x] Add and fix tests - [x] Implement bulk assigner logic - [x] bulk assigner tests - [x] Port over current assigner to use bulk designer (+ share on-demand with bulk): top-level assigner has core ranges: legacy, bulk - [x] Adjust migrations to reflect new assigner structure - [x] Move migration code to Assignment code directly and make it recursive (make it possible to skip releases) -> follow up ticket. - [x] Test migrations - [x] Add migration PR to runtimes repo -> follow up ticket. - [x] Wire up with actual UMP messages - [x] Write PR docs --------- Co-authored-by: eskimor <eskimor@no-such-url.com> Co-authored-by: Bradley Olson <34992650+BradleyOlson64@users.noreply.github.com> Co-authored-by: BradleyOlson64 <lotrftw9@gmail.com> Co-authored-by: Anton Vilhelm Ásgeirsson <antonva@users.noreply.github.com> Co-authored-by: antonva <anton.asgeirsson@parity.io> Co-authored-by: Bastian Köcher <git@kchr.de> Co-authored-by: Marcin S. <marcin@realemail.net> Co-authored-by: Bastian Köcher <info@kchr.de> Co-authored-by: command-bot <>
This commit is contained in:
@@ -506,6 +506,21 @@ impl OnNewHead for Tuple {
|
||||
}
|
||||
}
|
||||
|
||||
/// Assign coretime to some parachain.
|
||||
///
|
||||
/// This assigns coretime to a parachain without using the coretime chain. Thus, this should only be
|
||||
/// used for testing purposes.
|
||||
pub trait AssignCoretime {
|
||||
/// ONLY USE FOR TESTING OR GENESIS.
|
||||
fn assign_coretime(id: ParaId) -> DispatchResult;
|
||||
}
|
||||
|
||||
impl AssignCoretime for () {
|
||||
fn assign_coretime(_: ParaId) -> DispatchResult {
|
||||
Ok(())
|
||||
}
|
||||
}
|
||||
|
||||
pub trait WeightInfo {
|
||||
fn force_set_current_code(c: u32) -> Weight;
|
||||
fn force_set_current_head(s: u32) -> Weight;
|
||||
@@ -605,6 +620,13 @@ pub mod pallet {
|
||||
|
||||
/// Weight information for extrinsics in this pallet.
|
||||
type WeightInfo: WeightInfo;
|
||||
|
||||
/// Runtime hook for assigning coretime for a given parachain.
|
||||
///
|
||||
/// This is only used at genesis or by root.
|
||||
///
|
||||
/// TODO: Remove once coretime is the standard accross all chains.
|
||||
type AssignCoretime: AssignCoretime;
|
||||
}
|
||||
|
||||
#[pallet::event]
|
||||
@@ -838,6 +860,8 @@ pub mod pallet {
|
||||
panic!("empty validation code is not allowed in genesis");
|
||||
}
|
||||
Pallet::<T>::initialize_para_now(&mut parachains, *id, genesis_args);
|
||||
T::AssignCoretime::assign_coretime(*id)
|
||||
.expect("Assigning coretime works at genesis; qed");
|
||||
}
|
||||
// parachains are flushed on drop
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user