From 4cc84845d510f47ade878c818d8df4185528dbc0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rados=C5=82aw=20Kapka?= Date: Tue, 19 Sep 2023 01:46:20 +0200 Subject: [PATCH] Move state endpoint to `beacon` namespace (#353) Co-authored-by: Paul Harris --- CHANGES.md | 12 ++++--- apis/beacon/states/state.yaml | 64 +++++++++++++++++++++++++++++++++++ apis/debug/state.v2.yaml | 1 + beacon-node-oapi.yaml | 2 ++ 4 files changed, 75 insertions(+), 4 deletions(-) create mode 100644 apis/beacon/states/state.yaml diff --git a/CHANGES.md b/CHANGES.md index 8919ce26..dfeadb98 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -7,14 +7,18 @@ These endpoints have been added or updated since the last release. There are likely to be descriptions etc outside of the list below, but new query parameters, changes to headers, new endpoints should be listed. -| Endpoint | [Lighthouse](https://github.com/sigp/lighthouse) | [Lodestar](https://github.com/ChainSafe/lodestar) | [Nimbus](https://github.com/status-im/nimbus-eth2) | [Prysm](https://github.com/prysmaticlabs/prysm) | [Teku](https://github.com/ConsenSys/teku) | -|---------------------------------------------------------------------------------------------------------------------------------------------|--------------------------------------------------|---------------------------------------------------|----------------------------------------------------|-------------------------------------------------|-------------------------------------------| +| Endpoint | [Lighthouse](https://github.com/sigp/lighthouse) | [Lodestar](https://github.com/ChainSafe/lodestar) | [Nimbus](https://github.com/status-im/nimbus-eth2) | [Prysm](https://github.com/prysmaticlabs/prysm) | [Teku](https://github.com/ConsenSys/teku) | +|-----------------------------------------------------------------------------------------------------------------------------|--------------------------------------------------|---------------------------------------------------|----------------------------------------------------|-------------------------------------------------|-------------------------------------------| +| [#353](https://github.com/ethereum/beacon-APIs/pull/353) `/eth/v1/beacon/states/{state_id}` added | | | | | | +| [#339](https://github.com/ethereum/beacon-APIs/pull/339) `POST /eth/v3/beacon/blocks` added | | | | | | The Following are no longer in the Standard API, removed since the latest version. -| Endpoint | [Lighthouse](https://github.com/sigp/lighthouse) | [Lodestar](https://github.com/ChainSafe/lodestar) | [Nimbus](https://github.com/status-im/nimbus-eth2) | [Prysm](https://github.com/prysmaticlabs/prysm) | [Teku](https://github.com/ConsenSys/teku) | -|----------------------------------------------------------------------------------------------------------|--------------------------------------------------|---------------------------------------------------|----------------------------------------------------|-------------------------------------------------|-------------------------------------------| +| Endpoint | [Lighthouse](https://github.com/sigp/lighthouse) | [Lodestar](https://github.com/ChainSafe/lodestar) | [Nimbus](https://github.com/status-im/nimbus-eth2) | [Prysm](https://github.com/prysmaticlabs/prysm) | [Teku](https://github.com/ConsenSys/teku) | +|--------------------------------------------------------------------------------------------------------------|--------------------------------------------------|---------------------------------------------------|----------------------------------------------------|-------------------------------------------------|-------------------------------------------| +| [#353](https://github.com/ethereum/beacon-APIs/pull/353) `/eth/v1/debug/beacon/states/{state_id}` deprecated | | | | | | +| [#339](https://github.com/ethereum/beacon-APIs/pull/339) `POST /eth/v2/beacon/*blocks` deprecated | | | | | | ## Version 2.4.1 diff --git a/apis/beacon/states/state.yaml b/apis/beacon/states/state.yaml new file mode 100644 index 00000000..d3b5644b --- /dev/null +++ b/apis/beacon/states/state.yaml @@ -0,0 +1,64 @@ +get: + operationId: "getState" + summary: "Get full BeaconState object" + description: | + Returns full BeaconState object for given stateId. + Depending on `Accept` header it can be returned either as json or as bytes serialized by SSZ + tags: + - Beacon + parameters: + - name: state_id + in: path + required: true + $ref: '../../../beacon-node-oapi.yaml#/components/parameters/StateId' + responses: + "200": + description: Success + headers: + Eth-Consensus-Version: + $ref: '../../../beacon-node-oapi.yaml#/components/headers/Eth-Consensus-Version' + content: + application/json: + schema: + title: GetStateV2Response + type: object + properties: + version: + type: string + enum: [ phase0, altair, bellatrix, capella, deneb ] + example: "phase0" + execution_optimistic: + $ref: "../../../beacon-node-oapi.yaml#/components/schemas/ExecutionOptimistic" + finalized: + $ref: "../../../beacon-node-oapi.yaml#/components/schemas/Finalized" + 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" + - $ref: "../../../beacon-node-oapi.yaml#/components/schemas/Capella.BeaconState" + - $ref: "../../../beacon-node-oapi.yaml#/components/schemas/Deneb.BeaconState" + application/octet-stream: + schema: + description: "SSZ serialized state bytes. Use Accept header to choose this response type" + "400": + description: "Invalid state ID" + content: + application/json: + schema: + $ref: "../../../beacon-node-oapi.yaml#/components/schemas/ErrorMessage" + example: + code: 400 + message: "Invalid state ID: current" + "404": + description: "State not found" + content: + application/json: + schema: + $ref: "../../../beacon-node-oapi.yaml#/components/schemas/ErrorMessage" + example: + code: 404 + message: "State not found" + "500": + $ref: '../../../beacon-node-oapi.yaml#/components/responses/InternalError' + diff --git a/apis/debug/state.v2.yaml b/apis/debug/state.v2.yaml index 8fd2058b..fd68f92b 100644 --- a/apis/debug/state.v2.yaml +++ b/apis/debug/state.v2.yaml @@ -1,6 +1,7 @@ get: operationId: "getStateV2" summary: "Get full BeaconState object" + deprecated: true description: | Returns full BeaconState object for given stateId. Depending on `Accept` header it can be returned either as json or as bytes serialized by SSZ diff --git a/beacon-node-oapi.yaml b/beacon-node-oapi.yaml index 03c36c00..0d03a74c 100644 --- a/beacon-node-oapi.yaml +++ b/beacon-node-oapi.yaml @@ -65,6 +65,8 @@ paths: /eth/v1/beacon/genesis: $ref: "./apis/beacon/genesis.yaml" + /eth/v1/beacon/states/{state_id}: + $ref: "./apis/beacon/states/state.yaml" /eth/v1/beacon/states/{state_id}/root: $ref: "./apis/beacon/states/root.yaml" /eth/v1/beacon/states/{state_id}/fork: