From a8a464c5fe33715141dd5c6749cc0bba2827d05a Mon Sep 17 00:00:00 2001 From: Dustin Brody Date: Wed, 2 Feb 2022 08:42:43 +0000 Subject: [PATCH] update engine API signatures to alpha.6 --- web3/engine_api_callsigs.nim | 4 ++-- web3/engine_api_types.nim | 31 +++++++++++++++++++------------ web3/ethtypes.nim | 2 +- 3 files changed, 22 insertions(+), 15 deletions(-) diff --git a/web3/engine_api_callsigs.nim b/web3/engine_api_callsigs.nim index 165f215..405dab7 100644 --- a/web3/engine_api_callsigs.nim +++ b/web3/engine_api_callsigs.nim @@ -1,7 +1,7 @@ -# https://github.com/ethereum/execution-apis/blob/v1.0.0-alpha.5/src/engine/specification.md +# https://github.com/ethereum/execution-apis/blob/v1.0.0-alpha.6/src/engine/specification.md#core import ethtypes, engine_api_types -proc engine_executePayloadV1(payload: ExecutionPayloadV1): ExecutePayloadResponse +proc engine_newPayloadV1(payload: ExecutionPayloadV1): PayloadStatusV1 proc engine_forkchoiceUpdatedV1(forkchoiceState: ForkchoiceStateV1, payloadAttributes: Option[PayloadAttributesV1]): ForkchoiceUpdatedResponse proc engine_getPayloadV1(payloadId: PayloadID): ExecutionPayloadV1 diff --git a/web3/engine_api_types.nim b/web3/engine_api_types.nim index 9e3e610..499fc59 100644 --- a/web3/engine_api_types.nim +++ b/web3/engine_api_types.nim @@ -6,39 +6,47 @@ export ethtypes type - # https://github.com/ethereum/execution-apis/blob/v1.0.0-alpha.5/src/engine/specification.md#payloadattributesv1 + # https://github.com/ethereum/execution-apis/blob/v1.0.0-alpha.6/src/engine/specification.md#payloadattributesv1 PayloadAttributesV1* = object timestamp*: Quantity random*: FixedBytes[32] suggestedFeeRecipient*: Address + # https://github.com/ethereum/execution-apis/blob/v1.0.0-alpha.6/src/engine/specification.md#payloadstatusv1 PayloadExecutionStatus* {.pure.} = enum - valid = "VALID" - invalid = "INVALID" - syncing = "SYNCING" + valid = "VALID" + invalid = "INVALID" + syncing = "SYNCING" + accepted = "ACCEPTED" + invalid_block_hash = "INVALID_BLOCK_HASH" + invalid_terminal_block = "INVALID_TERMINAL_BLOCK" - PayloadID* = FixedBytes[8] - - ExecutePayloadResponse* = object + PayloadStatusV1* = object status*: PayloadExecutionStatus latestValidHash*: Option[BlockHash] validationError*: Option[string] - # https://github.com/ethereum/execution-apis/blob/v1.0.0-alpha.5/src/engine/specification.md#forkchoicestatev1 + # https://github.com/ethereum/execution-apis/blob/v1.0.0-alpha.6/src/engine/specification.md#forkchoicestatev1 ForkchoiceStateV1* = object headBlockHash*: BlockHash safeBlockHash*: BlockHash finalizedBlockHash*: BlockHash + # https://github.com/ethereum/execution-apis/blob/v1.0.0-alpha.6/src/engine/specification.md#response-1 ForkchoiceUpdatedStatus* {.pure.} = enum - success = "SUCCESS" - syncing = "SYNCING" + valid = "VALID" + invalid = "INVALID" + syncing = "SYNCING" + invalid_terminal_block = "INVALID_TERMINAL_BLOCK" + + PayloadID* = FixedBytes[8] ForkchoiceUpdatedResponse* = object - status*: ForkchoiceUpdatedStatus + payloadStatus*: ForkchoiceUpdatedStatus payloadId*: Option[PayloadID] const + # https://github.com/ethereum/execution-apis/blob/v1.0.0-alpha.6/src/engine/specification.md#errors engineApiParseError* = - 32700 engineApiInvalidRequest* = -32600 engineApiMethodNotFound* = -32601 @@ -46,4 +54,3 @@ const engineApiInternalError* = -32603 engineApiServerError* = -32000 engineApiUnknownPayload* = -32001 - engineApiInvalidTerminalBlock* = -32002 diff --git a/web3/ethtypes.nim b/web3/ethtypes.nim index 227086f..0de7727 100644 --- a/web3/ethtypes.nim +++ b/web3/ethtypes.nim @@ -201,7 +201,7 @@ type TypedTransaction* = distinct seq[byte] - # https://github.com/ethereum/execution-apis/blob/v1.0.0-alpha.5/src/engine/specification.md#executionpayloadv1 + # https://github.com/ethereum/execution-apis/blob/v1.0.0-alpha.6/src/engine/specification.md#executionpayloadv1 ExecutionPayloadV1* = object parentHash*: BlockHash feeRecipient*: Address