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
proc engine_newPayloadV1(payload: ExecutionPayloadV1): PayloadStatusV1
proc engine_forkchoiceUpdatedV1(forkchoiceState: ForkchoiceStateV1, payloadAttributes: Option[PayloadAttributesV1]): ForkchoiceUpdatedResponse
proc engine_getPayloadV1(payloadId: PayloadID): ExecutionPayloadV1
proc engine_exchangeTransitionConfigurationV1(transitionConfiguration: TransitionConfigurationV1): TransitionConfigurationV1

View File

@ -1,18 +1,19 @@
import
std/options,
stint,
ethtypes
export
ethtypes
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
timestamp*: Quantity
random*: FixedBytes[32]
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
valid = "VALID"
invalid = "INVALID"
@ -26,21 +27,27 @@ type
latestValidHash*: Option[BlockHash]
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
headBlockHash*: BlockHash
safeBlockHash*: 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]
ForkchoiceUpdatedResponse* = object
payloadStatus*: PayloadStatusV1
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
# 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
engineApiInvalidRequest* = -32600
engineApiMethodNotFound* = -32601

View File

@ -203,7 +203,7 @@ type
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
parentHash*: BlockHash
feeRecipient*: Address