Skip to content
Merged
Show file tree
Hide file tree
Changes from 5 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion pysetup/spec_builders/electra.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,8 @@ class NoopExecutionEngine(ExecutionEngine):
def notify_new_payload(self: ExecutionEngine,
execution_payload: ExecutionPayload,
parent_beacon_block_root: Root,
execution_requests_list: Sequence[bytes]) -> bool:
execution_requests_list: Sequence[bytes],
target_blobs_per_block: uint64) -> bool:
return True

def notify_forkchoice_updated(self: ExecutionEngine,
Expand Down
16 changes: 10 additions & 6 deletions specs/electra/beacon-chain.md
Original file line number Diff line number Diff line change
Expand Up @@ -986,24 +986,26 @@ class NewPayloadRequest(object):

##### Modified `notify_new_payload`

*Note*: The function `notify_new_payload` is modified to include the additional `execution_requests` parameter in Electra.
*Note*: The function `notify_new_payload` is modified to include the additional
`execution_requests_list` and `target_blobs_per_block` parameters in Electra.

```python
def notify_new_payload(self: ExecutionEngine,
execution_payload: ExecutionPayload,
parent_beacon_block_root: Root,
execution_requests_list: Sequence[bytes]) -> bool:
execution_requests_list: Sequence[bytes],
target_blobs_per_block: uint64) -> bool:
"""
Return ``True`` if and only if ``execution_payload`` and ``execution_requests``
Return ``True`` if and only if ``execution_payload`` and ``execution_requests_list``
are valid with respect to ``self.execution_state``.
"""
...
```

##### Modified `verify_and_notify_new_payload`

*Note*: The function `verify_and_notify_new_payload` is modified to pass the additional parameter `execution_requests`
when calling `notify_new_payload` in Electra.
*Note*: The function `verify_and_notify_new_payload` is modified to pass the additional parameters
`execution_requests_list` and `target_blobs_per_block` when calling `notify_new_payload` in Electra.

```python
def verify_and_notify_new_payload(self: ExecutionEngine,
Expand All @@ -1014,6 +1016,7 @@ def verify_and_notify_new_payload(self: ExecutionEngine,
execution_payload = new_payload_request.execution_payload
parent_beacon_block_root = new_payload_request.parent_beacon_block_root
execution_requests_list = get_execution_requests_list(new_payload_request.execution_requests) # [New in Electra]
target_blobs_per_block = MAX_BLOBS_PER_BLOCK // 2 # [New in Electra:EIP7742]

if not self.is_valid_block_hash(execution_payload, parent_beacon_block_root):
return False
Expand All @@ -1025,7 +1028,8 @@ def verify_and_notify_new_payload(self: ExecutionEngine,
if not self.notify_new_payload(
execution_payload,
parent_beacon_block_root,
execution_requests_list):
execution_requests_list,
target_blobs_per_block):
return False

return True
Expand Down
38 changes: 38 additions & 0 deletions specs/electra/fork-choice.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
# Electra -- Fork Choice

## Table of contents
<!-- TOC -->
<!-- START doctoc generated TOC please keep comment here to allow auto update -->
<!-- DON'T EDIT THIS SECTION, INSTEAD RE-RUN doctoc TO UPDATE -->

- [Introduction](#introduction)
- [Containers](#containers)
- [Helpers](#helpers)
- [Extended `PayloadAttributes`](#extended-payloadattributes)

<!-- END doctoc generated TOC please keep comment here to allow auto update -->
<!-- /TOC -->

## Introduction

This is the modification of the fork choice accompanying the Electra upgrade.

## Containers

## Helpers

### Extended `PayloadAttributes`

`PayloadAttributes` is extended with the maximum number of blobs per block.

```python
@dataclass
class PayloadAttributes(object):
timestamp: uint64
prev_randao: Bytes32
suggested_fee_recipient: ExecutionAddress
withdrawals: Sequence[Withdrawal]
parent_beacon_block_root: Root
target_blob_count: uint64 # [New in Electra]
maximum_blob_count: uint64 # [New in Electra]
```
2 changes: 2 additions & 0 deletions specs/electra/validator.md
Original file line number Diff line number Diff line change
Expand Up @@ -176,6 +176,8 @@ def prepare_execution_payload(state: BeaconState,
suggested_fee_recipient=suggested_fee_recipient,
withdrawals=withdrawals,
parent_beacon_block_root=hash_tree_root(state.latest_block_header),
target_blob_count=MAX_BLOBS_PER_BLOCK // 2, # [New in Electra]
maximum_blob_count=MAX_BLOBS_PER_BLOCK, # [New in Electra]
)
return execution_engine.notify_forkchoice_updated(
head_block_hash=parent_hash,
Expand Down