Move optimsitic_roots definition

This commit is contained in:
Paul Hauner 2021-12-20 10:41:50 +11:00
parent da6cad8767
commit 9901cb38f7
No known key found for this signature in database
GPG Key ID: 5E2CFF9B75FA63DF

View File

@ -22,6 +22,10 @@ Let `head_block: BeaconBlock` be the result of calling of the fork choice
algorithm at the time of block production. Let `justified_block: BeaconBlock` algorithm at the time of block production. Let `justified_block: BeaconBlock`
be the latest current justified ancestor ancestor of the `head_block`. be the latest current justified ancestor ancestor of the `head_block`.
Let `optimistic_roots: Set[Root]` be the set of `hash_tree_root(block)` for all
optimistically imported blocks which have yet to receive an `INVALID` or
`VALID` designation from an execution engine.
```python ```python
def is_optimistic(block: BeaconBlock) -> bool: def is_optimistic(block: BeaconBlock) -> bool:
hash_tree_root(block) in optimistic_roots hash_tree_root(block) in optimistic_roots
@ -74,15 +78,11 @@ To optimistically import a block:
- The `execute_payload` function MUST return `True` if the execution - The `execute_payload` function MUST return `True` if the execution
engine returns `SYNCING` or `VALID`. An `INVALID` response MUST return `False`. engine returns `SYNCING` or `VALID`. An `INVALID` response MUST return `False`.
In addition to this change to validation, the consensus engine MUST be able In addition to this change to validation, the consensus engine MUST be able to
to ascertain, after import, which blocks returned `SYNCING` and which returned ascertain, after import, which blocks returned `SYNCING` (`optimistic_roots`)
`VALID`. This document will assume that consensus engines store the following and which returned `VALID`.
set:
- `optimistic_roots: Set[Root]`: `hash_tree_root(block)` where Notably, optimistically imported blocks MUST have passed all verifications
`block.body.execution_payload` is known to be `SYNCING`.
Notably, blocks included in `optimistic_roots` have passed all verifications
included in `process_block` (noting the modifications to the included in `process_block` (noting the modifications to the
`execute_payload`). I.e., the blocks are fully verified but awaiting execution `execute_payload`). I.e., the blocks are fully verified but awaiting execution
of the `ExecutionPayload`. of the `ExecutionPayload`.