Skip to content

Commit

Permalink
Place updates for old methods in the Cancun spec
Browse files Browse the repository at this point in the history
  • Loading branch information
flcl42 committed Jun 29, 2023
1 parent 5ec36f7 commit f0f5ba7
Show file tree
Hide file tree
Showing 2 changed files with 41 additions and 23 deletions.
45 changes: 34 additions & 11 deletions src/engine/cancun.md
Original file line number Diff line number Diff line change
Expand Up @@ -94,9 +94,9 @@ Refer to the response for [`engine_newPayloadV2`](./shanghai.md#engine_newpayloa

This method follows the same specification as [`engine_newPayloadV2`](./shanghai.md#engine_newpayloadv2) with the addition of the following:

1. Client software **MUST** return `-32602: Invalid params` error unless all parameters and their fields are provided with non-`null` values.
1. Client software **MUST** return `-38005: Unsupported fork` error if the `timestamp` of the payload is less than the Cancun activation timestamp.

2. Client software **MUST** return `-38005: Unsupported fork` error if the `timestamp` of the payload is less than the Cancun activation timestamp. This rule replaces similar one defined for `engine_newPayloadV1`.
2. Client software **MUST** return `-32602: Invalid params` error unless all parameters and their fields are provided with non-`null` values.

3. Given the expected array of blob versioned hashes client software **MUST** run its validation by taking the following steps:
1. Obtain the actual array by concatenating blob versioned hashes lists (`tx.blob_versioned_hashes`) of each [blob transaction](https://eips.ethereum.org/EIPS/eip-4844#new-transaction-type) included in the payload, respecting the order of inclusion. If the payload has no blob transactions the expected array **MUST** be `[]`.
Expand All @@ -114,10 +114,6 @@ This method follows the same specification as [`engine_newPayloadV2`](./shanghai
2. `payloadAttributes`: `Object|null` - Instance of [`PayloadAttributesV3`](#payloadattributesv3) or `null`.
* timeout: 8s

Client software **MUST** return `-32602: Invalid params` error unless:
* every field of `forkchoiceState` is provided with non-`null` value,
* every field of `payloadAttributes` is provided with non-`null` values when `payloadAttributes` is not `null`.

#### Response

Refer to the response for [`engine_forkchoiceUpdatedV2`](./shanghai.md#engine_forkchoiceupdatedv2).
Expand All @@ -128,6 +124,10 @@ This method follows the same specification as [`engine_forkchoiceUpdatedV2`](./s

1. Client software **MUST** return `-38005: Unsupported fork` error if the `payloadAttributes.timestamp` is less than the Cancun activation timestamp.

2. Client software **MUST** return `-32602: Invalid params` error unless:
* every field of `forkchoiceState` is provided with non-`null` value,
* every field of `payloadAttributes` is provided with non-`null` values when `payloadAttributes` is not `null`.

### engine_getPayloadV3

The response of this method is extended with [`BlobsBundleV1`](#blobsbundlev1) containing the blobs, their respective KZG commitments
Expand All @@ -152,14 +152,14 @@ and proofs corresponding to the `versioned_hashes` included in the blob transact

Refer to the specification for [`engine_getPayloadV2`](./shanghai.md#engine_getpayloadv2) with addition of the following:

1. The call **MUST** return `blobsBundle` with empty `blobs`, `commitments` and `proofs` if the payload doesn't contain any blob transactions.
1. Client software **MUST** return `-38005: Unsupported fork` error if the `timestamp` of the built payload is less than the Cancun activation timestamp.

2. The call **MUST** return `commitments` matching the versioned hashes of the transactions list of the execution payload, in the same order,
i.e. `assert verify_kzg_commitments_against_transactions(payload.transactions, blobsBundle.commitments)` (see EIP-4844 consensus-specs).
2. The call **MUST** return `blobsBundle` with empty `blobs`, `commitments` and `proofs` if the payload doesn't contain any blob transactions.

3. The call **MUST** return `blobs` and `proofs` that match the `commitments` list, i.e. `assert len(blobsBundle.commitments) == len(blobsBundle.blobs) == len(blobsBundle.proofs)` and `assert verify_blob_kzg_proof_batch(blobsBundle.blobs, blobsBundle.commitments, blobsBundle.proofs)`.
3. The call **MUST** return `commitments` matching the versioned hashes of the transactions list of the execution payload, in the same order,
i.e. `assert verify_kzg_commitments_against_transactions(payload.transactions, blobsBundle.commitments)` (see EIP-4844 consensus-specs).

4. Client software **MUST** return `-38005: Unsupported fork` error if the `timestamp` of the built payload is less than the Cancun activation timestamp.
4. The call **MUST** return `blobs` and `proofs` that match the `commitments` list, i.e. `assert len(blobsBundle.commitments) == len(blobsBundle.blobs) == len(blobsBundle.proofs)` and `assert verify_blob_kzg_proof_batch(blobsBundle.blobs, blobsBundle.commitments, blobsBundle.proofs)`.

### Deprecate `engine_exchangeTransitionConfigurationV1`

Expand All @@ -170,3 +170,26 @@ This document introduces deprecation of [`engine_exchangeTransitionConfiguration
2. Execution layer clients **MUST NOT** surface an error message to the user if this method is not called.

3. Consensus and execution layer clients **MAY** remove support of this method after Cancun. If no longer supported, this method **MUST** be removed from the [`engine_exchangeCapabilities`](./common.md#engine_exchangecapabilities) request or response list depending on whether it is consensus or execution layer client.


### Update methods of previous forks

For the following methods:

- `engine_newPayloadV1`
- `engine_newPayloadV2`
- `engine_getPayloadV1`
- `engine_getPayloadV2`

an early validation **MUST** be added:

1. Client software **MUST** return `-38005: Unsupported fork` error if the `timestamp` of the payload is greater or equal to the Cancun activation timestamp.

For the following methods:

- `engine_forkchoiceUpdatedV1`
- `engine_forkchoiceUpdatedV2`

similar early validation **MUST** be added:

1. Client software **MUST** return `-38005: Unsupported fork` error if the `payloadAttributes.timestamp` of the payload is greater or equal to the Cancun activation timestamp.
19 changes: 7 additions & 12 deletions src/engine/paris.md
Original file line number Diff line number Diff line change
Expand Up @@ -159,18 +159,15 @@ The payload build process is specified as follows:

#### Specification

1. Client software **MUST** validate `blockHash` value as being equivalent to `Keccak256(RLP(ExecutionBlockHeader))`, where `ExecutionBlockHeader` is the execution layer block header (the former PoW block header structure). Fields of this object are set to the corresponding payload values and constant values according to the Block structure section of [EIP-3675](https://eips.ethereum.org/EIPS/eip-3675#block-structure), extended with the corresponding section of [EIP-4399](https://eips.ethereum.org/EIPS/eip-4399#block-structure). Client software **MUST** run this validation in all cases even if this branch or any other branches of the block tree are in an active sync process.

1. Client software **MUST** return `-38005: Unsupported fork` error if the `timestamp` of the payload is greater or equal to the Cancun activation timestamp.
2. Client software **MAY** initiate a sync process if requisite data for payload validation is missing. Sync process is specified in the [Sync](#sync) section.

2. Client software **MUST** validate `blockHash` value as being equivalent to `Keccak256(RLP(ExecutionBlockHeader))`, where `ExecutionBlockHeader` is the execution layer block header (the former PoW block header structure). Fields of this object are set to the corresponding payload values and constant values according to the Block structure section of [EIP-3675](https://eips.ethereum.org/EIPS/eip-3675#block-structure), extended with the corresponding section of [EIP-4399](https://eips.ethereum.org/EIPS/eip-4399#block-structure). Client software **MUST** run this validation in all cases even if this branch or any other branches of the block tree are in an active sync process.
3. Client software **MUST** validate the payload if it extends the canonical chain and requisite data for the validation is locally available. The validation process is specified in the [Payload validation](#payload-validation) section.

3. Client software **MAY** initiate a sync process if requisite data for payload validation is missing. Sync process is specified in the [Sync](#sync) section.
4. Client software **MAY NOT** validate the payload if the payload doesn't belong to the canonical chain.

4. Client software **MUST** validate the payload if it extends the canonical chain and requisite data for the validation is locally available. The validation process is specified in the [Payload validation](#payload-validation) section.

5. Client software **MAY NOT** validate the payload if the payload doesn't belong to the canonical chain.

6. Client software **MUST** respond to this method call in the following way:
5. Client software **MUST** respond to this method call in the following way:
* `{status: INVALID_BLOCK_HASH, latestValidHash: null, validationError: errorMessage | null}` if the `blockHash` validation has failed
* `{status: INVALID, latestValidHash: 0x0000000000000000000000000000000000000000000000000000000000000000, validationError: errorMessage | null}` if terminal block conditions are not satisfied
* `{status: SYNCING, latestValidHash: null, validationError: null}` if requisite data for the payload's acceptance or validation is missing
Expand All @@ -181,7 +178,7 @@ The payload build process is specified as follows:
- the payload hasn't been fully validated
- ancestors of a payload are known and comprise a well-formed chain.

7. If any of the above fails due to errors unrelated to the normal processing flow of the method, client software **MUST** respond with an error object.
6. If any of the above fails due to errors unrelated to the normal processing flow of the method, client software **MUST** respond with an error object.

### engine_forkchoiceUpdatedV1

Expand Down Expand Up @@ -254,9 +251,7 @@ The payload build process is specified as follows:

2. The call **MUST** return `-38001: Unknown payload` error if the build process identified by the `payloadId` does not exist.

3. Client software **MUST** return `-38005: Unsupported fork` error if the `timestamp` of the payload is greater or equal to the Cancun activation timestamp.

4. Client software **MAY** stop the corresponding build process after serving this call.
3. Client software **MAY** stop the corresponding build process after serving this call.

### engine_exchangeTransitionConfigurationV1

Expand Down

0 comments on commit f0f5ba7

Please sign in to comment.