UNPKG

@lodestar/beacon-node

Version:

A Typescript implementation of the beacon chain

82 lines 4.07 kB
import { ForkName } from "@lodestar/params"; import { CachedBeaconStateAllForks } from "@lodestar/state-transition"; import { AttesterSlashing, SignedBeaconBlock, ValidatorIndex, capella, phase0 } from "@lodestar/types"; import { IBeaconDb } from "../../db/index.js"; import { Metrics } from "../../metrics/metrics.js"; import { SignedBLSToExecutionChangeVersioned } from "../../util/types.js"; import { BlockType } from "../interface.js"; export declare class OpPool { /** Map of uniqueId(AttesterSlashing) -> AttesterSlashing */ private readonly attesterSlashings; /** Map of to slash validator index -> ProposerSlashing */ private readonly proposerSlashings; /** Map of to exit validator index -> SignedVoluntaryExit */ private readonly voluntaryExits; /** Set of seen attester slashing indexes. No need to prune */ private readonly attesterSlashingIndexes; /** Map of validator index -> SignedBLSToExecutionChange */ private readonly blsToExecutionChanges; get attesterSlashingsSize(): number; get proposerSlashingsSize(): number; get voluntaryExitsSize(): number; get blsToExecutionChangeSize(): number; fromPersisted(db: IBeaconDb): Promise<void>; toPersisted(db: IBeaconDb): Promise<void>; /** Returns false if at least one intersecting index has not been seen yet */ hasSeenAttesterSlashing(intersectingIndices: ValidatorIndex[]): boolean; hasSeenVoluntaryExit(validatorIndex: ValidatorIndex): boolean; hasSeenBlsToExecutionChange(validatorIndex: ValidatorIndex): boolean; hasSeenProposerSlashing(validatorIndex: ValidatorIndex): boolean; /** Must be validated beforehand */ insertAttesterSlashing(fork: ForkName, attesterSlashing: AttesterSlashing, rootHash?: Uint8Array): void; /** Must be validated beforehand */ insertProposerSlashing(proposerSlashing: phase0.ProposerSlashing): void; /** Must be validated beforehand */ insertVoluntaryExit(voluntaryExit: phase0.SignedVoluntaryExit): void; /** Must be validated beforehand */ insertBlsToExecutionChange(blsToExecutionChange: capella.SignedBLSToExecutionChange, preCapella?: boolean): void; /** * Get proposer and attester slashings and voluntary exits and bls to execution change for inclusion in a block. * * This function computes both types of slashings and exits, because attester slashings and exits may be invalidated by * slashings included earlier in the block. */ getSlashingsAndExits(state: CachedBeaconStateAllForks, blockType: BlockType, metrics: Metrics | null): [ AttesterSlashing[], phase0.ProposerSlashing[], phase0.SignedVoluntaryExit[], capella.SignedBLSToExecutionChange[] ]; /** For beacon pool API */ getAllAttesterSlashings(): AttesterSlashing[]; /** For beacon pool API */ getAllProposerSlashings(): phase0.ProposerSlashing[]; /** For beacon pool API */ getAllVoluntaryExits(): phase0.SignedVoluntaryExit[]; /** For beacon pool API */ getAllBlsToExecutionChanges(): SignedBLSToExecutionChangeVersioned[]; /** * Prune all types of transactions given the latest head state */ pruneAll(headBlock: SignedBeaconBlock, headState: CachedBeaconStateAllForks): void; /** * Prune attester slashings for all slashed or withdrawn validators. */ private pruneAttesterSlashings; /** * Prune proposer slashings for validators which are exited in the finalized epoch. */ private pruneProposerSlashings; /** * Call after finalizing * Prune if validator has already exited at or before the finalized checkpoint of the head. */ private pruneVoluntaryExits; /** * Prune BLS to execution changes that have been applied to the state more than 1 block ago. * In the worse case where head block is reorged, the same BlsToExecutionChange message can be re-added * to opPool once gossipsub seen cache TTL passes. */ private pruneBlsToExecutionChanges; } //# sourceMappingURL=opPool.d.ts.map