UNPKG

@lodestar/beacon-node

Version:

A Typescript implementation of the beacon chain

68 lines 3.31 kB
import { DataAvailabilityStatus } from "@lodestar/state-transition"; import { ExecutionPayloadStatus } from "../../execution/index.js"; import { BeaconChain } from "../chain.js"; import { PayloadEnvelopeInput } from "../seenCache/seenPayloadEnvelopeInput.js"; import { ImportPayloadOpts } from "./types.js"; export declare enum PayloadErrorCode { EXECUTION_ENGINE_INVALID = "PAYLOAD_ERROR_EXECUTION_ENGINE_INVALID", EXECUTION_ENGINE_ERROR = "PAYLOAD_ERROR_EXECUTION_ENGINE_ERROR", BLOCK_NOT_IN_FORK_CHOICE = "PAYLOAD_ERROR_BLOCK_NOT_IN_FORK_CHOICE", MISS_BLOCK_STATE = "PAYLOAD_ERROR_MISS_BLOCK_STATE", ENVELOPE_VERIFICATION_ERROR = "PAYLOAD_ERROR_ENVELOPE_VERIFICATION_ERROR", INVALID_SIGNATURE = "PAYLOAD_ERROR_INVALID_SIGNATURE" } export type PayloadErrorType = { code: PayloadErrorCode.EXECUTION_ENGINE_INVALID; execStatus: ExecutionPayloadStatus; errorMessage: string; } | { code: PayloadErrorCode.EXECUTION_ENGINE_ERROR; execStatus: ExecutionPayloadStatus; errorMessage: string; } | { code: PayloadErrorCode.BLOCK_NOT_IN_FORK_CHOICE; blockRootHex: string; } | { code: PayloadErrorCode.MISS_BLOCK_STATE; blockRootHex: string; } | { code: PayloadErrorCode.ENVELOPE_VERIFICATION_ERROR; message: string; } | { code: PayloadErrorCode.INVALID_SIGNATURE; }; export declare class PayloadError extends Error { type: PayloadErrorType; constructor(type: PayloadErrorType, message?: string); } /** * Import an execution payload envelope after all data is available. * * The envelope is only verified here, no state mutation. State effects from the payload * are applied on the next block via processParentExecutionPayload. * * The DA wait must have run upstream (range sync awaits DA in `verifyBlocksInEpoch` for the * whole segment; gossip / API path uses the `processExecutionPayload` wrapper below). * * Steps: * 1. Emit `execution_payload_available` event for payload attestation * 2. Get the ProtoBlock from fork choice * 3. Regenerate state for envelope verification * 4. Verify envelope (fields against state, signature, and EL in parallel where possible) * 5. Persist verified payload envelope to hot DB (waits for write-queue space for backpressure) * 6. Update fork choice (transitions the block's PENDING variant to FULL) * 7. Queue notifyForkchoiceUpdate to engine api * 8. Record metrics for payload envelope and column sources * 9. Emit `execution_payload` event */ export declare function importExecutionPayload(this: BeaconChain, payloadInput: PayloadEnvelopeInput, dataAvailabilityStatus: DataAvailabilityStatus, opts?: ImportPayloadOpts): Promise<void>; /** * Process an execution payload envelope end-to-end: wait for DA, then import. * * Used by the PayloadEnvelopeProcessor queue (gossip / API / unknown-payload sync) — i.e. * callers that have NOT already awaited DA themselves. Range sync's inline dispatch in * processBlocks skips this wrapper and calls `importExecutionPayload` directly, since * `verifyBlocksInEpoch` already awaited DA for the segment. */ export declare function processExecutionPayload(this: BeaconChain, payloadInput: PayloadEnvelopeInput, signal: AbortSignal, opts?: ImportPayloadOpts): Promise<void>; //# sourceMappingURL=importExecutionPayload.d.ts.map