@lodestar/beacon-node
Version:
A Typescript implementation of the beacon chain
49 lines • 3.17 kB
TypeScript
import { ChainForkConfig } from "@lodestar/config";
import { CachedBeaconStateAllForks } from "@lodestar/state-transition";
import { BeaconBlock, RootHex, SubnetID, altair, deneb } from "@lodestar/types";
import { Epoch, Slot, ValidatorIndex } from "@lodestar/types";
import { IndexedAttestation, SignedAggregateAndProof } from "@lodestar/types";
import { Logger } from "@lodestar/utils";
import { RegistryMetricCreator } from "../metrics/index.js";
type Seconds = number;
export declare enum OpSource {
api = "api",
gossip = "gossip"
}
export type ValidatorMonitor = {
registerLocalValidator(index: number): void;
registerLocalValidatorInSyncCommittee(index: number, untilEpoch: Epoch): void;
registerValidatorStatuses(currentEpoch: Epoch, inclusionDelays: number[], flags: number[], isActiveCurrEpoch: boolean[], isActivePrevEpoch: boolean[], balances?: number[]): void;
registerBeaconBlock(src: OpSource, delaySec: Seconds, block: BeaconBlock): void;
registerBlobSidecar(src: OpSource, seenTimestampSec: Seconds, blob: deneb.BlobSidecar): void;
registerImportedBlock(block: BeaconBlock, data: {
proposerBalanceDelta: number;
}): void;
onPoolSubmitUnaggregatedAttestation(seenTimestampSec: number, indexedAttestation: IndexedAttestation, subnet: SubnetID, sentPeers: number): void;
onPoolSubmitAggregatedAttestation(seenTimestampSec: number, indexedAttestation: IndexedAttestation, sentPeers: number): void;
registerGossipUnaggregatedAttestation(seenTimestampSec: Seconds, indexedAttestation: IndexedAttestation): void;
registerGossipAggregatedAttestation(seenTimestampSec: Seconds, signedAggregateAndProof: SignedAggregateAndProof, indexedAttestation: IndexedAttestation): void;
registerAttestationInBlock(indexedAttestation: IndexedAttestation, parentSlot: Slot, correctHead: boolean, missedSlotVote: boolean, inclusionBlockRoot: RootHex, inclusionBlockSlot: Slot): void;
registerGossipSyncContributionAndProof(syncContributionAndProof: altair.ContributionAndProof, syncCommitteeParticipantIndices: ValidatorIndex[]): void;
registerSyncAggregateInBlock(epoch: Epoch, syncAggregate: altair.SyncAggregate, syncCommitteeIndices: Uint32Array): void;
onceEveryEndOfEpoch(state: CachedBeaconStateAllForks): void;
scrapeMetrics(slotClock: Slot): void;
};
export type ValidatorMonitorOpts = {
/** Log validator monitor events as info */
validatorMonitorLogs?: boolean;
};
export declare const defaultValidatorMonitorOpts: ValidatorMonitorOpts;
export declare function createValidatorMonitor(metricsRegister: RegistryMetricCreator | null, config: ChainForkConfig, genesisTime: number, logger: Logger, opts: ValidatorMonitorOpts): ValidatorMonitor;
/**
* Cache to prevent accessing the state tree to fetch block roots repeteadly.
* In normal network conditions the same root is read multiple times, specially the target.
*/
export declare class RootHexCache {
private readonly state;
private readonly blockRootSlotCache;
constructor(state: CachedBeaconStateAllForks);
getBlockRootAtSlot(slot: Slot): RootHex;
}
export {};
//# sourceMappingURL=validatorMonitor.d.ts.map