Skip to content

Commit 7e14ed6

Browse files
committed
Validator identities endpoint.
In support of ethereum#449.
1 parent 3132da1 commit 7e14ed6

File tree

3 files changed

+87
-0
lines changed

3 files changed

+87
-0
lines changed
Lines changed: 69 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,69 @@
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 either hex encoded public keys (any bytes48 with 0x prefix) or validator indices"
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+
"500":
69+
$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
@@ -75,6 +75,8 @@ paths:
7575
$ref: "./apis/beacon/states/validator.yaml"
7676
/eth/v1/beacon/states/{state_id}/validator_balances:
7777
$ref: "./apis/beacon/states/validator_balances.yaml"
78+
/eth/v1/beacon/states/{state_id}/validator_identities:
79+
$ref: "./apis/beacon/states/validator_identities.yaml"
7880
/eth/v1/beacon/states/{state_id}/committees:
7981
$ref: "./apis/beacon/states/committee.yaml"
8082
/eth/v1/beacon/states/{state_id}/sync_committees:
@@ -223,6 +225,8 @@ components:
223225
$ref: './types/api.yaml#/ValidatorResponse'
224226
ValidatorBalanceResponse:
225227
$ref: './types/api.yaml#/ValidatorBalanceResponse'
228+
ValidatorIdentityResponse:
229+
$ref: './types/api.yaml#/ValidatorIdentityResponse'
226230
ValidatorStatus:
227231
$ref: './types/api.yaml#/ValidatorStatus'
228232
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)