@lodestar/beacon-node
Version:
A Typescript implementation of the beacon chain
66 lines • 2.52 kB
TypeScript
import { ChainConfig } from "@lodestar/config";
import { RootHex } from "@lodestar/types";
import { PayloadIdCache } from "./interface.js";
import { EngineApiRpcParamTypes, EngineApiRpcReturnTypes, PayloadStatus } from "./types.js";
import { JsonRpcBackend } from "./utils.js";
export type ExecutionEngineMockOpts = {
genesisBlockHash?: string;
eth1BlockHash?: string;
onlyPredefinedResponses?: boolean;
genesisTime?: number;
config?: ChainConfig;
};
/**
* Mock ExecutionEngine for fast prototyping and unit testing
*/
export declare class ExecutionEngineMockBackend implements JsonRpcBackend {
private readonly opts;
headBlockHash: string;
safeBlockHash: string;
finalizedBlockHash: string;
readonly payloadIdCache: PayloadIdCache;
/** Known valid blocks */
private readonly validBlocks;
/** Preparing payloads to be retrieved via engine_getPayloadV1 */
private readonly preparingPayloads;
private readonly payloadsForDeletion;
private readonly predefinedPayloadStatuses;
private payloadId;
private capellaForkTimestamp;
private denebForkTimestamp;
private electraForkTimestamp;
private fuluForkTimestamp;
private gloasForkTimestamp;
readonly handlers: {
[K in keyof EngineApiRpcParamTypes]: (...args: EngineApiRpcParamTypes[K]) => EngineApiRpcReturnTypes[K];
};
constructor(opts: ExecutionEngineMockOpts);
private getPayloadBodiesByHash;
private getPayloadBodiesByRange;
/**
* Mock manipulator to add predefined responses before execution engine client calls
*/
addPredefinedPayloadStatus(blockHash: RootHex, payloadStatus: PayloadStatus): void;
/**
* `engine_newPayloadV1`
*/
private notifyNewPayload;
/**
* `engine_forkchoiceUpdatedV1`
*/
private notifyForkchoiceUpdate;
/**
* `engine_getPayloadV1`
*
* 1. Given the payloadId client software MUST respond with the most recent version of the payload that is available in the corresponding building process at the time of receiving the call.
* 2. The call MUST be responded with 5: Unavailable payload error if the building process identified by the payloadId doesn't exist.
* 3. Client software MAY stop the corresponding building process after serving this call.
*/
private getPayloadV1;
private getPayloadV5;
private getClientVersionV1;
private getBlobs;
private getBlobsV2;
private timestampToFork;
}
//# sourceMappingURL=mock.d.ts.map