From 2ae6ab0e7e00d3d9b7a67d62996ea737c78daa11 Mon Sep 17 00:00:00 2001 From: Alexander Popiak Date: Tue, 3 Nov 2020 14:01:18 +0100 Subject: [PATCH] Update MILLISECS_PER_BLOCK comments (#7483) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * add doc comment to node template MILLISECS_PER_BLOCK * add broken link comment * update Babe block time link Co-authored-by: André Silva <123550+andresilva@users.noreply.github.com> Co-authored-by: André Silva <123550+andresilva@users.noreply.github.com> --- substrate/bin/node-template/runtime/src/lib.rs | 6 ++++++ substrate/bin/node/runtime/src/constants.rs | 2 +- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/substrate/bin/node-template/runtime/src/lib.rs b/substrate/bin/node-template/runtime/src/lib.rs index 5028301978..d67a5bde96 100644 --- a/substrate/bin/node-template/runtime/src/lib.rs +++ b/substrate/bin/node-template/runtime/src/lib.rs @@ -102,6 +102,12 @@ pub const VERSION: RuntimeVersion = RuntimeVersion { transaction_version: 1, }; +/// This determines the average expected block time that we are targetting. +/// Blocks will be produced at a minimum duration defined by `SLOT_DURATION`. +/// `SLOT_DURATION` is picked up by `pallet_timestamp` which is in turn picked +/// up by `pallet_aura` to implement `fn slot_duration()`. +/// +/// Change this to adjust the block time. pub const MILLISECS_PER_BLOCK: u64 = 6000; pub const SLOT_DURATION: u64 = MILLISECS_PER_BLOCK; diff --git a/substrate/bin/node/runtime/src/constants.rs b/substrate/bin/node/runtime/src/constants.rs index 8e87d61c1e..0301c30d5b 100644 --- a/substrate/bin/node/runtime/src/constants.rs +++ b/substrate/bin/node/runtime/src/constants.rs @@ -50,7 +50,7 @@ pub mod time { /// always be assigned, in which case `MILLISECS_PER_BLOCK` and /// `SLOT_DURATION` should have the same value. /// - /// + /// pub const MILLISECS_PER_BLOCK: Moment = 3000; pub const SECS_PER_BLOCK: Moment = MILLISECS_PER_BLOCK / 1000;