@lodestar/beacon-node
Version:
A Typescript implementation of the beacon chain
54 lines • 2.69 kB
TypeScript
import { BeaconConfig, ForkBoundary } from "@lodestar/config";
import { Logger } from "@lodestar/utils";
import { IClock } from "../../util/clock.js";
import { NetworkCoreMetrics } from "../core/metrics.js";
import { MetadataController } from "../metadata.js";
import { RequestedSubnet } from "../peers/utils/index.js";
import { CommitteeSubscription, GossipSubscriber, SubnetsService, SubnetsServiceOpts } from "./interface.js";
/**
* Manage sync committee subnets. Sync committees are long (~27h) so there aren't random long-lived subscriptions
*/
export declare class SyncnetsService implements SubnetsService {
private readonly config;
private readonly clock;
private readonly gossip;
private readonly metadata;
private readonly logger;
private readonly metrics;
private readonly opts?;
/**
* All currently subscribed subnets. Syncnets do not have additional long-lived
* random subscriptions since the committees are already active for long periods of time.
* Also, the node will aggregate through the entire period to simplify the validator logic.
* So `subscriptionsCommittee` represents subnets to find peers and aggregate data.
* This class will tell gossip to subscribe and un-subscribe.
* If a value exists for `SubscriptionId` it means that gossip subscription is active in network.gossip
*/
private subscriptionsCommittee;
constructor(config: BeaconConfig, clock: IClock, gossip: GossipSubscriber, metadata: MetadataController, logger: Logger, metrics: NetworkCoreMetrics | null, opts?: SubnetsServiceOpts | undefined);
close(): void;
/**
* Get all active subnets for the hearbeat.
*/
getActiveSubnets(): RequestedSubnet[];
/**
* Called from the API when validator is a part of a committee.
*/
addCommitteeSubscriptions(subscriptions: CommitteeSubscription[]): void;
/** Call ONLY ONCE: Two epoch before the fork, re-subscribe all existing random subscriptions to the new fork */
subscribeSubnetsNextBoundary(boundary: ForkBoundary): void;
/** Call ONLY ONCE: Two epochs after the fork, un-subscribe all subnets from the old fork */
unsubscribeSubnetsPrevBoundary(boundary: ForkBoundary): void;
/**
* Run per epoch, clean-up operations that are not urgent
*/
private onEpoch;
/** Update ENR */
private updateMetadata;
/** Tigger a gossip subcription only if not already subscribed */
private subscribeToSubnets;
/** Trigger a gossip un-subscrition only if no-one is still subscribed */
private unsubscribeSubnets;
private onScrapeLodestarMetrics;
}
//# sourceMappingURL=syncnetsService.d.ts.map