mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-04-29 20:47:56 +00:00
node: Update BABE protocol parameters (#3211)
* node: update babe parameters to target 6 second block time * node: add comment on MILLISECS_PER_BLOCK constant
This commit is contained in:
committed by
DemiMarie-parity
parent
5220ccbf20
commit
2b021ba4f1
@@ -29,9 +29,28 @@ pub mod currency {
|
||||
pub mod time {
|
||||
use node_primitives::Moment;
|
||||
|
||||
/// Since BABE is probabilistic this is the average expected block time that
|
||||
/// we are targetting. Blocks will be produced at a minimum duration defined
|
||||
/// by `SLOT_DURATION`, but some slots will not be allocated to any
|
||||
/// authority and hence no block will be produced. We expect to have this
|
||||
/// block time on average following the defined slot duration and the value
|
||||
/// of `c` configured for BABE.
|
||||
/// This value is only used indirectly to define the unit constants below
|
||||
/// that are expressed in blocks. The rest of the code should use
|
||||
/// `SLOT_DURATION` instead (like the timestamp module for calculating the
|
||||
/// minimum period).
|
||||
/// <https://research.web3.foundation/en/latest/polkadot/BABE/Babe/#6-practical-results>
|
||||
pub const MILLISECS_PER_BLOCK: Moment = 6000;
|
||||
pub const SECS_PER_BLOCK: Moment = MILLISECS_PER_BLOCK / 1000;
|
||||
pub const SLOT_DURATION: Moment = 6000;
|
||||
|
||||
pub const SLOT_DURATION: Moment = 1650;
|
||||
|
||||
pub const EPOCH_DURATION_IN_BLOCKS: Moment = 10 * MINUTES;
|
||||
pub const EPOCH_DURATION_IN_SLOTS: Moment = {
|
||||
const SLOT_FILL_RATE: f64 = MILLISECS_PER_BLOCK as f64 / SLOT_DURATION as f64;
|
||||
|
||||
(EPOCH_DURATION_IN_BLOCKS as f64 * SLOT_FILL_RATE) as Moment
|
||||
};
|
||||
|
||||
// These time units are defined in number of blocks.
|
||||
pub const MINUTES: Moment = 60 / SECS_PER_BLOCK;
|
||||
|
||||
Reference in New Issue
Block a user