mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-05-30 14:01:02 +00:00
parachains runtime: configurable maximum validators per core (#2043)
* parachains runtime: configurable maximum validators per core * update guide and add test
This commit is contained in:
committed by
GitHub
parent
8081c54428
commit
0f4395fc44
@@ -61,6 +61,8 @@ pub struct HostConfiguration<BlockNumber> {
|
||||
pub thread_availability_period: BlockNumber,
|
||||
/// The amount of blocks ahead to schedule parachains and parathreads.
|
||||
pub scheduling_lookahead: u32,
|
||||
/// The maximum number of validators to have per core. `None` means no maximum.
|
||||
pub max_validators_per_core: Option<u32>,
|
||||
/// The amount of sessions to keep for disputes.
|
||||
pub dispute_period: SessionIndex,
|
||||
/// The amount of consensus slots that must pass between submitting an assignment and
|
||||
@@ -271,6 +273,16 @@ decl_module! {
|
||||
Ok(())
|
||||
}
|
||||
|
||||
/// Set the maximum number of validators to assign to any core.
|
||||
#[weight = (1_000, DispatchClass::Operational)]
|
||||
pub fn set_max_validators_per_core(origin, new: Option<u32>) -> DispatchResult {
|
||||
ensure_root(origin)?;
|
||||
Self::update_config_member(|config| {
|
||||
sp_std::mem::replace(&mut config.max_validators_per_core, new) != new
|
||||
});
|
||||
Ok(())
|
||||
}
|
||||
|
||||
/// Set the dispute period, in number of sessions to keep for disputes.
|
||||
#[weight = (1_000, DispatchClass::Operational)]
|
||||
pub fn set_dispute_period(origin, new: SessionIndex) -> DispatchResult {
|
||||
@@ -582,6 +594,7 @@ mod tests {
|
||||
chain_availability_period: 10,
|
||||
thread_availability_period: 8,
|
||||
scheduling_lookahead: 3,
|
||||
max_validators_per_core: None,
|
||||
dispute_period: 239,
|
||||
no_show_slots: 240,
|
||||
n_delay_tranches: 241,
|
||||
@@ -645,6 +658,9 @@ mod tests {
|
||||
Configuration::set_scheduling_lookahead(
|
||||
Origin::root(), new_config.scheduling_lookahead,
|
||||
).unwrap();
|
||||
Configuration::set_max_validators_per_core(
|
||||
Origin::root(), new_config.max_validators_per_core,
|
||||
).unwrap();
|
||||
Configuration::set_dispute_period(
|
||||
Origin::root(), new_config.dispute_period,
|
||||
).unwrap();
|
||||
|
||||
Reference in New Issue
Block a user