verify_batch_permutation

Function verify_batch_permutation 

Source
pub fn verify_batch_permutation(
    slots: &[usize],
    ks: &[usize],
    canonical: bool,
) -> Vec<usize>
Expand description

Dispatch ORDER for one verify batch — the permutation only.

slots[i] / ks[i] describe batch member i in the caller’s arbitrary order (ks[i] = that member’s ROW count, drafts+1). order[p] is the input index dispatched at position p.

  • canonical = true — sort by ssm slot ASCENDING. ks is unread: under the canonical assignment the depths are already descending along that order, so slot order IS depth order and there is nothing to trade off.
  • canonical = false — the kill-switch path: deepest first, ssm slot second (today’s behaviour, where the two demands genuinely conflict).

Ties break on input index, so the result is a deterministic function of the inputs — a graph key must never depend on sort instability. Callers that build the batch in ascending active-sequence index therefore agree on the order of slot-less (usize::MAX) members.

Idempotent under canonical = true, so a chunked caller may re-apply it to a contiguous sub-range of an already-ordered batch.