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:
André Silva
2019-07-30 06:39:33 +01:00
committed by Gavin Wood
parent 20eb52d6bb
commit 483ad60379
5 changed files with 27 additions and 6 deletions
+7 -4
View File
@@ -79,7 +79,7 @@ pub const VERSION: RuntimeVersion = RuntimeVersion {
// and set impl_version to equal spec_version. If only runtime
// implementation changes and behavior does not, then leave spec_version as
// is and increment impl_version.
spec_version: 122,
spec_version: 123,
impl_version: 123,
apis: RUNTIME_API_VERSIONS,
};
@@ -128,10 +128,12 @@ impl system::Trait for Runtime {
parameter_types! {
pub const EpochDuration: u64 = EPOCH_DURATION_IN_SLOTS;
pub const ExpectedBlockTime: Moment = MILLISECS_PER_BLOCK;
}
impl babe::Trait for Runtime {
type EpochDuration = EpochDuration;
type ExpectedBlockTime = ExpectedBlockTime;
}
impl indices::Trait for Runtime {
@@ -517,9 +519,10 @@ impl_runtime_apis! {
impl babe_primitives::BabeApi<Block> for Runtime {
fn startup_data() -> babe_primitives::BabeConfiguration {
// The choice of `c` parameter is done in accordance to
// the slot duration and expected target block time, for
// safely resisting network delays of maximum two seconds.
// The choice of `c` parameter (where `1 - c` represents the
// probability of a slot being empty), is done in accordance to the
// slot duration and expected target block time, for safely
// resisting network delays of maximum two seconds.
// <https://research.web3.foundation/en/latest/polkadot/BABE/Babe/#6-practical-results>
babe_primitives::BabeConfiguration {
median_required_blocks: 1000,