Skip to content

Commit

Permalink
Add new endpoint to fetch fork choice context from a client. (#232)
Browse files Browse the repository at this point in the history
Co-authored-by: Enrico Del Fante <enrico.delfante@consensys.net>
Co-authored-by: Michael Sproul <micsproul@gmail.com>
  • Loading branch information
3 people authored Oct 29, 2022
1 parent c071f04 commit ff89656
Show file tree
Hide file tree
Showing 3 changed files with 72 additions and 0 deletions.
31 changes: 31 additions & 0 deletions apis/debug/fork_choice.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
get:
operationId: getDebugForkChoice
summary: Get fork choice array
description: Retrieves all current fork choice context.
tags:
- Debug
responses:
"200":
description: Success
content:
application/json:
schema:
title: GetForkChoiceResponse
type: object
description: "Debugging context of fork choice"
required: [justified_checkpoint, finalized_checkpoint]
properties:
justified_checkpoint:
$ref: '../../beacon-node-oapi.yaml#/components/schemas/Checkpoint'
finalized_checkpoint:
$ref: '../../beacon-node-oapi.yaml#/components/schemas/Checkpoint'
fork_choice_nodes:
type: array
description: "Fork choice nodes"
minItems: 1
items:
$ref: "../../beacon-node-oapi.yaml#/components/schemas/Node"
extra_data:
$ref: "../../beacon-node-oapi.yaml#/components/schemas/ExtraData"
"500":
$ref: "../../beacon-node-oapi.yaml#/components/responses/InternalError"
6 changes: 6 additions & 0 deletions beacon-node-oapi.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -117,6 +117,8 @@ paths:
$ref: './apis/debug/heads.yaml'
/eth/v2/debug/beacon/heads:
$ref: './apis/debug/heads.v2.yaml'
/eth/v1/debug/fork_choice:
$ref: './apis/debug/fork_choice.yaml'

/eth/v1/node/identity:
$ref: "./apis/node/identity.yaml"
Expand Down Expand Up @@ -292,6 +294,10 @@ components:
example: "phase0"
SignedValidatorRegistration:
$ref: './types/registration.yaml#/SignedValidatorRegistration'
Node:
$ref: './types/fork_choice.yaml#/Node'
ExtraData:
$ref: './types/fork_choice.yaml#/ExtraData'

parameters:
StateId:
Expand Down
35 changes: 35 additions & 0 deletions types/fork_choice.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
Node:
type: object
description: "fork choice node attributes"
properties:
slot:
allOf:
- $ref: './primitive.yaml#/Uint64'
- description: "The slot to which this block corresponds."
block_root:
allOf:
- $ref: './primitive.yaml#/Root'
- description: "The signing merkle root of the `BeaconBlock`."
parent_root:
allOf:
- $ref: './primitive.yaml#/Root'
- description: "The signing merkle root of the parent `BeaconBlock`."
justified_epoch:
$ref: './primitive.yaml#/Uint64'
finalized_epoch:
$ref: './primitive.yaml#/Uint64'
weight:
$ref: './primitive.yaml#/Uint64'
validity:
type: string
enum: [VALID, INVALID, OPTIMISTIC]
execution_block_hash:
allOf:
- $ref: './primitive.yaml#/Root'
- description: "The `block_hash` from the `execution_payload` of the `BeaconBlock`"
extra_data:
$ref: '#/ExtraData'

ExtraData:
type: object
description: 'Optional extra data that clients may provide, which could differ from client to client.'

0 comments on commit ff89656

Please sign in to comment.