From bdc2d12a48ae56b10ffcb9f5400debfeec1e49ed Mon Sep 17 00:00:00 2001 From: Mark Mackey Date: Tue, 20 Sep 2022 15:04:58 -0500 Subject: [PATCH] Endpoint for EIP-4881 Deposit Contract Snapshot --- apis/beacon/deposit_snapshot.yaml | 34 +++++++++++++++++++++++++++++++ beacon-node-oapi.yaml | 4 ++++ types/api.yaml | 19 +++++++++++++++++ 3 files changed, 57 insertions(+) create mode 100644 apis/beacon/deposit_snapshot.yaml diff --git a/apis/beacon/deposit_snapshot.yaml b/apis/beacon/deposit_snapshot.yaml new file mode 100644 index 00000000..0951a63f --- /dev/null +++ b/apis/beacon/deposit_snapshot.yaml @@ -0,0 +1,34 @@ + get: + operationId: getDepositSnapshot + summary: "Get Deposit Tree Snapshot" + description: | + Retrieve [EIP-4881](https://eips.ethereum.org/EIPS/eip-4881) Deposit Tree Snapshot. + Depending on `Accept` header it can be returned either as json or as bytes serialzed by SSZ + tags: + - Beacon + responses: + "200": + description: Success + content: + application/json: + schema: + type: object + title: GetDepositSnapshotResponse + properties: + data: + $ref: '../../beacon-node-oapi.yaml#/components/schemas/DepositSnapshotResponse' + application/octet-stream: + schema: + description: "SSZ serialized block bytes. Use Accept header to choose this response type" + "404": + description: "No Finalized Snapshot Available" + content: + application/json: + schema: + allOf: + - $ref: "../../beacon-node-oapi.yaml#/components/schemas/ErrorMessage" + - example: + code: 404 + message: "No Finalized Snapshot Available" + "500": + $ref: '../../beacon-node-oapi.yaml#/components/responses/InternalError' diff --git a/beacon-node-oapi.yaml b/beacon-node-oapi.yaml index 97792ead..548e4520 100644 --- a/beacon-node-oapi.yaml +++ b/beacon-node-oapi.yaml @@ -89,6 +89,8 @@ paths: /eth/v1/beacon/blocks/{block_id}/attestations: $ref: "./apis/beacon/blocks/attestations.yaml" + /eth/v1/beacon/deposit_snapshot: + $ref: "./apis/beacon/deposit_snapshot.yaml" /eth/v1/beacon/pool/attestations: $ref: "./apis/beacon/pool/attestations.yaml" /eth/v1/beacon/pool/attester_slashings: @@ -168,6 +170,8 @@ components: $ref: './types/state.yaml#/BeaconState' BeaconBlock: $ref: './types/block.yaml#/BeaconBlock' + DepositSnapshotResponse: + $ref: './types/api.yaml#/DepositSnapshotResponse' SignedBeaconBlock: $ref: './types/block.yaml#/SignedBeaconBlock' SignedBeaconBlockHeader: diff --git a/types/api.yaml b/types/api.yaml index 444de725..61c50ff7 100644 --- a/types/api.yaml +++ b/types/api.yaml @@ -1,5 +1,24 @@ # API specific types +DepositSnapshotResponse: + type: object + properties: + finalized: + type: array + items: + allOf: + - $ref: './primitive.yaml#/Root' + minItems: 3 + maxItems: 3 + deposit_root: + $ref: './primitive.yaml#/Root' + deposit_count: + $ref: './primitive.yaml#/Uint64' + execution_block_hash: + $ref: './primitive.yaml#/Root' + execution_block_height: + $ref: './primitive.yaml#/Uint64' + ValidatorResponse: type: object properties: