Skip to main content

bits_per_query

Function bits_per_query 

Source
pub const fn bits_per_query(log_blowup: u32, field_bits: u64) -> u64
Expand description

Returns the conjectured security contributed by a single FRI query, in fixed point.

This is the “random words” rate of 2025/2010 section 1.5:

bits_per_query = -log2(ρ + η),   ρ = 2^-log_blowup,   η = log2(e/ρ) · ρ / log2(q)

Rewriting to keep every step in fixed point and avoid materializing ρ:

-log2(ρ + η) = log_blowup - log2(1 + (log2(e) + log_blowup) / log2(q))

so the correction is a ratio of two fixed-point integers whose logarithm ceil_log2 can take directly. The correction is rounded up and then subtracted, keeping the rate conservative.

field_bits is log2(q) for the field FRI operates over — the challenge field, in fixed point. Values outside 1..=from_bits(u32::MAX) are unsupported and return zero. This bound keeps the numerator representable even at the largest log_blowup.

Returns zero when the correction would exceed log_blowup, i.e. when the rate is not positive and queries contribute nothing.