Skip to main content

start_control_channel_capacity

Function start_control_channel_capacity 

Source
fn start_control_channel_capacity(cfg: &SessionManagerConfig) -> usize
Expand description

Capacity of the control Start protocol lane (every variant but StartSession).

Fed by SessionManager::dispatch_message with try_send, and an overflow drops the message. For most Start messages that is recoverable, but a dropped SsaCommit is not: there is no NACK or retransmission, so the coefficient cell stays empty forever, the commitment never completes, and the cycle dies on the supervisor’s max_deposit_wait deadline. It therefore keeps the whole PIX commitment term.

PIX load is the entire commitment set of an SSA cycle, chunked into packet-sized messages. Batching multiplies it: an Exit may ask for up to ssas_per_request SSAs at once, so the per-cycle term is scaled by the configured maximum even when dynamic admission selects less.

The per-cycle burst is bounded by two independent limits, and the capacity takes the smaller:

  • quota_range.end() / PIX_QUOTA_BYTES_PER_SHARE is polys × (threshold + surplus), an over-estimate by that whole second factor, since a cycle carries one constant term per polynomial and nothing else. The quota alone does not reveal how the product splits, so the over-estimate cannot be undone from it.
  • MAX_POLYS_PER_SSA is the number of polynomials SessionManager::check_pix_params will accept, whatever the quota says. It therefore bounds the commitments a cycle can ever deliver.

Clamping to the second matters because this capacity is reserved: an operator-settable quota_range feeding an unclamped derivation is an allocation with no upper bound — at quota_range.end() = 1e13 it asks for 77 GB. At the default dimensions the commitments reach the MAX_POLYS_PER_SSA ceiling, so the capacity term is the resulting burst plus START_PROTOCOL_CHANNEL_RESERVE: the margin over the burst is the reserve itself.

The batch factor is bounded by MAX_SSA_BATCH_SIZE for the same allocation reason, and is clamped here rather than taken on trust from the config, so callers that build a SessionManagerConfig without going through SessionManager::new cannot inflate it.

Deliberately not sized by maximum_sessions: that quantity sizes the session lane, where a StartSession flood’s own drops are taken, and this lane is the one a flood must not touch.