snowbridge_beacon_primitives/
bits.rs1use sp_std::prelude::*;
4use ssz_rs::{Bitvector, Deserialize};
5
6pub fn decompress_sync_committee_bits<
7 const SYNC_COMMITTEE_SIZE: usize,
8 const SYNC_COMMITTEE_BITS_SIZE: usize,
9>(
10 input: [u8; SYNC_COMMITTEE_BITS_SIZE],
11) -> [u8; SYNC_COMMITTEE_SIZE] {
12 Bitvector::<{ SYNC_COMMITTEE_SIZE }>::deserialize(&input)
13 .expect("checked statically; qed")
14 .iter()
15 .map(|bit| u8::from(bit == true))
16 .collect::<Vec<u8>>()
17 .try_into()
18 .expect("checked statically; qed")
19}