mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-05-31 09:51:02 +00:00
Improve HostConfiguration consistency check (#3897)
fixes https://github.com/paritytech/polkadot-sdk/issues/3886 --------- Signed-off-by: Andrei Sandu <andrei-mihail@parity.io>
This commit is contained in:
@@ -187,7 +187,7 @@ pub struct HostConfiguration<BlockNumber> {
|
||||
///
|
||||
/// Must be at least 1.
|
||||
pub no_show_slots: u32,
|
||||
/// The number of delay tranches in total.
|
||||
/// The number of delay tranches in total. Must be at least 1.
|
||||
pub n_delay_tranches: u32,
|
||||
/// The width of the zeroth delay tranche for approval assignments. This many delay tranches
|
||||
/// beyond 0 are all consolidated to form a wide 0 tranche.
|
||||
@@ -247,7 +247,7 @@ impl<BlockNumber: Default + From<u32>> Default for HostConfiguration<BlockNumber
|
||||
max_validators: None,
|
||||
dispute_period: 6,
|
||||
dispute_post_conclusion_acceptance_period: 100.into(),
|
||||
n_delay_tranches: Default::default(),
|
||||
n_delay_tranches: 1,
|
||||
zeroth_delay_tranche_width: Default::default(),
|
||||
needed_approvals: Default::default(),
|
||||
relay_vrf_modulo_samples: Default::default(),
|
||||
@@ -315,6 +315,8 @@ pub enum InconsistentError<BlockNumber> {
|
||||
LookaheadExceedsTTL,
|
||||
/// Passed in queue size for on-demand was too large.
|
||||
OnDemandQueueSizeTooLarge,
|
||||
/// Number of delay tranches cannot be 0.
|
||||
ZeroDelayTranches,
|
||||
}
|
||||
|
||||
impl<BlockNumber> HostConfiguration<BlockNumber>
|
||||
@@ -412,6 +414,10 @@ where
|
||||
return Err(OnDemandQueueSizeTooLarge)
|
||||
}
|
||||
|
||||
if self.n_delay_tranches.is_zero() {
|
||||
return Err(ZeroDelayTranches)
|
||||
}
|
||||
|
||||
Ok(())
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user