From 6090f8b9827dca5580734fe4a786150b82a97015 Mon Sep 17 00:00:00 2001 From: Paul Harris Date: Mon, 10 May 2021 08:29:03 +1000 Subject: [PATCH] Add the ability to produce an unsigned altair block - added `/eth/v2/validator/blocks/{slot}` route - added a note on the v1 endpoint that it only supports phase0 block production Added a note in the description of v2 to indicate the list of supported blocks will change over time as forks progress, hopefully setting the expectation that we're not creating a new api each time a fork happens. --- apis/validator/block.v2.yaml | 62 ++++++++++++++++++++++++++++++++++++ apis/validator/block.yaml | 5 ++- beacon-node-oapi.yaml | 4 +++ 3 files changed, 70 insertions(+), 1 deletion(-) create mode 100644 apis/validator/block.v2.yaml diff --git a/apis/validator/block.v2.yaml b/apis/validator/block.v2.yaml new file mode 100644 index 00000000..f0a4fb53 --- /dev/null +++ b/apis/validator/block.v2.yaml @@ -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' \ No newline at end of file diff --git a/apis/validator/block.yaml b/apis/validator/block.yaml index 40759c12..4e0c1119 100644 --- a/apis/validator/block.yaml +++ b/apis/validator/block.yaml @@ -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 diff --git a/beacon-node-oapi.yaml b/beacon-node-oapi.yaml index ed7824da..4cc3a1df 100644 --- a/beacon-node-oapi.yaml +++ b/beacon-node-oapi.yaml @@ -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: @@ -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: