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:
eskimor
2023-12-21 19:06:58 +01:00
committed by GitHub
parent 18d53dbf91
commit 69434d9a32
71 changed files with 4059 additions and 1213 deletions
@@ -60,6 +60,16 @@ pub struct SessionChangeNotification<BlockNumber> {
pub session_index: SessionIndex,
}
/// Inform something about a new session.
pub trait OnNewSession<N> {
/// A new session was started.
fn on_new_session(notification: &SessionChangeNotification<N>);
}
impl<N> OnNewSession<N> for () {
fn on_new_session(_: &SessionChangeNotification<N>) {}
}
/// Number of validators (not only parachain) in a session.
pub type ValidatorSetCount = u32;
@@ -120,6 +130,10 @@ pub mod pallet {
type Randomness: Randomness<Self::Hash, BlockNumberFor<Self>>;
/// An origin which is allowed to force updates to parachains.
type ForceOrigin: EnsureOrigin<<Self as frame_system::Config>::RuntimeOrigin>;
/// Temporary hack to call `Coretime::on_new_session` on chains that support `Coretime` or
/// to disable it on the ones that don't support it. Can be removed and replaced by a simple
/// bound to `coretime::Config` once all chains support it.
type CoretimeOnNewSession: OnNewSession<BlockNumberFor<Self>>;
/// Weight information for extrinsics in this pallet.
type WeightInfo: WeightInfo;
}
@@ -271,6 +285,7 @@ impl<T: Config> Pallet<T> {
T::SlashingHandler::initializer_on_new_session(session_index);
dmp::Pallet::<T>::initializer_on_new_session(&notification, &outgoing_paras);
hrmp::Pallet::<T>::initializer_on_new_session(&notification, &outgoing_paras);
T::CoretimeOnNewSession::on_new_session(&notification);
}
/// Should be called when a new session occurs. Buffers the session notification to be applied