Skip to content

Commit 5d63406

Browse files
0x00101010fradamtImTeimkalinin
authored
execution-apis: Add EIP-7594 (PeerDAS) related changes (#630)
* Define osaka related api changes * doctoc README * fix error * Update src/engine/openrpc/schemas/blob.yaml Co-authored-by: fradamt <[email protected]> * Update src/engine/osaka.md Co-authored-by: fradamt <[email protected]> * Add more description * Update src/engine/osaka.md Co-authored-by: Tei Im <[email protected]> * Update src/engine/osaka.md Co-authored-by: Tei Im <[email protected]> * Adjust field order * fix camel case and other small changes * Update how transactions should be handled * Update description, remove proof_version * Add back proofVersion * Remove ExecutionPayloadV4 * update based on comment * remove auto format to keep it simple * flatten cells * Update based on comments * Fix typo: scema -> schema * Update based on latest discussion * update wording * Update based on comments * More update * Update based on discussions * fix build --------- Co-authored-by: fradamt <[email protected]> Co-authored-by: Tei Im <[email protected]> Co-authored-by: Mikhail Kalinin <[email protected]>
1 parent 4008859 commit 5d63406

File tree

7 files changed

+578
-4
lines changed

7 files changed

+578
-4
lines changed

src/engine/openrpc/methods/blob.yaml

Lines changed: 163 additions & 0 deletions
Large diffs are not rendered by default.

src/engine/openrpc/methods/payload.yaml

Lines changed: 220 additions & 0 deletions
Large diffs are not rendered by default.

src/engine/openrpc/schemas/blob.yaml

Lines changed: 19 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,25 @@ BlobAndProofV1:
55
- blob
66
- proof
77
properties:
8-
blob:
8+
blob:
99
title: Blob
10-
$ref: '#/components/schemas/bytes'
10+
$ref: "#/components/schemas/bytes"
1111
proof:
1212
title: proof
13-
$ref: '#/components/schemas/bytes48'
14-
13+
$ref: "#/components/schemas/bytes48"
14+
15+
BlobAndProofV2:
16+
title: Blob and proof object V2
17+
type: object
18+
required:
19+
- blob
20+
- proofs
21+
properties:
22+
blob:
23+
title: Blob
24+
$ref: "#/components/schemas/bytes"
25+
proofs:
26+
title: Cell Proofs
27+
type: array
28+
items:
29+
$ref: "#/components/schemas/bytes48"

src/engine/openrpc/schemas/payload.yaml

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -281,6 +281,29 @@ BlobsBundleV1:
281281
type: array
282282
items:
283283
$ref: '#/components/schemas/bytes'
284+
BlobsBundleV2:
285+
title: Blobs bundle object V2
286+
type: object
287+
required:
288+
- commitments
289+
- proofs
290+
- blobs
291+
properties:
292+
commitments:
293+
title: Commitments
294+
type: array
295+
items:
296+
$ref: '#/components/schemas/bytes48'
297+
proofs:
298+
title: Proofs
299+
type: array
300+
items:
301+
$ref: '#/components/schemas/bytes48'
302+
blobs:
303+
title: Blobs
304+
type: array
305+
items:
306+
$ref: '#/components/schemas/bytes'
284307
DepositRequestV1:
285308
title: Deposit request object V1
286309
type: object

src/engine/osaka.md

Lines changed: 142 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,142 @@
1+
# Engine API -- Osaka
2+
3+
Engine API changes introduced in Osaka.
4+
5+
This specification is based on and extends [Engine API - Prague](./prague.md) specification.
6+
7+
<!-- START doctoc generated TOC please keep comment here to allow auto update -->
8+
<!-- DON'T EDIT THIS SECTION, INSTEAD RE-RUN doctoc TO UPDATE -->
9+
**Table of Contents**
10+
11+
- [Structures](#structures)
12+
- [BlobsBundleV2](#blobsbundlev2)
13+
- [BlobAndProofV2](#blobandproofv2)
14+
- [Methods](#methods)
15+
- [engine_getPayloadV5](#engine_getpayloadv5)
16+
- [Request](#request)
17+
- [Response](#response)
18+
- [Specification](#specification)
19+
- [engine_getBlobsV2](#engine_getblobsv2)
20+
- [Request](#request-1)
21+
- [Response](#response-1)
22+
- [Specification](#specification-1)
23+
- [Update the methods of previous forks](#update-the-methods-of-previous-forks)
24+
- [Cancun API](#cancun-api)
25+
- [Prague API](#prague-api)
26+
27+
<!-- END doctoc generated TOC please keep comment here to allow auto update -->
28+
29+
## Structures
30+
31+
### BlobsBundleV2
32+
33+
The fields are encoded as follows:
34+
35+
- `commitments`: `Array of DATA` - Array of `KZGCommitment` as defined in [EIP-4844](https://eips.ethereum.org/EIPS/eip-4844), 48 bytes each (`DATA`).
36+
- `proofs`: `Array of DATA` - Array of `KZGProof` (48 bytes each, type defined in [EIP-4844](https://eips.ethereum.org/EIPS/eip-4844), semantics defined in [EIP-7594](https://github.com/ethereum/EIPs/blob/master/EIPS/eip-7594.md)).
37+
- `blobs`: `Array of DATA` - Array of blobs, each blob is `FIELD_ELEMENTS_PER_BLOB * BYTES_PER_FIELD_ELEMENT = 4096 * 32 = 131072` bytes (`DATA`) representing a SSZ-encoded `Blob` as defined in [EIP-4844](https://eips.ethereum.org/EIPS/eip-4844)
38+
39+
`blobs` and `commitments` arrays **MUST** be of same length and `proofs` **MUST** contain exactly `CELLS_PER_EXT_BLOB` * `len(blobs)` cell proofs.
40+
41+
### BlobAndProofV2
42+
43+
The fields are encoded as follows:
44+
45+
- `blob`: `DATA` - `FIELD_ELEMENTS_PER_BLOB * BYTES_PER_FIELD_ELEMENT = 4096 * 32 = 131072` bytes (`DATA`) representing a SSZ-encoded `Blob` as defined in [EIP-4844](https://eips.ethereum.org/EIPS/eip-4844).
46+
- `proofs`: `Array of DATA` - Array of `KZGProof` as defined in [EIP-4844](https://eips.ethereum.org/EIPS/eip-4844), 48 bytes each (`DATA`).
47+
48+
`proofs` **MUST** contain exactly `CELLS_PER_EXT_BLOB` cell proofs.
49+
50+
## Methods
51+
52+
### engine_getPayloadV5
53+
54+
This method is updated in a backward incompatible way. Instead of returning `BlobBundleV1`, it returns `BlobsBundleV2`.
55+
56+
#### Request
57+
58+
* method: `engine_getPayloadV5`
59+
* params:
60+
1. `payloadId`: `DATA`, 8 Bytes - Identifier of the payload build process
61+
* timeout: 1s
62+
63+
#### Response
64+
65+
* result: `object`
66+
- `executionPayload`: [`ExecutionPayloadV3`](./cancun.md#executionpayloadv3)
67+
- `blockValue` : `QUANTITY`, 256 Bits - The expected value to be received by the `feeRecipient` in wei
68+
- `blobsBundle`: [`BlobsBundleV2`](#BlobsBundleV2) - Bundle with data corresponding to blob transactions included into `executionPayload`
69+
- `shouldOverrideBuilder` : `BOOLEAN` - Suggestion from the execution layer to use this `executionPayload` instead of an externally provided one
70+
- `executionRequests`: `Array of DATA` - Execution layer triggered requests obtained from the `executionPayload` transaction execution.
71+
* error: code and message set in case an exception happens while getting the payload.
72+
73+
#### Specification
74+
75+
This method follows the same specification as [`engine_getPayloadV4`](./prague.md#engine_getpayloadv4) with changes of the following:
76+
77+
1. Client software **MUST** return `-38005: Unsupported fork` error if the `timestamp` of the built payload does not fall within the time frame of the Osaka fork.
78+
79+
2. The call **MUST** return `BlobsBundleV2` with empty `blobs`, `commitments` and `proofs` if the payload doesn't contain any blob transactions.
80+
81+
3. The call **MUST** return `blobs` and `proofs` that match the `commitments` list, i.e.
82+
1. `assert len(blobsBundle.commitments) == len(blobsBundle.blobs)` and
83+
2. `assert len(blobsBundle.proofs) == len(blobsBundle.blobs) * CELLS_PER_EXT_BLOB` and
84+
3. `assert verify_cell_kzg_proof_batch(commitments, cell_indices, cells, blobsBundle.proofs)` (see [EIP-7594 consensus-specs](https://github.com/ethereum/consensus-specs/blob/36d80adb44c21c66379c6207a9578f9b1dcc8a2d/specs/fulu/polynomial-commitments-sampling.md#verify_cell_kzg_proof_batch))
85+
1. `commitments` should list each commitment `CELLS_PER_EXT_BLOB` times, repeating it for every cell. In python, `[blobsBundle.commitments[i] for i in range(len(blobsBundle.blobs)) for _ in range(CELLS_PER_EXT_BLOB)]`
86+
2. `cell_indices` should be `[0, ..., CELLS_PER_EXT_BLOB, 0, ..., CELLS_PER_EXT_BLOB, ...]`. In python, `list(range(CELLS_PER_EXT_BLOB)) * len(blobsBundle.blobs)`
87+
3. `cells` is the list of cells for an extended blob. In python, `[cell for blob in blobsBundle.blobs for cell in compute_cells(blob)]` (see [compute_cells](https://github.com/ethereum/consensus-specs/blob/v1.5.0-beta.3/specs/fulu/polynomial-commitments-sampling.md#compute_cells) in consensus-specs)
88+
4. All of the inputs to `verify_cell_kzg_proof_batch` have the same length, `CELLS_PER_EXT_BLOB * len(blobsBundle.blobs)`
89+
90+
### engine_getBlobsV2
91+
92+
Consensus layer clients **MAY** use this method to fetch blobs from the execution layer blob pool.
93+
94+
#### Request
95+
96+
* method: `engine_getBlobsV2`
97+
* params:
98+
1. `Array of DATA`, 32 Bytes - Array of blob versioned hashes.
99+
* timeout: 1s
100+
101+
#### Response
102+
103+
* result: `Array of BlobAndProofV2` - Array of [`BlobAndProofV2`](#BlobAndProofV2) or `null` in case of any missing blobs.
104+
* error: code and message set in case an error occurs during processing of the request.
105+
106+
#### Specification
107+
108+
Refer to the specification for [`engine_getBlobsV1`](./cancun.md#engine_getblobsv1) with changes of the following:
109+
110+
1. Given an array of blob versioned hashes client software **MUST** respond with an array of `BlobAndProofV2` objects with matching versioned hashes, respecting the order of versioned hashes in the input array.
111+
2. Client software **MUST** return `null` in case of any missing or older version blobs. For instance,
112+
1. if the request is `[A_versioned_hash, B_versioned_hash, C_versioned_hash]` and client software has data for blobs `A` and `C`, but doesn't have data for `B`, the response **MUST** be `null`.
113+
2. if the request is `[A_versioned_hash_for_blob_with_blob_proof]`, the response **MUST** be `null` as well.
114+
3. Client software **MUST** support request sizes of at least 128 blob versioned hashes. The client **MUST** return `-38004: Too large request` error if the number of requested blobs is too large.
115+
4. Client software **MUST** return `null` if syncing or otherwise unable to serve blob pool data.
116+
5. Callers **MUST** consider that execution layer clients may prune old blobs from their pool, and will respond with `null` if a blob has been pruned.
117+
118+
### Update the methods of previous forks
119+
120+
#### Cancun API
121+
122+
This section defines how Osaka payload should be handled by the ['Cancun API'](./cancun.md).
123+
124+
For the following methods:
125+
126+
- [`engine_getBlobsV1`](./cancun.md#engine_getblobsv1)
127+
128+
a validation **MUST** be added:
129+
130+
1. Client software **MUST** return `-38005: Unsupported fork` error if the Osaka fork has been activated.
131+
132+
#### Prague API
133+
134+
This section defines how Osaka payload should be handled by the ['Prague API'](./prague.md).
135+
136+
For the following methods:
137+
138+
- [`engine_getPayloadV4`](./prague.md#engine_getpayloadv4)
139+
140+
a validation **MUST** be added:
141+
142+
1. Client software **MUST** return `-38005: Unsupported fork` error if the `timestamp` of payload greater or equal to the Osaka activation timestamp.

src/eth/submit.yaml

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,16 @@
3030
[EIP-4844](https://eips.ethereum.org/EIPS/eip-4844) transactions, the raw
3131
form must be the network form. This means it includes the blobs, KZG
3232
commitments, and KZG proofs.
33+
For [EIP-7594](https://eips.ethereum.org/EIPS/eip-7594) transactions, the raw format
34+
must be the network form. This means it includes the blobs, KZG commitments, and cell proofs.
35+
The logic for handling the new transaction during fork boundaries are
36+
1. When receiving an encoded transaction with cell proofs before the PeerDAS fork activates, we reject it. Only blob proofs are accepted into the pool.
37+
2. At the time of fork activation, the implementer could (not mandatory)
38+
- Drop all old-format transactions
39+
- Convert old proofs to new format (computationally expensive)
40+
- Convert only when including in a locally produced block
41+
3. After the fork has activated, only txs with cell proofs are accepted via p2p relay.
42+
4. On RPC (eth_sendRawTransaction), txs with blob proofs may still be accepted and will be auto-converted by the node. At implementer discretion, this facility can be deprecated later when users have switched to new client libraries that can create cell proofs.
3343
params:
3444
- name: Transaction
3545
required: true

wordlist.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -68,3 +68,4 @@ src
6868
https
6969
forkchoiceupdatedresponsev
7070
exitv
71+
txs

0 commit comments

Comments
 (0)