alpha.7 engine API

This commit is contained in:
Dustin Brody 2022-02-23 16:55:46 +00:00
parent 94a3c2bd95
commit 719fb4813a
No known key found for this signature in database
GPG Key ID: 3D7A11A0156519DC
3 changed files with 15 additions and 7 deletions

View File

@ -1,7 +1,8 @@
# https://github.com/ethereum/execution-apis/blob/v1.0.0-alpha.6/src/engine/specification.md#core # https://github.com/ethereum/execution-apis/blob/v1.0.0-alpha.7/src/engine/specification.md#core
import ethtypes, engine_api_types import ethtypes, engine_api_types
proc engine_newPayloadV1(payload: ExecutionPayloadV1): PayloadStatusV1 proc engine_newPayloadV1(payload: ExecutionPayloadV1): PayloadStatusV1
proc engine_forkchoiceUpdatedV1(forkchoiceState: ForkchoiceStateV1, payloadAttributes: Option[PayloadAttributesV1]): ForkchoiceUpdatedResponse proc engine_forkchoiceUpdatedV1(forkchoiceState: ForkchoiceStateV1, payloadAttributes: Option[PayloadAttributesV1]): ForkchoiceUpdatedResponse
proc engine_getPayloadV1(payloadId: PayloadID): ExecutionPayloadV1 proc engine_getPayloadV1(payloadId: PayloadID): ExecutionPayloadV1
proc engine_exchangeTransitionConfigurationV1(transitionConfiguration: TransitionConfigurationV1): TransitionConfigurationV1

View File

@ -1,18 +1,19 @@
import import
std/options, std/options,
stint,
ethtypes ethtypes
export export
ethtypes ethtypes
type type
# https://github.com/ethereum/execution-apis/blob/v1.0.0-alpha.6/src/engine/specification.md#payloadattributesv1 # https://github.com/ethereum/execution-apis/blob/v1.0.0-alpha.7/src/engine/specification.md#payloadattributesv1
PayloadAttributesV1* = object PayloadAttributesV1* = object
timestamp*: Quantity timestamp*: Quantity
random*: FixedBytes[32] random*: FixedBytes[32]
suggestedFeeRecipient*: Address suggestedFeeRecipient*: Address
# https://github.com/ethereum/execution-apis/blob/v1.0.0-alpha.6/src/engine/specification.md#payloadstatusv1 # https://github.com/ethereum/execution-apis/blob/v1.0.0-alpha.7/src/engine/specification.md#payloadstatusv1
PayloadExecutionStatus* {.pure.} = enum PayloadExecutionStatus* {.pure.} = enum
valid = "VALID" valid = "VALID"
invalid = "INVALID" invalid = "INVALID"
@ -26,21 +27,27 @@ type
latestValidHash*: Option[BlockHash] latestValidHash*: Option[BlockHash]
validationError*: Option[string] validationError*: Option[string]
# https://github.com/ethereum/execution-apis/blob/v1.0.0-alpha.6/src/engine/specification.md#forkchoicestatev1 # https://github.com/ethereum/execution-apis/blob/v1.0.0-alpha.7/src/engine/specification.md#forkchoicestatev1
ForkchoiceStateV1* = object ForkchoiceStateV1* = object
headBlockHash*: BlockHash headBlockHash*: BlockHash
safeBlockHash*: BlockHash safeBlockHash*: BlockHash
finalizedBlockHash*: BlockHash finalizedBlockHash*: BlockHash
# https://github.com/ethereum/execution-apis/blob/v1.0.0-alpha.6/src/engine/specification.md#response-1 # https://github.com/ethereum/execution-apis/blob/v1.0.0-alpha.7/src/engine/specification.md#response-1
PayloadID* = FixedBytes[8] PayloadID* = FixedBytes[8]
ForkchoiceUpdatedResponse* = object ForkchoiceUpdatedResponse* = object
payloadStatus*: PayloadStatusV1 payloadStatus*: PayloadStatusV1
payloadId*: Option[PayloadID] payloadId*: Option[PayloadID]
# https://github.com/ethereum/execution-apis/blob/v1.0.0-alpha.7/src/engine/specification.md#transitionconfigurationv1
TransitionConfigurationV1* = object
terminalTotalDifficulty*: Uint256
terminalBlockHash*: BlockHash
terminalBlockNumber*: Quantity
const const
# https://github.com/ethereum/execution-apis/blob/v1.0.0-alpha.6/src/engine/specification.md#errors # https://github.com/ethereum/execution-apis/blob/v1.0.0-alpha.7/src/engine/specification.md#errors
engineApiParseError* = - 32700 engineApiParseError* = - 32700
engineApiInvalidRequest* = -32600 engineApiInvalidRequest* = -32600
engineApiMethodNotFound* = -32601 engineApiMethodNotFound* = -32601

View File

@ -203,7 +203,7 @@ type
TypedTransaction* = distinct seq[byte] TypedTransaction* = distinct seq[byte]
# https://github.com/ethereum/execution-apis/blob/v1.0.0-alpha.6/src/engine/specification.md#executionpayloadv1 # https://github.com/ethereum/execution-apis/blob/v1.0.0-alpha.7/src/engine/specification.md#executionpayloadv1
ExecutionPayloadV1* = object ExecutionPayloadV1* = object
parentHash*: BlockHash parentHash*: BlockHash
feeRecipient*: Address feeRecipient*: Address