Separate the block processing time from the latency

This commit is contained in:
Luke Parker
2022-11-11 05:42:13 -05:00
parent 2411660bd8
commit fffb7a6914
7 changed files with 46 additions and 31 deletions

View File

@@ -130,8 +130,9 @@ impl<T: TendermintValidator> TendermintAuthority<T> {
.propose(
self.import.inherent_data(parent).await,
Digest::default(),
// TODO: Production time, size limit
Duration::from_secs(1),
// Assumes a block cannot take longer to download than it'll take to process
Duration::from_secs((T::BLOCK_PROCESSING_TIME_IN_SECONDS / 2).into()),
// TODO: Size limit
None,
)
.await
@@ -253,7 +254,8 @@ impl<T: TendermintValidator> Network for TendermintAuthority<T> {
type Weights = TendermintValidators<T>;
type Block = T::Block;
const BLOCK_TIME: u32 = T::BLOCK_TIME_IN_SECONDS;
const BLOCK_PROCESSING_TIME: u32 = T::BLOCK_PROCESSING_TIME_IN_SECONDS;
const LATENCY_TIME: u32 = T::LATENCY_TIME_IN_SECONDS;
fn signer(&self) -> TendermintSigner<T> {
self.active.as_ref().unwrap().signer.clone()

View File

@@ -53,7 +53,8 @@ pub fn set_config(protocol: ProtocolName) -> NonDefaultSetConfig {
/// Trait consolidating all generics required by sc_tendermint for processing.
pub trait TendermintClient: Send + Sync + 'static {
const BLOCK_TIME_IN_SECONDS: u32;
const BLOCK_PROCESSING_TIME_IN_SECONDS: u32;
const LATENCY_TIME_IN_SECONDS: u32;
type Block: Block;
type Backend: Backend<Self::Block> + 'static;
@@ -81,7 +82,8 @@ pub trait TendermintClient: Send + Sync + 'static {
/// Trait implementable on firm types to automatically provide a full TendermintClient impl.
pub trait TendermintClientMinimal: Send + Sync + 'static {
const BLOCK_TIME_IN_SECONDS: u32;
const BLOCK_PROCESSING_TIME_IN_SECONDS: u32;
const LATENCY_TIME_IN_SECONDS: u32;
type Block: Block;
type Backend: Backend<Self::Block> + 'static;
@@ -102,7 +104,8 @@ where
BlockBuilderApi<T::Block> + TendermintApi<T::Block>,
TransactionFor<T::Client, T::Block>: Send + Sync + 'static,
{
const BLOCK_TIME_IN_SECONDS: u32 = T::BLOCK_TIME_IN_SECONDS;
const BLOCK_PROCESSING_TIME_IN_SECONDS: u32 = T::BLOCK_PROCESSING_TIME_IN_SECONDS;
const LATENCY_TIME_IN_SECONDS: u32 = T::LATENCY_TIME_IN_SECONDS;
type Block = T::Block;
type Backend = T::Backend;