import { getUint8ByteToBitBooleanArray } from "@chainsafe/ssz";
import { ATTESTATION_SUBNET_COUNT, SYNC_COMMITTEE_SUBNET_COUNT } from "@lodestar/params";
import { newFilledArray } from "@lodestar/state-transition";
export const zeroAttnets = newFilledArray(ATTESTATION_SUBNET_COUNT, false);
export const zeroSyncnets = newFilledArray(SYNC_COMMITTEE_SUBNET_COUNT, false);
/**
 * Fast deserialize a BitVector, with pre-cached bool array in `getUint8ByteToBitBooleanArray()`
 *
 * Never throw a deserialization error:
 * - if bytes is too short, it will pad with zeroes
 * - if bytes is too long, it will ignore the extra values
 */
export function deserializeEnrSubnets(bytes, subnetCount) {
    if (subnetCount <= 8) {
        return getUint8ByteToBitBooleanArray(bytes[0] ?? 0);
    }
    let boolsArr = [];
    const byteCount = Math.ceil(subnetCount / 8);
    for (let i = 0; i < byteCount; i++) {
        boolsArr = boolsArr.concat(getUint8ByteToBitBooleanArray(bytes[i] ?? 0));
    }
    return boolsArr;
}
//# sourceMappingURL=enrSubnetsDeserialize.js.map