Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add sync_committee_rewards #262

Merged
merged 17 commits into from
Nov 22, 2022
Merged
Show file tree
Hide file tree
Changes from 15 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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"
8 changes: 8 additions & 0 deletions beacon-node-oapi.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,10 @@ tags:
Minimal set of endpoints to enable a working validator implementation.

[Checkout validator flow](./validator-flow.md) to learn how to use this api.
- name: Rewards
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 @@ -90,6 +94,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/blinded_blocks/{block_id}:
$ref: "./apis/beacon/blocks/blinded_block.yaml"
/eth/v1/beacon/light_client/bootstrap/{block_root}:
Expand Down Expand Up @@ -314,6 +320,8 @@ components:
$ref: './types/fork_choice.yaml#/Node'
ExtraData:
$ref: './types/fork_choice.yaml#/ExtraData'
SyncCommitteeRewards:
$ref: './types/rewards.yaml#/SyncCommitteeRewards'

parameters:
StateId:
Expand Down
4 changes: 4 additions & 0 deletions types/primitive.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,10 @@ Uint256:
type: string
example: "1"

Int64:
type: string
example: "1"

DependentRoot:
allOf:
- $ref: "./primitive.yaml#/Root"
Expand Down
18 changes: 18 additions & 0 deletions types/rewards.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
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"