From 785991de9499daf7bc2fc424307365a5b7fa56ab Mon Sep 17 00:00:00 2001 From: tersec Date: Thu, 10 Oct 2024 02:35:54 +0000 Subject: [PATCH] new Pectra engine API (#168) --- tests/test_execution_types.nim | 66 --------------------------------- web3/contract_dsl.nim | 4 +- web3/conversions.nim | 6 +-- web3/encoding.nim | 36 +++++++++--------- web3/engine_api.nim | 13 ++----- web3/engine_api_types.nim | 52 ++------------------------ web3/eth_api_types.nim | 6 +-- web3/execution_types.nim | 68 +++------------------------------- 8 files changed, 36 insertions(+), 215 deletions(-) diff --git a/tests/test_execution_types.nim b/tests/test_execution_types.nim index 2e5c074..b2fe6e7 100644 --- a/tests/test_execution_types.nim +++ b/tests/test_execution_types.nim @@ -64,25 +64,6 @@ suite "Execution types tests": shouldOverrideBuilder: Opt.some(false), ) - deposit = DepositRequestV1( - pubkey: FixedBytes[48].conv(1), - withdrawalCredentials: FixedBytes[32].conv(3), - amount: 5.Quantity, - signature: FixedBytes[96].conv(7), - index: 9.Quantity - ) - - withdrawal = WithdrawalRequestV1( - sourceAddress: address(7), - validatorPubkey: FixedBytes[48].conv(9) - ) - - consolidation = ConsolidationRequestV1( - sourceAddress: address(8), - sourcePubkey: FixedBytes[48].conv(10), - targetPubkey: FixedBytes[48].conv(11) - ) - test "payload version": var badv31 = payload badv31.blobGasUsed = Opt.none(Quantity) @@ -170,50 +151,3 @@ suite "Execution types tests": let v1 = response.V1 check v1 == v1.getPayloadResponse.V1 - - test "payload version 4": - var v4 = payload - v4.depositRequests = Opt.some(@[deposit]) - v4.withdrawalRequests = Opt.some(@[withdrawal]) - v4.consolidationRequests = Opt.some(@[consolidation]) - check v4.version == Version.V4 - - var bad41 = v4 - bad41.depositRequests = Opt.none(seq[DepositRequestV1]) - check bad41.version == Version.V4 - - var bad42 = v4 - bad42.withdrawalRequests = Opt.none(seq[WithdrawalRequestV1]) - check bad42.version == Version.V4 - - var bad43 = v4 - bad43.consolidationRequests = Opt.none(seq[ConsolidationRequestV1]) - check bad43.version == Version.V4 - - let v41 = bad41.V4 - check v41.depositRequests == newSeq[DepositRequestV1]() - check v41.withdrawalRequests == v4.withdrawalRequests.get - check v41.consolidationRequests == v4.consolidationRequests.get - - let v42 = bad42.V4 - check v42.depositRequests == v4.depositRequests.get - check v42.withdrawalRequests == newSeq[WithdrawalRequestV1]() - check v41.consolidationRequests == v4.consolidationRequests.get - - let v43 = bad43.V4 - check v43.depositRequests == v4.depositRequests.get - check v43.withdrawalRequests == v4.withdrawalRequests.get - check v43.consolidationRequests == newSeq[ConsolidationRequestV1]() - - # roundtrip - let v4p = v4.V4 - check v4p == v4p.executionPayload.V4 - - # response version 4 - var resv4 = response - resv4.executionPayload = v4 - check resv4.version == Version.V4 - - # response roundtrip - let rv3p = resv4.V4 - check rv3p == rv3p.getPayloadResponse.V4 \ No newline at end of file diff --git a/web3/contract_dsl.nim b/web3/contract_dsl.nim index 4d66dff..4a1db4f 100644 --- a/web3/contract_dsl.nim +++ b/web3/contract_dsl.nim @@ -198,7 +198,7 @@ proc genFunction(cname: NimNode, functionObject: FunctionObject): NimNode = `senderName`.sender, `output`, static(keccak256(`signature`).data[0..<4]) & encode(`funcParamsTuple`)) -proc `&`(a, b: openarray[byte]): seq[byte] = +proc `&`(a, b: openArray[byte]): seq[byte] = let sza = a.len let szb = b.len result.setLen(sza + szb) @@ -217,7 +217,7 @@ proc genConstructor(cname: NimNode, constructorObject: ConstructorObject): NimNo funcParamsTuple.add(ident input.name) result = quote do: - proc deployContract*[TSender](`sender`: TSender, contractType: typedesc[`cname`], `contractCode`: openarray[byte]): auto = + proc deployContract*[TSender](`sender`: TSender, contractType: typedesc[`cname`], `contractCode`: openArray[byte]): auto = discard for input in constructorObject.inputs: result[3].add nnkIdentDefs.newTree( diff --git a/web3/conversions.nim b/web3/conversions.nim index 6193d32..c4a84f8 100644 --- a/web3/conversions.nim +++ b/web3/conversions.nim @@ -60,13 +60,10 @@ derefType(ReceiptObject).useDefaultSerializationIn JrpcConv #------------------------------------------------------------------------------ WithdrawalV1.useDefaultSerializationIn JrpcConv -DepositRequestV1.useDefaultSerializationIn JrpcConv -WithdrawalRequestV1.useDefaultSerializationIn JrpcConv ExecutionPayloadV1.useDefaultSerializationIn JrpcConv ExecutionPayloadV2.useDefaultSerializationIn JrpcConv ExecutionPayloadV1OrV2.useDefaultSerializationIn JrpcConv ExecutionPayloadV3.useDefaultSerializationIn JrpcConv -ExecutionPayloadV4.useDefaultSerializationIn JrpcConv BlobsBundleV1.useDefaultSerializationIn JrpcConv ExecutionPayloadBodyV1.useDefaultSerializationIn JrpcConv PayloadAttributesV1.useDefaultSerializationIn JrpcConv @@ -82,7 +79,6 @@ GetPayloadV2ResponseExact.useDefaultSerializationIn JrpcConv GetPayloadV3Response.useDefaultSerializationIn JrpcConv GetPayloadV4Response.useDefaultSerializationIn JrpcConv ClientVersionV1.useDefaultSerializationIn JrpcConv -ConsolidationRequestV1.useDefaultSerializationIn JrpcConv #------------------------------------------------------------------------------ # execution_types @@ -329,7 +325,7 @@ proc readValue*(r: var JsonReader[JrpcConv], val: var RtBlockIdentifier) proc writeValue*(w: var JsonWriter[JrpcConv], v: RtBlockIdentifier) {.gcsafe, raises: [IOError].} = case v.kind - of bidNumber: w.writeValue(v.number.Quantity) + of bidNumber: w.writeValue(v.number) of bidAlias: w.writeValue(v.alias) proc readValue*(r: var JsonReader[JrpcConv], val: var TxOrHash) diff --git a/web3/encoding.nim b/web3/encoding.nim index 5d9cd90..2b0876b 100644 --- a/web3/encoding.nim +++ b/web3/encoding.nim @@ -17,13 +17,13 @@ func encode*[bits: static[int]](x: StUint[bits]): seq[byte] = func encode*[bits: static[int]](x: StInt[bits]): seq[byte] = @(x.toByteArrayBE()) -func decode*(input: openarray[byte], baseOffset, offset: int, to: var StUint): int = +func decode*(input: openArray[byte], baseOffset, offset: int, to: var StUint): int = const meaningfulLen = to.bits div 8 let offset = offset + baseOffset to = type(to).fromBytesBE(input.toOpenArray(offset, offset + meaningfulLen - 1)) meaningfulLen -func decode*[N](input: openarray[byte], baseOffset, offset: int, to: var StInt[N]): int = +func decode*[N](input: openArray[byte], baseOffset, offset: int, to: var StInt[N]): int = const meaningfulLen = N div 8 let offset = offset + baseOffset to = type(to).fromBytesBE(input.toOpenArray(offset, offset + meaningfulLen - 1)) @@ -39,7 +39,7 @@ func encode*[N: static int](b: FixedBytes[N]): seq[byte] = encodeFixed(b.data) func encode*(b: Address): seq[byte] = encodeFixed(b.data) func encode*[N](b: array[N, byte]): seq[byte] {.inline.} = encodeFixed(b) -func decodeFixed(input: openarray[byte], baseOffset, offset: int, to: var openArray[byte]): int = +func decodeFixed(input: openArray[byte], baseOffset, offset: int, to: var openArray[byte]): int = let meaningfulLen = to.len var padding = to.len mod 32 if padding != 0: @@ -49,10 +49,10 @@ func decodeFixed(input: openarray[byte], baseOffset, offset: int, to: var openAr assign(to, input.toOpenArray(offset, offset + meaningfulLen - 1)) meaningfulLen + padding -func decode*[N](input: openarray[byte], baseOffset, offset: int, to: var FixedBytes[N]): int {.inline.} = +func decode*[N](input: openArray[byte], baseOffset, offset: int, to: var FixedBytes[N]): int {.inline.} = decodeFixed(input, baseOffset, offset, array[N, byte](to)) -func decode*(input: openarray[byte], baseOffset, offset: int, to: var Address): int {.inline.} = +func decode*(input: openArray[byte], baseOffset, offset: int, to: var Address): int {.inline.} = decodeFixed(input, baseOffset, offset, array[20, byte](to)) func encodeDynamic(v: openArray[byte]): seq[byte] = @@ -71,7 +71,7 @@ func encode*(x: seq[byte]): seq[byte] {.inline.} = func encode*(x: string): seq[byte] {.inline.} = encodeDynamic(x.toOpenArrayByte(0, x.high)) -func decode*(input: openarray[byte], baseOffset, offset: int, to: var seq[byte]): int = +func decode*(input: openArray[byte], baseOffset, offset: int, to: var seq[byte]): int = var dataOffsetBig, dataLenBig: UInt256 result = decode(input, baseOffset, offset, dataOffsetBig) let dataOffset = dataOffsetBig.truncate(int) @@ -80,7 +80,7 @@ func decode*(input: openarray[byte], baseOffset, offset: int, to: var seq[byte]) let actualDataOffset = baseOffset + dataOffset + 32 to = input[actualDataOffset ..< actualDataOffset + dataLen] -func decode*(input: openarray[byte], baseOffset, offset: int, to: var string): int = +func decode*(input: openArray[byte], baseOffset, offset: int, to: var string): int = var dataOffsetBig, dataLenBig: UInt256 result = decode(input, baseOffset, offset, dataOffsetBig) let dataOffset = dataOffsetBig.truncate(int) @@ -89,15 +89,15 @@ func decode*(input: openarray[byte], baseOffset, offset: int, to: var string): i let actualDataOffset = baseOffset + dataOffset + 32 to = string.fromBytes(input.toOpenArray(actualDataOffset, actualDataOffset + dataLen - 1)) -func decode*(input: openarray[byte], baseOffset, offset: int, to: var DynamicBytes): int {.inline.} = +func decode*(input: openArray[byte], baseOffset, offset: int, to: var DynamicBytes): int {.inline.} = var s: seq[byte] result = decode(input, baseOffset, offset, s) # TODO: Check data len, and raise? to = typeof(to)(move(s)) -func decode*(input: openarray[byte], baseOffset, offset: int, obj: var object): int +func decode*(input: openArray[byte], baseOffset, offset: int, obj: var object): int -func decode*[T](input: openarray[byte], baseOffset, offset: int, to: var seq[T]): int {.inline.} = +func decode*[T](input: openArray[byte], baseOffset, offset: int, to: var seq[T]): int {.inline.} = var dataOffsetBig, dataLenBig: UInt256 result = decode(input, baseOffset, offset, dataOffsetBig) let dataOffset = dataOffsetBig.truncate(int) @@ -110,10 +110,10 @@ func decode*[T](input: openarray[byte], baseOffset, offset: int, to: var seq[T]) for i in 0 ..< dataLen: offset += decode(input, baseOffset, offset, to[i]) -proc isDynamicObject(T: typedesc): bool +func isDynamicObject(T: typedesc): bool template isDynamicType(a: typedesc): bool = - when a is seq | openarray | string | DynamicBytes: + when a is seq | openArray | string | DynamicBytes: true elif a is object: const r = isDynamicObject(a) @@ -121,7 +121,7 @@ template isDynamicType(a: typedesc): bool = else: false -proc isDynamicObject(T: typedesc): bool = +func isDynamicObject(T: typedesc): bool = var a: T for v in fields(a): if isDynamicType(typeof(v)): return true @@ -129,12 +129,12 @@ proc isDynamicObject(T: typedesc): bool = func encode*(x: bool): seq[byte] = encode(x.int.u256) -func decode*(input: openarray[byte], baseOffset, offset: int, to: var bool): int = +func decode*(input: openArray[byte], baseOffset, offset: int, to: var bool): int = var i: Int256 result = decode(input, baseOffset, offset, i) to = not i.isZero() -func decode*(input: openarray[byte], baseOffset, offset: int, obj: var object): int = +func decode*(input: openArray[byte], baseOffset, offset: int, obj: var object): int = when isDynamicObject(typeof(obj)): var dataOffsetBig: UInt256 result = decode(input, baseOffset, offset, dataOffsetBig) @@ -153,7 +153,7 @@ func decode*(input: openarray[byte], baseOffset, offset: int, obj: var object): func encode*(x: tuple): seq[byte] -func encode*[T](x: openarray[T]): seq[byte] = +func encode*[T](x: openArray[T]): seq[byte] = result = encode(x.len.u256) when isDynamicType(T): result.setLen((1 + x.len) * 32) @@ -165,7 +165,7 @@ func encode*[T](x: openarray[T]): seq[byte] = for i in 0 ..< x.len: result &= encode(x[i]) -proc getTupleImpl(t: NimNode): NimNode = +func getTupleImpl(t: NimNode): NimNode = getTypeImpl(t)[1].getTypeImpl() macro typeListLen*(t: typedesc[tuple]): int = @@ -191,5 +191,5 @@ func encode*(x: tuple): seq[byte] = inc i # Obsolete -func decode*(input: string, offset: int, to: var DynamicBytes): int {.inline, deprecated: "Use decode(openarray[byte], ...) instead".} = +func decode*(input: string, offset: int, to: var DynamicBytes): int {.inline, deprecated: "Use decode(openArray[byte], ...) instead".} = decode(hexToSeqByte(input), 0, offset div 2, to) * 2 diff --git a/web3/engine_api.nim b/web3/engine_api.nim index b45fa3d..6434083 100644 --- a/web3/engine_api.nim +++ b/web3/engine_api.nim @@ -27,7 +27,7 @@ createRpcSigsFromNim(RpcClient): proc engine_newPayloadV1(payload: ExecutionPayloadV1): PayloadStatusV1 proc engine_newPayloadV2(payload: ExecutionPayloadV2): PayloadStatusV1 proc engine_newPayloadV3(payload: ExecutionPayloadV3, expectedBlobVersionedHashes: seq[VersionedHash], parentBeaconBlockRoot: Hash32): PayloadStatusV1 - proc engine_newPayloadV4(payload: ExecutionPayloadV4, expectedBlobVersionedHashes: seq[VersionedHash], parentBeaconBlockRoot: Hash32): PayloadStatusV1 + proc engine_newPayloadV4(payload: ExecutionPayloadV3, expectedBlobVersionedHashes: seq[VersionedHash], parentBeaconBlockRoot: Hash32, executionRequests: array[3, seq[byte]]): PayloadStatusV1 proc engine_forkchoiceUpdatedV1(forkchoiceState: ForkchoiceStateV1, payloadAttributes: Opt[PayloadAttributesV1]): ForkchoiceUpdatedResponse proc engine_forkchoiceUpdatedV2(forkchoiceState: ForkchoiceStateV1, payloadAttributes: Opt[PayloadAttributesV2]): ForkchoiceUpdatedResponse proc engine_forkchoiceUpdatedV3(forkchoiceState: ForkchoiceStateV1, payloadAttributes: Opt[PayloadAttributesV3]): ForkchoiceUpdatedResponse @@ -54,7 +54,8 @@ createRpcSigsFromNim(RpcClient): parentBeaconBlockRoot: Opt[Hash32]): PayloadStatusV1 proc engine_newPayloadV4(payload: ExecutionPayload, expectedBlobVersionedHashes: Opt[seq[VersionedHash]], - parentBeaconBlockRoot: Opt[Hash32]): PayloadStatusV1 + parentBeaconBlockRoot: Opt[Hash32], + executionRequests: Opt[array[3, seq[byte]]]): PayloadStatusV1 proc engine_forkchoiceUpdatedV2(forkchoiceState: ForkchoiceStateV1, payloadAttributes: Opt[PayloadAttributes]): ForkchoiceUpdatedResponse proc engine_forkchoiceUpdatedV3(forkchoiceState: ForkchoiceStateV1, payloadAttributes: Opt[PayloadAttributes]): ForkchoiceUpdatedResponse @@ -124,14 +125,6 @@ template newPayload*( engine_newPayloadV3( rpcClient, payload, versionedHashes, parentBeaconBlockRoot) -template newPayload*( - rpcClient: RpcClient, - payload: ExecutionPayloadV4, - versionedHashes: seq[VersionedHash], - parentBeaconBlockRoot: Hash32): Future[PayloadStatusV1] = - engine_newPayloadV4( - rpcClient, payload, versionedHashes, parentBeaconBlockRoot) - template exchangeCapabilities*( rpcClient: RpcClient, methods: seq[string]): Future[seq[string]] = diff --git a/web3/engine_api_types.nim b/web3/engine_api_types.nim index c2f3378..4196e11 100644 --- a/web3/engine_api_types.nim +++ b/web3/engine_api_types.nim @@ -28,26 +28,6 @@ type address*: Address amount*: Quantity - # https://github.com/ethereum/execution-apis/blob/v1.0.0-beta.4/src/engine/prague.md#depositrequestv1 - DepositRequestV1* = object - pubkey*: Bytes48 - withdrawalCredentials*: Bytes32 - amount*: Quantity - signature*: Bytes96 - index*: Quantity - - # https://github.com/nflaig/execution-apis/blob/update-withdrawal-request/src/engine/prague.md#withdrawalrequestv1 - WithdrawalRequestV1* = object - sourceAddress*: Address - validatorPubkey*: Bytes48 - amount*: Quantity - - # https://github.com/ethereum/execution-apis/blob/3ae3d29fc9900e5c48924c238dff7643fdc3680e/src/engine/prague.md#consolidationrequestv1 - ConsolidationRequestV1* = object - sourceAddress*: Address - sourcePubkey*: Bytes48 - targetPubkey*: Bytes48 - # https://github.com/ethereum/execution-apis/blob/v1.0.0-beta.4/src/engine/paris.md#executionpayloadv1 # https://github.com/ethereum/execution-apis/blob/v1.0.0-beta.4/src/engine/openrpc/schemas/payload.yaml#L51 ExecutionPayloadV1* = object @@ -136,35 +116,10 @@ type blobGasUsed*: Quantity excessBlobGas*: Quantity - # https://github.com/ethereum/execution-apis/blob/3ae3d29fc9900e5c48924c238dff7643fdc3680e/src/engine/prague.md#executionpayloadv4 - # https://github.com/ethereum/execution-apis/blob/v1.0.0-beta.4/src/engine/openrpc/schemas/payload.yaml#L246 - ExecutionPayloadV4* = object - parentHash*: Hash32 - feeRecipient*: Address - stateRoot*: Hash32 - receiptsRoot*: Hash32 - logsBloom*: Bytes256 - prevRandao*: Bytes32 - blockNumber*: Quantity - gasLimit*: Quantity - gasUsed*: Quantity - timestamp*: Quantity - extraData*: DynamicBytes[0, 32] - baseFeePerGas*: UInt256 - blockHash*: Hash32 - transactions*: seq[TypedTransaction] - withdrawals*: seq[WithdrawalV1] - blobGasUsed*: Quantity - excessBlobGas*: Quantity - depositRequests*: seq[DepositRequestV1] - withdrawalRequests*: seq[WithdrawalRequestV1] - consolidationRequests*: seq[ConsolidationRequestV1] - SomeExecutionPayload* = ExecutionPayloadV1 | ExecutionPayloadV2 | - ExecutionPayloadV3 | - ExecutionPayloadV4 + ExecutionPayloadV3 # https://github.com/ethereum/execution-apis/blob/v1.0.0-beta.4/src/engine/cancun.md#blobsbundlev1 BlobsBundleV1* = object @@ -260,12 +215,13 @@ type blobsBundle*: BlobsBundleV1 shouldOverrideBuilder*: bool - # https://github.com/ethereum/execution-apis/blob/90a46e9137c89d58e818e62fa33a0347bba50085/src/engine/prague.md#response-1 + # https://github.com/ethereum/execution-apis/blob/4140e528360fea53c34a766d86a000c6c039100e/src/engine/prague.md#response-1 GetPayloadV4Response* = object - executionPayload*: ExecutionPayloadV4 + executionPayload*: ExecutionPayloadV3 blockValue*: UInt256 blobsBundle*: BlobsBundleV1 shouldOverrideBuilder*: bool + executionRequests*: array[3, seq[byte]] SomeGetPayloadResponse* = ExecutionPayloadV1 | diff --git a/web3/eth_api_types.nim b/web3/eth_api_types.nim index d000d21..b63dcbf 100644 --- a/web3/eth_api_types.nim +++ b/web3/eth_api_types.nim @@ -7,6 +7,8 @@ # This file may not be copied, modified, or distributed except according to # those terms. +{.push raises: [].} + import stint, ./primitives @@ -292,8 +294,6 @@ type blobGasUsedRatio*: seq[float64] reward*: Opt[seq[FeeHistoryReward]] -{.push raises: [].} - func blockId*(n: uint64): RtBlockIdentifier = RtBlockIdentifier(kind: bidNumber, number: Quantity n) @@ -334,4 +334,4 @@ func isEIP4844*(args: TransactionArgs): bool = # Backwards compatibility type - Topic* {.deprecated.} = Bytes32 + Topic* {.deprecated.} = Bytes32 \ No newline at end of file diff --git a/web3/execution_types.nim b/web3/execution_types.nim index b40d6f4..6e0f7dc 100644 --- a/web3/execution_types.nim +++ b/web3/execution_types.nim @@ -7,6 +7,8 @@ # This file may not be copied, modified, or distributed except according to # those terms. +{.push raises: [].} + import stint, ./engine_api_types @@ -34,9 +36,6 @@ type withdrawals*: Opt[seq[WithdrawalV1]] blobGasUsed*: Opt[Quantity] excessBlobGas*: Opt[Quantity] - depositRequests*: Opt[seq[DepositRequestV1]] - withdrawalRequests*: Opt[seq[WithdrawalRequestV1]] - consolidationRequests*:Opt[seq[ConsolidationRequestV1]] PayloadAttributes* = object timestamp*: Quantity @@ -60,16 +59,9 @@ type V1 V2 V3 - V4 - -{.push raises: [].} func version*(payload: ExecutionPayload): Version = - if payload.depositRequests.isSome or - payload.withdrawalRequests.isSome or - payload.consolidationRequests.isSome: - Version.V4 - elif payload.blobGasUsed.isSome or payload.excessBlobGas.isSome: + if payload.blobGasUsed.isSome or payload.excessBlobGas.isSome: Version.V3 elif payload.withdrawals.isSome: Version.V2 @@ -87,9 +79,7 @@ func version*(attr: PayloadAttributes): Version = func version*(res: GetPayloadResponse): Version = # TODO: should this return whatever version of # executionPayload.version? - if res.executionPayload.version == Version.V4: - Version.V4 - elif res.blobsBundle.isSome or res.shouldOverrideBuilder.isSome: + if res.blobsBundle.isSome or res.shouldOverrideBuilder.isSome: Version.V3 elif res.blockValue.isSome: Version.V2 @@ -256,30 +246,6 @@ func V3*(p: ExecutionPayload): ExecutionPayloadV3 = excessBlobGas: p.excessBlobGas.get(0.Quantity) ) -func V4*(p: ExecutionPayload): ExecutionPayloadV4 = - ExecutionPayloadV4( - parentHash: p.parentHash, - feeRecipient: p.feeRecipient, - stateRoot: p.stateRoot, - receiptsRoot: p.receiptsRoot, - logsBloom: p.logsBloom, - prevRandao: p.prevRandao, - blockNumber: p.blockNumber, - gasLimit: p.gasLimit, - gasUsed: p.gasUsed, - timestamp: p.timestamp, - extraData: p.extraData, - baseFeePerGas: p.baseFeePerGas, - blockHash: p.blockHash, - transactions: p.transactions, - withdrawals: p.withdrawals.get, - blobGasUsed: p.blobGasUsed.get(0.Quantity), - excessBlobGas: p.excessBlobGas.get(0.Quantity), - depositRequests: p.depositRequests.get(newSeq[DepositRequestV1]()), - withdrawalRequests: p.withdrawalRequests.get(newSeq[WithdrawalRequestV1]()), - consolidationRequests: p.consolidationRequests.get(newSeq[ConsolidationRequestV1]()), - ) - func V1*(p: ExecutionPayloadV1OrV2): ExecutionPayloadV1 = ExecutionPayloadV1( parentHash: p.parentHash, @@ -375,30 +341,6 @@ func executionPayload*(p: ExecutionPayloadV3): ExecutionPayload = excessBlobGas: Opt.some(p.excessBlobGas) ) -func executionPayload*(p: ExecutionPayloadV4): ExecutionPayload = - ExecutionPayload( - parentHash: p.parentHash, - feeRecipient: p.feeRecipient, - stateRoot: p.stateRoot, - receiptsRoot: p.receiptsRoot, - logsBloom: p.logsBloom, - prevRandao: p.prevRandao, - blockNumber: p.blockNumber, - gasLimit: p.gasLimit, - gasUsed: p.gasUsed, - timestamp: p.timestamp, - extraData: p.extraData, - baseFeePerGas: p.baseFeePerGas, - blockHash: p.blockHash, - transactions: p.transactions, - withdrawals: Opt.some(p.withdrawals), - blobGasUsed: Opt.some(p.blobGasUsed), - excessBlobGas: Opt.some(p.excessBlobGas), - depositRequests: Opt.some(p.depositRequests), - withdrawalRequests: Opt.some(p.withdrawalRequests), - consolidationRequests: Opt.some(p.consolidationRequests), - ) - func executionPayload*(p: ExecutionPayloadV1OrV2): ExecutionPayload = ExecutionPayload( parentHash: p.parentHash, @@ -437,7 +379,7 @@ func V3*(res: GetPayloadResponse): GetPayloadV3Response = func V4*(res: GetPayloadResponse): GetPayloadV4Response = GetPayloadV4Response( - executionPayload: res.executionPayload.V4, + executionPayload: res.executionPayload.V3, blockValue: res.blockValue.get, blobsBundle: res.blobsBundle.get(BlobsBundleV1()), shouldOverrideBuilder: res.shouldOverrideBuilder.get(false)