1
- import { ExecutionPayload , Root , RootHex , Wei } from "@lodestar/types" ;
1
+ import { ExecutionPayload , ExecutionRequests , Root , RootHex , Wei } from "@lodestar/types" ;
2
2
import { SLOTS_PER_EPOCH , ForkName , ForkSeq } from "@lodestar/params" ;
3
3
import { Logger } from "@lodestar/logger" ;
4
4
import {
@@ -37,6 +37,7 @@ import {
37
37
ExecutionPayloadBody ,
38
38
assertReqSizeLimit ,
39
39
deserializeExecutionPayloadBody ,
40
+ serializeExecutionRequests ,
40
41
} from "./types.js" ;
41
42
import { getExecutionEngineState } from "./utils.js" ;
42
43
@@ -195,7 +196,8 @@ export class ExecutionEngineHttp implements IExecutionEngine {
195
196
fork : ForkName ,
196
197
executionPayload : ExecutionPayload ,
197
198
versionedHashes ?: VersionedHashes ,
198
- parentBlockRoot ?: Root
199
+ parentBlockRoot ?: Root ,
200
+ executionRequests ?: ExecutionRequests
199
201
) : Promise < ExecutePayloadResponse > {
200
202
const method =
201
203
ForkSeq [ fork ] >= ForkSeq . electra
@@ -220,12 +222,28 @@ export class ExecutionEngineHttp implements IExecutionEngine {
220
222
const serializedVersionedHashes = serializeVersionedHashes ( versionedHashes ) ;
221
223
const parentBeaconBlockRoot = serializeBeaconBlockRoot ( parentBlockRoot ) ;
222
224
223
- const method = ForkSeq [ fork ] >= ForkSeq . electra ? "engine_newPayloadV4" : "engine_newPayloadV3" ;
224
- engineRequest = {
225
- method,
226
- params : [ serializedExecutionPayload , serializedVersionedHashes , parentBeaconBlockRoot ] ,
227
- methodOpts : notifyNewPayloadOpts ,
228
- } ;
225
+ if ( ForkSeq [ fork ] >= ForkSeq . electra ) {
226
+ if ( executionRequests === undefined ) {
227
+ throw Error ( `executionRequests required in notifyNewPayload for fork=${ fork } ` ) ;
228
+ }
229
+ const serializedExecutionRequests = serializeExecutionRequests ( executionRequests ) ;
230
+ engineRequest = {
231
+ method : "engine_newPayloadV4" ,
232
+ params : [
233
+ serializedExecutionPayload ,
234
+ serializedVersionedHashes ,
235
+ parentBeaconBlockRoot ,
236
+ serializedExecutionRequests ,
237
+ ] ,
238
+ methodOpts : notifyNewPayloadOpts ,
239
+ } ;
240
+ } else {
241
+ engineRequest = {
242
+ method : "engine_newPayloadV3" ,
243
+ params : [ serializedExecutionPayload , serializedVersionedHashes , parentBeaconBlockRoot ] ,
244
+ methodOpts : notifyNewPayloadOpts ,
245
+ } ;
246
+ }
229
247
} else {
230
248
const method = ForkSeq [ fork ] >= ForkSeq . capella ? "engine_newPayloadV2" : "engine_newPayloadV1" ;
231
249
engineRequest = {
@@ -391,6 +409,7 @@ export class ExecutionEngineHttp implements IExecutionEngine {
391
409
executionPayload : ExecutionPayload ;
392
410
executionPayloadValue : Wei ;
393
411
blobsBundle ?: BlobsBundle ;
412
+ executionRequests ?: ExecutionRequests ;
394
413
shouldOverrideBuilder ?: boolean ;
395
414
} > {
396
415
const method =
@@ -419,8 +438,7 @@ export class ExecutionEngineHttp implements IExecutionEngine {
419
438
}
420
439
421
440
async getPayloadBodiesByHash ( fork : ForkName , blockHashes : RootHex [ ] ) : Promise < ( ExecutionPayloadBody | null ) [ ] > {
422
- const method =
423
- ForkSeq [ fork ] >= ForkSeq . electra ? "engine_getPayloadBodiesByHashV2" : "engine_getPayloadBodiesByHashV1" ;
441
+ const method = "engine_getPayloadBodiesByHashV1" ;
424
442
assertReqSizeLimit ( blockHashes . length , 32 ) ;
425
443
const response = await this . rpc . fetchWithRetries <
426
444
EngineApiRpcReturnTypes [ typeof method ] ,
@@ -434,8 +452,7 @@ export class ExecutionEngineHttp implements IExecutionEngine {
434
452
startBlockNumber : number ,
435
453
blockCount : number
436
454
) : Promise < ( ExecutionPayloadBody | null ) [ ] > {
437
- const method =
438
- ForkSeq [ fork ] >= ForkSeq . electra ? "engine_getPayloadBodiesByRangeV2" : "engine_getPayloadBodiesByRangeV1" ;
455
+ const method = "engine_getPayloadBodiesByRangeV1" ;
439
456
assertReqSizeLimit ( blockCount , 32 ) ;
440
457
const start = numToQuantity ( startBlockNumber ) ;
441
458
const count = numToQuantity ( blockCount ) ;
0 commit comments