import { SecretKey } from "@chainsafe/blst"; import { routes } from "@lodestar/api"; import { BeaconConfig } from "@lodestar/config"; import { Attestation, BLSPubkey, BLSSignature, BeaconBlock, BlindedBeaconBlock, Epoch, Root, SignedAggregateAndProof, SignedBeaconBlock, SignedBlindedBeaconBlock, SingleAttestation, Slot, ValidatorIndex, altair, bellatrix, gloas, phase0 } from "@lodestar/types"; import { Metrics } from "../metrics.js"; import { ISlashingProtection } from "../slashingProtection/index.js"; import { PubkeyHex } from "../types.js"; import { LoggerVc } from "../util/logger.js"; import { DoppelgangerService } from "./doppelgangerService.js"; import { IndicesService } from "./indices.js"; type BLSPubkeyMaybeHex = BLSPubkey | PubkeyHex; type ExecutionAddress = string; export declare enum SignerType { Local = 0, Remote = 1 } export type SignerLocal = { type: SignerType.Local; secretKey: SecretKey; }; export type SignerRemote = { type: SignerType.Remote; url: string; pubkey: PubkeyHex; }; export type ProposerConfig = { graffiti?: string; strictFeeRecipientCheck?: boolean; feeRecipient?: ExecutionAddress; builder?: { gasLimit?: number; selection?: routes.validator.BuilderSelection; boostFactor?: bigint; }; }; export type ValidatorProposerConfig = { proposerConfig: { [index: PubkeyHex]: ProposerConfig; }; defaultConfig: ProposerConfig; }; export type ValidatorStoreModules = { config: BeaconConfig; slashingProtection: ISlashingProtection; indicesService: IndicesService; doppelgangerService: DoppelgangerService | null; metrics: Metrics | null; }; /** * Validator entity capable of producing signatures. Either: * - local: With BLS secret key * - remote: With data to contact a remote signer */ export type Signer = SignerLocal | SignerRemote; export declare const defaultOptions: { suggestedFeeRecipient: string; defaultGasLimit: number; builderSelection: routes.validator.BuilderSelection; builderAliasSelection: routes.validator.BuilderSelection; builderBoostFactor: bigint; broadcastValidation: routes.beacon.BroadcastValidation; blindedLocal: boolean; }; export declare const MAX_BUILDER_BOOST_FACTOR: bigint; /** * Service that sets up and handles validator attester duties. */ export declare class ValidatorStore { private readonly config; private readonly slashingProtection; private readonly indicesService; private readonly doppelgangerService; private readonly metrics; private readonly validators; /** Initially true because there are no validators */ private pubkeysToDiscover; private readonly defaultProposerConfig; constructor(modules: ValidatorStoreModules, valProposerConfig: ValidatorProposerConfig); /** * Create a validator store with initial signers */ static init(modules: ValidatorStoreModules, initialSigners: Signer[], valProposerConfig?: ValidatorProposerConfig): Promise; /** Return all known indices from the validatorStore pubkeys */ getAllLocalIndices(): ValidatorIndex[]; getPubkeyOfIndex(index: ValidatorIndex): PubkeyHex | undefined; pollValidatorIndices(): Promise; getFeeRecipient(pubkeyHex: PubkeyHex): ExecutionAddress; getFeeRecipientByIndex(index: ValidatorIndex): ExecutionAddress; setFeeRecipient(pubkeyHex: PubkeyHex, feeRecipient: ExecutionAddress): void; deleteFeeRecipient(pubkeyHex: PubkeyHex): void; getGraffiti(pubkeyHex: PubkeyHex): string | undefined; setGraffiti(pubkeyHex: PubkeyHex, graffiti: string): void; deleteGraffiti(pubkeyHex: PubkeyHex): void; getBuilderSelectionParams(pubkeyHex: PubkeyHex): { selection: routes.validator.BuilderSelection; boostFactor: bigint; }; strictFeeRecipientCheck(pubkeyHex: PubkeyHex): boolean; getGasLimit(pubkeyHex: PubkeyHex): number; setGasLimit(pubkeyHex: PubkeyHex, gasLimit: number): void; deleteGasLimit(pubkeyHex: PubkeyHex): void; getBuilderBoostFactor(pubkeyHex: PubkeyHex): bigint; setBuilderBoostFactor(pubkeyHex: PubkeyHex, boostFactor: bigint): void; deleteBuilderBoostFactor(pubkeyHex: PubkeyHex): void; /** Return true if `index` is active part of this validator client */ hasValidatorIndex(index: ValidatorIndex): boolean; getProposerConfig(pubkeyHex: PubkeyHex): ProposerConfig | null; addSigner(signer: Signer, valProposerConfig?: ValidatorProposerConfig): Promise; getSigner(pubkeyHex: PubkeyHex): Signer | undefined; removeSigner(pubkeyHex: PubkeyHex): boolean; /** Return true if there is at least 1 pubkey registered */ hasSomeValidators(): boolean; votingPubkeys(): PubkeyHex[]; hasVotingPubkey(pubkeyHex: PubkeyHex): boolean; getRemoteSignerPubkeys(signerUrl: string): PubkeyHex[]; signBlock(pubkey: BLSPubkey, blindedOrFull: BeaconBlock | BlindedBeaconBlock, currentSlot: Slot, logger?: LoggerVc): Promise; signExecutionPayloadEnvelope(pubkey: BLSPubkey, envelope: gloas.ExecutionPayloadEnvelope, currentSlot: Slot, logger?: LoggerVc): Promise; signRandao(pubkey: BLSPubkey, slot: Slot): Promise; signAttestation(duty: routes.validator.AttesterDuty, attestationData: phase0.AttestationData, currentEpoch: Epoch): Promise; signAggregateAndProof(duty: routes.validator.AttesterDuty, selectionProof: BLSSignature, aggregate: Attestation): Promise; signSyncCommitteeSignature(pubkey: BLSPubkeyMaybeHex, validatorIndex: ValidatorIndex, slot: Slot, beaconBlockRoot: Root): Promise; signContributionAndProof(duty: { pubkey: BLSPubkeyMaybeHex; validatorIndex: number; }, selectionProof: BLSSignature, contribution: altair.SyncCommitteeContribution): Promise; signPayloadAttestation(duty: routes.validator.PtcDuty, data: gloas.PayloadAttestationData, currentSlot: Slot, logger?: LoggerVc): Promise; signProposerPreferences(duty: routes.validator.ProposerDuty, dependentRoot: Uint8Array, feeRecipient: ExecutionAddress, gasLimit: number, currentSlot: Slot): Promise; signAttestationSelectionProof(pubkey: BLSPubkeyMaybeHex, slot: Slot): Promise; signSyncCommitteeSelectionProof(pubkey: BLSPubkeyMaybeHex, slot: Slot, subcommitteeIndex: number): Promise; signVoluntaryExit(pubkey: BLSPubkeyMaybeHex, validatorIndex: number, exitEpoch: Epoch): Promise; isDoppelgangerSafe(pubkeyHex: PubkeyHex): boolean; signValidatorRegistration(pubkeyMaybeHex: BLSPubkeyMaybeHex, regAttributes: { feeRecipient: ExecutionAddress; gasLimit: number; }, _slot: Slot): Promise; getValidatorRegistration(pubkeyMaybeHex: BLSPubkeyMaybeHex, regAttributes: { feeRecipient: ExecutionAddress; gasLimit: number; }, slot: Slot): Promise; private getSignature; /** Prevent signing bad data sent by the Beacon node */ private validateAttestationDuty; private validatePtcDuty; private assertDoppelgangerSafe; } export {}; //# sourceMappingURL=validatorStore.d.ts.map