Introduce new concept of "slot portion for proposing" (#8280)

* Introduce new concept of "slot portion for proposing"

Currently when building a block we actually give the proposer all of the
time in the slot, while this is wrong. The slot is actually split in at
least two phases proposing and propagation or in the polkadot case into
three phases validating pov's, proposing and propagation. As we don't
want to bring that much polkadot concepts into Substrate, we only
support splitting the slot into proposing and propagation. The portion
can now be passed as parameter to AuRa and BABE to configure this value.
However, this slot portion for propagation doesn't mean that the
proposer can not go over this limit. When we miss slots we still apply
the lenience factor to increase the proposing time, so that we have
enough time to build a heavy block.

Besides all what was said above, this is especially required for
parachains. Parachains have a much more constraint proposing window.
Currently the slot duration is at minimum 12 seconds, but we only have
around 500ms for proposing. So, this slot portion for proposing is
really required to make it working without hacks.

* Offgit feedback

* Cast cast cast
This commit is contained in:
Bastian Köcher
2021-03-09 20:14:54 +01:00
committed by GitHub
parent 7f17082002
commit 7599e0d6e8
7 changed files with 112 additions and 57 deletions
+3 -2
View File
@@ -25,8 +25,7 @@ use sc_consensus_babe;
use node_primitives::Block;
use node_runtime::RuntimeApi;
use sc_service::{
config::{Configuration}, error::{Error as ServiceError},
RpcHandlers, TaskManager,
config::Configuration, error::Error as ServiceError, RpcHandlers, TaskManager,
};
use sp_inherents::InherentDataProviders;
use sc_network::{Event, NetworkService};
@@ -35,6 +34,7 @@ use futures::prelude::*;
use sc_client_api::{ExecutorProvider, RemoteBackend};
use node_executor::Executor;
use sc_telemetry::{TelemetryConnectionNotifier, TelemetrySpan};
use sc_consensus_babe::SlotProportion;
type FullClient = sc_service::TFullClient<Block, RuntimeApi, Executor>;
type FullBackend = sc_service::TFullBackend<Block>;
@@ -279,6 +279,7 @@ pub fn new_full_base(
backoff_authoring_blocks,
babe_link,
can_author_with,
block_proposal_slot_portion: SlotProportion::new(0.5),
};
let babe = sc_consensus_babe::start_babe(babe_config)?;