Bellatrix: add get_safe_block_hash to validator.md

This commit is contained in:
Mikhail Kalinin 2022-03-22 22:51:45 +06:00
parent d195e066ad
commit 95a2327800
2 changed files with 6 additions and 3 deletions

View File

@ -110,10 +110,11 @@ All validator responsibilities remain unchanged other than those noted below. Na
To obtain an execution payload, a block proposer building a block on top of a `state` must take the following actions:
1. Set `payload_id = prepare_execution_payload(state, pow_chain, finalized_block_hash, suggested_fee_recipient, execution_engine)`, where:
1. Set `payload_id = prepare_execution_payload(state, pow_chain, finalized_block_hash, safe_block_hash, suggested_fee_recipient, execution_engine)`, where:
* `state` is the state object after applying `process_slots(state, slot)` transition to the resulting state of the parent block processing
* `pow_chain` is a `Dict[Hash32, PowBlock]` dictionary that abstractly represents all blocks in the PoW chain with block hash as the dictionary key
* `finalized_block_hash` is the hash of the latest finalized execution payload (`Hash32()` if none yet finalized)
* `safe_block_hash` is the return value of the `get_safe_block_hash(store: Store)` function call
* `suggested_fee_recipient` is the value suggested to be used for the `fee_recipient` field of the execution payload
@ -121,6 +122,7 @@ To obtain an execution payload, a block proposer building a block on top of a `s
def prepare_execution_payload(state: BeaconState,
pow_chain: Dict[Hash32, PowBlock],
finalized_block_hash: Hash32,
safe_block_hash: Hash32,
suggested_fee_recipient: ExecutionAddress,
execution_engine: ExecutionEngine) -> Optional[PayloadId]:
if not is_merge_transition_complete(state):
@ -149,8 +151,7 @@ def prepare_execution_payload(state: BeaconState,
# Set safe and head block hashes to the same value
return execution_engine.notify_forkchoice_updated(
head_block_hash=parent_hash,
# TODO: Use `parent_hash` as a stub for now.
safe_block_hash=parent_hash,
safe_block_hash=safe_block_hash,
finalized_block_hash=finalized_block_hash,
payload_attributes=payload_attributes,
)

View File

@ -143,6 +143,7 @@ def test_prepare_execution_payload(spec, state):
# Dummy arguments
finalized_block_hash = b'\x56' * 32
safe_block_hash = b'\x58' * 32
suggested_fee_recipient = b'\x78' * 20
# Mock execution_engine
@ -158,6 +159,7 @@ def test_prepare_execution_payload(spec, state):
state=state,
pow_chain=pow_chain.to_dict(),
finalized_block_hash=finalized_block_hash,
safe_block_hash=safe_block_hash,
suggested_fee_recipient=suggested_fee_recipient,
execution_engine=TestEngine(),
)