Documentation ¶
Index ¶
- Variables
- func GetBlockPayloadHash(blk interfaces.ReadOnlyBeaconBlock) ([32]byte, error)
- func IsExecutionBlock(body interfaces.ReadOnlyBeaconBlockBody) (bool, error)
- func IsExecutionEnabled(st state.BeaconState, body interfaces.ReadOnlyBeaconBlockBody) (bool, error)
- func IsExecutionEnabledUsingHeader(header interfaces.ExecutionData, body interfaces.ReadOnlyBeaconBlockBody) (bool, error)
- func IsMergeTransitionComplete(st state.BeaconState) (bool, error)
- func IsPreBellatrixVersion(v int) bool
- func ProcessPayload(st state.BeaconState, payload interfaces.ExecutionData) (state.BeaconState, error)
- func ProcessPayloadHeader(st state.BeaconState, header interfaces.ExecutionData) (state.BeaconState, error)
- func ValidatePayload(st state.BeaconState, payload interfaces.ExecutionData) error
- func ValidatePayloadHeader(st state.BeaconState, header interfaces.ExecutionData) error
- func ValidatePayloadHeaderWhenMergeCompletes(st state.BeaconState, header interfaces.ExecutionData) error
- func ValidatePayloadWhenMergeCompletes(st state.BeaconState, payload interfaces.ExecutionData) error
Constants ¶
This section is empty.
Variables ¶
Functions ¶
func GetBlockPayloadHash ¶
func GetBlockPayloadHash(blk interfaces.ReadOnlyBeaconBlock) ([32]byte, error)
GetBlockPayloadHash returns the hash of the execution payload of the block
func IsExecutionBlock ¶
func IsExecutionBlock(body interfaces.ReadOnlyBeaconBlockBody) (bool, error)
IsExecutionBlock returns whether the block has a non-empty ExecutionPayload.
Spec code: def is_execution_block(block: ReadOnlyBeaconBlock) -> bool:
return block.body.execution_payload != ExecutionPayload()
func IsExecutionEnabled ¶
func IsExecutionEnabled(st state.BeaconState, body interfaces.ReadOnlyBeaconBlockBody) (bool, error)
IsExecutionEnabled returns true if the beacon chain can begin executing. Meaning the payload header is beacon state is non-empty or the payload in block body is non-empty.
Spec code: def is_execution_enabled(state: BeaconState, body: ReadOnlyBeaconBlockBody) -> bool:
return is_merge_block(state, body) or is_merge_complete(state)
func IsExecutionEnabledUsingHeader ¶
func IsExecutionEnabledUsingHeader(header interfaces.ExecutionData, body interfaces.ReadOnlyBeaconBlockBody) (bool, error)
IsExecutionEnabledUsingHeader returns true if the execution is enabled using post processed payload header and block body. This is an optimized version of IsExecutionEnabled where beacon state is not required as an argument.
func IsMergeTransitionComplete ¶
func IsMergeTransitionComplete(st state.BeaconState) (bool, error)
IsMergeTransitionComplete returns true if the transition to Bellatrix has completed. Meaning the payload header in beacon state is not `ExecutionPayloadHeader()` (i.e. not empty).
Spec code: def is_merge_transition_complete(state: BeaconState) -> bool:
return state.latest_execution_payload_header != ExecutionPayloadHeader()
func IsPreBellatrixVersion ¶
IsPreBellatrixVersion returns true if input version is before bellatrix fork.
func ProcessPayload ¶
func ProcessPayload(st state.BeaconState, payload interfaces.ExecutionData) (state.BeaconState, error)
ProcessPayload processes input execution payload using beacon state. ValidatePayloadWhenMergeCompletes validates if payload is valid versus input beacon state. These validation steps ONLY apply to post merge.
Spec code: def process_execution_payload(state: BeaconState, payload: ExecutionPayload, execution_engine: ExecutionEngine) -> None:
# Verify consistency of the parent hash with respect to the previous execution payload header if is_merge_complete(state): assert payload.parent_hash == state.latest_execution_payload_header.block_hash # Verify random assert payload.random == get_randao_mix(state, get_current_epoch(state)) # Verify timestamp assert payload.timestamp == compute_timestamp_at_slot(state, state.slot) # Verify the execution payload is valid assert execution_engine.execute_payload(payload) # Cache execution payload header state.latest_execution_payload_header = ExecutionPayloadHeader( parent_hash=payload.parent_hash, FeeRecipient=payload.FeeRecipient, state_root=payload.state_root, receipt_root=payload.receipt_root, logs_bloom=payload.logs_bloom, random=payload.random, block_number=payload.block_number, gas_limit=payload.gas_limit, gas_used=payload.gas_used, timestamp=payload.timestamp, extra_data=payload.extra_data, base_fee_per_gas=payload.base_fee_per_gas, block_hash=payload.block_hash, transactions_root=hash_tree_root(payload.transactions), )
func ProcessPayloadHeader ¶
func ProcessPayloadHeader(st state.BeaconState, header interfaces.ExecutionData) (state.BeaconState, error)
ProcessPayloadHeader processes the payload header.
func ValidatePayload ¶
func ValidatePayload(st state.BeaconState, payload interfaces.ExecutionData) error
ValidatePayload validates if payload is valid versus input beacon state. These validation steps apply to both pre merge and post merge.
Spec code:
# Verify random assert payload.random == get_randao_mix(state, get_current_epoch(state)) # Verify timestamp assert payload.timestamp == compute_timestamp_at_slot(state, state.slot)
func ValidatePayloadHeader ¶
func ValidatePayloadHeader(st state.BeaconState, header interfaces.ExecutionData) error
ValidatePayloadHeader validates the payload header.
func ValidatePayloadHeaderWhenMergeCompletes ¶
func ValidatePayloadHeaderWhenMergeCompletes(st state.BeaconState, header interfaces.ExecutionData) error
ValidatePayloadHeaderWhenMergeCompletes validates the payload header when the merge completes.
func ValidatePayloadWhenMergeCompletes ¶
func ValidatePayloadWhenMergeCompletes(st state.BeaconState, payload interfaces.ExecutionData) error
ValidatePayloadWhenMergeCompletes validates if payload is valid versus input beacon state. These validation steps ONLY apply to post merge.
Spec code:
# Verify consistency of the parent hash with respect to the previous execution payload header if is_merge_complete(state): assert payload.parent_hash == state.latest_execution_payload_header.block_hash
Types ¶
This section is empty.