payloads_within_caps

Function payloads_within_caps 

Source
fn payloads_within_caps<PT: ProtocolTypes>(
    trace: &Trace<PT>,
    targets: &[TracePath],
    representative_payloads: usize,
    new_payloads: usize,
    constraints: &TermConstraints,
) -> bool
Expand description

Returns true iff replacing a term carrying representative_payloads payloads by one carrying new_payloads, at every path in targets, keeps each affected step recipe within constraints.threshold_max_payloads_per_term.

The budget is enforced per term (per step recipe), not as an average over the whole trace: a broad scope that rewrites several occurrences within a single recipe is charged the full growth for that recipe, so one dense recipe cannot hide behind many payload-free ones. Mirrors replacement_within_caps: only a growing replacement (new_payloads > representative_payloads) can exceed the budget, so a payload-neutral or shrinking replacement is accepted in O(1) without inspecting any recipe. Enforced uniformly for every replacement mutator via apply_to_targets (previously only ReplaceReuseMutator checked it, and only against a trace-wide average).