pub struct CongestionControlConfig {
pub max_congestion_incoming_gas: Gas,
pub max_congestion_outgoing_gas: Gas,
pub max_congestion_memory_consumption: u64,
pub max_congestion_missed_chunks: u64,
pub max_outgoing_gas: Gas,
pub min_outgoing_gas: Gas,
pub allowed_shard_outgoing_gas: Gas,
pub max_tx_gas: Gas,
pub min_tx_gas: Gas,
pub reject_tx_congestion_threshold: f64,
pub outgoing_receipts_usual_size_limit: u64,
pub outgoing_receipts_big_size_limit: u64,
}Expand description
The configuration for congestion control.
Fields§
§max_congestion_incoming_gas: GasHow much gas in delayed receipts of a shard is 100% incoming congestion.
Based on incoming congestion levels, a shard reduces the gas it spends on accepting new transactions instead of working on incoming receipts. Plus, incoming congestion contributes to overall congestion, which reduces how much other shards are allowed to forward to this shard.
max_congestion_outgoing_gas: GasHow much gas in outgoing buffered receipts of a shard is 100% congested.
Outgoing congestion contributes to overall congestion, which reduces how much other shards are allowed to forward to this shard.
max_congestion_memory_consumption: u64How much memory space of all delayed and buffered receipts in a shard is considered 100% congested.
Memory congestion contributes to overall congestion, which reduces how much other shards are allowed to forward to this shard.
This threshold limits memory requirements of validators to a degree but it is not a hard guarantee.
max_congestion_missed_chunks: u64How many missed chunks in a row in a shard is considered 100% congested.
max_outgoing_gas: GasThe maximum amount of gas attached to receipts a shard can forward to another shard per chunk.
The actual gas forwarding allowance is a linear interpolation between MIN_OUTGOING_GAS and MAX_OUTGOING_GAS, or 0 if the receiver is fully congested.
min_outgoing_gas: GasThe minimum gas each shard can send to a shard that is not fully congested.
The actual gas forwarding allowance is a linear interpolation between MIN_OUTGOING_GAS and MAX_OUTGOING_GAS, or 0 if the receiver is fully congested.
allowed_shard_outgoing_gas: GasHow much gas the chosen allowed shard can send to a 100% congested shard.
This amount is the absolute minimum of new workload a congested shard has to accept every round. It ensures deadlocks are provably impossible. But in ideal conditions, the gradual reduction of new workload entering the system combined with gradually limited forwarding to congested shards should prevent shards from becoming 100% congested in the first place.
max_tx_gas: GasThe maximum amount of gas in a chunk spent on converting new transactions to receipts.
The actual gas forwarding allowance is a linear interpolation between MIN_OUTGOING_GAS and MAX_OUTGOING_GAS, based on the incoming congestion of the local shard. Additionally, transactions can be rejected if the receiving remote shard is congested more than REJECT_TX_CONGESTION_THRESHOLD based on their general congestion level.
min_tx_gas: GasThe minimum amount of gas in a chunk spent on converting new transactions to receipts, as long as the receiving shard is not congested.
The actual gas forwarding allowance is a linear interpolation between MIN_OUTGOING_GAS and MAX_OUTGOING_GAS, based on the incoming congestion of the local shard. Additionally, transactions can be rejected if the receiving remote shard is congested more than REJECT_TX_CONGESTION_THRESHOLD based on their general congestion level.
reject_tx_congestion_threshold: f64How much congestion a shard can tolerate before it stops all shards from accepting new transactions with the receiver set to the congested shard.
outgoing_receipts_usual_size_limit: u64The standard size limit for outgoing receipts aimed at a single shard. This limit is pretty small to keep the size of source_receipt_proofs under control. It limits the total sum of outgoing receipts, not individual receipts.
outgoing_receipts_big_size_limit: u64Large size limit for outgoing receipts to a shard, used when it’s safe to send a lot of receipts without making the state witness too large. It limits the total sum of outgoing receipts, not individual receipts.
Implementations§
Source§impl CongestionControlConfig
impl CongestionControlConfig
Sourcepub fn test_disabled() -> Self
pub fn test_disabled() -> Self
Creates a config where congestion control is disabled. This config can be used for tests. It can be useful e.g. in tests with missing chunks where we still want to process all transactions.
Trait Implementations§
Source§impl Clone for CongestionControlConfig
impl Clone for CongestionControlConfig
Source§fn clone(&self) -> CongestionControlConfig
fn clone(&self) -> CongestionControlConfig
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for CongestionControlConfig
impl Debug for CongestionControlConfig
Source§impl From<CongestionControlConfig> for CongestionControlConfigView
impl From<CongestionControlConfig> for CongestionControlConfigView
Source§fn from(other: CongestionControlConfig) -> Self
fn from(other: CongestionControlConfig) -> Self
Source§impl From<CongestionControlConfigView> for CongestionControlConfig
impl From<CongestionControlConfigView> for CongestionControlConfig
Source§fn from(other: CongestionControlConfigView) -> Self
fn from(other: CongestionControlConfigView) -> Self
Source§impl PartialEq for CongestionControlConfig
impl PartialEq for CongestionControlConfig
impl Copy for CongestionControlConfig
impl Eq for CongestionControlConfig
impl StructuralPartialEq for CongestionControlConfig
Auto Trait Implementations§
impl Freeze for CongestionControlConfig
impl RefUnwindSafe for CongestionControlConfig
impl Send for CongestionControlConfig
impl Sync for CongestionControlConfig
impl Unpin for CongestionControlConfig
impl UnwindSafe for CongestionControlConfig
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.