Skip to main content

Module signer_bitmap

Module signer_bitmap 

Source
Expand description

Compact validator participation bitmap (SPEC §2.10).

§Requirements trace

§Encoding

  • Byte length: ceil(validator_count / 8) — see SignerBitmap::new.
  • Bit order: LSB-first within each byte (validator i → byte i/8, bit i % 8). This matches the pseudocode in ATT-004 and keeps popcount-based SignerBitmap::signer_count aligned with the spec.

§Usage

Construct with SignerBitmap::new, mark signers with SignerBitmap::set_signed, query with SignerBitmap::has_signed, SignerBitmap::signer_count, SignerBitmap::signing_percentage, and SignerBitmap::has_threshold. Combine peer views with SignerBitmap::merge and enumerate participants in order via SignerBitmap::signer_indices. Raw wire bytes are exposed through SignerBitmap::as_bytes / SignerBitmap::from_bytes for bincode payloads (SER-001).

§Safety / limits

SignerBitmap::new and SignerBitmap::from_bytes assert validator_count <= MAX_VALIDATORS so a single u32 cannot force multi-gigabyte allocations in this crate; the protocol cap is 65536 validators.

Structs§

SignerBitmap
Bit vector of “which validators signed,” sized for a fixed validator set (SPEC §2.10).

Constants§

MAX_VALIDATORS
Maximum number of validators representable in protocol bitmaps (SPEC §2.10, ATT-004).