@lodestar/beacon-node
Version:
A Typescript implementation of the beacon chain
41 lines • 1.52 kB
TypeScript
import { ForkBoundary } from "@lodestar/config";
import { Bytes32, Slot, SubnetID, ValidatorIndex } from "@lodestar/types";
import { GossipTopic } from "../gossip/interface.js";
import { RequestedSubnet } from "../peers/utils/index.js";
/** Generic CommitteeSubscription for both beacon attnets subs and syncnets subs */
export type CommitteeSubscription = {
validatorIndex: ValidatorIndex;
subnet: SubnetID;
slot: Slot;
isAggregator: boolean;
};
export type SubnetsService = {
close(): void;
addCommitteeSubscriptions(subscriptions: CommitteeSubscription[]): void;
getActiveSubnets(): RequestedSubnet[];
subscribeSubnetsNextBoundary(boundary: ForkBoundary): void;
unsubscribeSubnetsPrevBoundary(boundary: ForkBoundary): void;
};
export interface IAttnetsService extends SubnetsService {
shouldProcess(subnet: SubnetID, slot: Slot): boolean;
}
export type RandBetweenFn = (min: number, max: number) => number;
export type ShuffleFn = <T>(arr: T[]) => T[];
export type SubnetsServiceOpts = {
subscribeAllSubnets?: boolean;
slotsToSubscribeBeforeAggregatorDuty: number;
};
export type SubnetsServiceTestOpts = {
randBetweenFn?: RandBetweenFn;
shuffleFn?: ShuffleFn;
};
type TopicStr = string;
type PeerIdStr = string;
export type GossipSubscriber = {
subscribeTopic(topic: GossipTopic): void;
unsubscribeTopic(topic: GossipTopic): void;
mesh: Map<TopicStr, Set<PeerIdStr>>;
};
export type NodeId = Bytes32;
export {};
//# sourceMappingURL=interface.d.ts.map