Skip to content

Commit

Permalink
Add sync_committee_rewards (#262)
Browse files Browse the repository at this point in the history
Co-authored-by: Paul Harris <paul.harris@consensys.net>
Co-authored-by: navie <naviechan@gmail.com>
  • Loading branch information
3 people committed Nov 22, 2022
1 parent b8610fe commit 94105bb
Show file tree
Hide file tree
Showing 3 changed files with 87 additions and 1 deletion.
62 changes: 62 additions & 0 deletions apis/beacon/rewards/sync_committee.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
post:
operationId: getSyncCommitteeRewards
summary: Get sync committee rewards
description: Retrieves rewards info for sync committee members specified by array of public keys or validator index. If no array is provided, return reward info for every committee member.
tags:
- Beacon
- Rewards
- Experimental
parameters:
- name: block_id
in: path
required: true
example: "head"
$ref: '../../../beacon-node-oapi.yaml#/components/parameters/BlockId'
requestBody:
description: "An array of either hex encoded public key (any bytes48 with 0x prefix) or 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: GetSyncCommitteeRewardsResponse
type: object
properties:
execution_optimistic:
$ref: "../../../beacon-node-oapi.yaml#/components/schemas/ExecutionOptimistic"
finalized:
$ref: "../../../beacon-node-oapi.yaml#/components/schemas/Finalized"
data:
$ref: '../../../beacon-node-oapi.yaml#/components/schemas/SyncCommitteeRewards'
"400":
description: "Invalid get sync committee rewards request"
content:
application/json:
schema:
$ref: "../../../beacon-node-oapi.yaml#/components/schemas/ErrorMessage"
examples:
InvalidRequest:
value:
code: 400
message: "Invalid request to retrieve sync committee rewards info"
"404":
description: "Block not found"
content:
application/json:
schema:
$ref: "../../../beacon-node-oapi.yaml#/components/schemas/ErrorMessage"
example:
code: 404
message: "Block not found"
"500":
$ref: "../../../beacon-node-oapi.yaml#/components/responses/InternalError"
5 changes: 5 additions & 0 deletions beacon-node-oapi.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,7 @@ tags:
description: Endpoints to query rewards and penalties for validators.
- name: Experimental
description: Endpoints that are not stable or fully implemented by each client.

paths:

/eth/v1/beacon/genesis:
Expand Down Expand Up @@ -94,6 +95,8 @@ paths:
$ref: "./apis/beacon/blocks/root.yaml"
/eth/v1/beacon/blocks/{block_id}/attestations:
$ref: "./apis/beacon/blocks/attestations.yaml"
/eth/v1/beacon/rewards/sync_committee/{block_id}:
$ref: "./apis/beacon/rewards/sync_committee.yaml"
/eth/v1/beacon/deposit_snapshot:
$ref: "./apis/beacon/deposit_snapshot.yaml"
/eth/v1/beacon/rewards/blocks/{block_id}:
Expand Down Expand Up @@ -326,6 +329,8 @@ components:
$ref: './types/fork_choice.yaml#/Node'
ExtraData:
$ref: './types/fork_choice.yaml#/ExtraData'
SyncCommitteeRewards:
$ref: './types/rewards.yaml#/SyncCommitteeRewards'
BlockRewards:
$ref: './types/rewards.yaml#/BlockRewards'
AttestationsRewards:
Expand Down
21 changes: 20 additions & 1 deletion types/rewards.yaml
Original file line number Diff line number Diff line change
@@ -1,3 +1,22 @@
SyncCommitteeRewards:
description: "Rewards info for sync committee members"
type: array
items:
type: object
description: "Rewards info for a single sync committee member"
required: ["validator_index", "reward"]
properties:
validator_index:
allOf:
- $ref: "./primitive.yaml#/Uint64"
- example: 0
- description: "one entry for every validator participating in the sync committee"
reward:
allOf:
- $ref: "./primitive.yaml#/Int64"
- example: 2000
- description: "sync committee reward in gwei for the validator"

AttestationsRewards:
description: "Rewards info for attestations"
type: array
Expand Down Expand Up @@ -102,4 +121,4 @@ BlockRewards:
allOf:
- $ref: "./primitive.yaml#/Uint64"
- example: 123
- description: "block reward component due to included attester_slashings in gwei"
- description: "block reward component due to included attester_slashings in gwei"

0 comments on commit 94105bb

Please sign in to comment.