Skip to main content

diff_roots

Function diff_roots 

Source
pub fn diff_roots(
    base_slot: u64,
    target_slot: u64,
    buffer: &[[u8; 32]],
) -> RootsDiff
Expand description

Computes the sequence of newly written roots between two slots.

The returned delta contains every root written during the half-open slot range [base_slot, target_slot).

The input buffer is treated as a circular buffer, with its length defining the modulo capacity.

§Arguments

  • base_slot - First slot represented by the delta.
  • target_slot - Slot immediately following the final recorded root.
  • buffer - Circular root buffer.

§Complexity

O(target_slot - base_slot)