From 7ef938da772886c31cb655e4b4fbd989188a2afb Mon Sep 17 00:00:00 2001 From: Mikhail Kalinin Date: Thu, 23 Sep 2021 13:37:52 +0600 Subject: [PATCH] Add notify_ prefix to EE functions sending notifications --- setup.py | 4 ++-- specs/merge/beacon-chain.md | 12 ++++++------ specs/merge/fork-choice.md | 8 ++++---- 3 files changed, 12 insertions(+), 12 deletions(-) diff --git a/setup.py b/setup.py index 6d75caeb1..39eccad53 100644 --- a/setup.py +++ b/setup.py @@ -525,10 +525,10 @@ class NoopExecutionEngine(ExecutionEngine): def execute_payload(self: ExecutionEngine, execution_payload: ExecutionPayload) -> bool: return True - def consensus_validated(self: ExecutionEngine, block_hash: Hash32, valid: bool) -> None: + def notify_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: + def notify_forkchoice_updated(self: ExecutionEngine, head_block_hash: Hash32, finalized_block_hash: Hash32) -> None: pass def prepare_payload(self: ExecutionEngine, diff --git a/specs/merge/beacon-chain.md b/specs/merge/beacon-chain.md index 4a1c9c42f..9be89fcea 100644 --- a/specs/merge/beacon-chain.md +++ b/specs/merge/beacon-chain.md @@ -32,7 +32,7 @@ - [Beacon chain state transition function](#beacon-chain-state-transition-function) - [Execution engine](#execution-engine) - [`execute_payload`](#execute_payload) - - [`consensus_validated`](#consensus_validated) + - [`notify_consensus_validated`](#notify_consensus_validated) - [Block processing](#block-processing) - [Execution payload processing](#execution-payload-processing) - [`is_valid_gas_limit`](#is_valid_gas_limit) @@ -242,10 +242,10 @@ The implementation-dependent `ExecutionEngine` protocol encapsulates the executi * a state object `self.execution_state` of type `ExecutionState` * a state transition function `self.execute_payload` which applies changes to the `self.execution_state` -* a function `self.consensus_validated` which signals that the beacon block containing the execution payload +* a function `self.notify_consensus_validated` which signals that the beacon block containing the execution payload is valid with respect to the consensus rule set -*Note*: `execute_payload` and `consensus_validated` are functions accessed through the `EXECUTION_ENGINE` module which instantiates the `ExecutionEngine` protocol. +*Note*: `execute_payload` and `notify_consensus_validated` are functions accessed through the `EXECUTION_ENGINE` module which instantiates the `ExecutionEngine` protocol. The body of each of these functions is implementation dependent. The Engine API may be used to implement them with an external execution engine. @@ -260,14 +260,14 @@ def execute_payload(self: ExecutionEngine, execution_payload: ExecutionPayload) ... ``` -#### `consensus_validated` +#### `notify_consensus_validated` ```python -def consensus_validated(self: ExecutionEngine, block_hash: Hash32, valid: bool) -> None: +def notify_consensus_validated(self: ExecutionEngine, block_hash: Hash32, valid: bool) -> None: ... ``` -The inputs to this function depend on the result of the state transition. A call to `consensus_validated` must be made after 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: +The inputs to this function depend on the result of the state transition. A call to `notify_consensus_validated` must be made after 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 succeeds * `False` if `state_transition` function call fails diff --git a/specs/merge/fork-choice.md b/specs/merge/fork-choice.md index 5adeded16..7b8643e99 100644 --- a/specs/merge/fork-choice.md +++ b/specs/merge/fork-choice.md @@ -10,7 +10,7 @@ - [Introduction](#introduction) - [Protocols](#protocols) - [`ExecutionEngine`](#executionengine) - - [`forkchoice_updated`](#forkchoice_updated) + - [`notify_forkchoice_updated`](#notify_forkchoice_updated) - [Helpers](#helpers) - [`PowBlock`](#powblock) - [`get_pow_block`](#get_pow_block) @@ -31,12 +31,12 @@ This is the modification of the fork choice according to the executable beacon c ### `ExecutionEngine` -*Note*: The `forkchoice_updated` function is added to the `ExecutionEngine` protocol to signal the fork choice updates. +*Note*: The `notify_forkchoice_updated` function is added to the `ExecutionEngine` protocol to signal the fork choice updates. The body of this function is implementation dependent. The Engine API may be used to implement it with an external execution engine. -#### `forkchoice_updated` +#### `notify_forkchoice_updated` This function performs two actions *atomically*: * Re-organizes the execution payload chain and corresponding state to make `head_block_hash` the head. @@ -44,7 +44,7 @@ This function performs two actions *atomically*: and corresponding state, up to and including `finalized_block_hash`. ```python -def forkchoice_updated(self: ExecutionEngine, head_block_hash: Hash32, finalized_block_hash: Hash32) -> None: +def notify_forkchoice_updated(self: ExecutionEngine, head_block_hash: Hash32, finalized_block_hash: Hash32) -> None: ... ```