Skip to content

Commit

Permalink
Merge pull request #140 from rolfyone/v2-produce-block
Browse files Browse the repository at this point in the history
add GET `/eth/v2/validator/blocks/{slot}`
  • Loading branch information
mpetrunic authored May 10, 2021
2 parents 06df9bf + 6090f8b commit bc04c6c
Show file tree
Hide file tree
Showing 3 changed files with 70 additions and 1 deletion.
62 changes: 62 additions & 0 deletions apis/validator/block.v2.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
get:
tags:
- ValidatorRequiredApi
- Validator
operationId: "produceBlockV2"
summary: "Produce a new block, without signature."
description: |
Requests a beacon node to produce a valid block, which can then be signed by a validator.
Metadata in the response indicates the type of block produced, and the supported types of block
will be added to as forks progress.
parameters:
- name: slot
in: path
required: true
description: "The slot for which the block should be proposed."
schema:
$ref: "../../beacon-node-oapi.yaml#/components/schemas/Uint64"
- name: randao_reveal
in: query
required: true
description: "The validator's randao reveal value."
schema:
$ref: '../../beacon-node-oapi.yaml#/components/schemas/Signature'
- name: graffiti
in: query
required: false
description: "Arbitrary data validator wants to include in block."
schema:
$ref: '../../beacon-node-oapi.yaml#/components/schemas/Graffiti'
responses:
"200":
description: Success response
content:
application/json:
schema:
title: ProduceBlockV2Response
type: object
properties:
version:
type: string
enum: [ phase0, altair ]
example: "phase0"
data:
oneOf:
- $ref: '../../beacon-node-oapi.yaml#/components/schemas/BeaconBlock'
- $ref: "../../beacon-node-oapi.yaml#/components/schemas/Altair.BeaconBlock"
"400":
description: "Invalid block production request"
content:
application/json:
schema:
$ref: "../../beacon-node-oapi.yaml#/components/schemas/ErrorMessage"
examples:
InvalidRequest:
value:
code: 400
message: "Invalid request to produce a block"
"500":
$ref: '../../beacon-node-oapi.yaml#/components/responses/InternalError'
"503":
$ref: '../../beacon-node-oapi.yaml#/components/responses/CurrentlySyncing'
5 changes: 4 additions & 1 deletion apis/validator/block.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,10 @@ get:
- Validator
operationId: "produceBlock"
summary: "Produce a new block, without signature."
description: "Requests a beacon node to produce a valid block, which can then be signed by a validator."
description: |
Requests a beacon node to produce a valid block, which can then be signed by a validator.
__NOTE__: Supports only phase0 blocks.
parameters:
- name: slot
in: path
Expand Down
4 changes: 4 additions & 0 deletions beacon-node-oapi.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -120,6 +120,8 @@ paths:
$ref: "./apis/validator/duties/proposer.yaml"
/eth/v1/validator/blocks/{slot}:
$ref: "./apis/validator/block.yaml"
/eth/v2/validator/blocks/{slot}:
$ref: "./apis/validator/block.v2.yaml"
/eth/v1/validator/attestation_data:
$ref: "./apis/validator/attestation_data.yaml"
/eth/v1/validator/aggregate_attestation:
Expand Down Expand Up @@ -207,6 +209,8 @@ components:
$ref: './types/http.yaml#/IndexedErrorMessage'
Altair.SignedBeaconBlock:
$ref: './types/altair/block.yaml#/Altair/SignedBeaconBlock'
Altair.BeaconBlock:
$ref: './types/altair/block.yaml#/Altair/BeaconBlock'
Altair.BeaconState:
$ref: './types/altair/state.yaml#/Altair/BeaconState'
Altair.SyncCommitteeSubscription:
Expand Down

0 comments on commit bc04c6c

Please sign in to comment.