@lodestar/beacon-node
Version:
A Typescript implementation of the beacon chain
106 lines • 4.17 kB
TypeScript
import { ChainForkConfig } from "@lodestar/config";
import { ForkPostBellatrix } from "@lodestar/params";
import { CachedBeaconStateAllForks, CachedBeaconStateExecutions } from "@lodestar/state-transition";
import { BLSPubkey, BLSSignature, BeaconBlock, BeaconBlockBody, BlindedBeaconBlock, BlindedBeaconBlockBody, Bytes32, Root, RootHex, SSEPayloadAttributes, Slot, ValidatorIndex, Wei, deneb } from "@lodestar/types";
import { Logger } from "@lodestar/utils";
import { IEth1ForBlockProduction } from "../../eth1/index.js";
import { IExecutionEngine, PayloadId } from "../../execution/index.js";
import type { BeaconChain } from "../chain.js";
import { CommonBlockBody } from "../interface.js";
export declare enum PayloadPreparationType {
Fresh = "Fresh",
Cached = "Cached",
Reorged = "Reorged",
Blinded = "Blinded"
}
/**
* Block production steps tracked in metrics
*/
export declare enum BlockProductionStep {
proposerSlashing = "proposerSlashing",
attesterSlashings = "attesterSlashings",
voluntaryExits = "voluntaryExits",
blsToExecutionChanges = "blsToExecutionChanges",
attestations = "attestations",
eth1DataAndDeposits = "eth1DataAndDeposits",
syncAggregate = "syncAggregate",
executionPayload = "executionPayload"
}
export type BlockAttributes = {
randaoReveal: BLSSignature;
graffiti: Bytes32;
slot: Slot;
parentBlockRoot: Root;
parentSlot: Slot;
feeRecipient?: string;
};
export declare enum BlockType {
Full = "Full",
Blinded = "Blinded"
}
export type AssembledBodyType<T extends BlockType> = T extends BlockType.Full ? BeaconBlockBody : BlindedBeaconBlockBody;
export type AssembledBlockType<T extends BlockType> = T extends BlockType.Full ? BeaconBlock : BlindedBeaconBlock;
export declare enum BlobsResultType {
preDeneb = 0,
produced = 1,
blinded = 2
}
export type BlobsResult = {
type: BlobsResultType.preDeneb;
} | {
type: BlobsResultType.produced;
contents: deneb.Contents;
blockHash: RootHex;
} | {
type: BlobsResultType.blinded;
};
export declare function produceBlockBody<T extends BlockType>(this: BeaconChain, blockType: T, currentState: CachedBeaconStateAllForks, blockAttr: BlockAttributes & {
proposerIndex: ValidatorIndex;
proposerPubKey: BLSPubkey;
commonBlockBodyPromise?: Promise<CommonBlockBody>;
}): Promise<{
body: AssembledBodyType<T>;
blobs: BlobsResult;
executionPayloadValue: Wei;
shouldOverrideBuilder?: boolean;
}>;
/**
* Produce ExecutionPayload for pre-merge, merge, and post-merge.
*
* Expects `eth1MergeBlockFinder` to be actively searching for blocks well in advance to being called.
*
* @returns PayloadId = pow block found, null = pow NOT found
*/
export declare function prepareExecutionPayload(chain: {
eth1: IEth1ForBlockProduction;
executionEngine: IExecutionEngine;
config: ChainForkConfig;
}, logger: Logger, fork: ForkPostBellatrix, parentBlockRoot: Root, safeBlockHash: RootHex, finalizedBlockHash: RootHex, state: CachedBeaconStateExecutions, suggestedFeeRecipient: string): Promise<{
isPremerge: true;
} | {
isPremerge: false;
prepType: PayloadPreparationType;
payloadId: PayloadId;
}>;
export declare function getExecutionPayloadParentHash(chain: {
eth1: IEth1ForBlockProduction;
config: ChainForkConfig;
}, state: CachedBeaconStateExecutions): Promise<{
isPremerge: true;
} | {
isPremerge: false;
parentHash: Root;
}>;
export declare function getPayloadAttributesForSSE(fork: ForkPostBellatrix, chain: {
eth1: IEth1ForBlockProduction;
config: ChainForkConfig;
}, { prepareState, prepareSlot, parentBlockRoot, feeRecipient, }: {
prepareState: CachedBeaconStateExecutions;
prepareSlot: Slot;
parentBlockRoot: Root;
feeRecipient: string;
}): Promise<SSEPayloadAttributes>;
export declare function produceCommonBlockBody<T extends BlockType>(this: BeaconChain, blockType: T, currentState: CachedBeaconStateAllForks, { randaoReveal, graffiti, slot, parentSlot, parentBlockRoot, }: BlockAttributes & {
parentSlot: Slot;
}): Promise<CommonBlockBody>;
//# sourceMappingURL=produceBlockBody.d.ts.map