Skip to main content

max_cycle_budget_for_quota

Function max_cycle_budget_for_quota 

Source
pub fn max_cycle_budget_for_quota(
    quota_bytes: u64,
    ssas_per_request: usize,
) -> u64
Expand description

The largest reservation any offer inside a quota_range ending at quota_bytes can produce.

The quota fixes polys × (threshold + surplus) but not the split, and the two terms of hopr_protocol_pix::peak_cycle_bytes pull opposite ways — the share buffers want a high threshold, the per-polynomial overhead wants many polynomials — so the maximum is found by walking the thresholds rather than by a closed form. 254 iterations, once, at config load.

surplus = 0 throughout, which is what makes each candidate the worst of its threshold: the surplus is priced into the quota but holds no reconstructor state, so any surplus at all buys fewer polynomials for the same quota.

Used to reject a IncomingSessionPixConfig::max_live_cycle_bytes that could never admit even one Session at the dimensions its own quota_range advertises.