Remove AssignmentProviderConfig and use parameters from HostConfiguration instead (#3181)

This PR removes `AssignmentProviderConfig` and uses the corresponding
ondemand parameters from `HostConfiguration` instead. Additionally
`scheduling_lookahead` and all coretime/ondemand related parameters are
extracted in a separate struct - `SchedulerParams`.

The most relevant commit from the PR is [this
one](https://github.com/paritytech/polkadot-sdk/pull/3181/commits/830bc0f5e858944474171bbe33382ad96040b535).

Fixes https://github.com/paritytech/polkadot-sdk/issues/2268

---------

Co-authored-by: command-bot <>
This commit is contained in:
Tsvetomir Dimitrov
2024-02-29 09:12:02 +02:00
committed by GitHub
parent a22319cdd5
commit a035dc9be7
43 changed files with 900 additions and 438 deletions
+8 -11
View File
@@ -18,11 +18,7 @@ use crate::{
configuration, inclusion, initializer, paras,
paras::ParaKind,
paras_inherent,
scheduler::{
self,
common::{AssignmentProvider, AssignmentProviderConfig},
CoreOccupied, ParasEntry,
},
scheduler::{self, common::AssignmentProvider, CoreOccupied, ParasEntry},
session_info, shared,
};
use bitvec::{order::Lsb0 as BitOrderLsb0, vec::BitVec};
@@ -197,7 +193,10 @@ impl<T: paras_inherent::Config> BenchBuilder<T> {
/// Maximum number of validators per core (a.k.a. max validators per group). This value is used
/// if none is explicitly set on the builder.
pub(crate) fn fallback_max_validators_per_core() -> u32 {
configuration::Pallet::<T>::config().max_validators_per_core.unwrap_or(5)
configuration::Pallet::<T>::config()
.scheduler_params
.max_validators_per_core
.unwrap_or(5)
}
/// Specify a mapping of core index/ para id to the number of dispute statements for the
@@ -684,7 +683,7 @@ impl<T: paras_inherent::Config> BenchBuilder<T> {
// 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;
c.scheduler_params.num_cores = used_cores;
});
let validator_ids = Self::generate_validator_pairs(self.max_validators());
@@ -715,8 +714,7 @@ impl<T: paras_inherent::Config> BenchBuilder<T> {
let cores = (0..used_cores)
.into_iter()
.map(|i| {
let AssignmentProviderConfig { ttl, .. } =
scheduler::Pallet::<T>::assignment_provider_config(CoreIndex(i));
let ttl = configuration::Pallet::<T>::config().scheduler_params.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),
@@ -731,8 +729,7 @@ impl<T: paras_inherent::Config> BenchBuilder<T> {
let cores = (0..used_cores)
.into_iter()
.map(|i| {
let AssignmentProviderConfig { ttl, .. } =
scheduler::Pallet::<T>::assignment_provider_config(CoreIndex(i));
let ttl = configuration::Pallet::<T>::config().scheduler_params.ttl;
// Load an assignment into provider so that one is present to pop
let assignment =
<T as scheduler::Config>::AssignmentProvider::get_mock_assignment(