From b41316b25c77c525a2d33192a52958a6972b839d Mon Sep 17 00:00:00 2001 From: Jacek Sieka Date: Wed, 2 Oct 2024 09:30:29 +0200 Subject: [PATCH] parentBeaconBlockRoot is Hash32, per specs (#164) --- tests/test_execution_types.nim | 4 ++-- web3/engine_api.nim | 8 ++++---- web3/engine_api_types.nim | 2 +- web3/execution_types.nim | 2 +- 4 files changed, 8 insertions(+), 8 deletions(-) diff --git a/tests/test_execution_types.nim b/tests/test_execution_types.nim index 7362490..2e5c074 100644 --- a/tests/test_execution_types.nim +++ b/tests/test_execution_types.nim @@ -48,7 +48,7 @@ suite "Execution types tests": prevRandao: b32(2), suggestedFeeRecipient: address(3), withdrawals: Opt.some(@[wd]), - parentBeaconBlockRoot: Opt.some(b32(4)), + parentBeaconBlockRoot: Opt.some(h256(4)), ) blobs = BlobsBundleV1( @@ -110,7 +110,7 @@ suite "Execution types tests": test "attr version": var v2 = attr - v2.parentBeaconBlockRoot = Opt.none(Bytes32) + v2.parentBeaconBlockRoot = Opt.none(Hash32) var v1 = v2 v1.withdrawals = Opt.none(seq[WithdrawalV1]) check attr.version == Version.V3 diff --git a/web3/engine_api.nim b/web3/engine_api.nim index 09098a7..d5634da 100644 --- a/web3/engine_api.nim +++ b/web3/engine_api.nim @@ -26,8 +26,8 @@ createRpcSigsFromNim(RpcClient): proc engine_newPayloadV1(payload: ExecutionPayloadV1): PayloadStatusV1 proc engine_newPayloadV2(payload: ExecutionPayloadV2): PayloadStatusV1 - proc engine_newPayloadV3(payload: ExecutionPayloadV3, expectedBlobVersionedHashes: seq[VersionedHash], parentBeaconBlockRoot: Bytes32): PayloadStatusV1 - proc engine_newPayloadV4(payload: ExecutionPayloadV4, expectedBlobVersionedHashes: seq[VersionedHash], parentBeaconBlockRoot: Bytes32): 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_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 @@ -51,10 +51,10 @@ createRpcSigsFromNim(RpcClient): proc engine_newPayloadV2(payload: ExecutionPayloadV1OrV2): PayloadStatusV1 proc engine_newPayloadV3(payload: ExecutionPayload, expectedBlobVersionedHashes: Opt[seq[VersionedHash]], - parentBeaconBlockRoot: Opt[Bytes32]): PayloadStatusV1 + parentBeaconBlockRoot: Opt[Hash32]): PayloadStatusV1 proc engine_newPayloadV4(payload: ExecutionPayload, expectedBlobVersionedHashes: Opt[seq[VersionedHash]], - parentBeaconBlockRoot: Opt[Bytes32]): PayloadStatusV1 + parentBeaconBlockRoot: Opt[Hash32]): PayloadStatusV1 proc engine_forkchoiceUpdatedV2(forkchoiceState: ForkchoiceStateV1, payloadAttributes: Opt[PayloadAttributes]): ForkchoiceUpdatedResponse proc engine_forkchoiceUpdatedV3(forkchoiceState: ForkchoiceStateV1, payloadAttributes: Opt[PayloadAttributes]): ForkchoiceUpdatedResponse diff --git a/web3/engine_api_types.nim b/web3/engine_api_types.nim index 329a79b..c2f3378 100644 --- a/web3/engine_api_types.nim +++ b/web3/engine_api_types.nim @@ -200,7 +200,7 @@ type prevRandao*: Bytes32 suggestedFeeRecipient*: Address withdrawals*: seq[WithdrawalV1] - parentBeaconBlockRoot*: Bytes32 + parentBeaconBlockRoot*: Hash32 # This is ugly, but see the comment on ExecutionPayloadV1OrV2. PayloadAttributesV1OrV2* = object diff --git a/web3/execution_types.nim b/web3/execution_types.nim index 83b8652..b40d6f4 100644 --- a/web3/execution_types.nim +++ b/web3/execution_types.nim @@ -43,7 +43,7 @@ type prevRandao*: Bytes32 suggestedFeeRecipient*: Address withdrawals*: Opt[seq[WithdrawalV1]] - parentBeaconBlockRoot*: Opt[Bytes32] + parentBeaconBlockRoot*: Opt[Hash32] SomeOptionalPayloadAttributes* = Opt[PayloadAttributesV1] |