pr feedback

This commit is contained in:
Danny Ryan 2021-10-19 09:24:07 -06:00
parent ba582b3e3a
commit 294b60a48b
No known key found for this signature in database
GPG Key ID: 2765A792E42CE07A
2 changed files with 6 additions and 3 deletions

View File

@ -110,9 +110,11 @@ def on_block(store: Store, signed_block: SignedBeaconBlock) -> None:
# [New in Merge]
if is_merge_block(pre_state, block.body):
# Check the parent PoW block of execution payload is a valid terminal PoW block.
pow_block = get_pow_block(block.body.execution_payload.parent_hash)
pow_parent = get_pow_block(pow_block.parent_hash)
assert is_valid_terminal_pow_block(pow_block, pow_parent)
# If `TERMINAL_BLOCK_HASH` is used as an override, the activation epoch must be reached.
if TERMINAL_BLOCK_HASH != Hash32():
assert compute_epoch_at_slot(block.slot) >= TERMINAL_BLOCK_HASH_ACTIVATION_EPOCH

View File

@ -127,9 +127,10 @@ def prepare_execution_payload(state: BeaconState,
fee_recipient: ExecutionAddress,
execution_engine: ExecutionEngine) -> Optional[PayloadId]:
if not is_merge_complete(state):
is_tbh_override_set = TERMINAL_BLOCK_HASH != Hash32()
if is_tbh_override_set and get_current_epoch(state.slot) < TERMINAL_BLOCK_HASH_ACTIVATION_EPOCH:
# TBH is set but activation epoch is not yet reached, no prepare payload call is needed
is_terminal_block_hash_set = TERMINAL_BLOCK_HASH != Hash32()
is_activation_epoch_reached = get_current_epoch(state.slot) < TERMINAL_BLOCK_HASH_ACTIVATION_EPOCH
if is_terminal_block_hash_set and is_activation_epoch_reached:
# Terminal block hash is set but activation epoch is not yet reached, no prepare payload call is needed
return None
terminal_pow_block = get_terminal_pow_block(pow_chain)