79
79
- [ Request data] ( #request-data )
80
80
- [ Modified ` NewPayloadRequest ` ] ( #modified-newpayloadrequest )
81
81
- [ Engine APIs] ( #engine-apis )
82
+ - [ Modified ` is_valid_block_hash ` ] ( #modified-is_valid_block_hash )
82
83
- [ Modified ` notify_new_payload ` ] ( #modified-notify_new_payload )
83
84
- [ Modified ` verify_and_notify_new_payload ` ] ( #modified-verify_and_notify_new_payload )
84
85
- [ Block processing] ( #block-processing )
@@ -1003,30 +1004,51 @@ class NewPayloadRequest(object):
1003
1004
versioned_hashes: Sequence[VersionedHash]
1004
1005
parent_beacon_block_root: Root
1005
1006
execution_requests: ExecutionRequests # [New in Electra]
1007
+ target_blobs_per_block: uint64 # [New in Electra:EIP7742]
1006
1008
```
1007
1009
1008
1010
#### Engine APIs
1009
1011
1012
+ ##### Modified ` is_valid_block_hash `
1013
+
1014
+ * Note* : The function ` is_valid_block_hash ` is modified to include the additional
1015
+ ` execution_requests_list ` and ` target_blobs_per_block ` parameters in Electra.
1016
+
1017
+ ``` python
1018
+ def is_valid_block_hash (self : ExecutionEngine,
1019
+ execution_payload : ExecutionPayload,
1020
+ parent_beacon_block_root : Root,
1021
+ execution_requests_list : Sequence[bytes ],
1022
+ target_blobs_per_block : uint64) -> bool :
1023
+ """
1024
+ Return ``True`` if and only if ``execution_payload.block_hash`` is computed correctly.
1025
+ """
1026
+ ...
1027
+ ```
1028
+
1010
1029
##### Modified ` notify_new_payload `
1011
1030
1012
- * Note* : The function ` notify_new_payload ` is modified to include the additional ` execution_requests ` parameter in Electra.
1031
+ * Note* : The function ` notify_new_payload ` is modified to include the additional
1032
+ ` execution_requests_list ` and ` target_blobs_per_block ` parameters in Electra.
1013
1033
1014
1034
``` python
1015
1035
def notify_new_payload (self : ExecutionEngine,
1016
1036
execution_payload : ExecutionPayload,
1017
1037
parent_beacon_block_root : Root,
1018
- execution_requests_list : Sequence[bytes ]) -> bool :
1038
+ execution_requests_list : Sequence[bytes ],
1039
+ target_blobs_per_block : uint64) -> bool :
1019
1040
"""
1020
- Return ``True`` if and only if ``execution_payload`` and ``execution_requests ``
1041
+ Return ``True`` if and only if ``execution_payload`` and ``execution_requests_list ``
1021
1042
are valid with respect to ``self.execution_state``.
1022
1043
"""
1023
1044
...
1024
1045
```
1025
1046
1026
1047
##### Modified ` verify_and_notify_new_payload `
1027
1048
1028
- * Note* : The function ` verify_and_notify_new_payload ` is modified to pass the additional parameter ` execution_requests `
1029
- when calling ` notify_new_payload ` in Electra.
1049
+ * Note* : The function ` verify_and_notify_new_payload ` is modified to pass the additional parameters
1050
+ ` execution_requests_list ` and ` target_blobs_per_block ` when calling ` is_valid_block_hash ` and
1051
+ ` notify_new_payload ` in Electra.
1030
1052
1031
1053
``` python
1032
1054
def verify_and_notify_new_payload (self : ExecutionEngine,
@@ -1037,11 +1059,17 @@ def verify_and_notify_new_payload(self: ExecutionEngine,
1037
1059
execution_payload = new_payload_request.execution_payload
1038
1060
parent_beacon_block_root = new_payload_request.parent_beacon_block_root
1039
1061
execution_requests_list = get_execution_requests_list(new_payload_request.execution_requests) # [New in Electra]
1062
+ target_blobs_per_block = new_payload_request.target_blobs_per_block # [New in Electra:EIP7742]
1040
1063
1041
1064
if b ' ' in execution_payload.transactions:
1042
1065
return False
1043
1066
1044
- if not self .is_valid_block_hash(execution_payload, parent_beacon_block_root):
1067
+ # [Modified in Electra]
1068
+ if not self .is_valid_block_hash(
1069
+ execution_payload,
1070
+ parent_beacon_block_root,
1071
+ execution_requests_list,
1072
+ target_blobs_per_block):
1045
1073
return False
1046
1074
1047
1075
if not self .is_valid_versioned_hashes(new_payload_request):
@@ -1051,7 +1079,8 @@ def verify_and_notify_new_payload(self: ExecutionEngine,
1051
1079
if not self .notify_new_payload(
1052
1080
execution_payload,
1053
1081
parent_beacon_block_root,
1054
- execution_requests_list):
1082
+ execution_requests_list,
1083
+ target_blobs_per_block):
1055
1084
return False
1056
1085
1057
1086
return True
@@ -1213,6 +1242,7 @@ def process_execution_payload(state: BeaconState, body: BeaconBlockBody, executi
1213
1242
versioned_hashes = versioned_hashes,
1214
1243
parent_beacon_block_root = state.latest_block_header.parent_root,
1215
1244
execution_requests = body.execution_requests, # [New in Electra]
1245
+ target_blobs_per_block = MAX_BLOBS_PER_BLOCK // 2 , # [New in Electra:EIP7742]
1216
1246
)
1217
1247
)
1218
1248
# Cache execution payload header
0 commit comments