5050 - [ Modified ` process_operations ` ] ( #modified-process_operations )
5151 - [ Payload Attestations] ( #payload-attestations )
5252 - [ ` process_payload_attestation ` ] ( #process_payload_attestation )
53- - [ Modified ` process_execution_payload ` ] ( #modified-process_execution_payload )
54- - [ New ` verify_execution_payload_envelope_signature ` ] ( #new-verify_execution_payload_envelope_signature )
5553 - [ Modified ` is_merge_transition_complete ` ] ( #modified-is_merge_transition_complete )
5654 - [ Modified ` validate_merge_block ` ] ( #modified-validate_merge_block )
55+ - [ Execution payload processing] ( #execution-payload-processing )
56+ - [ New ` verify_execution_payload_envelope_signature ` ] ( #new-verify_execution_payload_envelope_signature )
57+ - [ New ` process_execution_payload ` ] ( #new-process_execution_payload )
5758
5859<!-- END doctoc generated TOC please keep comment here to allow auto update -->
5960<!-- /TOC -->
@@ -427,7 +428,8 @@ The post-state corresponding to a pre-state `state` and a signed execution paylo
427428def process_block (state : BeaconState, block : BeaconBlock) -> None :
428429 process_block_header(state, block)
429430 process_withdrawals(state) # [Modified in EIP-7732]
430- process_execution_payload_header(state, block) # [Modified in EIP-7732, removed process_execution_payload]
431+ # Removed `process_execution_payload` in EIP-7732
432+ process_execution_payload_header(state, block) # [New in EIP-7732]
431433 process_randao(state, block.body)
432434 process_eth1_data(state, block.body)
433435 process_operations(state, block.body) # [Modified in EIP-7732]
@@ -592,7 +594,49 @@ def process_payload_attestation(state: BeaconState, payload_attestation: Payload
592594 increase_balance(state, proposer_index, proposer_reward)
593595```
594596
595- #### Modified ` process_execution_payload `
597+ #### Modified ` is_merge_transition_complete `
598+
599+ ` is_merge_transition_complete ` is modified only for testing purposes to add the blob kzg commitments root for an empty list
600+
601+ ``` python
602+ def is_merge_transition_complete (state : BeaconState) -> bool :
603+ header = ExecutionPayloadHeader()
604+ kzgs = List[KZGCommitment, MAX_BLOB_COMMITMENTS_PER_BLOCK ]()
605+ header.blob_kzg_commitments_root = kzgs.hash_tree_root()
606+
607+ return state.latest_execution_payload_header != header
608+ ```
609+
610+ #### Modified ` validate_merge_block `
611+ ` validate_merge_block ` is modified to use the new ` signed_execution_payload_header ` message in the Beacon Block Body
612+
613+ ``` python
614+ def validate_merge_block (block : BeaconBlock) -> None :
615+ """
616+ Check the parent PoW block of execution payload is a valid terminal PoW block.
617+
618+ Note: Unavailable PoW block(s) may later become available,
619+ and a client software MAY delay a call to ``validate_merge_block``
620+ until the PoW block(s) become available.
621+ """
622+ if TERMINAL_BLOCK_HASH != Hash32():
623+ # If `TERMINAL_BLOCK_HASH` is used as an override, the activation epoch must be reached.
624+ assert compute_epoch_at_slot(block.slot) >= TERMINAL_BLOCK_HASH_ACTIVATION_EPOCH
625+ assert block.body.signed_execution_payload_header.message.parent_block_hash == TERMINAL_BLOCK_HASH
626+ return
627+
628+ # Modified in EIP-7732
629+ pow_block = get_pow_block(block.body.signed_execution_payload_header.message.parent_block_hash)
630+ # Check if `pow_block` is available
631+ assert pow_block is not None
632+ pow_parent = get_pow_block(pow_block.parent_hash)
633+ # Check if `pow_parent` is available
634+ assert pow_parent is not None
635+ # Check if `pow_block` is a valid terminal PoW block
636+ assert is_valid_terminal_pow_block(pow_block, pow_parent)
637+ ```
638+
639+ ### Execution payload processing
596640
597641##### New ` verify_execution_payload_envelope_signature `
598642
@@ -604,6 +648,8 @@ def verify_execution_payload_envelope_signature(
604648 return bls.Verify(builder.pubkey, signing_root, signed_envelope.signature)
605649```
606650
651+ #### New ` process_execution_payload `
652+
607653* Note* : ` process_execution_payload ` is now an independent check in state transition. It is called when importing a signed execution payload proposed by the builder of the current slot.
608654
609655``` python
@@ -672,45 +718,3 @@ def process_execution_payload(state: BeaconState,
672718 if verify:
673719 assert envelope.state_root == hash_tree_root(state)
674720```
675-
676- #### Modified ` is_merge_transition_complete `
677-
678- ` is_merge_transition_complete ` is modified only for testing purposes to add the blob kzg commitments root for an empty list
679-
680- ``` python
681- def is_merge_transition_complete (state : BeaconState) -> bool :
682- header = ExecutionPayloadHeader()
683- kzgs = List[KZGCommitment, MAX_BLOB_COMMITMENTS_PER_BLOCK ]()
684- header.blob_kzg_commitments_root = kzgs.hash_tree_root()
685-
686- return state.latest_execution_payload_header != header
687- ```
688-
689- #### Modified ` validate_merge_block `
690- ` validate_merge_block ` is modified to use the new ` signed_execution_payload_header ` message in the Beacon Block Body
691-
692- ``` python
693- def validate_merge_block (block : BeaconBlock) -> None :
694- """
695- Check the parent PoW block of execution payload is a valid terminal PoW block.
696-
697- Note: Unavailable PoW block(s) may later become available,
698- and a client software MAY delay a call to ``validate_merge_block``
699- until the PoW block(s) become available.
700- """
701- if TERMINAL_BLOCK_HASH != Hash32():
702- # If `TERMINAL_BLOCK_HASH` is used as an override, the activation epoch must be reached.
703- assert compute_epoch_at_slot(block.slot) >= TERMINAL_BLOCK_HASH_ACTIVATION_EPOCH
704- assert block.body.signed_execution_payload_header.message.parent_block_hash == TERMINAL_BLOCK_HASH
705- return
706-
707- # Modified in EIP-7732
708- pow_block = get_pow_block(block.body.signed_execution_payload_header.message.parent_block_hash)
709- # Check if `pow_block` is available
710- assert pow_block is not None
711- pow_parent = get_pow_block(pow_block.parent_hash)
712- # Check if `pow_parent` is available
713- assert pow_parent is not None
714- # Check if `pow_block` is a valid terminal PoW block
715- assert is_valid_terminal_pow_block(pow_block, pow_parent)
716- ```
0 commit comments