Skip to content

Commit

Permalink
Add Electra block and state objects from CL spec (#469)
Browse files Browse the repository at this point in the history
  • Loading branch information
nflaig authored Sep 23, 2024
1 parent ca2f9a8 commit 203410d
Show file tree
Hide file tree
Showing 20 changed files with 397 additions and 11 deletions.
2 changes: 1 addition & 1 deletion apis/beacon/blob_sidecars/blob_sidecars.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ get:
properties:
version:
type: string
enum: [phase0, altair, bellatrix, capella, deneb]
enum: [phase0, altair, bellatrix, capella, deneb, electra]
example: "deneb"
execution_optimistic:
$ref: "../../../beacon-node-oapi.yaml#/components/schemas/ExecutionOptimistic"
Expand Down
3 changes: 2 additions & 1 deletion apis/beacon/blocks/blinded_block.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ get:
properties:
version:
type: string
enum: [phase0, altair, bellatrix, capella, deneb]
enum: [phase0, altair, bellatrix, capella, deneb, electra]
example: "phase0"
execution_optimistic:
$ref: "../../../beacon-node-oapi.yaml#/components/schemas/ExecutionOptimistic"
Expand All @@ -39,6 +39,7 @@ get:
- $ref: "../../../beacon-node-oapi.yaml#/components/schemas/Bellatrix.SignedBlindedBeaconBlock"
- $ref: "../../../beacon-node-oapi.yaml#/components/schemas/Capella.SignedBlindedBeaconBlock"
- $ref: "../../../beacon-node-oapi.yaml#/components/schemas/Deneb.SignedBlindedBeaconBlock"
- $ref: "../../../beacon-node-oapi.yaml#/components/schemas/Electra.SignedBlindedBeaconBlock"
application/octet-stream:
schema:
description: "SSZ serialized block bytes. Use Accept header to choose this response type"
Expand Down
1 change: 1 addition & 0 deletions apis/beacon/blocks/blinded_blocks.v2.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@ post:
- $ref: "../../../beacon-node-oapi.yaml#/components/schemas/Bellatrix.SignedBlindedBeaconBlock"
- $ref: "../../../beacon-node-oapi.yaml#/components/schemas/Capella.SignedBlindedBeaconBlock"
- $ref: "../../../beacon-node-oapi.yaml#/components/schemas/Deneb.SignedBlindedBeaconBlock"
- $ref: "../../../beacon-node-oapi.yaml#/components/schemas/Electra.SignedBlindedBeaconBlock"
application/octet-stream:
schema:
description: "SSZ serialized block bytes. Use content type header to indicate that SSZ data is contained in the request body."
Expand Down
1 change: 1 addition & 0 deletions apis/beacon/blocks/blinded_blocks.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ post:
- $ref: "../../../beacon-node-oapi.yaml#/components/schemas/Bellatrix.SignedBlindedBeaconBlock"
- $ref: "../../../beacon-node-oapi.yaml#/components/schemas/Capella.SignedBlindedBeaconBlock"
- $ref: "../../../beacon-node-oapi.yaml#/components/schemas/Deneb.SignedBlindedBeaconBlock"
- $ref: "../../../beacon-node-oapi.yaml#/components/schemas/Electra.SignedBlindedBeaconBlock"
application/octet-stream:
schema:
description: "SSZ serialized block bytes. Use content type header to indicate that SSZ data is contained in the request body."
Expand Down
3 changes: 2 additions & 1 deletion apis/beacon/blocks/block.v2.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ get:
properties:
version:
type: string
enum: [phase0, altair, bellatrix, capella, deneb]
enum: [phase0, altair, bellatrix, capella, deneb, electra]
example: "phase0"
execution_optimistic:
$ref: "../../../beacon-node-oapi.yaml#/components/schemas/ExecutionOptimistic"
Expand All @@ -39,6 +39,7 @@ get:
- $ref: "../../../beacon-node-oapi.yaml#/components/schemas/Bellatrix.SignedBeaconBlock"
- $ref: "../../../beacon-node-oapi.yaml#/components/schemas/Capella.SignedBeaconBlock"
- $ref: "../../../beacon-node-oapi.yaml#/components/schemas/Deneb.SignedBeaconBlock"
- $ref: "../../../beacon-node-oapi.yaml#/components/schemas/Electra.SignedBeaconBlock"
application/octet-stream:
schema:
description: "SSZ serialized block bytes. Use Accept header to choose this response type"
Expand Down
1 change: 1 addition & 0 deletions apis/beacon/blocks/blocks.v2.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@ post:
- $ref: "../../../beacon-node-oapi.yaml#/components/schemas/Bellatrix.SignedBeaconBlock"
- $ref: "../../../beacon-node-oapi.yaml#/components/schemas/Capella.SignedBeaconBlock"
- $ref: "../../../beacon-node-oapi.yaml#/components/schemas/Deneb.SignedBlockContents"
- $ref: "../../../beacon-node-oapi.yaml#/components/schemas/Electra.SignedBlockContents"
application/octet-stream:
schema:
description: "SSZ serialized block bytes. Use content type header to indicate that SSZ data is contained in the request body."
Expand Down
1 change: 1 addition & 0 deletions apis/beacon/blocks/blocks.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ post:
- $ref: "../../../beacon-node-oapi.yaml#/components/schemas/Bellatrix.SignedBeaconBlock"
- $ref: "../../../beacon-node-oapi.yaml#/components/schemas/Capella.SignedBeaconBlock"
- $ref: "../../../beacon-node-oapi.yaml#/components/schemas/Deneb.SignedBlockContents"
- $ref: "../../../beacon-node-oapi.yaml#/components/schemas/Electra.SignedBlockContents"
application/octet-stream:
schema:
description: "SSZ serialized block bytes. Use content type header to indicate that SSZ data is contained in the request body."
Expand Down
3 changes: 2 additions & 1 deletion apis/debug/state.v2.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ get:
properties:
version:
type: string
enum: [ phase0, altair, bellatrix, capella, deneb ]
enum: [phase0, altair, bellatrix, capella, deneb, electra]
example: "phase0"
execution_optimistic:
$ref: "../../beacon-node-oapi.yaml#/components/schemas/ExecutionOptimistic"
Expand All @@ -39,6 +39,7 @@ get:
- $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"
- $ref: "../../beacon-node-oapi.yaml#/components/schemas/Electra.BeaconState"
application/octet-stream:
schema:
description: "SSZ serialized state bytes. Use Accept header to choose this response type"
Expand Down
3 changes: 2 additions & 1 deletion apis/validator/blinded_block.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ get:
properties:
version:
type: string
enum: [ phase0, altair, bellatrix, capella, deneb ]
enum: [phase0, altair, bellatrix, capella, deneb, electra]
example: "bellatrix"
data:
anyOf:
Expand All @@ -58,6 +58,7 @@ get:
- $ref: "../../beacon-node-oapi.yaml#/components/schemas/Bellatrix.BlindedBeaconBlock"
- $ref: "../../beacon-node-oapi.yaml#/components/schemas/Capella.BlindedBeaconBlock"
- $ref: "../../beacon-node-oapi.yaml#/components/schemas/Deneb.BlindedBeaconBlock"
- $ref: "../../beacon-node-oapi.yaml#/components/schemas/Electra.BlindedBeaconBlock"
application/octet-stream:
schema:
description: "SSZ serialized block bytes. Use Accept header to choose this response type, version string is sent in header `Eth-Consensus-Version`."
Expand Down
3 changes: 2 additions & 1 deletion apis/validator/block.v2.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ get:
properties:
version:
type: string
enum: [ phase0, altair, bellatrix, capella, deneb ]
enum: [phase0, altair, bellatrix, capella, deneb, electra]
example: "phase0"
data:
anyOf:
Expand All @@ -55,6 +55,7 @@ get:
- $ref: "../../beacon-node-oapi.yaml#/components/schemas/Bellatrix.BeaconBlock"
- $ref: "../../beacon-node-oapi.yaml#/components/schemas/Capella.BeaconBlock"
- $ref: "../../beacon-node-oapi.yaml#/components/schemas/Deneb.BlockContents"
- $ref: "../../beacon-node-oapi.yaml#/components/schemas/Electra.BlockContents"
application/octet-stream:
schema:
description: "SSZ serialized block bytes. Use Accept header to choose this response type, version string is sent in header `Eth-Consensus-Version`."
Expand Down
4 changes: 3 additions & 1 deletion apis/validator/block.v3.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ get:
properties:
version:
type: string
enum: [ phase0, altair, bellatrix, capella, deneb ]
enum: [phase0, altair, bellatrix, capella, deneb, electra]
example: "phase0"
execution_payload_blinded:
type: boolean
Expand All @@ -111,6 +111,8 @@ get:
- $ref: "../../beacon-node-oapi.yaml#/components/schemas/Capella.BlindedBeaconBlock"
- $ref: "../../beacon-node-oapi.yaml#/components/schemas/Deneb.BlockContents"
- $ref: "../../beacon-node-oapi.yaml#/components/schemas/Deneb.BlindedBeaconBlock"
- $ref: "../../beacon-node-oapi.yaml#/components/schemas/Electra.BlockContents"
- $ref: "../../beacon-node-oapi.yaml#/components/schemas/Electra.BlindedBeaconBlock"
application/octet-stream:
schema:
description: "SSZ serialized block or blinded block bytes. Use Accept header to choose this response type, version string is sent in header `Eth-Consensus-Version` and block type in `Eth-Blinded-Payload`."
Expand Down
12 changes: 12 additions & 0 deletions beacon-node-oapi.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -395,6 +395,18 @@ components:
$ref: './types/primitive.yaml#/Blob'
Deneb.BlobSidecars:
$ref: './types/deneb/blob_sidecar.yaml#/Deneb/BlobSidecars'
Electra.BeaconState:
$ref: './types/electra/state.yaml#/Electra/BeaconState'
Electra.BlockContents:
$ref: './types/electra/block_contents.yaml#/Electra/BlockContents'
Electra.SignedBeaconBlock:
$ref: './types/electra/block.yaml#/Electra/SignedBeaconBlock'
Electra.SignedBlockContents:
$ref: './types/electra/block_contents.yaml#/Electra/SignedBlockContents'
Electra.BlindedBeaconBlock:
$ref: './types/electra/block.yaml#/Electra/BlindedBeaconBlock'
Electra.SignedBlindedBeaconBlock:
$ref: './types/electra/block.yaml#/Electra/SignedBlindedBeaconBlock'
Electra.Attestation:
$ref: './types/electra/attestation.yaml#/Electra/Attestation'
Electra.AttesterSlashing:
Expand Down
8 changes: 4 additions & 4 deletions types/deneb/block.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ Deneb:
$ref: './execution_payload.yaml#/Deneb/ExecutionPayload'

BeaconBlock:
description: "The [`BeaconBlock`](https://github.com/ethereum/consensus-specs/blob/master/specs/deneb/beacon-chain.md#beaconblock) object from the CL Deneb spec."
description: "The [`BeaconBlock`](https://github.com/ethereum/consensus-specs/blob/master/specs/phase0/beacon-chain.md#beaconblock) object from the CL Deneb spec."
allOf:
- $ref: '../altair/block.yaml#/Altair/BeaconBlockCommon'
- type: object
Expand All @@ -65,7 +65,7 @@ Deneb:

SignedBeaconBlock:
type: object
description: "The [`SignedBeaconBlock`](https://github.com/ethereum/consensus-specs/blob/master/specs/deneb/beacon-chain.md#signedbeaconblock) object envelope from the CL Deneb spec."
description: "The [`SignedBeaconBlock`](https://github.com/ethereum/consensus-specs/blob/master/specs/phase0/beacon-chain.md#signedbeaconblock) object envelope from the CL Deneb spec."
required: [message, signature]
properties:
message:
Expand All @@ -84,7 +84,7 @@ Deneb:
$ref: './execution_payload.yaml#/Deneb/ExecutionPayloadHeader'

BlindedBeaconBlock:
description: "A variant of the [`BeaconBlock`](https://github.com/ethereum/consensus-specs/blob/master/specs/deneb/beacon-chain.md#beaconblock) object from the CL Deneb spec, which contains a `BlindedBeaconBlockBody` rather than a `BeaconBlockBody`."
description: "A variant of the [`BeaconBlock`](https://github.com/ethereum/consensus-specs/blob/master/specs/phase0/beacon-chain.md#beaconblock) object from the CL Deneb spec, which contains a `BlindedBeaconBlockBody` rather than a `BeaconBlockBody`."
allOf:
- $ref: '../altair/block.yaml#/Altair/BeaconBlockCommon'
- type: object
Expand All @@ -95,7 +95,7 @@ Deneb:

SignedBlindedBeaconBlock:
type: object
description: "A variant of the [`SignedBeaconBlock`](https://github.com/ethereum/consensus-specs/blob/master/specs/deneb/beacon-chain.md#signedbeaconblock) object envelope from the CL Deneb spec, which contains a `BlindedBeaconBlock` rather than a `BeaconBlock`."
description: "A variant of the [`SignedBeaconBlock`](https://github.com/ethereum/consensus-specs/blob/master/specs/phase0/beacon-chain.md#signedbeaconblock) object envelope from the CL Deneb spec, which contains a `BlindedBeaconBlock` rather than a `BeaconBlock`."
required: [message, signature]
properties:
message:
Expand Down
108 changes: 108 additions & 0 deletions types/electra/block.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,108 @@
Electra:
BeaconBlockBodyCommon:
# An abstract object to collect the common fields between the BeaconBlockBody and the BlindedBeaconBlockBody objects
type: object
description: "The [`BeaconBlockBody`](https://github.com/ethereum/consensus-specs/blob/v1.5.0-alpha.5/specs/electra/beacon-chain.md#beaconblockbody) object from the CL Electra spec."
required: [randao_reveal, eth1_data, graffiti, proposer_slashings, attester_slashings, attestations, deposits, voluntary_exits, sync_aggregate, bls_to_execution_changes, blob_kzg_commitments]
properties:
randao_reveal:
allOf:
- $ref: "../primitive.yaml#/Signature"
- description: "The RANDAO reveal value provided by the validator."
eth1_data:
$ref: "../eth1.yaml#/Eth1Data"
graffiti:
$ref: "../primitive.yaml#/Graffiti"
proposer_slashings:
type: array
items:
$ref: "../proposer_slashing.yaml#/ProposerSlashing"
attester_slashings:
type: array
items:
$ref: "./attester_slashing.yaml#/Electra/AttesterSlashing"
attestations:
type: array
items:
$ref: "./attestation.yaml#/Electra/Attestation"
deposits:
type: array
items:
$ref: "../deposit.yaml#/Deposit"
voluntary_exits:
type: array
items:
$ref: "../voluntary_exit.yaml#/SignedVoluntaryExit"
sync_aggregate:
$ref: "../altair/sync_aggregate.yaml#/Altair/SyncAggregate"
bls_to_execution_changes:
type: array
items:
$ref: "../bls_to_execution_change.yaml#/SignedBLSToExecutionChange"
blob_kzg_commitments:
type: array
items:
$ref: "../primitive.yaml#/KZGCommitment"

BeaconBlockBody:
allOf:
- $ref: "#/Electra/BeaconBlockBodyCommon"
- type: object
required: [execution_payload, execution_requests]
properties:
execution_payload:
$ref: "../deneb/execution_payload.yaml#/Deneb/ExecutionPayload"
execution_requests:
$ref: "./execution_requests.yaml#/Electra/ExecutionRequests"

BeaconBlock:
description: "The [`BeaconBlock`](https://github.com/ethereum/consensus-specs/blob/v1.5.0-alpha.5/specs/phase0/beacon-chain.md#beaconblock) object from the CL Electra spec."
allOf:
- $ref: "../altair/block.yaml#/Altair/BeaconBlockCommon"
- type: object
required: [body]
properties:
body:
$ref: "#/Electra/BeaconBlockBody"

SignedBeaconBlock:
type: object
description: "The [`SignedBeaconBlock`](https://github.com/ethereum/consensus-specs/blob/v1.5.0-alpha.5/specs/phase0/beacon-chain.md#signedbeaconblock) object envelope from the CL Electra spec."
required: [message, signature]
properties:
message:
$ref: "#/Electra/BeaconBlock"
signature:
$ref: "../primitive.yaml#/Signature"

BlindedBeaconBlockBody:
description: "A variant of the [`BeaconBlockBody`](https://github.com/ethereum/consensus-specs/blob/v1.5.0-alpha.5/specs/electra/beacon-chain.md#beaconblockbody) object from the CL Electra spec, which contains a transactions root rather than a full transactions list."
allOf:
- $ref: "#/Electra/BeaconBlockBodyCommon"
- type: object
required: [execution_payload_header, execution_requests_root]
properties:
execution_payload_header:
$ref: "../deneb/execution_payload.yaml#/Deneb/ExecutionPayloadHeader"
execution_requests_root:
$ref: "../primitive.yaml#/Root"

BlindedBeaconBlock:
description: "A variant of the [`BeaconBlock`](https://github.com/ethereum/consensus-specs/blob/v1.5.0-alpha.5/specs/phase0/beacon-chain.md#beaconblock) object from the CL Electra spec, which contains a `BlindedBeaconBlockBody` rather than a `BeaconBlockBody`."
allOf:
- $ref: "../altair/block.yaml#/Altair/BeaconBlockCommon"
- type: object
required: [body]
properties:
body:
$ref: "#/Electra/BlindedBeaconBlockBody"

SignedBlindedBeaconBlock:
type: object
description: "A variant of the [`SignedBeaconBlock`](https://github.com/ethereum/consensus-specs/blob/v1.5.0-alpha.5/specs/phase0/beacon-chain.md#signedbeaconblock) object envelope from the CL Electra spec, which contains a `BlindedBeaconBlock` rather than a `BeaconBlock`."
required: [message, signature]
properties:
message:
$ref: "#/Electra/BlindedBeaconBlock"
signature:
$ref: "../primitive.yaml#/Signature"
24 changes: 24 additions & 0 deletions types/electra/block_contents.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
Electra:
BlockContents:
type: object
description: "The required object for block production according to the Electra CL spec."
required: [block, kzg_proofs, blobs]
properties:
block:
$ref: "./block.yaml#/Electra/BeaconBlock"
kzg_proofs:
$ref: "../deneb/block_contents.yaml#/Deneb/KZGProofs"
blobs:
$ref: "../deneb/block_contents.yaml#/Deneb/Blobs"

SignedBlockContents:
type: object
description: "The required signed components of block production according to the Electra CL spec."
required: [signed_block, kzg_proofs, blobs]
properties:
signed_block:
$ref: "./block.yaml#/Electra/SignedBeaconBlock"
kzg_proofs:
$ref: "../deneb/block_contents.yaml#/Deneb/KZGProofs"
blobs:
$ref: "../deneb/block_contents.yaml#/Deneb/Blobs"
27 changes: 27 additions & 0 deletions types/electra/consolidation.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
Electra:
ConsolidationRequest:
type: object
description: "The [`ConsolidationRequest`](https://github.com/ethereum/consensus-specs/blob/v1.5.0-alpha.5/specs/electra/beacon-chain.md#consolidationrequest) object from the CL Electra spec."
required: [source_address, source_pubkey, target_pubkey]
properties:
source_address:
$ref: "../primitive.yaml#/ExecutionAddress"
description: "Execution address which sent the request."
source_pubkey:
$ref: "../primitive.yaml#/Pubkey"
description: "BLS public key of validator to consolidate from."
target_pubkey:
$ref: "../primitive.yaml#/Pubkey"
description: "BLS public key of validator to consolidate to."

PendingConsolidation:
type: object
description: "The [`PendingConsolidation`](https://github.com/ethereum/consensus-specs/blob/v1.5.0-alpha.5/specs/electra/beacon-chain.md#pendingconsolidation) object from the CL Electra spec."
required: [source_index, target_index]
properties:
source_index:
$ref: "../primitive.yaml#/Uint64"
description: "Index of validator to consolidate from."
target_index:
$ref: "../primitive.yaml#/Uint64"
description: "Index of validator to consolidate to."
Loading

0 comments on commit 203410d

Please sign in to comment.