diff --git a/packages/beacon-node/src/execution/engine/http.ts b/packages/beacon-node/src/execution/engine/http.ts index 0d2656ae46e..58acec5018b 100644 --- a/packages/beacon-node/src/execution/engine/http.ts +++ b/packages/beacon-node/src/execution/engine/http.ts @@ -24,6 +24,7 @@ import { ExecutionEngineState, ExecutionPayloadStatus, IExecutionEngine, + InclusionList, PayloadAttributes, PayloadId, VersionedHashes, @@ -202,10 +203,13 @@ export class ExecutionEngineHttp implements IExecutionEngine { executionPayload: ExecutionPayload, versionedHashes?: VersionedHashes, parentBlockRoot?: Root, - executionRequests?: ExecutionRequests + executionRequests?: ExecutionRequests, + inclusionList?: InclusionList, // TODO FOCIL: figure out how to get IL when process_execution_payload ): Promise { const method = - ForkSeq[fork] >= ForkSeq.electra + ForkSeq[fork] >= ForkSeq.focil + ? "engine_newPayloadV5" + : ForkSeq[fork] >= ForkSeq.electra ? "engine_newPayloadV4" : ForkSeq[fork] >= ForkSeq.deneb ? "engine_newPayloadV3" @@ -215,6 +219,7 @@ export class ExecutionEngineHttp implements IExecutionEngine { const serializedExecutionPayload = serializeExecutionPayload(fork, executionPayload); + // TODO FOCIL: Add V5. Current code is ugly with all the nested if let engineRequest: EngineRequest; if (ForkSeq[fork] >= ForkSeq.deneb) { if (versionedHashes === undefined) { diff --git a/packages/beacon-node/src/execution/engine/interface.ts b/packages/beacon-node/src/execution/engine/interface.ts index c32cc1bc721..df6017f1151 100644 --- a/packages/beacon-node/src/execution/engine/interface.ts +++ b/packages/beacon-node/src/execution/engine/interface.ts @@ -109,6 +109,10 @@ export type ClientVersion = { export type VersionedHashes = Uint8Array[]; +export type InclusionList = { + transactions: Uint8Array[]; +} + /** * Execution engine represents an abstract protocol to interact with execution clients. Potential transports include: * - JSON RPC over network @@ -135,7 +139,8 @@ export interface IExecutionEngine { executionPayload: ExecutionPayload, versionedHashes?: VersionedHashes, parentBeaconBlockRoot?: Root, - executionRequests?: ExecutionRequests + executionRequests?: ExecutionRequests, + inclusionList?: InclusionList, ): Promise; /** diff --git a/packages/beacon-node/src/execution/engine/mock.ts b/packages/beacon-node/src/execution/engine/mock.ts index 8a84d2b0148..f85ea93e4cb 100644 --- a/packages/beacon-node/src/execution/engine/mock.ts +++ b/packages/beacon-node/src/execution/engine/mock.ts @@ -89,6 +89,7 @@ export class ExecutionEngineMockBackend implements JsonRpcBackend { engine_newPayloadV2: this.notifyNewPayload.bind(this), engine_newPayloadV3: this.notifyNewPayload.bind(this), engine_newPayloadV4: this.notifyNewPayload.bind(this), + engine_newPayloadV5: this.notifyNewPayload.bind(this), engine_forkchoiceUpdatedV1: this.notifyForkchoiceUpdate.bind(this), engine_forkchoiceUpdatedV2: this.notifyForkchoiceUpdate.bind(this), engine_forkchoiceUpdatedV3: this.notifyForkchoiceUpdate.bind(this), @@ -100,6 +101,8 @@ export class ExecutionEngineMockBackend implements JsonRpcBackend { engine_getPayloadBodiesByRangeV1: this.getPayloadBodiesByRange.bind(this), engine_getClientVersionV1: this.getClientVersionV1.bind(this), engine_getBlobsV1: this.getBlobs.bind(this), + engine_getInclusionListV1: () => ({transactions: []}), + engine_updatePayloadWithInclusionListV1: () => ({payloadId: ""}) }; } diff --git a/packages/beacon-node/src/execution/engine/types.ts b/packages/beacon-node/src/execution/engine/types.ts index f35a63aa3d9..22826ef9cb7 100644 --- a/packages/beacon-node/src/execution/engine/types.ts +++ b/packages/beacon-node/src/execution/engine/types.ts @@ -28,6 +28,7 @@ export type EngineApiRpcParamTypes = { engine_newPayloadV2: [ExecutionPayloadRpc]; engine_newPayloadV3: [ExecutionPayloadRpc, VersionedHashesRpc, DATA]; engine_newPayloadV4: [ExecutionPayloadRpc, VersionedHashesRpc, DATA, ExecutionRequestsRpc]; + engine_newPayloadV5: [ExecutionPayloadRpc, VersionedHashesRpc, DATA, ExecutionRequestsRpc, InclusionListRpc]; /** * 1. Object - Payload validity status with respect to the consensus rules: * - blockHash: DATA, 32 Bytes - block hash value of the payload @@ -70,6 +71,17 @@ export type EngineApiRpcParamTypes = { engine_getClientVersionV1: [ClientVersionRpc]; engine_getBlobsV1: [DATA[]]; + + /** + * 1. DATA - 32 bytes - parent hash which returned inclusion list should be built upon + */ + engine_getInclusionListV1: [DATA]; + + /** + * 1. DATA - 8 bytes - Identifier of the payload build process + * 2. DATA[] aka InclusionListV1 + */ + engine_updatePayloadWithInclusionListV1: [QUANTITY, InclusionListRpc]; }; export type PayloadStatus = { @@ -87,6 +99,7 @@ export type EngineApiRpcReturnTypes = { engine_newPayloadV2: PayloadStatus; engine_newPayloadV3: PayloadStatus; engine_newPayloadV4: PayloadStatus; + engine_newPayloadV5: PayloadStatus; engine_forkchoiceUpdatedV1: { payloadStatus: PayloadStatus; payloadId: QUANTITY | null; @@ -114,6 +127,10 @@ export type EngineApiRpcReturnTypes = { engine_getClientVersionV1: ClientVersionRpc[]; engine_getBlobsV1: (BlobAndProofRpc | null)[]; + + engine_getInclusionListV1: InclusionListRpc; + + engine_updatePayloadWithInclusionListV1: UpdateInclusionListResponse; }; type ExecutionPayloadRpcWithValue = { @@ -212,6 +229,16 @@ export interface BlobsBundleRpc { proofs: DATA[]; // some ELs could also provide proofs, each 48 bytes } +type InclusionListRpc = { + /** Array of DATA - Array of transaction objects */ + transactions: DATA[]; +} + +type UpdateInclusionListResponse = { + /** DATA, 8 Bytes - Identifier of the payload build process */ + payloadId: QUANTITY; +} + export function serializeExecutionPayload(fork: ForkName, data: ExecutionPayload): ExecutionPayloadRpc { const payload: ExecutionPayloadRpc = { parentHash: bytesToData(data.parentHash), diff --git a/packages/types/src/types.ts b/packages/types/src/types.ts index 3f3105a6c96..042be9cd0d6 100644 --- a/packages/types/src/types.ts +++ b/packages/types/src/types.ts @@ -12,6 +12,7 @@ import {ts as bellatrix} from "./bellatrix/index.js"; import {ts as capella} from "./capella/index.js"; import {ts as deneb} from "./deneb/index.js"; import {ts as electra} from "./electra/index.js"; +import {ts as focil} from "./focil/index.js"; import {ts as phase0} from "./phase0/index.js"; import {Slot} from "./primitive/types.js"; @@ -22,6 +23,7 @@ export {ts as bellatrix} from "./bellatrix/index.js"; export {ts as capella} from "./capella/index.js"; export {ts as deneb} from "./deneb/index.js"; export {ts as electra} from "./electra/index.js"; +export {ts as focil} from "./focil/index.js"; /** Common non-spec type to represent roots as strings */ export type RootHex = string;