From 3ae3d29fc9900e5c48924c238dff7643fdc3680e Mon Sep 17 00:00:00 2001 From: Mikhail Kalinin Date: Sun, 16 Jun 2024 18:04:13 +0600 Subject: [PATCH] engine: Add EL triggered consolidations (#554) --- src/engine/openrpc/methods/payload.yaml | 25 ++++++++++++++++++++- src/engine/openrpc/schemas/payload.yaml | 29 +++++++++++++++++++++++++ src/engine/prague.md | 11 ++++++++++ 3 files changed, 64 insertions(+), 1 deletion(-) diff --git a/src/engine/openrpc/methods/payload.yaml b/src/engine/openrpc/methods/payload.yaml index 774c7110..6726060d 100644 --- a/src/engine/openrpc/methods/payload.yaml +++ b/src/engine/openrpc/methods/payload.yaml @@ -270,6 +270,13 @@ - sourceAddress: '0x00000000000000000000000000000000000010f6' validatorPubkey: '0x98daeed734da114470da559bd4b4c7259e1f7952555241dcbc90cf194a2ef676fc6005f3672fada2a3645edb297a7553' amount: '0x1' + consolidationRequests: + - sourceAddress: '0xa94f5374fce5edbc8e2a8697c15331677e6ebf0b' + sourcePubkey: '0x85103a5617937691dfeeb89b86a80d5dc9e3c9d3a1a0e7ce311e26e0bb732eabaa47ffa288f0d54de28209a62a7d29d0' + targetPubkey: '0x98daeed734da114470da559bd4b4c7259e1f7952555241dcbc90cf194a2ef676fc6005f3672fada2a3645edb297a7553' + - sourceAddress: '0x00000000000000000000000000000000000010f6' + sourcePubkey: '0x96a96086cff07df17668f35f7418ef8798079167e3f4f9b72ecde17b28226137cf454ab1dd20ef5d924786ab3483c2f9' + targetPubkey: '0xa5c85a60ba2905c215f6a12872e62b1ee037051364244043a5f639aa81b04a204c55e7cc851f29c7c183be253ea1510b' - name: Expected blob versioned hashes value: - '0x000657f37554c781402a22917dee2f75def7ab966d7b770905398eba3c444014' @@ -677,6 +684,10 @@ - sourceAddress: '0xa94f5374fce5edbc8e2a8697c15331677e6ebf0b' validatorPubkey: '0x85103a5617937691dfeeb89b86a80d5dc9e3c9d3a1a0e7ce311e26e0bb732eabaa47ffa288f0d54de28209a62a7d29d0' amount: '0x0' + consolidationRequests: + - sourceAddress: '0x00000000000000000000000000000000000010f6' + sourcePubkey: '0x96a96086cff07df17668f35f7418ef8798079167e3f4f9b72ecde17b28226137cf454ab1dd20ef5d924786ab3483c2f9' + targetPubkey: '0xa5c85a60ba2905c215f6a12872e62b1ee037051364244043a5f639aa81b04a204c55e7cc851f29c7c183be253ea1510b' - transactions: - '0xf865108506fc23ac00830124f8940101010101010101010101010101010101010101018031a0d9712a3c40ae85aea4ad1bd95a0b7cc7bd805189a9e2517403b11a00a1530f81a053b53b0267a6dcfe9f9a1652307b396b3e8a65e65707a450e60c92baefdbcfbe' - '0x02f86c0711843b9aca008506fc23ac00830124f89402020202020202020202020202020202020202020180c080a071d36bc93c7ae8cc5c01501e51e5e97a51aa541d1a89c809a2af7eb40e9bc2cba071644230e21c075c1da08916aff5efe9f95a6f6a4f94dc217f6c1bb4a3240b29' @@ -699,6 +710,10 @@ - sourceAddress: '0x00000000000000000000000000000000000010f6' validatorPubkey: '0x98daeed734da114470da559bd4b4c7259e1f7952555241dcbc90cf194a2ef676fc6005f3672fada2a3645edb297a7553' amount: '0x1' + consolidationRequests: + - sourceAddress: '0xa94f5374fce5edbc8e2a8697c15331677e6ebf0b' + sourcePubkey: '0x85103a5617937691dfeeb89b86a80d5dc9e3c9d3a1a0e7ce311e26e0bb732eabaa47ffa288f0d54de28209a62a7d29d0' + targetPubkey: '0x98daeed734da114470da559bd4b4c7259e1f7952555241dcbc90cf194a2ef676fc6005f3672fada2a3645edb297a7553' - name: engine_getPayloadBodiesByRangeV1 summary: Given a range of block numbers returns bodies of the corresponding execution payloads externalDocs: @@ -775,7 +790,7 @@ schema: type: array items: - $ref: '#/components/schemas/ExecutionPayloadBodyV1' + $ref: '#/components/schemas/ExecutionPayloadBodyV2' errors: - code: -38004 message: Too large request @@ -811,6 +826,10 @@ - sourceAddress: '0xa94f5374fce5edbc8e2a8697c15331677e6ebf0b' validatorPubkey: '0x85103a5617937691dfeeb89b86a80d5dc9e3c9d3a1a0e7ce311e26e0bb732eabaa47ffa288f0d54de28209a62a7d29d0' amount: '0x0' + consolidationRequests: + - sourceAddress: '0x00000000000000000000000000000000000010f6' + sourcePubkey: '0x96a96086cff07df17668f35f7418ef8798079167e3f4f9b72ecde17b28226137cf454ab1dd20ef5d924786ab3483c2f9' + targetPubkey: '0xa5c85a60ba2905c215f6a12872e62b1ee037051364244043a5f639aa81b04a204c55e7cc851f29c7c183be253ea1510b' - transactions: - '0xf865108506fc23ac00830124f8940101010101010101010101010101010101010101018031a0d9712a3c40ae85aea4ad1bd95a0b7cc7bd805189a9e2517403b11a00a1530f81a053b53b0267a6dcfe9f9a1652307b396b3e8a65e65707a450e60c92baefdbcfbe' - '0x02f86c0711843b9aca008506fc23ac00830124f89402020202020202020202020202020202020202020180c080a071d36bc93c7ae8cc5c01501e51e5e97a51aa541d1a89c809a2af7eb40e9bc2cba071644230e21c075c1da08916aff5efe9f95a6f6a4f94dc217f6c1bb4a3240b29' @@ -833,3 +852,7 @@ - sourceAddress: '0x00000000000000000000000000000000000010f6' validatorPubkey: '0x98daeed734da114470da559bd4b4c7259e1f7952555241dcbc90cf194a2ef676fc6005f3672fada2a3645edb297a7553' amount: '0x1' + consolidationRequests: + - sourceAddress: '0xa94f5374fce5edbc8e2a8697c15331677e6ebf0b' + sourcePubkey: '0x85103a5617937691dfeeb89b86a80d5dc9e3c9d3a1a0e7ce311e26e0bb732eabaa47ffa288f0d54de28209a62a7d29d0' + targetPubkey: '0x98daeed734da114470da559bd4b4c7259e1f7952555241dcbc90cf194a2ef676fc6005f3672fada2a3645edb297a7553' diff --git a/src/engine/openrpc/schemas/payload.yaml b/src/engine/openrpc/schemas/payload.yaml index dee1bc85..e050991b 100644 --- a/src/engine/openrpc/schemas/payload.yaml +++ b/src/engine/openrpc/schemas/payload.yaml @@ -266,6 +266,7 @@ ExecutionPayloadV4: - excessBlobGas - depositRequests - withdrawalRequests + - consolidationRequests properties: parentHash: $ref: '#/components/schemas/ExecutionPayloadV3/properties/parentHash' @@ -311,6 +312,11 @@ ExecutionPayloadV4: type: array items: $ref: '#/components/schemas/WithdrawalRequestV1' + consolidationRequests: + title: Consolidation requests + type: array + items: + $ref: '#/components/schemas/ConsolidationRequestV1' ExecutionPayloadBodyV1: title: Execution payload body object V1 type: object @@ -358,6 +364,12 @@ ExecutionPayloadBodyV2: - 'null' items: $ref: '#/components/schemas/WithdrawalRequestV1' + consolidationRequests: + title: Consolidation requests + - array + - 'null' + items: + $ref: '#/components/schemas/ConsolidationRequestV1' BlobsBundleV1: title: Blobs bundle object V1 type: object @@ -423,3 +435,20 @@ WithdrawalRequestV1: amount: title: Withdraw amount $ref: '#/components/schemas/uint64' +ConsolidationRequestV1: + title: Consolidation request object V1 + type: object + required: + - sourceAddress + - sourcePubkey + - targetPubkey + properties: + sourceAddress: + title: Source address + $ref: '#/components/schemas/address' + sourcePubkey: + title: Source validator public key + $ref: '#/components/schemas/bytes48' + targetPubkey: + title: Target validator public key + $ref: '#/components/schemas/bytes48' diff --git a/src/engine/prague.md b/src/engine/prague.md index 7afacb3b..688c6abb 100644 --- a/src/engine/prague.md +++ b/src/engine/prague.md @@ -12,6 +12,7 @@ This specification is based on and extends [Engine API - Cancun](./cancun.md) sp - [Structures](#structures) - [DepositRequestV1](#depositrequestv1) - [WithdrawalRequestV1](#withdrawalrequestv1) + - [ConsolidationRequestV1](#consolidationrequestv1) - [ExecutionPayloadV4](#executionpayloadv4) - [ExecutionPayloadBodyV2](#executionpayloadbodyv2) - [Methods](#methods) @@ -59,6 +60,14 @@ The fields are encoded as follows: *Note:* The `amount` value is represented in Gwei. +### ConsolidationRequestV1 +This structure maps onto the consolidation request from [EIP-7251](https://eips.ethereum.org/EIPS/eip-7251). +The fields are encoded as follows: + +- `sourceAddress`: `DATA`, 20 Bytes +- `sourcePubkey`: `DATA`, 48 Bytes +- `targetPubkey`: `DATA`, 48 Bytes + ### ExecutionPayloadV4 This structure has the syntax of [`ExecutionPayloadV3`](./cancun.md#executionpayloadv3) and appends the new fields: `depositRequests` and `withdrawalRequests`. @@ -82,6 +91,7 @@ This structure has the syntax of [`ExecutionPayloadV3`](./cancun.md#executionpay - `excessBlobGas`: `QUANTITY`, 64 Bits - `depositRequests`: `Array of DepositRequestV1` - Array of deposits, each object is an `OBJECT` containing the fields of a `DepositRequestV1` structure. - `withdrawalRequests`: `Array of WithdrawalRequestV1` - Array of withdrawal requests, each object is an `OBJECT` containing the fields of a `WithdrawalRequestV1` structure. +- `consolidationRequests`: `Array of ConsolidationRequestV1` - Array of consolidation requests, each object is an `OBJECT` containing the fields of a `ConsolidationRequestV1` structure. ### ExecutionPayloadBodyV2 @@ -91,6 +101,7 @@ This structure has the syntax of [`ExecutionPayloadBodyV1`](./shanghai.md#execut - `withdrawals`: `Array of WithdrawalV1` - Array of withdrawals, each object is an `OBJECT` containing the fields of a `WithdrawalV1` structure. - `depositRequests`: `Array of DepositRequestV1` - Array of deposits, each object is an `OBJECT` containing the fields of a `DepositRequestV1` structure. - `withdrawalRequests`: `Array of WithdrawalRequestV1` - Array of withdrawal requests, each object is an `OBJECT` containing the fields of a `WithdrawalRequestV1` structure. +- `consolidationRequests`: `Array of ConsolidationRequestV1` - Array of consolidation requests, each object is an `OBJECT` containing the fields of a `ConsolidationRequestV1` structure. ## Methods