Skip to content

Commit

Permalink
pass execution_requests to block hash validation
Browse files Browse the repository at this point in the history
  • Loading branch information
ralexstokes committed Oct 8, 2024
1 parent 57483cb commit f3891e2
Showing 1 changed file with 21 additions and 2 deletions.
23 changes: 21 additions & 2 deletions specs/electra/beacon-chain.md
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,7 @@
- [Request data](#request-data)
- [Modified `NewPayloadRequest`](#modified-newpayloadrequest)
- [Engine APIs](#engine-apis)
- [Modified `is_valid_block_hash`](#modified-is_valid_block_hash)
- [Modified `notify_new_payload`](#modified-notify_new_payload)
- [Modified `verify_and_notify_new_payload`](#modified-verify_and_notify_new_payload)
- [Block processing](#block-processing)
Expand Down Expand Up @@ -983,6 +984,21 @@ class NewPayloadRequest(object):

#### Engine APIs

##### Modified `is_valid_block_hash`

*Note*: The function `is_valid_block_hash` is modified to include the additional `execution_requests` parameter in Electra.

```python
def is_valid_block_hash(self: ExecutionEngine,
execution_payload: ExecutionPayload,
parent_beacon_block_root: Root,
execution_requests: ExecutionRequests) -> bool:
"""
Return ``True`` if and only if ``execution_payload.block_hash`` is computed correctly.
"""
...
```

##### Modified `notify_new_payload`

*Note*: The function `notify_new_payload` is modified to include the additional `execution_requests` parameter in Electra.
Expand All @@ -993,7 +1009,7 @@ def notify_new_payload(self: ExecutionEngine,
parent_beacon_block_root: Root,
execution_requests: ExecutionRequests) -> bool:
"""
Return ``True`` if and only if ``execution_payload`` and ``execution_requests``
Return ``True`` if and only if ``execution_payload`` and ``execution_requests``
are valid with respect to ``self.execution_state``.
"""
...
Expand All @@ -1014,7 +1030,10 @@ def verify_and_notify_new_payload(self: ExecutionEngine,
parent_beacon_block_root = new_payload_request.parent_beacon_block_root
execution_requests = new_payload_request.execution_requests # [New in Electra]

if not self.is_valid_block_hash(execution_payload, parent_beacon_block_root):
if not self.is_valid_block_hash(
execution_payload,
parent_beacon_block_root,
execution_requests):
return False

if not self.is_valid_versioned_hashes(new_payload_request):
Expand Down

0 comments on commit f3891e2

Please sign in to comment.