From b3840880062800fa9f72d7945110f87d70fef706 Mon Sep 17 00:00:00 2001 From: Danny Ryan Date: Fri, 29 Oct 2021 13:07:58 -0600 Subject: [PATCH 1/3] add safeBlockHash to forkchoiceUpdated --- src/engine/specification.md | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/engine/specification.md b/src/engine/specification.md index 091347734..a0c2e5e33 100644 --- a/src/engine/specification.md +++ b/src/engine/specification.md @@ -142,6 +142,7 @@ This structure contains the attributes required to initiate a payload build proc * method: "engine_forkchoiceUpdatedV1" * params: 1. `headBlockHash`: `DATA`, 32 Bytes - block hash of the head of the canonical chain + 2. `safeBlockHash`: `DATA`, 32 Bytes - the "safe" block hash of the canonical chain under certain synchrony and honesty assumptions. This value **MUST** be either equal to or an ancestor of `headBlockHash` 2. `finalizedBlockHash`: `DATA`, 32 Bytes - block hash of the most recent finalized block 3. `payloadAttributesV1`: `Object|null` - instance of [`PayloadAttributesV1`](#PayloadAttributesV1) or `null` @@ -152,7 +153,7 @@ This structure contains the attributes required to initiate a payload build proc #### Specification -1. This method call maps on the `POS_FORKCHOICE_UPDATED` event of [EIP-3675](https://eips.ethereum.org/EIPS/eip-3675#specification) and **MUST** be processed according to the specification defined in the EIP. +1. The values `(headBlockHash, finalizedBlockHash)` of this method call map on the `POS_FORKCHOICE_UPDATED` event of [EIP-3675](https://eips.ethereum.org/EIPS/eip-3675#specification) and **MUST** be processed according to the specification defined in the EIP. 2. Client software **MUST** return `SYNCING` status if the payload identified by either the `headBlockHash` or the `finalizedBlockHash` is unknown or if the sync process is in progress. In the event that either the `headBlockHash` or the `finalizedBlockHash` is unknown, the client software **SHOULD** initiate the sync process. From a8cdc6434acbd167e29208a76c9edaac8c1f0235 Mon Sep 17 00:00:00 2001 From: Danny Ryan Date: Mon, 1 Nov 2021 08:03:46 -0600 Subject: [PATCH 2/3] cleanup forkchoice via PR feedback --- src/engine/specification.md | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/engine/specification.md b/src/engine/specification.md index a0c2e5e33..e5a5aac5f 100644 --- a/src/engine/specification.md +++ b/src/engine/specification.md @@ -155,16 +155,18 @@ This structure contains the attributes required to initiate a payload build proc 1. The values `(headBlockHash, finalizedBlockHash)` of this method call map on the `POS_FORKCHOICE_UPDATED` event of [EIP-3675](https://eips.ethereum.org/EIPS/eip-3675#specification) and **MUST** be processed according to the specification defined in the EIP. -2. Client software **MUST** return `SYNCING` status if the payload identified by either the `headBlockHash` or the `finalizedBlockHash` is unknown or if the sync process is in progress. In the event that either the `headBlockHash` or the `finalizedBlockHash` is unknown, the client software **SHOULD** initiate the sync process. +2. All updates to the forkchoice resulting from this call **MUST** be made atomically. -3. Client software **MUST** begin a payload build process building on top of `headBlockHash` if `payloadAttributes` is not `null` and the client is not `SYNCING`. The build process is specified as: +3. Client software **MUST** return `SYNCING` status if the payload identified by either the `headBlockHash` or the `finalizedBlockHash` is unknown or if the sync process is in progress. In the event that either the `headBlockHash` or the `finalizedBlockHash` is unknown, the client software **SHOULD** initiate the sync process. + +4. Client software **MUST** begin a payload build process building on top of `headBlockHash` if `payloadAttributes` is not `null` and the client is not `SYNCING`. The build process is specified as: * The payload build process **MUST** be identifid via `payloadId` where `payloadId` is defined as the first `8` bytes of the `sha256` hash of concatenation of `headBlockHash`, `payloadAttributes.timestamp`, `payloadAttributes.random`, and `payloadAttributes.feeRecipient` where `payloadAttributes.timestamp` is encoded as big-endian and padded fully to 8 bytes -- i.e. `sha256(headBlockHash + timestamp + random + feeRecipient)[0:8]`. * Client software **MUST** set the payload field values according to the set of parameters passed into this method with exception of the `feeRecipient`. The prepared `ExecutionPayload` **MAY** deviate the `coinbase` field value from what is specified by the `feeRecipient` parameter. * Client software **SHOULD** build the initial version of the payload which has an empty transaction set. * Client software **SHOULD** start the process of updating the payload. The strategy of this process is implementation dependent. The default strategy is to keep the transaction set up-to-date with the state of local mempool. * Client software **SHOULD** stop the updating process when either a call to `engine_getPayload` with the build process's `payloadId` is made or [`SECONDS_PER_SLOT`](https://github.com/ethereum/consensus-specs/blob/dev/specs/phase0/beacon-chain.md#time-parameters-1) (currently set to 12 in the Mainnet configuration) seconds have passed since the point in time identified by the `timestamp` parameter. -4. If any of the above fails due to errors unrelated to the client software's normal `SYNCING` status, the client software **MUST** return an error. +5. If any of the above fails due to errors unrelated to the client software's normal `SYNCING` status, the client software **MUST** return an error. ### engine_getPayloadV1 From 7826e559ea47acb7654c6355444a1b95f507e746 Mon Sep 17 00:00:00 2001 From: Danny Ryan Date: Mon, 1 Nov 2021 10:46:25 -0600 Subject: [PATCH 3/3] Update src/engine/specification.md Co-authored-by: Diederik Loerakker --- src/engine/specification.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/engine/specification.md b/src/engine/specification.md index e5a5aac5f..282836a51 100644 --- a/src/engine/specification.md +++ b/src/engine/specification.md @@ -143,8 +143,8 @@ This structure contains the attributes required to initiate a payload build proc * params: 1. `headBlockHash`: `DATA`, 32 Bytes - block hash of the head of the canonical chain 2. `safeBlockHash`: `DATA`, 32 Bytes - the "safe" block hash of the canonical chain under certain synchrony and honesty assumptions. This value **MUST** be either equal to or an ancestor of `headBlockHash` - 2. `finalizedBlockHash`: `DATA`, 32 Bytes - block hash of the most recent finalized block - 3. `payloadAttributesV1`: `Object|null` - instance of [`PayloadAttributesV1`](#PayloadAttributesV1) or `null` + 3. `finalizedBlockHash`: `DATA`, 32 Bytes - block hash of the most recent finalized block + 4. `payloadAttributes`: `Object|null` - instance of [`PayloadAttributesV1`](#PayloadAttributesV1) or `null` #### Response