|
| 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. |
0 commit comments