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 broadcast_validation to block publishing #317

Merged
merged 3 commits into from
May 9, 2023
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
21 changes: 20 additions & 1 deletion apis/beacon/blocks/blinded_blocks.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,27 @@ post:
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`.
a `SignedBeaconBlock`. The broadcast behaviour may be adjusted via the `broadcast_validation`
query parameter.
parameters:
- name: broadcast_validation
in: query
required: false
description: |
Level of validation that must be applied to a block before it is broadcast.

Possible values:
- **`gossip`** (default): lightweight gossip checks only
- **`consensus`**: full consensus checks, including validation of all signatures and
blocks fields _except_ for the execution payload transactions.

If the block fails the requested level of a validation a 400 status MUST be returned
immediately and the block MUST NOT be broadcast to the network.

If validation succeeds, the block must still be fully verified before it is
incorporated into the state and a 20x status is returned to the caller.
schema:
$ref: '../../../beacon-node-oapi.yaml#/components/schemas/BroadcastValidation'
- in: header
schema:
$ref: '../../../beacon-node-oapi.yaml#/components/schemas/ConsensusVersion'
Expand Down
23 changes: 21 additions & 2 deletions apis/beacon/blocks/blocks.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,30 @@ post:
Instructs the beacon node to broadcast a newly signed beacon block to the beacon network,
to be included in the beacon chain. A success response (20x) indicates that the block
passed gossip validation and was successfully broadcast onto the network.
The beacon node is also expected to integrate the block into state, but may broadcast it
The beacon node is also expected to integrate the block into the state, but may broadcast it
before doing so, so as to aid timely delivery of the block. Should the block fail full
validation, a separate success response code (202) is used to indicate that the block was
successfully broadcast but failed integration.
successfully broadcast but failed integration. The broadcast behaviour may be adjusted via the
`broadcast_validation` query parameter.
parameters:
- name: broadcast_validation
in: query
required: false
description: |
Level of validation that must be applied to a block before it is broadcast.

Possible values:
- **`gossip`** (default): lightweight gossip checks only
- **`consensus`**: full consensus checks, including validation of all signatures and
blocks fields _except_ for the execution payload transactions.

If the block fails the requested level of a validation a 400 status MUST be returned
immediately and the block MUST NOT be broadcast to the network.

If validation succeeds, the block must still be fully verified before it is
incorporated into the state and a 20x status is returned to the caller.
schema:
$ref: '../../../beacon-node-oapi.yaml#/components/schemas/BroadcastValidation'
- in: header
schema:
$ref: '../../../beacon-node-oapi.yaml#/components/schemas/ConsensusVersion'
Expand Down
2 changes: 2 additions & 0 deletions beacon-node-oapi.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -207,6 +207,8 @@ components:
$ref: './types/state.yaml#/BeaconState'
BeaconBlock:
$ref: './types/block.yaml#/BeaconBlock'
BroadcastValidation:
$ref: './types/api.yaml#/BroadcastValidation'
DepositSnapshotResponse:
$ref: './types/api.yaml#/DepositSnapshotResponse'
SignedBeaconBlock:
Expand Down
5 changes: 5 additions & 0 deletions types/api.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -81,3 +81,8 @@ Committee:
description: "List of validator indices assigned to this committee"
items:
$ref: './primitive.yaml#/Uint64'

BroadcastValidation:
description: Level of validation that must be applied to a block before it is broadcast.
michaelsproul marked this conversation as resolved.
Show resolved Hide resolved
type: string
enum: [gossip, consensus]