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

proof of concept altair blocks #129

Merged
merged 9 commits into from
Apr 7, 2021
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
49 changes: 49 additions & 0 deletions apis/beacon/blocks/block.v2.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
get:
operationId: getBlockV2
summary: Get block
description: Retrieves block details for given block id.
tags:
- Beacon
parameters:
- name: block_id
in: path
$ref: '../../../beacon-node-oapi.yaml#/components/parameters/BlockId'
responses:
"200":
description: "Successful response"
content:
application/json:
schema:
title: GetBlockV2Response
type: object
properties:
version:
type: string
enum: [phase0, altair]
example: "phase0"
data:
oneOf:
- $ref: "../../../beacon-node-oapi.yaml#/components/schemas/SignedBeaconBlock"
- $ref: "../../../beacon-node-oapi.yaml#/components/schemas/Altair.SignedBeaconBlock"
"400":
description: "The block ID supplied could not be parsed"
content:
application/json:
schema:
allOf:
- $ref: "../../../beacon-node-oapi.yaml#/components/schemas/ErrorMessage"
- example:
code: 400
message: "Invalid block ID: current"
"404":
description: "Block not found"
content:
application/json:
schema:
allOf:
- $ref: "../../../beacon-node-oapi.yaml#/components/schemas/ErrorMessage"
- example:
code: 404
message: "Block not found"
"500":
$ref: "../../../beacon-node-oapi.yaml#/components/responses/InternalError"
8 changes: 6 additions & 2 deletions beacon-node-oapi.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,10 @@ info:
description: |
API specification for the beacon node, which enables users to query and participate in Ethereum 2.0 phase 0 beacon chain.

All requests by default send and receive JSON, and as such should have either or both of the "Content-Type: application/json"
All requests by default send and receive JSON, and as such should have either or both of the "Content-Type: application/json"
and "Accept: application/json" headers.
In addition, some request can return data in the SSZ format.
To indicate that SSZ data is required in response to a request the header "Accept: application/octet-stream" should be sent.
To indicate that SSZ data is required in response to a request the header "Accept: application/octet-stream" should be sent.
Note that only a subset of requests can respond with data in SSZ format; these are noted in each individual request.
version: "Dev - Eth2Spec v1.0.1"
contact:
Expand Down Expand Up @@ -69,6 +69,8 @@ paths:
$ref: "./apis/beacon/blocks/blocks.yaml"
/eth/v1/beacon/blocks/{block_id}:
$ref: "./apis/beacon/blocks/block.yaml"
/eth/v2/beacon/blocks/{block_id}:
$ref: "./apis/beacon/blocks/block.v2.yaml"
/eth/v1/beacon/blocks/{block_id}/root:
$ref: "./apis/beacon/blocks/root.yaml"
/eth/v1/beacon/blocks/{block_id}/attestations:
Expand Down Expand Up @@ -199,6 +201,8 @@ components:
$ref: './types/http.yaml#/ErrorMessage'
IndexedErrorMessage:
$ref: './types/http.yaml#/IndexedErrorMessage'
Altair.SignedBeaconBlock:
$ref: './types/altair/block.yaml#/Altair/SignedBeaconBlock'

parameters:
StateId:
Expand Down
75 changes: 75 additions & 0 deletions types/altair/block.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,75 @@
Altair:
BeaconBlockCommon:
# An abstract object to collect the common fields between the BeaconBlockHeader and the BeaconBlock objects
type: object
properties:
slot:
allOf:
- $ref: "../primitive.yaml#/Uint64"
- description: "The slot to which this block corresponds."
proposer_index:
allOf:
- $ref: '../primitive.yaml#/Uint64'
- description: "Index of validator in validator registry."
parent_root:
allOf:
- $ref: '../primitive.yaml#/Root'
- description: "The signing merkle root of the parent `BeaconBlock`."
state_root:
allOf:
- $ref: '../primitive.yaml#/Root'
- description: "The tree hash merkle root of the `BeaconState` for the `BeaconBlock`."

BeaconBlockBody:
type: object
description: "The [`BeaconBlockBody`](https://github.com/ethereum/eth2.0-specs/blob/v1.1.0-alpha.1/specs/altair/beacon-chain.md#beaconblockbody) object from the Eth2.0 Altair 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: './sync_aggregate.yaml#/Altair/SyncAggregate'

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

SignedBeaconBlock:
type: object
description: "The [`SignedBeaconBlock`](https://github.com/ethereum/eth2.0-specs/blob/v1.1.0-alpha.1/specs/altair/beacon-chain.md#signedbeaconblock) object envelope from the Eth2.0 Altair spec."
properties:
message:
$ref: "#/Altair/BeaconBlock"
signature:
$ref: "../primitive.yaml#/Signature"
12 changes: 12 additions & 0 deletions types/altair/sync_aggregate.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
Altair:
SyncAggregate:
type: object
description: "The [`SyncAggregate`](https://github.com/ethereum/eth2.0-specs/blob/v1.1.0-alpha.1/specs/altair/beacon-chain.md#syncaggregate) object from the Eth2.0 Altair spec."
properties:
sync_committee_bits:
type: string
pattern: "^0x[a-fA-F0-9]+$"
example: "0x01"
description: "Aggregation bits of sync"
sync_committee_signature:
$ref: '../primitive.yaml#/Signature'
1 change: 1 addition & 0 deletions types/http.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -123,3 +123,4 @@ IndexedErrorMessage:
description: "Message describing error"
type: string
example: "invalid signature"