Skip to content

Commit

Permalink
Merge pull request #2965 from mkalinin/optimistic-sync-tests
Browse files Browse the repository at this point in the history
Extend fork_choice test format with on_payload_info
  • Loading branch information
hwwhww authored Sep 12, 2022
2 parents d8e7409 + e639a3b commit 97c61fe
Showing 1 changed file with 25 additions and 1 deletion.
26 changes: 25 additions & 1 deletion tests/formats/fork_choice/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ The file is located in the same folder (see below).

After this step, the `store` object may have been updated.

#### `on_merge_block` execution
#### `on_merge_block` execution step

Adds `PowBlock` data which is required for executing `on_block(store, block)`.
```yaml
Expand Down Expand Up @@ -97,6 +97,30 @@ The file is located in the same folder (see below).

After this step, the `store` object may have been updated.

#### `on_payload_info` execution step

Optional step for optimistic sync tests.

```yaml
{
block_hash: string, -- Encoded 32-byte value of payload's block hash.
payload_status: {
status: string, -- Enum, "VALID" | "INVALID" | "SYNCING" | "ACCEPTED" | "INVALID_BLOCK_HASH".
latest_valid_hash: string, -- Encoded 32-byte value of the latest valid block hash, may be `null`.
validation_error: string, -- Message providing additional details on the validation error, may be `null`.
}
}
```

This step sets the [`payloadStatus`](https://github.com/ethereum/execution-apis/blob/main/src/engine/specification.md#PayloadStatusV1)
value that Execution Layer client mock returns in responses to the following Engine API calls:
* [`engine_newPayloadV1(payload)`](https://github.com/ethereum/execution-apis/blob/main/src/engine/specification.md#engine_newpayloadv1) if `payload.blockHash == payload_info.block_hash`
* [`engine_forkchoiceUpdatedV1(forkchoiceState, ...)`](https://github.com/ethereum/execution-apis/blob/main/src/engine/specification.md#engine_forkchoiceupdatedv1) if `forkchoiceState.headBlockHash == payload_info.block_hash`

*Note:* Status of a payload must be *initialized* via `on_payload_info` before the corresponding `on_block` execution step.

*Note:* Status of the same payload may be updated for several times throughout the test.

#### Checks step

The checks to verify the current status of `store`.
Expand Down

0 comments on commit 97c61fe

Please sign in to comment.