Update consensus_validated description

This commit is contained in:
Mikhail Kalinin 2021-09-22 23:52:15 +06:00
parent 06107ce7d8
commit 24bacafeee
2 changed files with 8 additions and 6 deletions

View File

@ -522,10 +522,10 @@ def get_pow_chain_head() -> PowBlock:
class NoopExecutionEngine(ExecutionEngine):
def execute_payload(self, execution_payload: ExecutionPayload) -> bool:
def execute_payload(self: ExecutionEngine, execution_payload: ExecutionPayload) -> bool:
return True
def consensus_validated(self: ExecutionEngine, execution_payload: ExecutionPayload) -> None:
def consensus_validated(self: ExecutionEngine, block_hash: Hash32, valid: bool) -> None:
pass
def forkchoice_updated(self: ExecutionEngine, head_block_hash: Hash32, finalized_block_hash: Hash32) -> None:

View File

@ -263,10 +263,15 @@ def execute_payload(self: ExecutionEngine, execution_payload: ExecutionPayload)
#### `consensus_validated`
```python
def consensus_validated(self: ExecutionEngine, execution_payload: ExecutionPayload) -> None:
def consensus_validated(self: ExecutionEngine, block_hash: Hash32, valid: bool) -> None:
...
```
The call of this function depends on the result of the state transition and must be done when call to the [`state_transition`](../phase0/beacon-chain.md#beacon-chain-state-transition-function) function finishes. The value of the `valid` parameter must be set as follows:
* `True` if `state_transition` function call succeedes
* `False` if `state_transition` function call fails
### Block processing
*Note*: The call to the `process_execution_payload` must happen before the call to the `process_randao` as the former depends on the `randao_mix` computed with the reveal of the previous block.
@ -280,9 +285,6 @@ def process_block(state: BeaconState, block: BeaconBlock) -> None:
process_eth1_data(state, block.body)
process_operations(state, block.body)
process_sync_aggregate(state, block.body.sync_aggregate)
if is_execution_enabled(state, block.body):
# Notify the block is valid with respect to the consensus state transition function
EXECUTION_ENGINE.consensus_validated(block.body.execution_payload) # [New in Merge]
```
### Execution payload processing