pub(crate) fn validate_fill_fractions(
fill: &PixFillConfig,
) -> Result<(), TransportSessionError>Expand description
Range-checks the two PixFillConfig fractions, ahead of anything that computes with them.
Extracted from validate_pix_supervision because it is not the first validator to see them.
validate_incoming_session_pix_config derives the fill floor a cycle of the widest accepted
quota needs, and SessionManager::start calls it before validate_pix_supervision — as does
HoprProtocolConfig, where one is a field validator and the other a schema-level one. That
derivation runs Duration::mul_f64(finish_fraction), which panics on a NaN, a negative, or a
product the monotonic clock cannot represent. A single finish_fraction: .nan in a YAML file
would therefore abort the node at load instead of being reported as the configuration error it
is; values above one, or a negative loss_margin, would quietly compute a floor lower than the
one the cycle needs. Both callers run this first so neither outcome is reachable.
Finiteness is tested before every range, and the ranges are two-sided, for the reason spelled out
on max_off_front_share_fraction: every IEEE comparison against NaN is false, so a one-sided
test admits it — and a NaN here is not inert. It propagates through the aim point into the
required rate, and a NaN rate compares false against every hysteresis threshold, so the planner
would hold whatever it last emitted for the life of the Session.