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

Bellatrix and blinded blocks #194

Merged
merged 15 commits into from
Mar 28, 2022
Merged
Show file tree
Hide file tree
Changes from all 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
1 change: 1 addition & 0 deletions apis/beacon/blocks/attestations.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ get:
parameters:
- name: block_id
in: path
required: true
$ref: '../../../beacon-node-oapi.yaml#/components/parameters/BlockId'

responses:
Expand Down
45 changes: 45 additions & 0 deletions apis/beacon/blocks/blinded_blocks.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
post:
tags:
- Beacon
- ValidatorRequiredApi
summary: "Publish a signed block."
operationId: "publishBlindedBlock"
description: |
Instructs the beacon node to use the components of the `SignedBlindedBeaconBlock` to construct and publish a
`SignedBeaconBlock` by swapping out the `transactions_root` for the corresponding full list of `transactions`.
mpetrunic marked this conversation as resolved.
Show resolved Hide resolved
The beacon node should broadcast a newly constructed `SignedBeaconBlock` to the beacon network,
to be included in the beacon chain. The beacon node is not required to validate the signed
`BeaconBlock`, and a successful response (20X) only indicates that the broadcast has been
successful. The beacon node is expected to integrate the new block into its state, and
therefore validate the block internally, however blocks which fail the validation are still
broadcast but a different status code is returned (202). Pre-Bellatrix, this endpoint will accept
a `SignedBeaconBlock`.
requestBody:
description: "The `SignedBlindedBeaconBlock` object composed of `BlindedBeaconBlock` object (produced by beacon node) and validator signature."
required: true
content:
application/json:
schema:
oneOf:
- $ref: '../../../beacon-node-oapi.yaml#/components/schemas/SignedBeaconBlock'
- $ref: "../../../beacon-node-oapi.yaml#/components/schemas/Altair.SignedBeaconBlock"
- $ref: "../../../beacon-node-oapi.yaml#/components/schemas/Bellatrix.SignedBlindedBeaconBlock"
responses:
"200":
description: "The block was validated successfully and has been broadcast. It has also been integrated into the beacon node's database."
"202":
description: "The block failed validation, but was successfully broadcast anyway. It was not integrated into the beacon node's database."
"400":
description: "The `SignedBlindedBeaconBlock` object is invalid"
content:
application/json:
schema:
allOf:
- $ref: "../../../beacon-node-oapi.yaml#/components/schemas/ErrorMessage"
- example:
code: 400
message: "Invalid block: missing signature"
"500":
$ref: '../../../beacon-node-oapi.yaml#/components/responses/InternalError'
"503":
$ref: '../../../beacon-node-oapi.yaml#/components/responses/CurrentlySyncing'
4 changes: 3 additions & 1 deletion apis/beacon/blocks/block.v2.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ get:
parameters:
- name: block_id
in: path
required: true
$ref: '../../../beacon-node-oapi.yaml#/components/parameters/BlockId'
responses:
"200":
Expand All @@ -24,14 +25,15 @@ get:
properties:
version:
type: string
enum: [phase0, altair]
enum: [phase0, altair, bellatrix]
example: "phase0"
execution_optimistic:
$ref: "../../../beacon-node-oapi.yaml#/components/schemas/ExecutionOptimistic"
data:
oneOf:
- $ref: "../../../beacon-node-oapi.yaml#/components/schemas/SignedBeaconBlock"
- $ref: "../../../beacon-node-oapi.yaml#/components/schemas/Altair.SignedBeaconBlock"
- $ref: "../../../beacon-node-oapi.yaml#/components/schemas/Bellatrix.SignedBeaconBlock"
application/octet-stream:
schema:

Expand Down
9 changes: 8 additions & 1 deletion apis/beacon/blocks/block.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,14 @@ get:
parameters:
- name: block_id
in: path
$ref: '../../../beacon-node-oapi.yaml#/components/parameters/BlockId'
required: true
example: "head"
schema:
type: string
description: |
Block identifier.
Can be one of: "head" (canonical head in node's view), "genesis", "finalized", \<slot\>, \<hex encoded blockRoot with 0x prefix\>.

responses:
"200":
description: Success
Expand Down
1 change: 1 addition & 0 deletions apis/beacon/blocks/blocks.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ post:
oneOf:
- $ref: '../../../beacon-node-oapi.yaml#/components/schemas/SignedBeaconBlock'
- $ref: "../../../beacon-node-oapi.yaml#/components/schemas/Altair.SignedBeaconBlock"
- $ref: "../../../beacon-node-oapi.yaml#/components/schemas/Bellatrix.SignedBeaconBlock"
responses:
"200":
description: "The block was validated successfully and has been broadcast. It has also been integrated into the beacon node's database."
Expand Down
1 change: 1 addition & 0 deletions apis/beacon/blocks/header.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ get:
parameters:
- name: block_id
in: path
required: true
$ref: '../../../beacon-node-oapi.yaml#/components/parameters/BlockId'
responses:
"200":
Expand Down
9 changes: 8 additions & 1 deletion apis/beacon/blocks/root.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,14 @@ get:
parameters:
- name: block_id
in: path
$ref: '../../../beacon-node-oapi.yaml#/components/parameters/BlockId'
required: true
example: "head"
schema:
type: string
description: |
Block identifier.
Can be one of: "head" (canonical head in node's view), "genesis", "finalized", \<slot\>, \<hex encoded blockRoot with 0x prefix\>.

responses:
"200":
description: Success
Expand Down
3 changes: 2 additions & 1 deletion apis/debug/state.v2.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -25,14 +25,15 @@ get:
properties:
version:
type: string
enum: [ phase0, altair ]
enum: [ phase0, altair, bellatrix ]
example: "phase0"
execution_optimistic:
$ref: "../../beacon-node-oapi.yaml#/components/schemas/ExecutionOptimistic"
data:
oneOf:
- $ref: '../../beacon-node-oapi.yaml#/components/schemas/BeaconState'
- $ref: "../../beacon-node-oapi.yaml#/components/schemas/Altair.BeaconState"
- $ref: "../../beacon-node-oapi.yaml#/components/schemas/Bellatrix.BeaconState"
application/octet-stream:
schema:
description: "SSZ serialized state bytes. Use Accept header to choose this response type"
Expand Down
66 changes: 66 additions & 0 deletions apis/validator/blinded_block.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
get:
tags:
- ValidatorRequiredApi
- Validator
operationId: "produceBlindedBlock"
summary: "Produce a new blinded block, without signature."
description: |
Requests a beacon node to produce a valid blinded block, which can then be signed by a validator.
A blinded block is a block with only a transactions root, rather than a full transactions list.

Metadata in the response indicates the type of block produced, and the supported types of block
will be added to as forks progress.

Pre-Bellatrix, this endpoint will return a `BeaconBlock`.
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: ProduceBlindedBlockResponse
type: object
properties:
version:
type: string
enum: [ phase0, altair, bellatrix ]
example: "bellatrix"
data:
oneOf:
- $ref: '../../beacon-node-oapi.yaml#/components/schemas/BeaconBlock'
- $ref: "../../beacon-node-oapi.yaml#/components/schemas/Altair.BeaconBlock"
- $ref: "../../beacon-node-oapi.yaml#/components/schemas/Bellatrix.BlindedBeaconBlock"
"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'
3 changes: 2 additions & 1 deletion apis/validator/block.v2.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -39,12 +39,13 @@ get:
properties:
version:
type: string
enum: [ phase0, altair ]
enum: [ phase0, altair, bellatrix ]
example: "phase0"
data:
oneOf:
- $ref: '../../beacon-node-oapi.yaml#/components/schemas/BeaconBlock'
- $ref: "../../beacon-node-oapi.yaml#/components/schemas/Altair.BeaconBlock"
- $ref: "../../beacon-node-oapi.yaml#/components/schemas/Bellatrix.BeaconBlock"
"400":
description: "Invalid block production request"
content:
Expand Down
18 changes: 16 additions & 2 deletions beacon-node-oapi.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,8 @@ paths:
$ref: "./apis/beacon/blocks/header.yaml"
/eth/v1/beacon/blocks:
$ref: "./apis/beacon/blocks/blocks.yaml"
/eth/v1/beacon/blinded_blocks:
$ref: "./apis/beacon/blocks/blinded_blocks.yaml"
/eth/v1/beacon/blocks/{block_id}:
$ref: "./apis/beacon/blocks/block.yaml"
/eth/v2/beacon/blocks/{block_id}:
Expand Down Expand Up @@ -129,7 +131,9 @@ paths:
/eth/v1/validator/blocks/{slot}:
$ref: "./apis/validator/block.yaml"
/eth/v2/validator/blocks/{slot}:
$ref: "./apis/validator/block.v2.yaml"
$ref: "./apis/validator/block.v2.yaml"
/eth/v1/validator/blinded_blocks/{slot}:
$ref: "./apis/validator/blinded_block.yaml"
/eth/v1/validator/attestation_data:
$ref: "./apis/validator/attestation_data.yaml"
/eth/v1/validator/aggregate_attestation:
Expand Down Expand Up @@ -245,6 +249,16 @@ components:
$ref: './types/altair/sync_committee.yaml#/Altair/SyncCommitteeByValidatorIndices'
ExecutionAddress:
$ref: './types/primitive.yaml#/ExecutionAddress'
Bellatrix.BeaconState:
$ref: './types/bellatrix/state.yaml#/Bellatrix/BeaconState'
Bellatrix.BeaconBlock:
$ref: './types/bellatrix/block.yaml#/Bellatrix/BeaconBlock'
Bellatrix.SignedBeaconBlock:
$ref: './types/bellatrix/block.yaml#/Bellatrix/SignedBeaconBlock'
Bellatrix.BlindedBeaconBlock:
$ref: './types/bellatrix/block.yaml#/Bellatrix/BlindedBeaconBlock'
Bellatrix.SignedBlindedBeaconBlock:
$ref: './types/bellatrix/block.yaml#/Bellatrix/SignedBlindedBeaconBlock'

parameters:
StateId:
Expand All @@ -267,5 +281,5 @@ components:
description: Required in response so client can deserialize returned json or ssz data more effectively.
schema:
type: string
enum: [phase0, altair]
enum: [phase0, altair, bellatrix]
example: "phase0"
2 changes: 1 addition & 1 deletion types/altair/state.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ Altair:
type: array
items:
allOf:
- $ref: '../primitive.yaml#/Root'
- $ref: '../primitive.yaml#/Bytes32'
minItems: 65536
maxItems: 65536
slashings:
Expand Down
90 changes: 90 additions & 0 deletions types/bellatrix/block.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,90 @@
Bellatrix:
BeaconBlockBodyCommon:
# An abstract object to collect the common fields between the BeaconBlockBody and the BlindedBeaconBlockBody objects
type: object
description: "The [`BeaconBlockBody`](https://github.com/ethereum/consensus-specs/blob/v1.1.9/specs/bellatrix/beacon-chain.md#beaconblockbody) object from the Eth2.0 Bellatrix spec."
properties:
randao_reveal:
allOf:
- $ref: '../primitive.yaml#/Signature'
- description: "The RanDAO reveal value provided by the validator."
eth1_data:
$ref: '../eth1.yaml#/Eth1Data'
graffiti:
type: string
pattern: "^0x[a-fA-F0-9]{64}$"
proposer_slashings:
type: array
items:
$ref: '../proposer_slashing.yaml#/ProposerSlashing'
attester_slashings:
type: array
items:
$ref: '../attester_slashing.yaml#/AttesterSlashing'
attestations:
type: array
items:
$ref: '../attestation.yaml#/Attestation'
deposits:
type: array
items:
$ref: '../deposit.yaml#/Deposit'
voluntary_exits:
type: array
items:
$ref: '../voluntary_exit.yaml#/SignedVoluntaryExit'
sync_aggregate:
$ref: '../altair/sync_aggregate.yaml#/Altair/SyncAggregate'

BeaconBlockBody:
allOf:
- $ref: '#/Bellatrix/BeaconBlockBodyCommon'
- type: object
properties:
execution_payload:
$ref: './execution_payload.yaml#/Bellatrix/ExecutionPayload'

BeaconBlock:
description: "The [`BeaconBlock`](https://github.com/ethereum/eth2.0-specs/blob/v1.1.9/specs/bellatrix/beacon-chain.md#beaconblock) object from the Eth2.0 Bellatrix spec."
allOf:
- $ref: '../altair/block.yaml#/Altair/BeaconBlockCommon'
- type: object
properties:
body:
$ref: '#/Bellatrix/BeaconBlockBody'

SignedBeaconBlock:
type: object
description: "The [`SignedBeaconBlock`](https://github.com/ethereum/eth2.0-specs/blob/v1.1.9/specs/bellatrix/beacon-chain.md#signedbeaconblock) object envelope from the Eth2.0 Bellatrix spec."
properties:
message:
$ref: "#/Bellatrix/BeaconBlock"
signature:
$ref: "../primitive.yaml#/Signature"

BlindedBeaconBlockBody:
description: "A variant of the [`BeaconBlockBody`](https://github.com/ethereum/consensus-specs/blob/v1.1.9/specs/bellatrix/beacon-chain.md#beaconblockbody) object from the Eth2.0 Bellatrix spec, which contains a transactions root rather than a full transactions list."
allOf:
- $ref: '#/Bellatrix/BeaconBlockBodyCommon'
- type: object
properties:
execution_payload_header:
$ref: './execution_payload.yaml#/Bellatrix/ExecutionPayloadHeader'

BlindedBeaconBlock:
description: "A variant of the the [`BeaconBlock`](https://github.com/ethereum/eth2.0-specs/blob/v1.1.9/specs/bellatrix/beacon-chain.md#beaconblock) object from the Eth2.0 Bellatrix spec, which contains a `BlindedBeaconBlockBody` rather than a `BeaconBlockBody`."
allOf:
- $ref: '../altair/block.yaml#/Altair/BeaconBlockCommon'
- type: object
properties:
body:
$ref: '#/Bellatrix/BlindedBeaconBlockBody'

SignedBlindedBeaconBlock:
type: object
description: "A variant of the the the [`SignedBeaconBlock`](https://github.com/ethereum/eth2.0-specs/blob/v1.1.9/specs/bellatrix/beacon-chain.md#signedbeaconblock) object envelope from the Eth2.0 Bellatrix spec, which contains a `BlindedBeaconBlock` rather than a `BeaconBlock`."
properties:
message:
$ref: "#/Bellatrix/BlindedBeaconBlock"
signature:
$ref: "../primitive.yaml#/Signature"
Loading