add state root endpoint
This commit is contained in:
parent
8a936ef387
commit
2d522dc3a4
|
@ -0,0 +1,17 @@
|
|||
get:
|
||||
operationId: "getStateRoot"
|
||||
summary: "Get state SSZ HashTreeRoot"
|
||||
description: "Calculates HashTreeRoot for state with given 'stateId'. If stateId is root, same value will be returned."
|
||||
tags:
|
||||
- Beacon
|
||||
parameters:
|
||||
- name: stateId
|
||||
$ref: '../../../beacon-node-oapi.yaml#/components/parameters/StateId'
|
||||
responses:
|
||||
"200":
|
||||
description: Success
|
||||
content:
|
||||
application/json:
|
||||
schema:
|
||||
$ref: '../../../beacon-node-oapi.yaml#/components/schemas/Root'
|
||||
|
|
@ -32,6 +32,9 @@ paths:
|
|||
|
||||
/v1/beacon/genesis:
|
||||
$ref: "./apis/beacon/genesis.yaml"
|
||||
/v1/beacon/states/{stateId}/root:
|
||||
$ref: "./apis/beacon/states/root.yaml"
|
||||
|
||||
# /v1/beacon/fork:
|
||||
# $ref: "./apis/beacon/fork.yaml#/single"
|
||||
# /v1/beacon/fork/stream:
|
||||
|
@ -69,6 +72,8 @@ paths:
|
|||
|
||||
components:
|
||||
schemas:
|
||||
BeaconState:
|
||||
$ref: './types/state.yaml#/BeaconState'
|
||||
BeaconBlock:
|
||||
$ref: './types/block.yaml#/schemas/BeaconBlock'
|
||||
SignedBeaconBlock:
|
||||
|
@ -105,6 +110,11 @@ components:
|
|||
$ref: './types/primitive.yaml#/schemas/Root'
|
||||
Signature:
|
||||
$ref: './types/primitive.yaml#/schemas/Signature'
|
||||
|
||||
parameters:
|
||||
StateId:
|
||||
$ref: './params/index.yaml#/StateId'
|
||||
|
||||
responses:
|
||||
InvalidRequest:
|
||||
$ref: './types/http.yaml#/responses/InvalidRequest'
|
||||
|
|
|
@ -42,6 +42,7 @@
|
|||
url: "https://petstore.swagger.io/v2/swagger.json",
|
||||
dom_id: '#swagger-ui',
|
||||
deepLinking: true,
|
||||
showExtensions: true,
|
||||
presets: [
|
||||
SwaggerUIBundle.presets.apis,
|
||||
SwaggerUIStandalonePreset
|
||||
|
|
|
@ -0,0 +1,9 @@
|
|||
StateId:
|
||||
name: stateId
|
||||
in: path
|
||||
required: true
|
||||
schema:
|
||||
type: string
|
||||
description: |
|
||||
State identifier.
|
||||
Can be one of: "head" (canonical head in node's view), "genesis", "finalized", "justified", \<slot\>, \<stateRoot\>.
|
183
types/state.yaml
183
types/state.yaml
|
@ -1,92 +1,91 @@
|
|||
schemas:
|
||||
BeaconState:
|
||||
type: object
|
||||
description: "The [`BeaconState`](https://github.com/ethereum/eth2.0-specs/blob/v0.11.1/specs/phase0/beacon-chain.md#beaconblock) object from the Eth2.0 spec."
|
||||
properties:
|
||||
genesis_time:
|
||||
$ref: "./primitive.yaml#/schemas/Uint64"
|
||||
genesis_validators_root:
|
||||
$ref: "./primitive.yaml#/schemas/Root"
|
||||
slot:
|
||||
$ref: "./primitive.yaml#/schemas/Uint64"
|
||||
fork:
|
||||
$ref: "./misc.yaml#/schemas/Fork"
|
||||
latest_block_header:
|
||||
$ref: "./block.yaml#/schemas/BeaconBlockHeader"
|
||||
block_roots:
|
||||
type: array
|
||||
items:
|
||||
allOf:
|
||||
- $ref: './primitive.yaml#/schemas/Root'
|
||||
minItems: 8192
|
||||
maxItems: 8192
|
||||
state_roots:
|
||||
type: array
|
||||
items:
|
||||
allOf:
|
||||
- $ref: './primitive.yaml#/schemas/Root'
|
||||
minItems: 8192
|
||||
maxItems: 8192
|
||||
historical_roots:
|
||||
type: array
|
||||
items:
|
||||
allOf:
|
||||
- $ref: './primitive.yaml#/schemas/Root'
|
||||
maxItems: 16777216
|
||||
eth1_data:
|
||||
$ref: "./eth1.yaml#/schemas/Eth1Data"
|
||||
eth1_data_votes:
|
||||
type: array
|
||||
items:
|
||||
allOf:
|
||||
- $ref: './eth1.yaml#/schemas/Eth1Data'
|
||||
maxItems: 1024
|
||||
eth1_deposit_index:
|
||||
$ref: "./primitive.yaml#/schemas/Uint64"
|
||||
validators:
|
||||
type: array
|
||||
items:
|
||||
allOf:
|
||||
- $ref: './validator.yaml#/schemas/Validator'
|
||||
balances:
|
||||
type: array
|
||||
description: "Validator balances in gwei"
|
||||
items:
|
||||
allOf:
|
||||
- $ref: './primitive.yaml#/schemas/Uint64'
|
||||
randao_mixes:
|
||||
type: array
|
||||
items:
|
||||
allOf:
|
||||
- $ref: './primitive.yaml#/schemas/Root'
|
||||
minItems: 65536
|
||||
maxItems: 65536
|
||||
slashings:
|
||||
type: array
|
||||
description: "Per-epoch sums of slashed effective balances"
|
||||
items:
|
||||
allOf:
|
||||
- $ref: './primitive.yaml#/schemas/Uint64'
|
||||
minItems: 8192
|
||||
maxItems: 8192
|
||||
previous_epoch_attestations:
|
||||
type: array
|
||||
items:
|
||||
allOf:
|
||||
- $ref: './attestation.yaml#/schemas/PendingAttestation'
|
||||
current_epoch_attestations:
|
||||
type: array
|
||||
items:
|
||||
allOf:
|
||||
- $ref: './attestation.yaml#/schemas/PendingAttestation'
|
||||
justification_bits:
|
||||
type: string
|
||||
format: byte
|
||||
pattern: "^0x[a-fA-F0-9]+$"
|
||||
description: "Bit set for every recent justified epoch"
|
||||
previous_justified_checkpoint:
|
||||
$ref: "./misc.yaml#/schemas/Checkpoint"
|
||||
current_justified_checkpoint:
|
||||
$ref: "./misc.yaml#/schemas/Checkpoint"
|
||||
finalized_checkpoint:
|
||||
$ref: "./misc.yaml#/schemas/Checkpoint"
|
||||
BeaconState:
|
||||
type: object
|
||||
description: "The [`BeaconState`](https://github.com/ethereum/eth2.0-specs/blob/v0.11.1/specs/phase0/beacon-chain.md#beaconblock) object from the Eth2.0 spec."
|
||||
properties:
|
||||
genesis_time:
|
||||
$ref: "./primitive.yaml#/schemas/Uint64"
|
||||
genesis_validators_root:
|
||||
$ref: "./primitive.yaml#/schemas/Root"
|
||||
slot:
|
||||
$ref: "./primitive.yaml#/schemas/Uint64"
|
||||
fork:
|
||||
$ref: "./misc.yaml#/schemas/Fork"
|
||||
latest_block_header:
|
||||
$ref: "./block.yaml#/schemas/BeaconBlockHeader"
|
||||
block_roots:
|
||||
type: array
|
||||
items:
|
||||
allOf:
|
||||
- $ref: './primitive.yaml#/schemas/Root'
|
||||
minItems: 8192
|
||||
maxItems: 8192
|
||||
state_roots:
|
||||
type: array
|
||||
items:
|
||||
allOf:
|
||||
- $ref: './primitive.yaml#/schemas/Root'
|
||||
minItems: 8192
|
||||
maxItems: 8192
|
||||
historical_roots:
|
||||
type: array
|
||||
items:
|
||||
allOf:
|
||||
- $ref: './primitive.yaml#/schemas/Root'
|
||||
maxItems: 16777216
|
||||
eth1_data:
|
||||
$ref: "./eth1.yaml#/schemas/Eth1Data"
|
||||
eth1_data_votes:
|
||||
type: array
|
||||
items:
|
||||
allOf:
|
||||
- $ref: './eth1.yaml#/schemas/Eth1Data'
|
||||
maxItems: 1024
|
||||
eth1_deposit_index:
|
||||
$ref: "./primitive.yaml#/schemas/Uint64"
|
||||
validators:
|
||||
type: array
|
||||
items:
|
||||
allOf:
|
||||
- $ref: './validator.yaml#/schemas/Validator'
|
||||
balances:
|
||||
type: array
|
||||
description: "Validator balances in gwei"
|
||||
items:
|
||||
allOf:
|
||||
- $ref: './primitive.yaml#/schemas/Uint64'
|
||||
randao_mixes:
|
||||
type: array
|
||||
items:
|
||||
allOf:
|
||||
- $ref: './primitive.yaml#/schemas/Root'
|
||||
minItems: 65536
|
||||
maxItems: 65536
|
||||
slashings:
|
||||
type: array
|
||||
description: "Per-epoch sums of slashed effective balances"
|
||||
items:
|
||||
allOf:
|
||||
- $ref: './primitive.yaml#/schemas/Uint64'
|
||||
minItems: 8192
|
||||
maxItems: 8192
|
||||
previous_epoch_attestations:
|
||||
type: array
|
||||
items:
|
||||
allOf:
|
||||
- $ref: './attestation.yaml#/schemas/PendingAttestation'
|
||||
current_epoch_attestations:
|
||||
type: array
|
||||
items:
|
||||
allOf:
|
||||
- $ref: './attestation.yaml#/schemas/PendingAttestation'
|
||||
justification_bits:
|
||||
type: string
|
||||
format: byte
|
||||
pattern: "^0x[a-fA-F0-9]+$"
|
||||
description: "Bit set for every recent justified epoch"
|
||||
previous_justified_checkpoint:
|
||||
$ref: "./misc.yaml#/schemas/Checkpoint"
|
||||
current_justified_checkpoint:
|
||||
$ref: "./misc.yaml#/schemas/Checkpoint"
|
||||
finalized_checkpoint:
|
||||
$ref: "./misc.yaml#/schemas/Checkpoint"
|
||||
|
|
Loading…
Reference in New Issue