Skip to content

Commit 28f9f07

Browse files
authored
Merge pull request #3969 from jtraglia/execution-requests-list
Pass execution requests to Engine API as a list of bytes
2 parents 57483cb + 1a3e3ad commit 28f9f07

File tree

2 files changed

+19
-4
lines changed

2 files changed

+19
-4
lines changed

pysetup/spec_builders/electra.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ class ElectraSpecBuilder(BaseSpecBuilder):
1010
def imports(cls, preset_name: str):
1111
return f'''
1212
from eth2spec.deneb import {preset_name} as deneb
13+
from eth2spec.utils.ssz.ssz_impl import serialize
1314
'''
1415

1516
@classmethod
@@ -29,7 +30,7 @@ class NoopExecutionEngine(ExecutionEngine):
2930
def notify_new_payload(self: ExecutionEngine,
3031
execution_payload: ExecutionPayload,
3132
parent_beacon_block_root: Root,
32-
execution_requests: ExecutionRequests) -> bool:
33+
execution_requests_list: list[bytes]) -> bool:
3334
return True
3435
3536
def notify_forkchoice_updated(self: ExecutionEngine,

specs/electra/beacon-chain.md

Lines changed: 17 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -84,6 +84,7 @@
8484
- [Modified `get_expected_withdrawals`](#modified-get_expected_withdrawals)
8585
- [Modified `process_withdrawals`](#modified-process_withdrawals)
8686
- [Execution payload](#execution-payload)
87+
- [New `get_execution_requests_list`](#new-get_execution_requests_list)
8788
- [Modified `process_execution_payload`](#modified-process_execution_payload)
8889
- [Operations](#operations)
8990
- [Modified `process_operations`](#modified-process_operations)
@@ -991,7 +992,7 @@ class NewPayloadRequest(object):
991992
def notify_new_payload(self: ExecutionEngine,
992993
execution_payload: ExecutionPayload,
993994
parent_beacon_block_root: Root,
994-
execution_requests: ExecutionRequests) -> bool:
995+
execution_requests_list: list[bytes]) -> bool:
995996
"""
996997
Return ``True`` if and only if ``execution_payload`` and ``execution_requests``
997998
are valid with respect to ``self.execution_state``.
@@ -1012,7 +1013,7 @@ def verify_and_notify_new_payload(self: ExecutionEngine,
10121013
"""
10131014
execution_payload = new_payload_request.execution_payload
10141015
parent_beacon_block_root = new_payload_request.parent_beacon_block_root
1015-
execution_requests = new_payload_request.execution_requests # [New in Electra]
1016+
execution_requests_list = get_execution_requests_list(new_payload_request.execution_requests) # [New in Electra]
10161017

10171018
if not self.is_valid_block_hash(execution_payload, parent_beacon_block_root):
10181019
return False
@@ -1024,7 +1025,7 @@ def verify_and_notify_new_payload(self: ExecutionEngine,
10241025
if not self.notify_new_payload(
10251026
execution_payload,
10261027
parent_beacon_block_root,
1027-
execution_requests):
1028+
execution_requests_list):
10281029
return False
10291030

10301031
return True
@@ -1139,6 +1140,19 @@ def process_withdrawals(state: BeaconState, payload: ExecutionPayload) -> None:
11391140

11401141
#### Execution payload
11411142

1143+
##### New `get_execution_requests_list`
1144+
1145+
*Note*: Encodes execution requests as defined by [EIP-7685](https://eips.ethereum.org/EIPS/eip-7685).
1146+
1147+
```python
1148+
def get_execution_requests_list(execution_requests: ExecutionRequests) -> list[bytes]:
1149+
deposit_bytes = serialize(execution_requests.deposits)
1150+
withdrawal_bytes = serialize(execution_requests.withdrawals)
1151+
consolidation_bytes = serialize(execution_requests.consolidations)
1152+
1153+
return [deposit_bytes, withdrawal_bytes, consolidation_bytes]
1154+
```
1155+
11421156
##### Modified `process_execution_payload`
11431157

11441158
*Note*: The function `process_execution_payload` is modified to pass `execution_requests` into `execution_engine.verify_and_notify_new_payload` (via the updated `NewPayloadRequest`).

0 commit comments

Comments
 (0)