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
+1 -22
View File
@@ -23,7 +23,7 @@ use crate::{
initializer, origin, paras,
paras::ParaKind,
paras_inherent, scheduler,
scheduler::common::{AssignmentProvider, AssignmentProviderConfig},
scheduler::common::AssignmentProvider,
session_info, shared, ParaId,
};
use frame_support::pallet_prelude::*;
@@ -463,10 +463,6 @@ pub mod mock_assigner {
pub(super) type MockAssignmentQueue<T: Config> =
StorageValue<_, VecDeque<Assignment>, ValueQuery>;
#[pallet::storage]
pub(super) type MockProviderConfig<T: Config> =
StorageValue<_, AssignmentProviderConfig<BlockNumber>, OptionQuery>;
#[pallet::storage]
pub(super) type MockCoreCount<T: Config> = StorageValue<_, u32, OptionQuery>;
}
@@ -478,12 +474,6 @@ pub mod mock_assigner {
MockAssignmentQueue::<T>::mutate(|queue| queue.push_back(assignment));
}
// This configuration needs to be customized to service `get_provider_config` in
// scheduler tests.
pub fn set_assignment_provider_config(config: AssignmentProviderConfig<BlockNumber>) {
MockProviderConfig::<T>::set(Some(config));
}
// Allows for customized core count in scheduler tests, rather than a core count
// derived from on-demand config + parachain count.
pub fn set_core_count(count: u32) {
@@ -512,17 +502,6 @@ pub mod mock_assigner {
// in the mock assigner.
fn push_back_assignment(_assignment: Assignment) {}
// Gets the provider config we set earlier using `set_assignment_provider_config`, falling
// back to the on demand parachain configuration if none was set.
fn get_provider_config(_core_idx: CoreIndex) -> AssignmentProviderConfig<BlockNumber> {
match MockProviderConfig::<T>::get() {
Some(config) => config,
None => AssignmentProviderConfig {
max_availability_timeouts: 1,
ttl: BlockNumber::from(5u32),
},
}
}
#[cfg(any(feature = "runtime-benchmarks", test))]
fn get_mock_assignment(_: CoreIndex, para_id: ParaId) -> Assignment {
Assignment::Bulk(para_id)