import { ApiClient, routes } from "@lodestar/api"; import { BLSSignature, Slot } from "@lodestar/types"; import { Metrics } from "../metrics.js"; import { PubkeyHex } from "../types.js"; import { IClock, LoggerVc } from "../util/index.js"; import { ChainHeaderTracker } from "./chainHeaderTracker.js"; import { SyncingStatusTracker } from "./syncingStatusTracker.js"; import { ValidatorStore } from "./validatorStore.js"; /** Neatly joins the server-generated `AttesterData` with the locally-generated `selectionProof`. */ export type AttDutyAndProof = { duty: routes.validator.AttesterDuty; /** This value is only set to not null if the proof indicates that the validator is an aggregator. */ selectionProof: BLSSignature | null; /** This value will only be set if validator is part of distributed cluster and only has a key share */ partialSelectionProof?: BLSSignature; }; type AttestationDutiesServiceOpts = { distributedAggregationSelection?: boolean; }; export declare class AttestationDutiesService { private readonly logger; private readonly api; private clock; private readonly validatorStore; private readonly metrics; private readonly opts?; /** Maps a validator public key to their duties for each epoch */ private readonly dutiesByIndexByEpoch; /** * We may receive new dependentRoot of an epoch but it's not the last slot of epoch * so we have to wait for getting close to the next epoch to redownload new attesterDuties. */ private readonly pendingDependentRootByEpoch; constructor(logger: LoggerVc, api: ApiClient, clock: IClock, validatorStore: ValidatorStore, chainHeadTracker: ChainHeaderTracker, syncingStatusTracker: SyncingStatusTracker, metrics: Metrics | null, opts?: AttestationDutiesServiceOpts | undefined); removeDutiesForKey(pubkey: PubkeyHex): void; /** Returns all `ValidatorDuty` for the given `slot` */ getDutiesAtSlot(slot: Slot): AttDutyAndProof[]; /** * If a reorg dependent root comes at a slot other than last slot of epoch * just update this.pendingDependentRootByEpoch() and process here */ private prepareForNextEpoch; private runDutiesTasks; private pollBeaconAttesters; private pollBeaconAttestersForEpoch; /** * attester duties may be reorged due to 2 scenarios: * 1. node is syncing (for nextEpoch duties) * 2. node is reorged * previousDutyDependentRoot = get_block_root_at_slot(state, compute_start_slot_at_epoch(epoch - 1) - 1) * => dependent root of current epoch * currentDutyDependentRoot = get_block_root_at_slot(state, compute_start_slot_at_epoch(epoch) - 1) * => dependent root of next epoch */ private onNewHead; private handleAttesterDutiesReorg; private subscribeToBeaconCommitteeSubnets; private getDutyAndProof; /** Run once per epoch to prune duties map */ private pruneOldDuties; private runDistributedAggregationSelectionTasks; } export {}; //# sourceMappingURL=attestationDuties.d.ts.map