node: update flaming fir (#3508)

* node: reduce block time to 3s and add primary probability constant

* node: update flaming fir chain spec

* node: fix integration test
This commit is contained in:
André Silva
2019-08-28 18:03:54 +01:00
committed by GitHub
parent cc62ee60fe
commit 523c7f681e
4 changed files with 86 additions and 78 deletions
File diff suppressed because one or more lines are too long
+2 -2
View File
@@ -283,7 +283,7 @@ mod tests {
};
use node_primitives::DigestItem;
use node_runtime::{BalancesCall, Call, UncheckedExtrinsic};
use node_runtime::constants::{currency::CENTS, time::SLOT_DURATION};
use node_runtime::constants::{currency::CENTS, time::{PRIMARY_PROBABILITY, SLOT_DURATION}};
use codec::{Encode, Decode};
use primitives::{
crypto::Pair as CryptoPair, blake2_256,
@@ -404,7 +404,7 @@ mod tests {
slot_num,
&parent_header,
&*service.client(),
(278, 1000),
PRIMARY_PROBABILITY,
&keystore,
) {
break babe_pre_digest;
+10 -2
View File
@@ -40,11 +40,19 @@ pub mod time {
/// that are expressed in blocks. The rest of the code should use
/// `SLOT_DURATION` instead (like the timestamp module for calculating the
/// minimum period).
///
/// If using BABE with secondary slots (default) then all of the slots will
/// always be assigned, in which case `MILLISECS_PER_BLOCK` and
/// `SLOT_DURATION` should have the same value.
///
/// <https://research.web3.foundation/en/latest/polkadot/BABE/Babe/#6-practical-results>
pub const MILLISECS_PER_BLOCK: Moment = 6000;
pub const MILLISECS_PER_BLOCK: Moment = 3000;
pub const SECS_PER_BLOCK: Moment = MILLISECS_PER_BLOCK / 1000;
pub const SLOT_DURATION: Moment = 6000;
pub const SLOT_DURATION: Moment = MILLISECS_PER_BLOCK;
// 1 in 4 blocks (on average, not counting collisions) will be primary BABE blocks.
pub const PRIMARY_PROBABILITY: (u64, u64) = (1, 4);
pub const EPOCH_DURATION_IN_BLOCKS: BlockNumber = 10 * MINUTES;
pub const EPOCH_DURATION_IN_SLOTS: u64 = {
+1 -1
View File
@@ -563,7 +563,7 @@ impl_runtime_apis! {
babe_primitives::BabeConfiguration {
median_required_blocks: 1000,
slot_duration: Babe::slot_duration(),
c: (278, 1000),
c: PRIMARY_PROBABILITY,
}
}