@lodestar/beacon-node
Version:
A Typescript implementation of the beacon chain
22 lines • 1.11 kB
TypeScript
import { ChainConfig } from "@lodestar/config";
import { Epoch } from "@lodestar/types";
import { NodeId } from "./interface.js";
/**
* Spec https://github.com/ethereum/consensus-specs/blob/v1.4.0-alpha.3/specs/phase0/p2p-interface.md
*/
export declare function computeSubscribedSubnet(config: ChainConfig, nodeId: NodeId, epoch: Epoch): number[];
/**
* Spec https://github.com/ethereum/consensus-specs/blob/v1.4.0-alpha.3/specs/phase0/p2p-interface.md
*/
export declare function computeSubscribedSubnetByIndex(config: ChainConfig, nodeId: NodeId, epoch: Epoch, index: number): number;
/**
* Should return node_id >> (NODE_ID_BITS - int(ATTESTATION_SUBNET_PREFIX_BITS))
* Ideally we should use bigint here but since these constants are not likely to change we can use number
*/
export declare function getNodeIdPrefix(nodeId: NodeId): number;
/**
* Should return node_offset = node_id % EPOCHS_PER_SUBNET_SUBSCRIPTION
* This function is safe to return number because EPOCHS_PER_SUBNET_SUBSCRIPTION is 256
*/
export declare function getNodeOffset(nodeId: NodeId): number;
//# sourceMappingURL=util.d.ts.map