Skip to main content

diff_randao

Function diff_randao 

Source
pub fn diff_randao(
    base_slot: u64,
    target_slot: u64,
    target_buffer: &[[u8; 32]],
    slots_per_epoch: u64,
) -> RandaoDiff
Expand description

Computes the sequence of RANDAO mixes written between two slots.

The returned delta contains one mix for every epoch in the inclusive range from the epoch containing base_slot through the epoch containing target_slot.

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

§Arguments

  • base_slot - Starting slot.
  • target_slot - Ending slot.
  • target_buffer - Circular RANDAO mix buffer.
  • slots_per_epoch - Number of slots in a consensus epoch.

§Complexity

O(number of epochs)

§Panics

Panics if target_slot < base_slot.