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 3 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
43 changes: 43 additions & 0 deletions apis/beacon/blocks/blinded_blocks.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
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`
realbigsean 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)
realbigsean marked this conversation as resolved.
Show resolved Hide resolved

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/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'
3 changes: 2 additions & 1 deletion apis/beacon/blocks/block.v2.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -24,12 +24,13 @@ get:
properties:
version:
type: string
enum: [phase0, altair]
enum: [phase0, altair, bellatrix]
example: "phase0"
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
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
3 changes: 2 additions & 1 deletion apis/debug/state.v2.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -25,12 +25,13 @@ get:
properties:
version:
type: string
enum: [ phase0, altair ]
enum: [ phase0, altair, bellatrix ]
example: "phase0"
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
62 changes: 62 additions & 0 deletions apis/validator/blinded_block.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
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.
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: [ bellatrix ]
example: "bellatrix"
data:
oneOf:
- $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 @@ -127,7 +129,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/v2/validator/blinded_blocks/{slot}:
realbigsean marked this conversation as resolved.
Show resolved Hide resolved
$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 @@ -241,6 +245,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/BeaconBlock'
mpetrunic marked this conversation as resolved.
Show resolved Hide resolved
Bellatrix.SignedBlindedBeaconBlock:
$ref: './types/bellatrix/block.yaml#/Bellatrix/SignedBlindedBeaconBlock'

parameters:
StateId:
Expand All @@ -261,5 +275,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"
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"
49 changes: 49 additions & 0 deletions types/bellatrix/execution_payload.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
Bellatrix:
ExecutionPayloadCommon:
# An abstract object to collect the common fields between the ExecutionPayload and the ExecutionPayloadHeader objects.
type: object
description: "The [`ExecutionPayload`](https://github.com/ethereum/eth2.0-specs/blob/v1.1.9/specs/bellatrix) object from the Eth2.0 Bellatrix spec."
properties:
parent_hash:
$ref: '../primitive.yaml#/Root'
fee_recipient:
$ref: '../primitive.yaml#/ExecutionAddress'
state_root:
$ref: '../primitive.yaml#/Root'
receipts_root:
$ref: '../primitive.yaml#/Root'
logs_bloom:
$ref: '../primitive.yaml#/LogsBloom'
prev_randao:
$ref: '../primitive.yaml#/Root'
mpetrunic marked this conversation as resolved.
Show resolved Hide resolved
block_number:
$ref: '../primitive.yaml#/Uint64'
gas_limit:
$ref: '../primitive.yaml#/Uint64'
gas_used:
$ref: '../primitive.yaml#/Uint64'
timestamp:
$ref: '../primitive.yaml#/Uint64'
extra_data:
$ref: '../primitive.yaml#/ExtraData'
base_fee_per_gas:
$ref: '../primitive.yaml#/Uint256'
block_hash:
$ref: '../primitive.yaml#/Root'


ExecutionPayload:
allOf:
- $ref: '#/Bellatrix/ExecutionPayloadCommon'
- type: object
properties:
transactions:
$ref: './transactions.yaml#/Bellatrix/Transactions'

ExecutionPayloadHeader:
allOf:
- $ref: '#/Bellatrix/ExecutionPayloadCommon'
- type: object
properties:
transactions_root:
$ref: '../primitive.yaml#/Root'
Loading