mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-06-13 17:31:05 +00:00
srml: babe: add expected block time and epoch duration constants (#3241)
* srml: babe: add expected block time constant * srml: babe: expose epoch duration constant * node: bump spec_version * core: don't use moment type in test-runtime * babe: add docs regarding c parameter
This commit is contained in:
@@ -109,6 +109,7 @@ impl ProvideInherentData for InherentDataProvider {
|
||||
|
||||
pub trait Trait: timestamp::Trait {
|
||||
type EpochDuration: Get<u64>;
|
||||
type ExpectedBlockTime: Get<Self::Moment>;
|
||||
}
|
||||
|
||||
/// The length of the BABE randomness
|
||||
@@ -156,6 +157,17 @@ decl_storage! {
|
||||
decl_module! {
|
||||
/// The BABE SRML module
|
||||
pub struct Module<T: Trait> for enum Call where origin: T::Origin {
|
||||
/// The number of **slots** that an epoch takes. We couple sessions to
|
||||
/// epochs, i.e. we start a new session once the new epoch begins.
|
||||
const EpochDuration: u64 = T::EpochDuration::get();
|
||||
|
||||
/// The expected average block time at which BABE should be creating
|
||||
/// blocks. Since BABE is probabilistic it is not trivial to figure out
|
||||
/// what the expected average block time should be based on the slot
|
||||
/// duration and the security parameter `c` (where `1 - c` represents
|
||||
/// the probability of a slot being empty).
|
||||
const ExpectedBlockTime: T::Moment = T::ExpectedBlockTime::get();
|
||||
|
||||
/// Initialization
|
||||
fn on_initialize() {
|
||||
for digest in Self::get_inherent_digests()
|
||||
|
||||
Reference in New Issue
Block a user