Skip to content

Commit

Permalink
update attestation APIs to support EIP-7549
Browse files Browse the repository at this point in the history
  • Loading branch information
mehdi-aouadi committed May 24, 2024
1 parent 3132da1 commit 5d1e59e
Show file tree
Hide file tree
Showing 8 changed files with 90 additions and 27 deletions.
7 changes: 6 additions & 1 deletion apis/beacon/blocks/attestations.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,9 @@ get:
responses:
"200":
description: Success
headers:
Eth-Consensus-Version:
$ref: '../../../beacon-node-oapi.yaml#/components/headers/Eth-Consensus-Version'
content:
application/json:
schema:
Expand All @@ -27,7 +30,9 @@ get:
data:
type: array
items:
$ref: '../../../beacon-node-oapi.yaml#/components/schemas/Attestation'
oneOf:
- $ref: '../../../beacon-node-oapi.yaml#/components/schemas/Attestation'
- $ref: '../../../beacon-node-oapi.yaml#/components/schemas/Electra.Attestation'
"400":
description: "The block ID supplied could not be parsed"
content:
Expand Down
7 changes: 6 additions & 1 deletion apis/beacon/pool/attestations.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,9 @@ get:
responses:
"200":
description: Successful response
headers:
Eth-Consensus-Version:
$ref: '../../../beacon-node-oapi.yaml#/components/headers/Eth-Consensus-Version'
content:
application/json:
schema:
Expand All @@ -28,7 +31,9 @@ get:
data:
type: array
items:
$ref: '../../../beacon-node-oapi.yaml#/components/schemas/Attestation'
oneOf:
- $ref: '../../../beacon-node-oapi.yaml#/components/schemas/Attestation'
- $ref: '../../../beacon-node-oapi.yaml#/components/schemas/Electra.Attestation'
"400":
description: "The slot or committee index could not be parsed"
content:
Expand Down
11 changes: 9 additions & 2 deletions apis/beacon/pool/attester_slashings.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,9 @@ get:
responses:
"200":
description: Successful response
headers:
Eth-Consensus-Version:
$ref: '../../../beacon-node-oapi.yaml#/components/headers/Eth-Consensus-Version'
content:
application/json:
schema:
Expand All @@ -17,7 +20,9 @@ get:
data:
type: array
items:
$ref: '../../../beacon-node-oapi.yaml#/components/schemas/AttesterSlashing'
oneOf:
- $ref: '../../../beacon-node-oapi.yaml#/components/schemas/AttesterSlashing'
- $ref: '../../../beacon-node-oapi.yaml#/components/schemas/Electra.AttesterSlashing'
"500":
$ref: '../../../beacon-node-oapi.yaml#/components/responses/InternalError'

Expand All @@ -32,7 +37,9 @@ post:
content:
application/json:
schema:
$ref: '../../../beacon-node-oapi.yaml#/components/schemas/AttesterSlashing'
oneOf:
- $ref: '../../../beacon-node-oapi.yaml#/components/schemas/AttesterSlashing'
- $ref: '../../../beacon-node-oapi.yaml#/components/schemas/Electra.AttesterSlashing'
responses:
"200":
description: Success
Expand Down
8 changes: 6 additions & 2 deletions beacon-node-oapi.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -229,6 +229,8 @@ components:
$ref: './types/api.yaml#/Committee'
AttesterSlashing:
$ref: './types/attester_slashing.yaml#/AttesterSlashing'
Electra.AttesterSlashing:
$ref: './types/electra/attester_slashing.yaml#/Electra/AttesterSlashing'
ProposerSlashing:
$ref: './types/proposer_slashing.yaml#/ProposerSlashing'
SignedVoluntaryExit:
Expand All @@ -245,8 +247,10 @@ components:
$ref: './types/validator.yaml#/SignedAggregateAndProof'
Attestation:
$ref: './types/attestation.yaml#/Attestation'
Electra.Attestation:
$ref: './types/electra/attestation.yaml#/Electra/Attestation'
AttestationData:
$ref: './types/attestation.yaml#/AttestationData'
$ref: './types/attestation_data.yaml#/AttestationData'
BeaconCommitteeSelection:
$ref: './types/selection.yaml#/BeaconCommitteeSelection'
SyncCommitteeSelection:
Expand Down Expand Up @@ -329,7 +333,7 @@ components:
$ref: './types/bellatrix/block.yaml#/Bellatrix/SignedBlindedBeaconBlock'
ConsensusVersion:
type: string
enum: [phase0, altair, bellatrix, capella, deneb]
enum: [phase0, altair, bellatrix, capella, deneb, electra]
example: "phase0"
SignedValidatorRegistration:
$ref: './types/registration.yaml#/SignedValidatorRegistration'
Expand Down
25 changes: 4 additions & 21 deletions types/attestation.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ IndexedAttestation:
$ref: './primitive.yaml#/Signature'
description: "The BLS signature of the `IndexedAttestation`, created by the validator of the attestation."
data:
$ref: './attestation.yaml#/AttestationData'
$ref: './attestation_data.yaml#/AttestationData'

Attestation:
type: object
Expand All @@ -26,7 +26,7 @@ Attestation:
$ref: './primitive.yaml#/Signature'
description: "BLS aggregate signature."
data:
$ref: './attestation.yaml#/AttestationData'
$ref: './attestation_data.yaml#/AttestationData'

PendingAttestation:
type: object
Expand All @@ -37,25 +37,8 @@ PendingAttestation:
$ref: "./primitive.yaml#/BitList"
description: "Attester aggregation bits."
data:
$ref: '#/AttestationData'
$ref: './attestation_data.yaml#/AttestationData'
inclusion_delay:
$ref: "./primitive.yaml#/Uint64"
proposer_index:
$ref: "./primitive.yaml#/Uint64"

AttestationData:
type: object
description: "The [`AttestationData`](https://github.com/ethereum/consensus-specs/blob/v1.3.0/specs/phase0/beacon-chain.md#attestationdata) object from the CL spec."
required: [slot, index, beacon_block_root, source, target]
properties:
slot:
$ref: "./primitive.yaml#/Uint64"
index:
$ref: "./primitive.yaml#/Uint64"
beacon_block_root:
$ref: './primitive.yaml#/Root'
description: "LMD GHOST vote."
source:
$ref: "./misc.yaml#/Checkpoint"
target:
$ref: "./misc.yaml#/Checkpoint"
$ref: "./primitive.yaml#/Uint64"
16 changes: 16 additions & 0 deletions types/attestation_data.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
AttestationData:
type: object
description: "The [`AttestationData`](https://github.com/ethereum/consensus-specs/blob/v1.3.0/specs/phase0/beacon-chain.md#attestationdata) object from the CL spec."
required: [slot, index, beacon_block_root, source, target]
properties:
slot:
$ref: "./primitive.yaml#/Uint64"
index:
$ref: "./primitive.yaml#/Uint64"
beacon_block_root:
$ref: './primitive.yaml#/Root'
description: "LMD GHOST vote."
source:
$ref: "./misc.yaml#/Checkpoint"
target:
$ref: "./misc.yaml#/Checkpoint"
33 changes: 33 additions & 0 deletions types/electra/attestation.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
Electra:
IndexedAttestation:
type: object
description: "The [`IndexedAttestation`](https://github.com/ethereum/consensus-specs/blob/dev/specs/electra/beacon-chain.md#indexedattestation) object from the CL spec."
properties:
attesting_indices:
type: array
maxItems: 131072
description: "Attesting validator indices"
items:
$ref: "../primitive.yaml#/Uint64"
signature:
$ref: '../primitive.yaml#/Signature'
description: "The BLS signature of the `IndexedAttestation`, created by the validator of the attestation."
data:
$ref: '../attestation_data.yaml#/AttestationData'

Attestation:
type: object
description: "The [`Attestation`](https://github.com/ethereum/consensus-specs/blob/dev/specs/electra/beacon-chain.md#attestation) object from the CL spec."
required: [aggregation_bits, signature, data]
properties:
aggregation_bits:
$ref: "../primitive.yaml#/BitList"
description: "Attester aggregation bits."
data:
$ref: '../attestation_data.yaml#/AttestationData'
committee_bits:
$ref: "../primitive.yaml#/Bitvector"
description: "Attester aggregation bits."
signature:
$ref: '../primitive.yaml#/Signature'
description: "BLS aggregate signature."
10 changes: 10 additions & 0 deletions types/electra/attester_slashing.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
Electra:
AttesterSlashing:
type: object
description: "The [`AttesterSlashing`](https://github.com/ethereum/consensus-specs/blob/dev/specs/electra/beacon-chain.md#attesterslashing) object from the CL spec."
required: [attestation_1, attestation_2]
properties:
attestation_1:
$ref: './attestation.yaml#/Electra/IndexedAttestation'
attestation_2:
$ref: './attestation.yaml#/Electra/IndexedAttestation'

0 comments on commit 5d1e59e

Please sign in to comment.