Skip to main content

shard_of_bytes

Function shard_of_bytes 

Source
pub fn shard_of_bytes(raw: &[u8], num_shards: u32) -> Option<u32>
Expand description

Determines the shard ID from raw address bytes (simpler version).

This is a simpler alternative to shard_of_address_bytes that uses a direct last-byte approach instead of the full mask-based algorithm.

§Arguments

  • raw - Raw address bytes
  • num_shards - The total number of shards in the network

§Returns

  • Some(0xFF) for metachain addresses (last byte == 0xFF)
  • Some(shard_id) for regular shards
  • None if the address is empty