Skip to content

Commit 30f0568

Browse files
mcdeerolfyonenflaig
authored
Validator identities endpoint. (#452)
In support of #449. Co-authored-by: Paul Harris <[email protected]> Co-authored-by: Nico Flaig <[email protected]>
1 parent 203410d commit 30f0568

File tree

4 files changed

+90
-0
lines changed

4 files changed

+90
-0
lines changed

CHANGES.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ There are likely to be descriptions etc outside of the list below, but new query
1414
| [#448](https://github.com/ethereum/beacon-APIs/pull/448) `POST /eth/v2/beacon/pool/attestations` added | | | | | |
1515
| [#448](https://github.com/ethereum/beacon-APIs/pull/448) `GET /eth/v2/beacon/pool/attester_slashings` added | | | | | |
1616
| [#448](https://github.com/ethereum/beacon-APIs/pull/448) `POST /eth/v2/beacon/pool/attester_slashings` added | | | | | |
17+
| [#452](https://github.com/ethereum/beacon-APIs/pull/452) `POST /eth/v1/beacon/states/{state_id}/validator_identities` added | | | | | |
1718
| [#456](https://github.com/ethereum/beacon-APIs/pull/456) `POST /eth/v2/validator/aggregate_and_proofs` added | | | | | |
1819

1920

Lines changed: 71 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,71 @@
1+
post:
2+
operationId: "postStateValidatorIdentities"
3+
summary: "Get validator identities from state"
4+
description: |
5+
Returns filterable list of validators identities.
6+
7+
Identities will be returned for all indices or public keys that match known validators. If an index or public key does not
8+
match any known validator, no identity will be returned but this will not cause an error. There are no guarantees for the
9+
returned data in terms of ordering.
10+
11+
Depending on `Accept` header data can be returned either as JSON or as bytes serialized by SSZ.
12+
tags:
13+
- Beacon
14+
parameters:
15+
- name: state_id
16+
in: path
17+
$ref: '../../../beacon-node-oapi.yaml#/components/parameters/StateId'
18+
requestBody:
19+
description: "An array of values, with each value either a hex encoded public key (any bytes48 with 0x prefix) or a validator index."
20+
required: false
21+
content:
22+
application/json:
23+
schema:
24+
type: array
25+
uniqueItems: true
26+
items:
27+
description: "Either hex encoded public key (any bytes48 with 0x prefix) or validator index"
28+
type: string
29+
responses:
30+
"200":
31+
description: Success
32+
content:
33+
application/json:
34+
schema:
35+
title: PostStateValidatorIdentitiesResponse
36+
type: object
37+
required: [execution_optimistic, finalized, data]
38+
properties:
39+
execution_optimistic:
40+
$ref: "../../../beacon-node-oapi.yaml#/components/schemas/ExecutionOptimistic"
41+
finalized:
42+
$ref: "../../../beacon-node-oapi.yaml#/components/schemas/Finalized"
43+
data:
44+
type: array
45+
items:
46+
$ref: '../../../beacon-node-oapi.yaml#/components/schemas/ValidatorIdentityResponse'
47+
application/octet-stream:
48+
schema:
49+
description: "SSZ serialized results. Use Accept header to choose this response type"
50+
"400":
51+
description: "Invalid state ID or malformed request"
52+
content:
53+
application/json:
54+
schema:
55+
$ref: "../../../beacon-node-oapi.yaml#/components/schemas/ErrorMessage"
56+
example:
57+
code: 400
58+
message: "Invalid state ID: current"
59+
"404":
60+
description: "State not found"
61+
content:
62+
application/json:
63+
schema:
64+
$ref: "../../../beacon-node-oapi.yaml#/components/schemas/ErrorMessage"
65+
example:
66+
code: 404
67+
message: "State not found"
68+
"406":
69+
$ref: "../../../beacon-node-oapi.yaml#/components/responses/NotAcceptable"
70+
"500":
71+
$ref: '../../../beacon-node-oapi.yaml#/components/responses/InternalError'

beacon-node-oapi.yaml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -81,6 +81,8 @@ paths:
8181
$ref: "./apis/beacon/states/validator.yaml"
8282
/eth/v1/beacon/states/{state_id}/validator_balances:
8383
$ref: "./apis/beacon/states/validator_balances.yaml"
84+
/eth/v1/beacon/states/{state_id}/validator_identities:
85+
$ref: "./apis/beacon/states/validator_identities.yaml"
8486
/eth/v1/beacon/states/{state_id}/committees:
8587
$ref: "./apis/beacon/states/committee.yaml"
8688
/eth/v1/beacon/states/{state_id}/sync_committees:
@@ -239,6 +241,8 @@ components:
239241
$ref: './types/api.yaml#/ValidatorResponse'
240242
ValidatorBalanceResponse:
241243
$ref: './types/api.yaml#/ValidatorBalanceResponse'
244+
ValidatorIdentityResponse:
245+
$ref: './types/api.yaml#/ValidatorIdentityResponse'
242246
ValidatorStatus:
243247
$ref: './types/api.yaml#/ValidatorStatus'
244248
Committee:

types/api.yaml

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,20 @@ ValidatorBalanceResponse:
4545
$ref: "./primitive.yaml#/Gwei"
4646
description: "Current validator balance in gwei."
4747

48+
ValidatorIdentityResponse:
49+
type: object
50+
required: [index, pubkey, activation_epoch]
51+
properties:
52+
index:
53+
$ref: './primitive.yaml#/Uint64'
54+
description: "Index of validator in validator registry."
55+
pubkey:
56+
$ref: './primitive.yaml#/Pubkey'
57+
description: "Public key of validator."
58+
activation_epoch:
59+
$ref: "./primitive.yaml#/Uint64"
60+
description: "Epoch when validator activated. 'FAR_FUTURE_EPOCH' if not activated"
61+
4862
ValidatorStatus:
4963
description: |
5064
Possible statuses:

0 commit comments

Comments
 (0)