Skip to main content

peak_share_buffer_bytes

Function peak_share_buffer_bytes 

Source
pub fn peak_share_buffer_bytes<S: PixSpec>(params: &PixParams) -> u64
Expand description

The per-polynomial share buffer peak_cycle_bytes models, in bytes.

Vec doubles from a minimum of four elements, so a buffer holding threshold - 1 shares has a capacity of threshold.next_power_of_two() — up to twice what is stored. Modelling the allocation rather than the occupancy is what makes peak_cycle_bytes a ceiling.

Public because it is the one term of that model a consumer has reason to subtract back out: tests/memory_profile.rs reports the per-polynomial figure both with and without it, since the buffers dominate at the deployed dimensions and the residue is what PART_BUILDER_OVERHEAD_BYTES is set against. Restating the expression at the call site is what this exists to prevent — an external caller cannot reproduce it even in principle, because CompletedShare is crate-private and they would have to assume it is two scalars. True of the shipped specs, and not what the model reads.