diff --git a/docker/common.yml b/docker/common.yml index 8f215087d7..d032b1941c 100644 --- a/docker/common.yml +++ b/docker/common.yml @@ -8,7 +8,7 @@ services: - CHAIN=/data/chainspec.json - ALLOW_PRIVATE_IPV4=true - DISCOVER_LOCAL=true - - UNIT_CREATION_DELAY=300 + - UNIT_CREATION_DELAY=200 volumes: - ./data/:/data/ diff --git a/docker/docker_entrypoint.sh b/docker/docker_entrypoint.sh index 9982db8536..49b0485b0d 100644 --- a/docker/docker_entrypoint.sh +++ b/docker/docker_entrypoint.sh @@ -28,7 +28,7 @@ PROMETHEUS_ENABLED=${PROMETHEUS_ENABLED:-true} TELEMETRY_ENABLED=${TELEMETRY_ENABLED:-false} TELEMETRY_URL=${TELEMETRY_URL:-'wss://telemetry.polkadot.io/submit/'} TELEMETRY_VERBOSITY_LVL=${TELEMETRY_VERBOSITY_LVL:-'0'} -UNIT_CREATION_DELAY=${UNIT_CREATION_DELAY:-300} +UNIT_CREATION_DELAY=${UNIT_CREATION_DELAY:-200} DB_CACHE=${DB_CACHE:-1024} RUNTIME_CACHE_SIZE=${RUNTIME_CACHE_SIZE:-2} MAX_RUNTIME_INSTANCES=${MAX_RUNTIME_INSTANCES:-8} diff --git a/docker/smartnet-compose.yml b/docker/smartnet-compose.yml index 669363ec7d..a9d414c28e 100644 --- a/docker/smartnet-compose.yml +++ b/docker/smartnet-compose.yml @@ -16,7 +16,7 @@ services: - PURGE_BEFORE_START=false - RPC_PORT=9943 - RUST_LOG=info - - UNIT_CREATION_DELAY=300 + - UNIT_CREATION_DELAY=200 - BOOT_NODES=/ip4/127.0.0.1/tcp/30333/p2p/$BOOTNODE_PEER_ID - PUBLIC_ADDR=/ip4/127.0.0.1/tcp/30333 - VALIDATOR_PORT=30343 diff --git a/finality-aleph/src/abft/common.rs b/finality-aleph/src/abft/common.rs index bf9b26a398..595ba67c7a 100644 --- a/finality-aleph/src/abft/common.rs +++ b/finality-aleph/src/abft/common.rs @@ -2,7 +2,15 @@ use std::{sync::Arc, time::Duration}; use crate::UnitCreationDelay; -pub const MAX_ROUNDS: u16 = 7000; +// Chosen as a round number large enough so that given the default 200 ms unit creation delay, and the exponential +// slowdown consts below, the time to reach the max round noticeably surpasses the required 7 days. With this +// setting max round should be reached in ~12.5 days. +pub const MAX_ROUNDS: u16 = 10_000; + +// Given the default 200 ms unit creation delay, the expected no-slowdown time will be 7500*200/1000/60 = 25 minutes +// which is noticeably longer than the expected 15 minutes of session time. +const EXP_SLOWDOWN_START_ROUND: usize = 7500; +const EXP_SLOWDOWN_MUL: f64 = 1.004; fn exponential_slowdown( t: usize, @@ -29,7 +37,12 @@ pub type DelaySchedule = Arc Duration + Sync + Send + 'static>; pub fn unit_creation_delay_fn(unit_creation_delay: UnitCreationDelay) -> DelaySchedule { Arc::new(move |t| match t { 0 => Duration::from_millis(2000), - _ => exponential_slowdown(t, unit_creation_delay.0 as f64, 5000, 1.005), + _ => exponential_slowdown( + t, + unit_creation_delay.0 as f64, + EXP_SLOWDOWN_START_ROUND, + EXP_SLOWDOWN_MUL, + ), }) } diff --git a/primitives/src/lib.rs b/primitives/src/lib.rs index 4462729528..c102864fb6 100644 --- a/primitives/src/lib.rs +++ b/primitives/src/lib.rs @@ -136,7 +136,7 @@ pub const TOKEN: u128 = 10u128.pow(TOKEN_DECIMALS); pub const ADDRESSES_ENCODING: u8 = 42; /// ABFT unit creation delay (in ms) -pub const DEFAULT_UNIT_CREATION_DELAY: u64 = 300; +pub const DEFAULT_UNIT_CREATION_DELAY: u64 = 200; /// Committee Size for new chains pub const DEFAULT_COMMITTEE_SIZE: u32 = 4;