Skip to content

Commit 09f1acd

Browse files
authored
Merge branch 'master' into sync_committee_rewards
2 parents 6aba243 + d3e6aad commit 09f1acd

File tree

5 files changed

+237
-3
lines changed

5 files changed

+237
-3
lines changed

.github/workflows/main.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ jobs:
99
steps:
1010
- uses: actions/checkout@v2
1111
- uses: actions/setup-node@v2
12-
- run: npm i -g @apidevtools/swagger-cli@4 @redocly/cli
12+
- run: npm i -g @apidevtools/swagger-cli@4 @redocly/cli@1.0.0-beta.111
1313

1414
- name: Lint spec
1515
run: redocly lint ./beacon-node-oapi.yaml
Lines changed: 67 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,67 @@
1+
post:
2+
operationId: getAttestationsRewards
3+
summary: Get attestations rewards
4+
description: Retrieve attestation reward info for validators specified by array of public keys or validator index. If no array is provided, return reward info for every validator.
5+
tags:
6+
- Beacon
7+
- Rewards
8+
- Experimental
9+
parameters:
10+
- name: epoch
11+
in: path
12+
required: true
13+
description: "The epoch to get rewards info from"
14+
schema:
15+
$ref: "../../../beacon-node-oapi.yaml#/components/schemas/Uint64"
16+
requestBody:
17+
description: "An array of either hex encoded public key (any bytes48 with 0x prefix) or validator index"
18+
required: false
19+
content:
20+
application/json:
21+
schema:
22+
type: array
23+
uniqueItems: true
24+
items:
25+
description: "Either hex encoded public key (any bytes48 with 0x prefix) or validator index"
26+
type: string
27+
responses:
28+
"200":
29+
description: "Success"
30+
content:
31+
application/json:
32+
schema:
33+
title: GetAttestationsRewardsResponse
34+
type: object
35+
properties:
36+
execution_optimistic:
37+
$ref: "../../../beacon-node-oapi.yaml#/components/schemas/ExecutionOptimistic"
38+
finalized:
39+
$ref: "../../../beacon-node-oapi.yaml#/components/schemas/Finalized"
40+
data:
41+
type: array
42+
$ref: "../../../beacon-node-oapi.yaml#/components/schemas/AttestationsRewards"
43+
44+
"400":
45+
description: "Invalid get attestations rewards request"
46+
content:
47+
application/json:
48+
schema:
49+
$ref: "../../../beacon-node-oapi.yaml#/components/schemas/ErrorMessage"
50+
examples:
51+
InvalidRequest:
52+
value:
53+
code: 400
54+
message: "Invalid request to retrieve attestations rewards info"
55+
"404":
56+
description: "Epoch not known or required data not available"
57+
content:
58+
application/json:
59+
schema:
60+
$ref: "../../../beacon-node-oapi.yaml#/components/schemas/ErrorMessage"
61+
examples:
62+
InvalidRequest:
63+
value:
64+
code: 404
65+
message: "Epoch not known or required data not available"
66+
"500":
67+
$ref: "../../../beacon-node-oapi.yaml#/components/responses/InternalError"

apis/beacon/rewards/blocks.yaml

Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
get:
2+
operationId: getBlockRewards
3+
summary: Get block rewards
4+
description: Retrieve block reward info for a single block
5+
tags:
6+
- Beacon
7+
- Rewards
8+
- Experimental
9+
parameters:
10+
- name: block_id
11+
in: path
12+
required: true
13+
$ref: '../../../beacon-node-oapi.yaml#/components/parameters/BlockId'
14+
responses:
15+
"200":
16+
description: "Success"
17+
content:
18+
application/json:
19+
schema:
20+
title: GetBlockRewardsResponse
21+
type: object
22+
properties:
23+
execution_optimistic:
24+
$ref: "../../../beacon-node-oapi.yaml#/components/schemas/ExecutionOptimistic"
25+
finalized:
26+
$ref: "../../../beacon-node-oapi.yaml#/components/schemas/Finalized"
27+
data:
28+
$ref: '../../../beacon-node-oapi.yaml#/components/schemas/BlockRewards'
29+
"400":
30+
description: "Invalid get block rewards request"
31+
content:
32+
application/json:
33+
schema:
34+
$ref: "../../../beacon-node-oapi.yaml#/components/schemas/ErrorMessage"
35+
examples:
36+
InvalidRequest:
37+
value:
38+
code: 400
39+
message: "Invalid request to retrieve block rewards info"
40+
"404":
41+
description: "Block or required state not found"
42+
content:
43+
application/json:
44+
schema:
45+
$ref: "../../../beacon-node-oapi.yaml#/components/schemas/ErrorMessage"
46+
examples:
47+
InvalidRequest:
48+
value:
49+
code: 404
50+
message: "Block or required state not found"
51+
"500":
52+
$ref: "../../../beacon-node-oapi.yaml#/components/responses/InternalError"

beacon-node-oapi.yaml

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,8 @@ tags:
5757
- name: Rewards
5858
description: Endpoints to query rewards and penalties for validators.
5959
- name: Experimental
60-
description: Endpoints that are not stable or fully implemented by each client
60+
description: Endpoints that are not stable or fully implemented by each client.
61+
6162
paths:
6263

6364
/eth/v1/beacon/genesis:
@@ -96,6 +97,10 @@ paths:
9697
$ref: "./apis/beacon/blocks/attestations.yaml"
9798
/eth/v1/beacon/rewards/sync_committee/{block_id}:
9899
$ref: "./apis/beacon/rewards/sync_committee.yaml"
100+
/eth/v1/beacon/rewards/blocks/{block_id}:
101+
$ref: "./apis/beacon/rewards/blocks.yaml"
102+
/eth/v1/beacon/rewards/attestations/{epoch}:
103+
$ref: "./apis/beacon/rewards/attestations.yaml"
99104
/eth/v1/beacon/blinded_blocks/{block_id}:
100105
$ref: "./apis/beacon/blocks/blinded_block.yaml"
101106
/eth/v1/beacon/light_client/bootstrap/{block_root}:
@@ -322,6 +327,10 @@ components:
322327
$ref: './types/fork_choice.yaml#/ExtraData'
323328
SyncCommitteeRewards:
324329
$ref: './types/rewards.yaml#/SyncCommitteeRewards'
330+
BlockRewards:
331+
$ref: './types/rewards.yaml#/BlockRewards'
332+
AttestationsRewards:
333+
$ref: './types/rewards.yaml#/AttestationsRewards'
325334

326335
parameters:
327336
StateId:

types/rewards.yaml

Lines changed: 107 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,4 +15,110 @@ SyncCommitteeRewards:
1515
allOf:
1616
- $ref: "./primitive.yaml#/Int64"
1717
- example: 2000
18-
- description: "sync committee reward in gwei for the validator"
18+
- description: "sync committee reward in gwei for the validator"
19+
20+
AttestationsRewards:
21+
description: "Rewards info for attestations"
22+
type: array
23+
items:
24+
properties:
25+
ideal_rewards:
26+
type: array
27+
items:
28+
$ref: ./rewards.yaml#/IdealAttestationRewards
29+
total_rewards:
30+
type: array
31+
items:
32+
$ref: ./rewards.yaml#/AttestationRewards
33+
34+
AttestationRewards:
35+
type: object
36+
description: "Rewards info for a single attestation"
37+
required: ["validator_index", "head", "target", "source"]
38+
properties:
39+
validator_index:
40+
allOf:
41+
- $ref: "./primitive.yaml#/Uint64"
42+
- example: 0
43+
- description: "one entry for every validator based on their attestations in the epoch"
44+
head:
45+
allOf:
46+
- $ref: "./primitive.yaml#/Int64"
47+
- example: 2000
48+
- description: "attester's reward for head vote in gwei"
49+
target:
50+
allOf:
51+
- $ref: "./primitive.yaml#/Int64"
52+
- example: 2000
53+
- description: "attester's reward for target vote in gwei"
54+
source:
55+
allOf:
56+
- $ref: "./primitive.yaml#/Int64"
57+
- example: 4000
58+
- description: "attester's reward for source vote in gwei"
59+
inclusion_delay:
60+
allOf:
61+
- $ref: "./primitive.yaml#/Uint64"
62+
- example: 2000
63+
- description: "attester's inclusion_delay reward in gwei (phase0 only)"
64+
65+
IdealAttestationRewards:
66+
type: object
67+
description: "Ideal rewards info for a single attestation"
68+
required: ["effective_balance", "head", "target", "source"]
69+
properties:
70+
effective_balance:
71+
allOf:
72+
- $ref: "./primitive.yaml#/Uint64"
73+
- example: 1000000000
74+
- description: "validator's effective balance in gwei"
75+
head:
76+
allOf:
77+
- $ref: "./primitive.yaml#/Int64"
78+
- example: 2500
79+
- description: "Ideal attester's reward for head vote in gwei"
80+
target:
81+
allOf:
82+
- $ref: "./primitive.yaml#/Int64"
83+
- example: 5000
84+
- description: "Ideal attester's reward for target vote in gwei"
85+
source:
86+
allOf:
87+
- $ref: "./primitive.yaml#/Int64"
88+
- example: 5000
89+
- description: "Ideal attester's reward for source vote in gwei"
90+
91+
BlockRewards:
92+
type: object
93+
description: "Rewards info for a single block"
94+
properties:
95+
proposer_index:
96+
allOf:
97+
- $ref: "./primitive.yaml#/Uint64"
98+
- example: 123
99+
- description: "proposer of the block, the proposer index who receives these rewards"
100+
total:
101+
allOf:
102+
- $ref: "./primitive.yaml#/Uint64"
103+
- example: 123
104+
- description: "total block reward in gwei, equal to attestations + sync_aggregate + proposer_slashings + attester_slashings"
105+
attestations:
106+
allOf:
107+
- $ref: "./primitive.yaml#/Uint64"
108+
- example: 123
109+
- description: "block reward component due to included attestations in gwei"
110+
sync_aggregate:
111+
allOf:
112+
- $ref: "./primitive.yaml#/Uint64"
113+
- example: 123
114+
- description: "block reward component due to included sync_aggregate in gwei"
115+
proposer_slashings:
116+
allOf:
117+
- $ref: "./primitive.yaml#/Uint64"
118+
- example: 123
119+
- description: "block reward component due to included proposer_slashings in gwei"
120+
attester_slashings:
121+
allOf:
122+
- $ref: "./primitive.yaml#/Uint64"
123+
- example: 123
124+
- description: "block reward component due to included attester_slashings in gwei"

0 commit comments

Comments
 (0)