From 294b60a48befc76177ca72caadbe3a77f27ca8eb Mon Sep 17 00:00:00 2001 From: Danny Ryan Date: Tue, 19 Oct 2021 09:24:07 -0600 Subject: [PATCH] pr feedback --- specs/merge/fork-choice.md | 2 ++ specs/merge/validator.md | 7 ++++--- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/specs/merge/fork-choice.md b/specs/merge/fork-choice.md index d5fa08ee2..83bba3adf 100644 --- a/specs/merge/fork-choice.md +++ b/specs/merge/fork-choice.md @@ -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 diff --git a/specs/merge/validator.md b/specs/merge/validator.md index e0066ddce..88bf96643 100644 --- a/specs/merge/validator.md +++ b/specs/merge/validator.md @@ -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)