Skip to content

Commit

Permalink
Validator identities endpoint. (#452)
Browse files Browse the repository at this point in the history
In support of #449.

Co-authored-by: Paul Harris <[email protected]>
Co-authored-by: Nico Flaig <[email protected]>
  • Loading branch information
3 people authored Sep 24, 2024
1 parent 203410d commit 30f0568
Show file tree
Hide file tree
Showing 4 changed files with 90 additions and 0 deletions.
1 change: 1 addition & 0 deletions CHANGES.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ There are likely to be descriptions etc outside of the list below, but new query
| [#448](https://github.com/ethereum/beacon-APIs/pull/448) `POST /eth/v2/beacon/pool/attestations` added | | | | | |
| [#448](https://github.com/ethereum/beacon-APIs/pull/448) `GET /eth/v2/beacon/pool/attester_slashings` added | | | | | |
| [#448](https://github.com/ethereum/beacon-APIs/pull/448) `POST /eth/v2/beacon/pool/attester_slashings` added | | | | | |
| [#452](https://github.com/ethereum/beacon-APIs/pull/452) `POST /eth/v1/beacon/states/{state_id}/validator_identities` added | | | | | |
| [#456](https://github.com/ethereum/beacon-APIs/pull/456) `POST /eth/v2/validator/aggregate_and_proofs` added | | | | | |


Expand Down
71 changes: 71 additions & 0 deletions apis/beacon/states/validator_identities.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
post:
operationId: "postStateValidatorIdentities"
summary: "Get validator identities from state"
description: |
Returns filterable list of validators identities.
Identities will be returned for all indices or public keys that match known validators. If an index or public key does not
match any known validator, no identity will be returned but this will not cause an error. There are no guarantees for the
returned data in terms of ordering.
Depending on `Accept` header data can be returned either as JSON or as bytes serialized by SSZ.
tags:
- Beacon
parameters:
- name: state_id
in: path
$ref: '../../../beacon-node-oapi.yaml#/components/parameters/StateId'
requestBody:
description: "An array of values, with each value either a hex encoded public key (any bytes48 with 0x prefix) or a validator index."
required: false
content:
application/json:
schema:
type: array
uniqueItems: true
items:
description: "Either hex encoded public key (any bytes48 with 0x prefix) or validator index"
type: string
responses:
"200":
description: Success
content:
application/json:
schema:
title: PostStateValidatorIdentitiesResponse
type: object
required: [execution_optimistic, finalized, data]
properties:
execution_optimistic:
$ref: "../../../beacon-node-oapi.yaml#/components/schemas/ExecutionOptimistic"
finalized:
$ref: "../../../beacon-node-oapi.yaml#/components/schemas/Finalized"
data:
type: array
items:
$ref: '../../../beacon-node-oapi.yaml#/components/schemas/ValidatorIdentityResponse'
application/octet-stream:
schema:
description: "SSZ serialized results. Use Accept header to choose this response type"
"400":
description: "Invalid state ID or malformed request"
content:
application/json:
schema:
$ref: "../../../beacon-node-oapi.yaml#/components/schemas/ErrorMessage"
example:
code: 400
message: "Invalid state ID: current"
"404":
description: "State not found"
content:
application/json:
schema:
$ref: "../../../beacon-node-oapi.yaml#/components/schemas/ErrorMessage"
example:
code: 404
message: "State not found"
"406":
$ref: "../../../beacon-node-oapi.yaml#/components/responses/NotAcceptable"
"500":
$ref: '../../../beacon-node-oapi.yaml#/components/responses/InternalError'
4 changes: 4 additions & 0 deletions beacon-node-oapi.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,8 @@ paths:
$ref: "./apis/beacon/states/validator.yaml"
/eth/v1/beacon/states/{state_id}/validator_balances:
$ref: "./apis/beacon/states/validator_balances.yaml"
/eth/v1/beacon/states/{state_id}/validator_identities:
$ref: "./apis/beacon/states/validator_identities.yaml"
/eth/v1/beacon/states/{state_id}/committees:
$ref: "./apis/beacon/states/committee.yaml"
/eth/v1/beacon/states/{state_id}/sync_committees:
Expand Down Expand Up @@ -239,6 +241,8 @@ components:
$ref: './types/api.yaml#/ValidatorResponse'
ValidatorBalanceResponse:
$ref: './types/api.yaml#/ValidatorBalanceResponse'
ValidatorIdentityResponse:
$ref: './types/api.yaml#/ValidatorIdentityResponse'
ValidatorStatus:
$ref: './types/api.yaml#/ValidatorStatus'
Committee:
Expand Down
14 changes: 14 additions & 0 deletions types/api.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,20 @@ ValidatorBalanceResponse:
$ref: "./primitive.yaml#/Gwei"
description: "Current validator balance in gwei."

ValidatorIdentityResponse:
type: object
required: [index, pubkey, activation_epoch]
properties:
index:
$ref: './primitive.yaml#/Uint64'
description: "Index of validator in validator registry."
pubkey:
$ref: './primitive.yaml#/Pubkey'
description: "Public key of validator."
activation_epoch:
$ref: "./primitive.yaml#/Uint64"
description: "Epoch when validator activated. 'FAR_FUTURE_EPOCH' if not activated"

ValidatorStatus:
description: |
Possible statuses:
Expand Down

0 comments on commit 30f0568

Please sign in to comment.