consensus-slots: cleanup SlotDuration config (#10878)

* consensus-slots: cleanup the SlotDuration config

* fix tests

* address review comments
This commit is contained in:
André Silva
2022-02-22 19:39:16 +00:00
committed by GitHub
parent f00404bfd6
commit 2561e11ed7
19 changed files with 161 additions and 191 deletions
@@ -79,7 +79,7 @@ pub const MEDIAN_ALGORITHM_CARDINALITY: usize = 1200; // arbitrary suggestion by
/// The index of an authority.
pub type AuthorityIndex = u32;
pub use sp_consensus_slots::Slot;
pub use sp_consensus_slots::{Slot, SlotDuration};
/// An equivocation proof for multiple block authorships on the same slot (i.e. double vote).
pub type EquivocationProof<H> = sp_consensus_slots::EquivocationProof<H, AuthorityId>;
@@ -237,13 +237,6 @@ impl AllowedSlots {
}
}
#[cfg(feature = "std")]
impl sp_consensus::SlotData for BabeGenesisConfiguration {
fn slot_duration(&self) -> std::time::Duration {
std::time::Duration::from_millis(self.slot_duration)
}
}
/// Configuration data used by the BABE consensus engine.
#[derive(Clone, PartialEq, Eq, Encode, Decode, RuntimeDebug, MaxEncodedLen, TypeInfo)]
#[cfg_attr(feature = "std", derive(Serialize, Deserialize))]