@lodestar/beacon-node
Version:
A Typescript implementation of the beacon chain
62 lines • 2.45 kB
TypeScript
import { RootHex, bellatrix } 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;
onlyPredefinedResponses?: boolean;
capellaForkTimestamp?: number;
denebForkTimestamp?: number;
electraForkTimestamp?: number;
};
/**
* 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, both pre-merge and post-merge */
private readonly validBlocks;
/** Preparing payloads to be retrieved via engine_getPayloadV1 */
private readonly preparingPayloads;
private readonly payloadsForDeletion;
private readonly predefinedPayloadStatuses;
private payloadId;
readonly handlers: {
[K in keyof EngineApiRpcParamTypes]: (...args: EngineApiRpcParamTypes[K]) => EngineApiRpcReturnTypes[K];
};
constructor(opts: ExecutionEngineMockOpts);
private getPayloadBodiesByHash;
private getPayloadBodiesByRange;
/**
* Mock manipulator to add more known blocks to this mock.
*/
addPowBlock(powBlock: bellatrix.PowBlock): void;
/**
* 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 getPayload;
private getClientVersionV1;
private getBlobs;
private timestampToFork;
}
//# sourceMappingURL=mock.d.ts.map