mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-05-31 11:01:01 +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:
@@ -20,7 +20,7 @@ use crate::{
|
||||
paras_inherent,
|
||||
scheduler::{
|
||||
self,
|
||||
common::{Assignment, AssignmentProviderConfig},
|
||||
common::{AssignmentProvider, AssignmentProviderConfig},
|
||||
CoreOccupied, ParasEntry,
|
||||
},
|
||||
session_info, shared,
|
||||
@@ -96,6 +96,8 @@ pub(crate) struct BenchBuilder<T: paras_inherent::Config> {
|
||||
/// Make every candidate include a code upgrade by setting this to `Some` where the interior
|
||||
/// value is the byte length of the new code.
|
||||
code_upgrade: Option<u32>,
|
||||
/// Specifies whether the claimqueue should be filled.
|
||||
fill_claimqueue: bool,
|
||||
_phantom: sp_std::marker::PhantomData<T>,
|
||||
}
|
||||
|
||||
@@ -122,6 +124,7 @@ impl<T: paras_inherent::Config> BenchBuilder<T> {
|
||||
dispute_sessions: Default::default(),
|
||||
backed_and_concluding_cores: Default::default(),
|
||||
code_upgrade: None,
|
||||
fill_claimqueue: true,
|
||||
_phantom: sp_std::marker::PhantomData::<T>,
|
||||
}
|
||||
}
|
||||
@@ -225,6 +228,13 @@ impl<T: paras_inherent::Config> BenchBuilder<T> {
|
||||
self.max_validators() / self.max_validators_per_core()
|
||||
}
|
||||
|
||||
/// Set whether the claim queue should be filled.
|
||||
#[cfg(not(feature = "runtime-benchmarks"))]
|
||||
pub(crate) fn set_fill_claimqueue(mut self, f: bool) -> Self {
|
||||
self.fill_claimqueue = f;
|
||||
self
|
||||
}
|
||||
|
||||
/// Get the minimum number of validity votes in order for a backed candidate to be included.
|
||||
#[cfg(feature = "runtime-benchmarks")]
|
||||
pub(crate) fn fallback_min_validity_votes() -> u32 {
|
||||
@@ -643,7 +653,7 @@ impl<T: paras_inherent::Config> BenchBuilder<T> {
|
||||
})
|
||||
.collect();
|
||||
|
||||
DisputeStatementSet { candidate_hash: candidate_hash, session, statements }
|
||||
DisputeStatementSet { candidate_hash, session, statements }
|
||||
})
|
||||
.collect()
|
||||
}
|
||||
@@ -663,14 +673,18 @@ impl<T: paras_inherent::Config> BenchBuilder<T> {
|
||||
inclusion::PendingAvailability::<T>::remove_all(None);
|
||||
|
||||
// We don't allow a core to have both disputes and be marked fully available at this block.
|
||||
let cores = self.max_cores();
|
||||
let max_cores = self.max_cores();
|
||||
let used_cores =
|
||||
(self.dispute_sessions.len() + self.backed_and_concluding_cores.len()) as u32;
|
||||
assert!(used_cores <= cores);
|
||||
assert!(used_cores <= max_cores);
|
||||
let fill_claimqueue = self.fill_claimqueue;
|
||||
|
||||
// NOTE: there is an n+2 session delay for these actions to take effect.
|
||||
// We are currently in Session 0, so these changes will take effect in Session 2.
|
||||
Self::setup_para_ids(used_cores);
|
||||
configuration::ActiveConfig::<T>::mutate(|c| {
|
||||
c.coretime_cores = used_cores;
|
||||
});
|
||||
|
||||
let validator_ids = Self::generate_validator_pairs(self.max_validators());
|
||||
let target_session = SessionIndex::from(self.target_session);
|
||||
@@ -702,13 +716,33 @@ impl<T: paras_inherent::Config> BenchBuilder<T> {
|
||||
.map(|i| {
|
||||
let AssignmentProviderConfig { ttl, .. } =
|
||||
scheduler::Pallet::<T>::assignment_provider_config(CoreIndex(i));
|
||||
CoreOccupied::Paras(ParasEntry::new(
|
||||
Assignment::new(ParaId::from(i as u32)),
|
||||
now + ttl,
|
||||
))
|
||||
// Load an assignment into provider so that one is present to pop
|
||||
let assignment = <T as scheduler::Config>::AssignmentProvider::get_mock_assignment(
|
||||
CoreIndex(i),
|
||||
ParaId::from(i),
|
||||
);
|
||||
CoreOccupied::Paras(ParasEntry::new(assignment, now + ttl))
|
||||
})
|
||||
.collect();
|
||||
scheduler::AvailabilityCores::<T>::set(cores);
|
||||
if fill_claimqueue {
|
||||
// Add items to claim queue as well:
|
||||
let cores = (0..used_cores)
|
||||
.into_iter()
|
||||
.map(|i| {
|
||||
let AssignmentProviderConfig { ttl, .. } =
|
||||
scheduler::Pallet::<T>::assignment_provider_config(CoreIndex(i));
|
||||
// Load an assignment into provider so that one is present to pop
|
||||
let assignment =
|
||||
<T as scheduler::Config>::AssignmentProvider::get_mock_assignment(
|
||||
CoreIndex(i),
|
||||
ParaId::from(i),
|
||||
);
|
||||
(CoreIndex(i), [ParasEntry::new(assignment, now + ttl)].into())
|
||||
})
|
||||
.collect();
|
||||
scheduler::ClaimQueue::<T>::set(cores);
|
||||
}
|
||||
|
||||
Bench::<T> {
|
||||
data: ParachainsInherentData {
|
||||
|
||||
Reference in New Issue
Block a user