3.5 KiB
EIP-4788 -- Honest Validator
Notice: This document is a work-in-progress for researchers and implementers.
Table of contents
Introduction
This document represents the changes to be made in the code of an "honest validator" to implement the EIP-4788 feature.
Prerequisites
This document is an extension of the Capella -- Honest Validator guide. All behaviors and definitions defined in this document, and documents it extends, carry over unless explicitly noted or overridden.
All terminology, constants, functions, and protocol mechanics defined in the updated Beacon Chain doc of Capella are requisite for this document and used throughout. Please see related Beacon Chain doc before continuing and use them as a reference throughout.
Helpers
Protocols
ExecutionEngine
Modified get_payload
get_payload
returns the upgraded EIP-4788 ExecutionPayload
type.
Beacon chain responsibilities
All validator responsibilities remain unchanged other than those noted below.
Block proposal
Constructing the BeaconBlockBody
ExecutionPayload
ExecutionPayload
s are constructed as they were in Capella, except that the parent beacon block root is also supplied.
Note: In this section, state
is the state of the slot for the block proposal without the block yet applied.
That is, state
is the previous_state
processed through any empty slots up to the assigned slot using process_slots(previous_state, slot)
.
Note: The only change made to prepare_execution_payload
is to add the parent beacon block root as an additional
parameter to the PayloadAttributes
.
def prepare_execution_payload(state: BeaconState,
safe_block_hash: Hash32,
finalized_block_hash: Hash32,
suggested_fee_recipient: ExecutionAddress,
execution_engine: ExecutionEngine) -> Optional[PayloadId]:
# Verify consistency of the parent hash with respect to the previous execution payload header
parent_hash = state.latest_execution_payload_header.block_hash
# Set the forkchoice head and initiate the payload build process
payload_attributes = PayloadAttributes(
timestamp=compute_timestamp_at_slot(state, state.slot),
prev_randao=get_randao_mix(state, get_current_epoch(state)),
suggested_fee_recipient=suggested_fee_recipient,
withdrawals=get_expected_withdrawals(state),
parent_beacon_block_root=hash_tree_root(state.latest_block_header), # [New in EIP-4788]
)
return execution_engine.notify_forkchoice_updated(
head_block_hash=parent_hash,
safe_block_hash=safe_block_hash,
finalized_block_hash=finalized_block_hash,
payload_attributes=payload_attributes,
)