UNPKG

@lodestar/beacon-node

Version:

A Typescript implementation of the beacon chain

55 lines 2.25 kB
import { routes } from "@lodestar/api"; import { ApplicationMethods } from "@lodestar/api/server"; import { ProducedBlockSource } from "@lodestar/types"; import { ApiOptions } from "../../options.js"; import { ApiModules } from "../types.js"; /** * If the node is within this many epochs from the head, we declare it to be synced regardless of * the network sync state. * * This helps prevent attacks where nodes can convince us that we're syncing some non-existent * finalized head. * * TODO: Lighthouse uses 8 for the attack described above. However, 8 kills Lodestar since validators * can trigger regen to fast-forward head state 8 epochs to be immediately invalidated as sync sets * a new head. Then the checkpoint state cache grows unbounded with very different states (because * they are 8 epochs apart) and causes an OOM. Research a proper solution once regen and the state * caches are better. */ export declare const SYNC_TOLERANCE_EPOCHS = 1; /** * Engine block selection reasons tracked in metrics / logs */ export declare enum EngineBlockSelectionReason { BuilderDisabled = "builder_disabled", BuilderError = "builder_error", BuilderTimeout = "builder_timeout", BuilderPending = "builder_pending", BuilderNoBid = "builder_no_bid", BuilderCensorship = "builder_censorship", BlockValue = "block_value", EnginePreferred = "engine_preferred" } /** * Builder block selection reasons tracked in metrics / logs */ export declare enum BuilderBlockSelectionReason { EngineDisabled = "engine_disabled", EngineError = "engine_error", EnginePending = "engine_pending", BlockValue = "block_value", BuilderPreferred = "builder_preferred" } export type BlockSelectionResult = { source: ProducedBlockSource.engine; reason: EngineBlockSelectionReason; } | { source: ProducedBlockSource.builder; reason: BuilderBlockSelectionReason; }; /** * Server implementation for handling validator duties. * See `@lodestar/validator/src/api` for the client implementation). */ export declare function getValidatorApi(opts: ApiOptions, { chain, config, logger, metrics, network, sync }: ApiModules): ApplicationMethods<routes.validator.Endpoints>; //# sourceMappingURL=index.d.ts.map