-
Notifications
You must be signed in to change notification settings - Fork 175
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Update attestation APIs to support EIP-7549 (#448)
* update attestation APIs to support EIP-7549 * fix attestations array shcema * fix one of array item schemas * use anyOf instead of oneOf * bump attestations apis to v2 * add change log entries * refactoring * add consensus version header to POST apis parameters * update spec version * fix typos * rebase master * update indexed attestation spec link * update changes log * add new line * Review PR * fixing reviews * Fix Attestation field order * Correct committee_bits example * Fix required properties ordering --------- Co-authored-by: Nico Flaig <[email protected]>
- Loading branch information
1 parent
5152163
commit 41cc574
Showing
12 changed files
with
297 additions
and
27 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,60 @@ | ||
get: | ||
operationId: getBlockAttestationsV2 | ||
summary: Get block attestations | ||
description: Retrieves attestation included in requested block. | ||
tags: | ||
- Beacon | ||
parameters: | ||
- name: block_id | ||
in: path | ||
required: true | ||
$ref: '../../../beacon-node-oapi.yaml#/components/parameters/BlockId' | ||
responses: | ||
"200": | ||
description: Success | ||
headers: | ||
Eth-Consensus-Version: | ||
$ref: '../../../beacon-node-oapi.yaml#/components/headers/Eth-Consensus-Version' | ||
content: | ||
application/json: | ||
schema: | ||
title: GetBlockAttestationsV2Response | ||
type: object | ||
required: [version, execution_optimistic, finalized, data] | ||
properties: | ||
version: | ||
type: string | ||
enum: [phase0, altair, bellatrix, capella, deneb, electra] | ||
example: "phase0" | ||
execution_optimistic: | ||
$ref: "../../../beacon-node-oapi.yaml#/components/schemas/ExecutionOptimistic" | ||
finalized: | ||
$ref: "../../../beacon-node-oapi.yaml#/components/schemas/Finalized" | ||
data: | ||
anyOf: | ||
- type: array | ||
items: | ||
$ref: '../../../beacon-node-oapi.yaml#/components/schemas/Attestation' | ||
- type: array | ||
items: | ||
$ref: '../../../beacon-node-oapi.yaml#/components/schemas/Electra.Attestation' | ||
"400": | ||
description: "The block ID supplied could not be parsed" | ||
content: | ||
application/json: | ||
schema: | ||
$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: | ||
$ref: "../../../beacon-node-oapi.yaml#/components/schemas/ErrorMessage" | ||
example: | ||
code: 404 | ||
message: "Block not found" | ||
"500": | ||
$ref: "../../../beacon-node-oapi.yaml#/components/responses/InternalError" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,96 @@ | ||
get: | ||
operationId: getPoolAttestationsV2 | ||
summary: Get attestations from operations pool | ||
description: Retrieves attestations known by the node but not necessarily incorporated into any block | ||
parameters: | ||
- name: slot | ||
in: query | ||
required: false | ||
schema: | ||
$ref: '../../../beacon-node-oapi.yaml#/components/schemas/Uint64' | ||
- name: committee_index | ||
in: query | ||
required: false | ||
schema: | ||
$ref: '../../../beacon-node-oapi.yaml#/components/schemas/Uint64' | ||
tags: | ||
- Beacon | ||
responses: | ||
"200": | ||
description: Successful response | ||
headers: | ||
Eth-Consensus-Version: | ||
$ref: '../../../beacon-node-oapi.yaml#/components/headers/Eth-Consensus-Version' | ||
content: | ||
application/json: | ||
schema: | ||
title: GetPoolAttestationsV2Response | ||
type: object | ||
required: [version, data] | ||
properties: | ||
version: | ||
type: string | ||
enum: [phase0, altair, bellatrix, capella, deneb, electra] | ||
example: "phase0" | ||
data: | ||
anyOf: | ||
- type: array | ||
items: | ||
$ref: '../../../beacon-node-oapi.yaml#/components/schemas/Attestation' | ||
- type: array | ||
items: | ||
$ref: '../../../beacon-node-oapi.yaml#/components/schemas/Electra.Attestation' | ||
"400": | ||
description: "The slot or committee index could not be parsed" | ||
content: | ||
application/json: | ||
schema: | ||
$ref: "../../../beacon-node-oapi.yaml#/components/schemas/ErrorMessage" | ||
example: | ||
code: 400 | ||
message: "Invalid slot: current" | ||
"500": | ||
$ref: '../../../beacon-node-oapi.yaml#/components/responses/InternalError' | ||
|
||
post: | ||
operationId: submitPoolAttestationsV2 | ||
summary: Submit Attestation objects to node | ||
description: | | ||
Submits Attestation objects to the node. Each attestation in the request body is processed individually. | ||
If an attestation is validated successfully, the node MUST publish that attestation on the appropriate subnet. | ||
If one or more attestations fail validation, the node MUST return a 400 error with details of which attestations have failed, and why. | ||
parameters: | ||
- in: header | ||
schema: | ||
$ref: '../../../beacon-node-oapi.yaml#/components/schemas/ConsensusVersion' | ||
required: true | ||
name: Eth-Consensus-Version | ||
description: "Version of the attestations being submitted." | ||
tags: | ||
- Beacon | ||
- ValidatorRequiredApi | ||
requestBody: | ||
required: true | ||
content: | ||
application/json: | ||
schema: | ||
anyOf: | ||
- type: array | ||
items: | ||
$ref: '../../../beacon-node-oapi.yaml#/components/schemas/Attestation' | ||
- type: array | ||
items: | ||
$ref: '../../../beacon-node-oapi.yaml#/components/schemas/Electra.Attestation' | ||
responses: | ||
"200": | ||
description: Attestations are stored in pool and broadcast on the appropriate subnet | ||
"400": | ||
description: "Errors with one or more attestations" | ||
content: | ||
application/json: | ||
schema: | ||
$ref: "../../../beacon-node-oapi.yaml#/components/schemas/IndexedErrorMessage" | ||
"500": | ||
$ref: '../../../beacon-node-oapi.yaml#/components/responses/InternalError' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,69 @@ | ||
get: | ||
operationId: getPoolAttesterSlashingsV2 | ||
summary: Get attester slashings from operations pool | ||
description: Retrieves attester slashings known by the node but not necessarily incorporated into any block | ||
tags: | ||
- Beacon | ||
responses: | ||
"200": | ||
description: Successful response | ||
headers: | ||
Eth-Consensus-Version: | ||
$ref: '../../../beacon-node-oapi.yaml#/components/headers/Eth-Consensus-Version' | ||
content: | ||
application/json: | ||
schema: | ||
title: GetPoolAttesterSlashingsV2Response | ||
type: object | ||
required: [version, data] | ||
properties: | ||
version: | ||
type: string | ||
enum: [phase0, altair, bellatrix, capella, deneb, electra] | ||
example: "phase0" | ||
data: | ||
anyOf: | ||
- type: array | ||
items: | ||
$ref: '../../../beacon-node-oapi.yaml#/components/schemas/AttesterSlashing' | ||
- type: array | ||
items: | ||
$ref: '../../../beacon-node-oapi.yaml#/components/schemas/Electra.AttesterSlashing' | ||
"500": | ||
$ref: '../../../beacon-node-oapi.yaml#/components/responses/InternalError' | ||
|
||
post: | ||
operationId: submitPoolAttesterSlashingsV2 | ||
summary: Submit AttesterSlashing object to node's pool | ||
description: Submits AttesterSlashing object to node's pool. Upon successful validation the node MUST broadcast it to network. | ||
parameters: | ||
- in: header | ||
schema: | ||
$ref: '../../../beacon-node-oapi.yaml#/components/schemas/ConsensusVersion' | ||
required: true | ||
name: Eth-Consensus-Version | ||
description: "Version of the attester slashing being submitted." | ||
tags: | ||
- Beacon | ||
requestBody: | ||
required: true | ||
content: | ||
application/json: | ||
schema: | ||
anyOf: | ||
- $ref: '../../../beacon-node-oapi.yaml#/components/schemas/AttesterSlashing' | ||
- $ref: '../../../beacon-node-oapi.yaml#/components/schemas/Electra.AttesterSlashing' | ||
responses: | ||
"200": | ||
description: Success | ||
"400": | ||
description: "Invalid attester slashing" | ||
content: | ||
application/json: | ||
schema: | ||
$ref: "../../../beacon-node-oapi.yaml#/components/schemas/ErrorMessage" | ||
example: | ||
code: 400 | ||
message: "Invalid attester slashing, it will never pass validation so it's rejected" | ||
"500": | ||
$ref: '../../../beacon-node-oapi.yaml#/components/responses/InternalError' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.