diff --git a/specs/merge/beacon-chain.md b/specs/merge/beacon-chain.md index c343c2ec9..b8362771e 100644 --- a/specs/merge/beacon-chain.md +++ b/specs/merge/beacon-chain.md @@ -69,7 +69,7 @@ order and append any additional fields to the end. ```python class BeaconBlockBody(phase0.BeaconBlockBody): - application_payload: ApplicationPayload # [Added in Merge] application payload + application_payload: ApplicationPayload # [New in Merge] application payload ``` #### `BeaconState` @@ -79,8 +79,8 @@ class BeaconBlockBody(phase0.BeaconBlockBody): ```python class BeaconState(phase0.BeaconState): # Application-layer - application_state_root: Bytes32 # [New in Merge] - application_block_hash: Bytes32 # [New in Merge] + application_state_root: Bytes32 # [New in Merge] + application_block_hash: Bytes32 # [New in Merge] ``` ### New containers @@ -96,7 +96,7 @@ class Transaction(Container): gas_limit: uint64 recipient: Bytes20 value: uint256 - input: List[Bytes1, MAX_BYTES_PER_TRANSACTION_PAYLOAD] + data: List[byte, MAX_BYTES_PER_TRANSACTION_PAYLOAD] v: uint256 r: uint256 s: uint256 @@ -115,7 +115,6 @@ class ApplicationPayload(Container): gas_used: uint64 receipt_root: Bytes32 logs_bloom: Vector[Bytes1, BYTES_PER_LOGS_BLOOM] - difficulty: uint64 # Temporary field, will be removed later on transactions: List[Transaction, MAX_APPLICATION_TRANSACTIONS] ``` @@ -178,11 +177,9 @@ def process_application_payload(state: BeaconState, body: BeaconBlockBody) -> No state.application_state_root = body.application_payload.state_root state.application_block_hash = body.application_payload.block_hash - elif is_transition_block(state, body): assert body.application_payload == ApplicationPayload(block_hash=body.application_payload.block_hash) state.application_block_hash = body.application_payload.block_hash - else: assert body.application_payload == ApplicationPayload() ``` diff --git a/specs/merge/fork-choice.md b/specs/merge/fork-choice.md index c022de4ab..d299a8247 100644 --- a/specs/merge/fork-choice.md +++ b/specs/merge/fork-choice.md @@ -49,7 +49,7 @@ Used by fork-choice handler, `on_block`. ```python def is_valid_transition_block(block: PowBlock) -> boolean: is_total_difficulty_reached = block.total_difficulty >= TRANSITION_TOTAL_DIFFICULTY - return block.is_processed and block.is_valid and is_total_difficulty_reached + return block.is_valid and is_total_difficulty_reached ``` ### Updated fork-choice handlers @@ -74,9 +74,11 @@ def on_block(store: Store, signed_block: SignedBeaconBlock) -> None: # Check block is a descendant of the finalized block at the checkpoint finalized slot assert get_ancestor(store, block.parent_root, finalized_slot) == store.finalized_checkpoint.root - # [New in Merge] Consider delaying the beacon block processing until PoW block is accepted by the application node + # [New in Merge] if is_transition_block(pre_state, block.body): pow_block = get_pow_block(block.body.application_payload.block_hash) + # Delay consideration of block until PoW block is processed by the PoW node + assert pow_block.is_processed assert is_valid_transition_block(pow_block) # Check the block is valid and compute the post-state diff --git a/specs/merge/validator.md b/specs/merge/validator.md index 110a2a883..49f7f6137 100644 --- a/specs/merge/validator.md +++ b/specs/merge/validator.md @@ -56,13 +56,13 @@ The body of this function is implementation dependent. ```python def get_application_payload(state: BeaconState) -> ApplicationPayload: if not is_transition_completed(state): - pow_block = get_pow_chain_head() - if pow_block.total_difficulty < TRANSITION_TOTAL_DIFFICULTY: - # Pre-merge, empty payload - return ApplicationPayload() - else: - # Signify merge via last PoW block_hash and an otherwise empty payload - return ApplicationPayload(block_hash=pow_block.block_hash) + pow_block = get_pow_chain_head() + if pow_block.total_difficulty < TRANSITION_TOTAL_DIFFICULTY: + # Pre-merge, empty payload + return ApplicationPayload() + else: + # Signify merge via last PoW block_hash and an otherwise empty payload + return ApplicationPayload(block_hash=pow_block.block_hash) # Post-merge, normal payload application_parent_hash = state.application_block_hash