From 203410d04697520abb83b1c7e8a396e1b7878b1c Mon Sep 17 00:00:00 2001 From: Nico Flaig Date: Mon, 23 Sep 2024 03:38:41 +0100 Subject: [PATCH 1/3] Add Electra block and state objects from CL spec (#469) --- apis/beacon/blob_sidecars/blob_sidecars.yaml | 2 +- apis/beacon/blocks/blinded_block.yaml | 3 +- apis/beacon/blocks/blinded_blocks.v2.yaml | 1 + apis/beacon/blocks/blinded_blocks.yaml | 1 + apis/beacon/blocks/block.v2.yaml | 3 +- apis/beacon/blocks/blocks.v2.yaml | 1 + apis/beacon/blocks/blocks.yaml | 1 + apis/debug/state.v2.yaml | 3 +- apis/validator/blinded_block.yaml | 3 +- apis/validator/block.v2.yaml | 3 +- apis/validator/block.v3.yaml | 4 +- beacon-node-oapi.yaml | 12 ++ types/deneb/block.yaml | 8 +- types/electra/block.yaml | 108 +++++++++++++++++ types/electra/block_contents.yaml | 24 ++++ types/electra/consolidation.yaml | 27 +++++ types/electra/deposit.yaml | 32 +++++ types/electra/execution_requests.yaml | 21 ++++ types/electra/state.yaml | 121 +++++++++++++++++++ types/electra/withdrawal.yaml | 30 +++++ 20 files changed, 397 insertions(+), 11 deletions(-) create mode 100644 types/electra/block.yaml create mode 100644 types/electra/block_contents.yaml create mode 100644 types/electra/consolidation.yaml create mode 100644 types/electra/deposit.yaml create mode 100644 types/electra/execution_requests.yaml create mode 100644 types/electra/state.yaml create mode 100644 types/electra/withdrawal.yaml diff --git a/apis/beacon/blob_sidecars/blob_sidecars.yaml b/apis/beacon/blob_sidecars/blob_sidecars.yaml index 92b4e853..e65b4810 100644 --- a/apis/beacon/blob_sidecars/blob_sidecars.yaml +++ b/apis/beacon/blob_sidecars/blob_sidecars.yaml @@ -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" diff --git a/apis/beacon/blocks/blinded_block.yaml b/apis/beacon/blocks/blinded_block.yaml index d85bce32..8c5f25c7 100644 --- a/apis/beacon/blocks/blinded_block.yaml +++ b/apis/beacon/blocks/blinded_block.yaml @@ -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" @@ -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" diff --git a/apis/beacon/blocks/blinded_blocks.v2.yaml b/apis/beacon/blocks/blinded_blocks.v2.yaml index 93e3b568..24f0d091 100644 --- a/apis/beacon/blocks/blinded_blocks.v2.yaml +++ b/apis/beacon/blocks/blinded_blocks.v2.yaml @@ -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." diff --git a/apis/beacon/blocks/blinded_blocks.yaml b/apis/beacon/blocks/blinded_blocks.yaml index 73704485..b5b70fe5 100644 --- a/apis/beacon/blocks/blinded_blocks.yaml +++ b/apis/beacon/blocks/blinded_blocks.yaml @@ -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." diff --git a/apis/beacon/blocks/block.v2.yaml b/apis/beacon/blocks/block.v2.yaml index 9f2322de..05a41595 100644 --- a/apis/beacon/blocks/block.v2.yaml +++ b/apis/beacon/blocks/block.v2.yaml @@ -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" @@ -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" diff --git a/apis/beacon/blocks/blocks.v2.yaml b/apis/beacon/blocks/blocks.v2.yaml index 97e83766..ec5a19ee 100644 --- a/apis/beacon/blocks/blocks.v2.yaml +++ b/apis/beacon/blocks/blocks.v2.yaml @@ -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." diff --git a/apis/beacon/blocks/blocks.yaml b/apis/beacon/blocks/blocks.yaml index e5813c29..c28fc714 100644 --- a/apis/beacon/blocks/blocks.yaml +++ b/apis/beacon/blocks/blocks.yaml @@ -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." diff --git a/apis/debug/state.v2.yaml b/apis/debug/state.v2.yaml index d413af1c..cdfa17a7 100644 --- a/apis/debug/state.v2.yaml +++ b/apis/debug/state.v2.yaml @@ -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" @@ -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" diff --git a/apis/validator/blinded_block.yaml b/apis/validator/blinded_block.yaml index 90ca5659..72c60519 100644 --- a/apis/validator/blinded_block.yaml +++ b/apis/validator/blinded_block.yaml @@ -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: @@ -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`." diff --git a/apis/validator/block.v2.yaml b/apis/validator/block.v2.yaml index 00ad2fc8..4ee38d0f 100644 --- a/apis/validator/block.v2.yaml +++ b/apis/validator/block.v2.yaml @@ -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: @@ -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`." diff --git a/apis/validator/block.v3.yaml b/apis/validator/block.v3.yaml index f2adf9fe..3788717d 100644 --- a/apis/validator/block.v3.yaml +++ b/apis/validator/block.v3.yaml @@ -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 @@ -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`." diff --git a/beacon-node-oapi.yaml b/beacon-node-oapi.yaml index 33ebff47..59d1aefd 100644 --- a/beacon-node-oapi.yaml +++ b/beacon-node-oapi.yaml @@ -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: diff --git a/types/deneb/block.yaml b/types/deneb/block.yaml index 4891c25f..d58607a5 100644 --- a/types/deneb/block.yaml +++ b/types/deneb/block.yaml @@ -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 @@ -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: @@ -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 @@ -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: diff --git a/types/electra/block.yaml b/types/electra/block.yaml new file mode 100644 index 00000000..db460fd3 --- /dev/null +++ b/types/electra/block.yaml @@ -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" diff --git a/types/electra/block_contents.yaml b/types/electra/block_contents.yaml new file mode 100644 index 00000000..d4a38519 --- /dev/null +++ b/types/electra/block_contents.yaml @@ -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" diff --git a/types/electra/consolidation.yaml b/types/electra/consolidation.yaml new file mode 100644 index 00000000..94b9a75e --- /dev/null +++ b/types/electra/consolidation.yaml @@ -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." diff --git a/types/electra/deposit.yaml b/types/electra/deposit.yaml new file mode 100644 index 00000000..e124df7c --- /dev/null +++ b/types/electra/deposit.yaml @@ -0,0 +1,32 @@ +Electra: + DepositRequest: + type: object + description: "The [`DepositRequest`](https://github.com/ethereum/consensus-specs/blob/v1.5.0-alpha.5/specs/electra/beacon-chain.md#depositrequest) object from the CL Electra spec." + required: [pubkey, withdrawal_credentials, amount, signature, index] + properties: + pubkey: + $ref: "../primitive.yaml#/Pubkey" + description: "BLS public key of validator." + withdrawal_credentials: + $ref: "../primitive.yaml#/Root" + description: "The withdrawal credentials." + amount: + $ref: "../primitive.yaml#/Gwei" + description: "The value to be deposited (gwei)." + signature: + $ref: "../primitive.yaml#/Signature" + index: + $ref: "../primitive.yaml#/Uint64" + description: "The index of the deposit request." + + PendingBalanceDeposit: + type: object + description: "The [`PendingBalanceDeposit`](https://github.com/ethereum/consensus-specs/blob/v1.5.0-alpha.5/specs/electra/beacon-chain.md#pendingbalancedeposit) object from the CL Electra spec." + required: [index, amount] + properties: + index: + $ref: "../primitive.yaml#/Uint64" + description: "Index of validator in validator registry." + amount: + $ref: "../primitive.yaml#/Gwei" + description: "The value to be deposited (gwei)." diff --git a/types/electra/execution_requests.yaml b/types/electra/execution_requests.yaml new file mode 100644 index 00000000..1851c89b --- /dev/null +++ b/types/electra/execution_requests.yaml @@ -0,0 +1,21 @@ +Electra: + ExecutionRequests: + type: object + description: "The [`ExecutionRequests`](https://github.com/ethereum/consensus-specs/blob/v1.5.0-alpha.6/specs/electra/beacon-chain.md#executionrequests) object from the CL Electra spec." + required: [deposits, withdrawals, consolidations] + properties: + deposits: + type: array + items: + $ref: "./deposit.yaml#/Electra/DepositRequest" + maxItems: 8192 + withdrawals: + type: array + items: + $ref: "./withdrawal.yaml#/Electra/WithdrawalRequest" + maxItems: 16 + consolidations: + type: array + items: + $ref: "./consolidation.yaml#/Electra/ConsolidationRequest" + maxItems: 1 diff --git a/types/electra/state.yaml b/types/electra/state.yaml new file mode 100644 index 00000000..7798a372 --- /dev/null +++ b/types/electra/state.yaml @@ -0,0 +1,121 @@ +Electra: + BeaconState: + type: object + description: "The [`BeaconState`](https://github.com/ethereum/consensus-specs/blob/v1.5.0-alpha.5/specs/electra/beacon-chain.md#beaconstate) object from the CL Electra spec." + required: [genesis_time, genesis_validators_root, slot, fork, latest_block_header, block_roots, state_roots, historical_roots, eth1_data, eth1_data_votes, eth1_deposit_index, validators, balances, randao_mixes, slashings, previous_epoch_participation, current_epoch_participation, justification_bits, previous_justified_checkpoint, current_justified_checkpoint, finalized_checkpoint, inactivity_scores, current_sync_committee, next_sync_committee, latest_execution_payload_header, next_withdrawal_index, next_withdrawal_validator_index, historical_summaries, deposit_requests_start_index, deposit_balance_to_consume, exit_balance_to_consume, earliest_exit_epoch, consolidation_balance_to_consume, earliest_consolidation_epoch, pending_balance_deposits, pending_partial_withdrawals, pending_consolidations] + properties: + genesis_time: + $ref: "../primitive.yaml#/Uint64" + genesis_validators_root: + $ref: "../primitive.yaml#/Root" + slot: + $ref: "../primitive.yaml#/Uint64" + fork: + $ref: "../misc.yaml#/Fork" + latest_block_header: + $ref: "../block.yaml#/BeaconBlockHeader" + block_roots: + type: array + description: "Fixed length of 8192 items" + items: + $ref: "../primitive.yaml#/Root" + state_roots: + type: array + description: "Fixed length of 8192 items" + items: + $ref: "../primitive.yaml#/Root" + historical_roots: + type: array + description: "Variable length list, maximum 16777216 items. Frozen in Capella, replaced by historical_summaries." + items: + $ref: "../primitive.yaml#/Root" + eth1_data: + $ref: "../eth1.yaml#/Eth1Data" + eth1_data_votes: + type: array + description: "Fixed length of 1024 items" + items: + $ref: "../eth1.yaml#/Eth1Data" + maxItems: 1024 + eth1_deposit_index: + $ref: "../primitive.yaml#/Uint64" + validators: + type: array + description: "Variable length list, maximum 1099511627776 items" + items: + $ref: "../validator.yaml#/Validator" + balances: + type: array + description: "Validator balances in gwei. Variable length list, maximum 1099511627776 items" + items: + $ref: '../primitive.yaml#/Uint64' + randao_mixes: + type: array + description: "Fixed length of 65536 items" + items: + $ref: "../primitive.yaml#/Bytes32" + slashings: + type: array + description: "Per-epoch sums of slashed effective balances. Fixed length of 8192 items" + items: + $ref: "../primitive.yaml#/Uint64" + previous_epoch_participation: + $ref: "../altair/epoch_participation.yaml#/Altair/EpochParticipation" + current_epoch_participation: + $ref: "../altair/epoch_participation.yaml#/Altair/EpochParticipation" + justification_bits: + $ref: "../primitive.yaml#/BitList" + description: "Bit set for every recent justified epoch" + previous_justified_checkpoint: + $ref: "../misc.yaml#/Checkpoint" + current_justified_checkpoint: + $ref: "../misc.yaml#/Checkpoint" + finalized_checkpoint: + $ref: "../misc.yaml#/Checkpoint" + inactivity_scores: + description: "Per-validator inactivity scores. Introduced in Altair. Variable length list, maximum 1099511627776 items" + type: array + items: + $ref: "../primitive.yaml#/Uint64" + current_sync_committee: + $ref: "../altair/sync_committee.yaml#/Altair/SyncCommittee" + next_sync_committee: + $ref: "../altair/sync_committee.yaml#/Altair/SyncCommittee" + latest_execution_payload_header: + $ref: "../deneb/execution_payload.yaml#/Deneb/ExecutionPayloadHeader" + next_withdrawal_index: + $ref: "../primitive.yaml#/Uint64" + next_withdrawal_validator_index: + $ref: "../primitive.yaml#/Uint64" + historical_summaries: + type: array + items: + $ref: "../capella/historical_summary.yaml#/Capella/HistoricalSummary" + description: "Variable length list, maximum 16777216 items" + deposit_requests_start_index: + $ref: "../primitive.yaml#/Uint64" + deposit_balance_to_consume: + $ref: "../primitive.yaml#/Gwei" + exit_balance_to_consume: + $ref: "../primitive.yaml#/Gwei" + earliest_exit_epoch: + $ref: "../primitive.yaml#/Uint64" + consolidation_balance_to_consume: + $ref: "../primitive.yaml#/Gwei" + earliest_consolidation_epoch: + $ref: "../primitive.yaml#/Uint64" + pending_balance_deposits: + type: array + items: + $ref: "./deposit.yaml#/Electra/PendingBalanceDeposit" + maxItems: 134217728 + pending_partial_withdrawals: + type: array + items: + $ref: "./withdrawal.yaml#/Electra/PendingPartialWithdrawal" + maxItems: 134217728 + pending_consolidations: + type: array + items: + $ref: "./consolidation.yaml#/Electra/PendingConsolidation" + maxItems: 262144 diff --git a/types/electra/withdrawal.yaml b/types/electra/withdrawal.yaml new file mode 100644 index 00000000..bca58715 --- /dev/null +++ b/types/electra/withdrawal.yaml @@ -0,0 +1,30 @@ +Electra: + WithdrawalRequest: + type: object + description: "The [`WithdrawalRequest`](https://github.com/ethereum/consensus-specs/blob/v1.5.0-alpha.5/specs/electra/beacon-chain.md#withdrawalrequest) object from the CL Electra spec." + required: [source_address, validator_pubkey, amount] + properties: + source_address: + $ref: "../primitive.yaml#/ExecutionAddress" + description: "Execution address which sent the request." + validator_pubkey: + $ref: "../primitive.yaml#/Pubkey" + description: "BLS public key of validator." + amount: + $ref: "../primitive.yaml#/Gwei" + description: "The value to be withdrawn (gwei)." + + PendingPartialWithdrawal: + type: object + description: "The [`PendingPartialWithdrawal`](https://github.com/ethereum/consensus-specs/blob/v1.5.0-alpha.5/specs/electra/beacon-chain.md#pendingpartialwithdrawal) object from the CL Electra spec." + required: [index, amount, withdrawable_epoch] + properties: + index: + $ref: "../primitive.yaml#/Uint64" + description: "Index of validator in validator registry." + amount: + $ref: "../primitive.yaml#/Uint64" + description: "The value to be withdrawn (gwei)." + withdrawable_epoch: + $ref: "../primitive.yaml#/Uint64" + description: "The epoch when the amount is withdrawable." From 30f056852c2a4ffdb97c4187112d7b307d08a3b9 Mon Sep 17 00:00:00 2001 From: Jim McDonald Date: Tue, 24 Sep 2024 22:52:29 +0100 Subject: [PATCH 2/3] Validator identities endpoint. (#452) In support of #449. Co-authored-by: Paul Harris Co-authored-by: Nico Flaig --- CHANGES.md | 1 + apis/beacon/states/validator_identities.yaml | 71 ++++++++++++++++++++ beacon-node-oapi.yaml | 4 ++ types/api.yaml | 14 ++++ 4 files changed, 90 insertions(+) create mode 100644 apis/beacon/states/validator_identities.yaml diff --git a/CHANGES.md b/CHANGES.md index 235c8c63..dda3467d 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -14,6 +14,7 @@ There are likely to be descriptions etc outside of the list below, but new query | [#448](https://github.com/ethereum/beacon-APIs/pull/448) `POST /eth/v2/beacon/pool/attestations` added | | | | | | | [#448](https://github.com/ethereum/beacon-APIs/pull/448) `GET /eth/v2/beacon/pool/attester_slashings` added | | | | | | | [#448](https://github.com/ethereum/beacon-APIs/pull/448) `POST /eth/v2/beacon/pool/attester_slashings` added | | | | | | +| [#452](https://github.com/ethereum/beacon-APIs/pull/452) `POST /eth/v1/beacon/states/{state_id}/validator_identities` added | | | | | | | [#456](https://github.com/ethereum/beacon-APIs/pull/456) `POST /eth/v2/validator/aggregate_and_proofs` added | | | | | | diff --git a/apis/beacon/states/validator_identities.yaml b/apis/beacon/states/validator_identities.yaml new file mode 100644 index 00000000..4963f5c3 --- /dev/null +++ b/apis/beacon/states/validator_identities.yaml @@ -0,0 +1,71 @@ +post: + operationId: "postStateValidatorIdentities" + summary: "Get validator identities from state" + description: | + Returns filterable list of validators identities. + + Identities will be returned for all indices or public keys that match known validators. If an index or public key does not + match any known validator, no identity will be returned but this will not cause an error. There are no guarantees for the + returned data in terms of ordering. + + Depending on `Accept` header data can be returned either as JSON or as bytes serialized by SSZ. + tags: + - Beacon + parameters: + - name: state_id + in: path + $ref: '../../../beacon-node-oapi.yaml#/components/parameters/StateId' + requestBody: + description: "An array of values, with each value either a hex encoded public key (any bytes48 with 0x prefix) or a validator index." + required: false + content: + application/json: + schema: + type: array + uniqueItems: true + items: + description: "Either hex encoded public key (any bytes48 with 0x prefix) or validator index" + type: string + responses: + "200": + description: Success + content: + application/json: + schema: + title: PostStateValidatorIdentitiesResponse + type: object + required: [execution_optimistic, finalized, data] + properties: + execution_optimistic: + $ref: "../../../beacon-node-oapi.yaml#/components/schemas/ExecutionOptimistic" + finalized: + $ref: "../../../beacon-node-oapi.yaml#/components/schemas/Finalized" + data: + type: array + items: + $ref: '../../../beacon-node-oapi.yaml#/components/schemas/ValidatorIdentityResponse' + application/octet-stream: + schema: + description: "SSZ serialized results. Use Accept header to choose this response type" + "400": + description: "Invalid state ID or malformed request" + 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" + "406": + $ref: "../../../beacon-node-oapi.yaml#/components/responses/NotAcceptable" + "500": + $ref: '../../../beacon-node-oapi.yaml#/components/responses/InternalError' diff --git a/beacon-node-oapi.yaml b/beacon-node-oapi.yaml index 59d1aefd..31a60561 100644 --- a/beacon-node-oapi.yaml +++ b/beacon-node-oapi.yaml @@ -81,6 +81,8 @@ paths: $ref: "./apis/beacon/states/validator.yaml" /eth/v1/beacon/states/{state_id}/validator_balances: $ref: "./apis/beacon/states/validator_balances.yaml" + /eth/v1/beacon/states/{state_id}/validator_identities: + $ref: "./apis/beacon/states/validator_identities.yaml" /eth/v1/beacon/states/{state_id}/committees: $ref: "./apis/beacon/states/committee.yaml" /eth/v1/beacon/states/{state_id}/sync_committees: @@ -239,6 +241,8 @@ components: $ref: './types/api.yaml#/ValidatorResponse' ValidatorBalanceResponse: $ref: './types/api.yaml#/ValidatorBalanceResponse' + ValidatorIdentityResponse: + $ref: './types/api.yaml#/ValidatorIdentityResponse' ValidatorStatus: $ref: './types/api.yaml#/ValidatorStatus' Committee: diff --git a/types/api.yaml b/types/api.yaml index 8d1dd9fc..8b577e16 100644 --- a/types/api.yaml +++ b/types/api.yaml @@ -45,6 +45,20 @@ ValidatorBalanceResponse: $ref: "./primitive.yaml#/Gwei" description: "Current validator balance in gwei." +ValidatorIdentityResponse: + type: object + required: [index, pubkey, activation_epoch] + properties: + index: + $ref: './primitive.yaml#/Uint64' + description: "Index of validator in validator registry." + pubkey: + $ref: './primitive.yaml#/Pubkey' + description: "Public key of validator." + activation_epoch: + $ref: "./primitive.yaml#/Uint64" + description: "Epoch when validator activated. 'FAR_FUTURE_EPOCH' if not activated" + ValidatorStatus: description: | Possible statuses: From e7f7d70423b0abfe9d9f33b701be2ec03e44eb02 Mon Sep 17 00:00:00 2001 From: Fredrik Svantes Date: Tue, 24 Sep 2024 23:56:36 +0200 Subject: [PATCH 3/3] Removed default builder boost (#438) Co-authored-by: Paul Harris --- apis/validator/block.v3.yaml | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/apis/validator/block.v3.yaml b/apis/validator/block.v3.yaml index 3788717d..b1eb5cc7 100644 --- a/apis/validator/block.v3.yaml +++ b/apis/validator/block.v3.yaml @@ -53,18 +53,17 @@ get: Servers must support the following values of the boost factor which encode common preferences: - * `builder_boost_factor=0`: prefer the execution node payload unless an error makes it + * `builder_boost_factor=0`: prefer the local execution node payload unless an error makes it unviable. - * `builder_boost_factor=100`: default profit maximization mode; choose whichever + * `builder_boost_factor=100`: profit maximization mode; choose whichever payload pays more. - * `builder_boost_factor=2**64 - 1`: prefer the builder payload unless an error or + * `builder_boost_factor=2**64 - 1`: prefer the external builder payload unless an error or beacon node health check makes it unviable. Servers should use saturating arithmetic or another technique to ensure that large values of the `builder_boost_factor` do not trigger overflows or errors. If this parameter is provided and the beacon node is not configured with a builder then the beacon node MUST - respond with a full block, which the caller can choose to reject if it wishes. If this - parameter is **not** provided then it should be treated as having the default value of 100. + respond with a full block, which the caller can choose to reject if it wishes. If the value is provided but out of range for a 64-bit unsigned integer, then an error response with status code 400 MUST be returned. schema: