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
+76
View File
@@ -23,6 +23,7 @@ use sp_std::prelude::*;
use parity_scale_codec::{Decode, Encode};
use primitives::RuntimeDebug;
use scale_info::TypeInfo;
use sp_arithmetic::Perbill;
/// Approval voting configuration parameters
#[derive(
@@ -50,6 +51,81 @@ impl Default for ApprovalVotingParams {
}
}
/// Scheduler configuration parameters. All coretime/ondemand parameters are here.
#[derive(
RuntimeDebug,
Copy,
Clone,
PartialEq,
Encode,
Decode,
TypeInfo,
serde::Serialize,
serde::Deserialize,
)]
pub struct SchedulerParams<BlockNumber> {
/// How often parachain groups should be rotated across parachains.
///
/// Must be non-zero.
pub group_rotation_frequency: BlockNumber,
/// Availability timeout for a block on a core, measured in blocks.
///
/// This is the maximum amount of blocks after a core became occupied that validators have time
/// to make the block available.
///
/// This value only has effect on group rotations. If backers backed something at the end of
/// their rotation, the occupied core affects the backing group that comes afterwards. We limit
/// the effect one backing group can have on the next to `paras_availability_period` blocks.
///
/// Within a group rotation there is no timeout as backers are only affecting themselves.
///
/// Must be at least 1. With a value of 1, the previous group will not be able to negatively
/// affect the following group at the expense of a tight availability timeline at group
/// rotation boundaries.
pub paras_availability_period: BlockNumber,
/// The maximum number of validators to have per core.
///
/// `None` means no maximum.
pub max_validators_per_core: Option<u32>,
/// The amount of blocks ahead to schedule paras.
pub lookahead: u32,
/// How many cores are managed by the coretime chain.
pub num_cores: u32,
/// The max number of times a claim can time out in availability.
pub max_availability_timeouts: u32,
/// The maximum queue size of the pay as you go module.
pub on_demand_queue_max_size: u32,
/// The target utilization of the spot price queue in percentages.
pub on_demand_target_queue_utilization: Perbill,
/// How quickly the fee rises in reaction to increased utilization.
/// The lower the number the slower the increase.
pub on_demand_fee_variability: Perbill,
/// The minimum amount needed to claim a slot in the spot pricing queue.
pub on_demand_base_fee: Balance,
/// The number of blocks a claim stays in the scheduler's claimqueue before getting cleared.
/// This number should go reasonably higher than the number of blocks in the async backing
/// lookahead.
pub ttl: BlockNumber,
}
impl<BlockNumber: Default + From<u32>> Default for SchedulerParams<BlockNumber> {
fn default() -> Self {
Self {
group_rotation_frequency: 1u32.into(),
paras_availability_period: 1u32.into(),
max_validators_per_core: Default::default(),
lookahead: 1,
num_cores: Default::default(),
max_availability_timeouts: Default::default(),
on_demand_queue_max_size: ON_DEMAND_DEFAULT_QUEUE_MAX_SIZE,
on_demand_target_queue_utilization: Perbill::from_percent(25),
on_demand_fee_variability: Perbill::from_percent(3),
on_demand_base_fee: 10_000_000u128,
ttl: 5u32.into(),
}
}
}
use bitvec::vec::BitVec;
/// Bit indices in the `HostConfiguration.node_features` that correspond to different node features.