Clean up debug/heads v2 types (#5859)
This commit is contained in:
parent
b7026a683a
commit
9aabca6a64
|
@ -72,8 +72,11 @@ proc installDebugApiHandlers*(router: var RestRouter, node: BeaconNode) =
|
|||
"/eth/v2/debug/beacon/heads") do () -> RestApiResponse:
|
||||
RestApiResponse.jsonResponse(
|
||||
node.dag.heads.mapIt(
|
||||
(root: it.root, slot: it.slot,
|
||||
execution_optimistic: not it.executionValid)
|
||||
RestChainHeadV2(
|
||||
root: it.root,
|
||||
slot: it.slot,
|
||||
execution_optimistic: not it.executionValid
|
||||
)
|
||||
)
|
||||
)
|
||||
|
||||
|
|
|
@ -122,6 +122,7 @@ RestJson.useDefaultSerializationFor(
|
|||
RestBeaconStatesFinalityCheckpoints,
|
||||
RestBlockHeader,
|
||||
RestBlockHeaderInfo,
|
||||
RestChainHeadV2,
|
||||
RestCommitteeSubscription,
|
||||
RestContributionAndProof,
|
||||
RestDepositContract,
|
||||
|
|
|
@ -13,6 +13,12 @@ import
|
|||
|
||||
export chronos, client, rest_types, eth2_rest_serialization
|
||||
|
||||
proc getDebugChainHeadsV2*(): RestResponse[GetDebugChainHeadsV2Response] {.
|
||||
rest, endpoint: "/eth/v2/debug/beacon/heads",
|
||||
meth: MethodGet.}
|
||||
## https://ethereum.github.io/beacon-APIs/#/Beacon/getDebugChainHeadsV2
|
||||
|
||||
|
||||
proc getStateV2Plain*(state_id: StateIdent): RestPlainResponse {.
|
||||
rest, endpoint: "/eth/v2/debug/beacon/states/{state_id}",
|
||||
accept: preferSSZ,
|
||||
|
|
|
@ -263,9 +263,10 @@ type
|
|||
connected*: uint64
|
||||
disconnecting*: uint64
|
||||
|
||||
RestChainHead* = object
|
||||
RestChainHeadV2* = object
|
||||
root*: Eth2Digest
|
||||
slot*: Slot
|
||||
execution_optimistic*: bool
|
||||
|
||||
RestMetadata* = object
|
||||
seq_number*: string
|
||||
|
@ -541,7 +542,7 @@ type
|
|||
GetBlockHeaderResponse* = DataOptimisticAndFinalizedObject[RestBlockHeaderInfo]
|
||||
GetBlockHeadersResponse* = DataEnclosedObject[seq[RestBlockHeaderInfo]]
|
||||
GetBlockRootResponse* = DataOptimisticObject[RestRoot]
|
||||
GetDebugChainHeadsResponse* = DataEnclosedObject[seq[RestChainHead]]
|
||||
GetDebugChainHeadsV2Response* = DataEnclosedObject[seq[RestChainHeadV2]]
|
||||
GetDepositContractResponse* = DataEnclosedObject[RestDepositContract]
|
||||
GetDepositSnapshotResponse* = DataEnclosedObject[RestDepositSnapshot]
|
||||
GetEpochCommitteesResponse* = DataEnclosedObject[seq[RestBeaconStatesCommittees]]
|
||||
|
|
|
@ -449,7 +449,7 @@ proc validateMnemonic*(inputWords: string,
|
|||
|
||||
# TODO consider using a SecretString type for inputWords
|
||||
|
||||
let words = strutils.strip(inputWords.string.toNFKD).split(Whitespace)
|
||||
let words = strutils.strip(inputWords.toNFKD).split(Whitespace)
|
||||
if words.len < 12 or words.len > 24 or words.len mod 3 != 0:
|
||||
return false
|
||||
|
||||
|
|
Loading…
Reference in New Issue