Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Engine API: unify failure mode for mismatched structure versions #337

Merged
merged 9 commits into from
Jan 12, 2023
Merged
5 changes: 4 additions & 1 deletion src/engine/experimental/blob-extension.md
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,10 @@ The fields are encoded as follows:

* method: `engine_newPayloadV3`
* params:
1. [`ExecutionPayloadV3`](#ExecutionPayloadV3)
1. [`ExecutionPayloadV2`](./shanghai.md#ExecutionPayloadV2) | [`ExecutionPayloadV3`](#ExecutionPayloadV3), where:
- `ExecutionPayloadV2` **MUST** be used if the `timestamp` value is lower than the EIP-4844 activation timestamp,
- `ExecutionPayloadV3` **MUST** be used if the `timestamp` value is greater or equal to the EIP-4844 activation timestamp,
- Client software **MUST** return `-32602: Invalid params` error if the wrong version of the structure is used in the method call.

#### Specification

Expand Down
23 changes: 10 additions & 13 deletions src/engine/shanghai.md
Original file line number Diff line number Diff line change
Expand Up @@ -78,20 +78,18 @@ This structure has the syntax of `PayloadAttributesV1` and appends a single fiel

* method: `engine_newPayloadV2`
* params:
1. [`ExecutionPayloadV2`](#ExecutionPayloadV2)
1. [`ExecutionPayloadV1`](#./paris.md#ExecutionPayloadV1) | [`ExecutionPayloadV2`](#ExecutionPayloadV2), where:
- `ExecutionPayloadV1` **MUST** be used if the `timestamp` value is lower than the Shanghai timestamp,
- `ExecutionPayloadV2` **MUST** be used if the `timestamp` value is greater or equal to the Shanghai timestamp,
- Client software **MUST** return `-32602: Invalid params` error if the wrong version of the structure is used in the method call.

#### Response

Refer to the response for [`engine_newPayloadV1`](./paris.md#engine_newpayloadv1).

#### Specification

This method follows the same specification as [`engine_newPayloadV1`](./paris.md#engine_newpayloadv1) with the exception of the following:

1. If withdrawal functionality is activated, client software **MUST** return an `INVALID` status with the appropriate `latestValidHash` if `payload.withdrawals` is `null`.
Similarly, if the functionality is not activated, client software **MUST** return an `INVALID` status with the appropriate `latestValidHash` if `payloadAttributes.withdrawals` is not `null`.
Blocks without withdrawals **MUST** be expressed with an explicit empty list `[]` value.
Refer to the validity conditions for [`engine_newPayloadV1`](./paris.md#engine_newpayloadv1) to specification of the appropriate `latestValidHash` value.
This method follows the same specification as [`engine_newPayloadV1`](./paris.md#engine_newpayloadv1).

### engine_forkchoiceUpdatedV2

Expand All @@ -100,19 +98,18 @@ This method follows the same specification as [`engine_newPayloadV1`](./paris.md
* method: "engine_forkchoiceUpdatedV2"
* params:
1. `forkchoiceState`: `Object` - instance of [`ForkchoiceStateV1`](./paris.md#ForkchoiceStateV1)
2. `payloadAttributes`: `Object|null` - instance of [`PayloadAttributesV2`](#PayloadAttributesV2) or `null`
2. `payloadAttributes`: `Object|null` - instance of [`PayloadAttributesV1`](./paris.md#PayloadAttributesV1) | [`PayloadAttributesV2`](#PayloadAttributesV2) or `null`, where:
- `PayloadAttributesV1` **MUST** be used to build a payload with the `timestamp` value lower than the Shanghai timestamp,
- `PayloadAttributesV2` **MUST** be used to build a payload with the `timestamp` value greater or equal to the Shanghai timestamp,
- Client software **MUST** return `-32602: Invalid params` error if the wrong version of the structure is used in the method call.

#### Response

Refer to the response for [`engine_forkchoiceUpdatedV1`](./paris.md#engine_forkchoiceupdatedv1).

#### Specification

This method follows the same specification as [`engine_forkchoiceUpdatedV1`](./paris.md#engine_forkchoiceupdatedv1) with the exception of the following:

1. If withdrawal functionality is activated, client software **MUST** return error `-38003: Invalid payload attributes` if `payloadAttributes.withdrawals` is `null`.
Similarly, if the functionality is not activated, client software **MUST** return error `-38003: Invalid payload attributes` if `payloadAttributes.withdrawals` is not `null`.
Blocks without withdrawals **MUST** be expressed with an explicit empty list `[]` value.
This method follows the same specification as [`engine_forkchoiceUpdatedV1`](./paris.md#engine_forkchoiceupdatedv1).

### engine_getPayloadV2

Expand Down