compute_history_rank

Function compute_history_rank 

Source
pub fn compute_history_rank(
    chunk: &IntegerList,
    block_number: u64,
) -> (u64, Option<u64>)
Available on crate feature provider only.
Expand description

Computes the rank and finds the next modification block in a history shard.

Given a block_number, this function returns:

  • rank: The number of entries strictly before block_number in the shard
  • found_block: The block number at position rank (i.e., the first block >= block_number where a modification occurred), or None if rank is out of bounds

The rank is adjusted when block_number exactly matches an entry in the shard, so that found_block always returns the modification at or after the target.

This logic is shared between MDBX cursor-based lookups and RocksDB iterator lookups.