Skip to content

Commit

Permalink
Merge pull request #242 from michaelsproul/state-randao
Browse files Browse the repository at this point in the history
Endpoint for state RANDAO mix
  • Loading branch information
rolfyone authored Oct 11, 2022
2 parents 0cef092 + 6a99ff4 commit cc04d0e
Show file tree
Hide file tree
Showing 2 changed files with 69 additions and 0 deletions.
67 changes: 67 additions & 0 deletions apis/beacon/states/randao.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
get:
operationId: "getStateRandao"
summary: "Get the RANDAO mix for some epoch in a specified state."
description: |
Fetch the RANDAO mix for the requested epoch from the state identified by `state_id`.
If an epoch is not specified then the RANDAO mix for the state's current epoch will be returned.
By adjusting the `state_id` parameter you can query for any historic value of the RANDAO mix.
Ordinarily states from the same epoch will mutate the RANDAO mix for that epoch as blocks are
applied.
tags:
- Beacon
parameters:
- name: state_id
in: path
$ref: '../../../beacon-node-oapi.yaml#/components/parameters/StateId'
- name: epoch
description: "Epoch to fetch the RANDAO mix for. Default: state's current epoch."
in: query
required: false
allowEmptyValue: false
schema:
allOf:
- $ref: '../../../beacon-node-oapi.yaml#/components/schemas/Uint64'
- example: ""
responses:
"200":
description: Success
content:
application/json:
schema:
title: GetStateRandaoResponse
type: object
properties:
execution_optimistic:
$ref: "../../../beacon-node-oapi.yaml#/components/schemas/ExecutionOptimistic"
data:
type: object
properties:
randao:
allOf:
- $ref: '../../../beacon-node-oapi.yaml#/components/schemas/Root'
- description: RANDAO mix for requested epoch in state.
"400":
description: "Invalid state ID or epoch"
content:
application/json:
schema:
allOf:
- $ref: "../../../beacon-node-oapi.yaml#/components/schemas/ErrorMessage"
- example:
code: 400
message: "Epoch is out of range for the `randao_mixes` of the state"
"404":
description: "State not found"
content:
application/json:
schema:
allOf:
- $ref: "../../../beacon-node-oapi.yaml#/components/schemas/ErrorMessage"
example:
code: 404
message: "State not found"
"500":
$ref: '../../../beacon-node-oapi.yaml#/components/responses/InternalError'

2 changes: 2 additions & 0 deletions beacon-node-oapi.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,8 @@ paths:
$ref: "./apis/beacon/states/committee.yaml"
/eth/v1/beacon/states/{state_id}/sync_committees:
$ref: "./apis/beacon/states/sync_committees.yaml"
/eth/v1/beacon/states/{state_id}/randao:
$ref: "./apis/beacon/states/randao.yaml"
/eth/v1/beacon/headers:
$ref: "./apis/beacon/blocks/headers.yaml"
/eth/v1/beacon/headers/{block_id}:
Expand Down

0 comments on commit cc04d0e

Please sign in to comment.