Skip to content

Commit f731dbf

Browse files
authored
Merge pull request #170 from mkalinin/update-terminal-block-validation
Engine API: replace terminal block error with INVALID_TERMINAL_BLOCK status
2 parents f040e6d + 5179039 commit f731dbf

File tree

1 file changed

+11
-11
lines changed

1 file changed

+11
-11
lines changed

src/engine/specification.md

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,6 @@ The list of error codes introduced by this specification can be found below.
9696
| -32603 | Internal error | Internal JSON-RPC error. |
9797
| -32000 | Server error | Generic client error while processing request. |
9898
| -32001 | Unknown payload | Payload does not exist / is not available. |
99-
| -32002 | Invalid terminal block | Terminal block doesn't satisfy terminal block conditions. |
10099

101100
Each error returns a `null` `data` value, except `-32000` which returns the `data` object with a `err` member that explains the error encountered.
102101

@@ -165,7 +164,7 @@ This structure contains the attributes required to initiate a payload build proc
165164

166165
This structure contains the result of processing a payload. The fields are encoded as follows:
167166

168-
- `status`: `enum` - `"VALID" | "INVALID" | "SYNCING" | "ACCEPTED" | "INVALID_BLOCK_HASH"`
167+
- `status`: `enum` - `"VALID" | "INVALID" | "SYNCING" | "ACCEPTED" | "INVALID_BLOCK_HASH" | "INVALID_TERMINAL_BLOCK"`
169168
- `latestValidHash`: `DATA|null`, 32 Bytes - the hash of the most recent *valid* block in the branch defined by payload and its ancestors
170169
- `validationError`: `String|null` - a message providing additional details on the validation error if the payload is deemed `INVALID`
171170

@@ -177,13 +176,13 @@ Payload validation process consists of validating a payload with respect to the
177176

178177
1. Client software **MAY** obtain a parent state by executing ancestors of a payload as a part of the validation process. In this case each ancestor **MUST** also pass payload validation process.
179178

179+
1. Client software **MUST** validate that the most recent PoW block in the chain of a payload ancestors satisfies terminal block conditions according to [EIP-3675](https://eips.ethereum.org/EIPS/eip-3675#transition-block-validity). This check maps to the transition block validity section of the EIP. If this validation fails, the response **MUST** contain `{status: INVALID_TERMINAL_BLOCK, latestValidHash: null}`. Additionally, each block in a tree of descendants of an invalid terminal block **MUST** be deemed `INVALID`.
180+
180181
1. Client software **MUST** validate a payload according to the block header and execution environment rule set with modifications to these rule sets defined in the [Block Validity](https://eips.ethereum.org/EIPS/eip-3675#block-validity) section of [EIP-3675](https://eips.ethereum.org/EIPS/eip-3675#specification):
181182
* If validation succeeds, the response **MUST** contain `{status: VALID, latestValidHash: payload.blockHash}`
182-
* If validation fails, the response **MUST** contain `{status: INVALID, latestValidHash: validHash}` where `validHash` is the block hash of the most recent *valid* ancestor of the invalid payload. That is, the valid ancestor of the payload with the highest `blockNumber`. Note that `validHash` may reference a PoW block
183+
* If validation fails, the response **MUST** contain `{status: INVALID, latestValidHash: validHash}` where `validHash` is the block hash of the most recent *valid* ancestor of the invalid payload. That is, the valid ancestor of the payload with the highest `blockNumber`
183184
* Client software **MUST NOT** surface an `INVALID` payload over any API endpoint and p2p interface.
184185

185-
1. Client software **MUST** return `-32002: Invalid terminal block` error if the most recent PoW block in the chain of a payload ancestors, that is a PoW block with the highest `blockNumber`, doesn't satisfy terminal block conditions according to [EIP-3675](https://eips.ethereum.org/EIPS/eip-3675#transition-block-validity). This check maps on the Transition block validity section of the EIP.
186-
187186
1. Client software **MAY** provide additional details on the validation error if a payload is deemed `INVALID` by assigning the corresponding message to the `validationError` field.
188187

189188
1. The process of validating a payload on the canonical chain **MUST NOT** be affected by an active sync process on a side branch of the block tree. For example, if side branch `B` is `SYNCING` but the requisite data for validating a payload from canonical branch `A` is available, client software **MUST** run full validation of the payload and respond accordingly.
@@ -235,14 +234,14 @@ The payload build process is specified as follows:
235234
1. Client software **MAY NOT** validate the payload if the payload doesn't belong to the canonical chain.
236235

237236
1. Client software **MUST** respond to this method call in the following way:
238-
* `{status: INVALID_BLOCK_HASH, latestValidHash: null, validationError: null}` if the `blockHash` validation has failed
237+
* `{status: INVALID_BLOCK_HASH, latestValidHash: null, validationError: errorMessage | null}` if the `blockHash` validation has failed
238+
* `{status: INVALID_TERMINAL_BLOCK, latestValidHash: null, validationError: errorMessage | null}` if terminal block conditions are not satisfied
239239
* `{status: SYNCING, latestValidHash: null, validationError: null}` if the payload extends the canonical chain and requisite data for its validation is missing
240240
* with the payload status obtained from the [Payload validation](#payload-validation) process if the payload has been fully validated while processing the call
241241
* `{status: ACCEPTED, latestValidHash: null, validationError: null}` if the following conditions are met:
242242
- the `blockHash` of the payload is valid
243243
- the payload doesn't extend the canonical chain
244-
- the payload hasn't been fully validated
245-
* with `-32002: Invalid terminal block` error if terminal block conditions aren't met.
244+
- the payload hasn't been fully validated.
246245

247246
1. 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.
248247

@@ -262,6 +261,7 @@ The payload build process is specified as follows:
262261
* `"VALID"`
263262
* `"INVALID"`
264263
* `"SYNCING"`
264+
* `"INVALID_TERMINAL_BLOCK"`
265265
- `payloadId`: `DATA|null`, 8 Bytes - identifier of the payload build process or `null`
266266
* error: code and message set in case an exception happens while the validating payload, updating the forkchoice or initiating the payload build process.
267267

@@ -271,7 +271,7 @@ The payload build process is specified as follows:
271271

272272
1. Client software **MAY** skip an update of the forkchoice state and **MUST NOT** begin a payload build process if `forkchoiceState.headBlockHash` doesn't reference a leaf of the block tree. That is, the block referenced by `forkchoiceState.headBlockHash` is neither the head of the canonical chain nor a block at the tip of any other chain.
273273

274-
1. Client software **MUST** return `-32002: Invalid terminal block` error if `forkchoiceState.headBlockHash` references a PoW block that doesn't satisfy terminal block conditions according to [EIP-3675](https://eips.ethereum.org/EIPS/eip-3675#definitions). This check maps to the transition block validity section of the EIP.
274+
1. If `forkchoiceState.headBlockHash` references a PoW block, client software **MUST** validate this block with respect to terminal block conditions according to [EIP-3675](https://eips.ethereum.org/EIPS/eip-3675#transition-block-validity). This check maps to the transition block validity section of the EIP. Additionally, if this validation fails, client software **MUST NOT** update the forkchoice state and **MUST NOT** begin a payload build process.
275275

276276
1. Before updating the forkchoice state, client software **MUST** ensure the validity of the payload referenced by `forkchoiceState.headBlockHash`, and **MAY** validate the payload while processing the call. The validation process is specified in the [Payload validation](#payload-validation) section.
277277

@@ -284,9 +284,9 @@ The payload build process is specified as follows:
284284
1. Client software **MUST** respond to this method call in the following way:
285285
* `{payloadStatus: {status: SYNCING, latestValidHash: null, validationError: null}, payloadId: null}` if `forkchoiceState.headBlockHash` references an unknown payload or a payload that can't be validated because requisite data for the validation is missing
286286
* `{payloadStatus: {status: INVALID, latestValidHash: null, validationError: errorMessage | null}, payloadId: null}` obtained from the [Payload validation](#payload-validation) process if the payload is deemed `INVALID`
287+
* `{payloadStatus: {status: INVALID_TERMINAL_BLOCK, latestValidHash: null, validationError: errorMessage | null}, payloadId: null}` either obtained from the [Payload validation](#payload-validation) process or as a result of validating a PoW block referenced by `forkchoiceState.headBlockHash`
287288
* `{payloadStatus: {status: VALID, latestValidHash: forkchoiceState.headBlockHash, validationError: null}, payloadId: null}` if the payload is deemed `VALID` and a build process hasn't been started
288-
* `{payloadStatus: {status: VALID, latestValidHash: forkchoiceState.headBlockHash, validationError: null}, payloadId: buildProcessId}` if the payload is deemed `VALID` and the build process has begun
289-
* with `-32002: Invalid terminal block` error if terminal block conditions aren't met
289+
* `{payloadStatus: {status: VALID, latestValidHash: forkchoiceState.headBlockHash, validationError: null}, payloadId: buildProcessId}` if the payload is deemed `VALID` and the build process has begun.
290290

291291
1. 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.
292292

0 commit comments

Comments
 (0)