Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update types to support EIP-4844 #271

Merged
merged 21 commits into from
Dec 25, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
21 commits
Select commit Hold shift + click to select a range
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion apis/beacon/blocks/blinded_block.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ get:
properties:
version:
type: string
enum: [phase0, altair, bellatrix, capella]
enum: [phase0, altair, bellatrix, capella, eip4844]
example: "phase0"
execution_optimistic:
$ref: "../../../beacon-node-oapi.yaml#/components/schemas/ExecutionOptimistic"
Expand All @@ -37,6 +37,7 @@ get:
- $ref: "../../../beacon-node-oapi.yaml#/components/schemas/Altair.SignedBeaconBlock"
- $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/EIP4844.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.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ post:
- $ref: "../../../beacon-node-oapi.yaml#/components/schemas/Altair.SignedBeaconBlock"
- $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/EIP4844.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 @@ -25,7 +25,7 @@ get:
properties:
version:
type: string
enum: [phase0, altair, bellatrix, capella]
enum: [phase0, altair, bellatrix, capella, eip4844]
example: "phase0"
execution_optimistic:
$ref: "../../../beacon-node-oapi.yaml#/components/schemas/ExecutionOptimistic"
Expand All @@ -37,6 +37,7 @@ get:
- $ref: "../../../beacon-node-oapi.yaml#/components/schemas/Altair.SignedBeaconBlock"
- $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/EIP4844.SignedBeaconBlock"
application/octet-stream:
schema:

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 @@ -30,6 +30,7 @@ post:
- $ref: "../../../beacon-node-oapi.yaml#/components/schemas/Altair.SignedBeaconBlock"
- $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/EIP4844.SignedBeaconBlock"
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 @@ -25,7 +25,7 @@ get:
properties:
version:
type: string
enum: [ phase0, altair, bellatrix, capella ]
enum: [ phase0, altair, bellatrix, capella, eip4844 ]
example: "phase0"
execution_optimistic:
$ref: "../../beacon-node-oapi.yaml#/components/schemas/ExecutionOptimistic"
Expand All @@ -37,6 +37,7 @@ get:
- $ref: "../../beacon-node-oapi.yaml#/components/schemas/Altair.BeaconState"
- $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/EIP4844.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 @@ -54,14 +54,15 @@ get:
properties:
version:
type: string
enum: [ phase0, altair, bellatrix, capella ]
enum: [ phase0, altair, bellatrix, capella, eip4844 ]
example: "bellatrix"
data:
oneOf:
- $ref: '../../beacon-node-oapi.yaml#/components/schemas/BeaconBlock'
- $ref: "../../beacon-node-oapi.yaml#/components/schemas/Altair.BeaconBlock"
- $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/EIP4844.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 @@ -51,14 +51,15 @@ get:
properties:
version:
type: string
enum: [ phase0, altair, bellatrix, capella ]
enum: [ phase0, altair, bellatrix, capella, eip4844 ]
example: "phase0"
data:
oneOf:
- $ref: '../../beacon-node-oapi.yaml#/components/schemas/BeaconBlock'
- $ref: "../../beacon-node-oapi.yaml#/components/schemas/Altair.BeaconBlock"
- $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/EIP4844.BeaconBlock"
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
12 changes: 11 additions & 1 deletion beacon-node-oapi.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -311,7 +311,7 @@ components:
Bellatrix.SignedBlindedBeaconBlock:
$ref: './types/bellatrix/block.yaml#/Bellatrix/SignedBlindedBeaconBlock'
ConsensusVersion:
enum: [phase0, altair, bellatrix, capella]
enum: [phase0, altair, bellatrix, capella, eip4844]
example: "phase0"
SignedValidatorRegistration:
$ref: './types/registration.yaml#/SignedValidatorRegistration'
Expand All @@ -325,6 +325,16 @@ components:
$ref: './types/capella/block.yaml#/Capella/BlindedBeaconBlock'
Capella.SignedBlindedBeaconBlock:
$ref: './types/capella/block.yaml#/Capella/SignedBlindedBeaconBlock'
EIP4844.BeaconState:
$ref: './types/eip4844/state.yaml#/EIP4844/BeaconState'
EIP4844.BeaconBlock:
$ref: './types/eip4844/block.yaml#/EIP4844/BeaconBlock'
EIP4844.SignedBeaconBlock:
$ref: './types/eip4844/block.yaml#/EIP4844/SignedBeaconBlock'
EIP4844.BlindedBeaconBlock:
$ref: './types/eip4844/block.yaml#/EIP4844/BlindedBeaconBlock'
EIP4844.SignedBlindedBeaconBlock:
$ref: './types/eip4844/block.yaml#/EIP4844/SignedBlindedBeaconBlock'
Node:
$ref: './types/fork_choice.yaml#/Node'
ExtraData:
Expand Down
1 change: 1 addition & 0 deletions types/bellatrix/execution_payload.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ Bellatrix:
allOf:
- $ref: '#/Bellatrix/ExecutionPayloadCommon'
- type: object
additionalProperties: false
jimmygchen marked this conversation as resolved.
Show resolved Hide resolved
properties:
transactions_root:
$ref: '../primitive.yaml#/Root'
12 changes: 4 additions & 8 deletions types/capella/block.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,10 @@ Capella:
$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'

BeaconBlockBody:
allOf:
Expand All @@ -42,10 +46,6 @@ Capella:
properties:
execution_payload:
$ref: './execution_payload.yaml#/Capella/ExecutionPayload'
bls_to_execution_changes:
type: array
items:
$ref: '../bls_to_execution_change.yaml#/SignedBLSToExecutionChange'

BeaconBlock:
description: "The [`BeaconBlock`](https://github.com/ethereum/consensus-specs/blob/master/specs/Capella/beacon-chain.md#beaconblock) object from the CL Capella spec."
Expand Down Expand Up @@ -73,10 +73,6 @@ Capella:
properties:
execution_payload_header:
$ref: './execution_payload.yaml#/Capella/ExecutionPayloadHeader'
bls_to_execution_changes:
type: array
items:
$ref: '../bls_to_execution_change.yaml#/SignedBLSToExecutionChange'

BlindedBeaconBlock:
description: "A variant of the the [`BeaconBlock`](https://github.com/ethereum/consensus-specs/blob/master/specs/capella/beacon-chain.md#beaconblock) object from the CL Capella spec, which contains a `BlindedBeaconBlockBody` rather than a `BeaconBlockBody`."
Expand Down
1 change: 1 addition & 0 deletions types/capella/execution_payload.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ Capella:
allOf:
- $ref: '#/Capella/ExecutionPayloadCommon'
- type: object
additionalProperties: false
properties:
transactions_root:
$ref: '../primitive.yaml#/Root'
Expand Down
97 changes: 97 additions & 0 deletions types/eip4844/block.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,97 @@
EIP4844:
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/master/specs/eip4844/beacon-chain.md#beaconblockbody) object from the CL EIP-4844 spec."
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#/AttesterSlashing'
attestations:
type: array
items:
$ref: '../attestation.yaml#/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: '#/EIP4844/BeaconBlockBodyCommon'
- type: object
properties:
execution_payload:
$ref: './execution_payload.yaml#/EIP4844/ExecutionPayload'

BeaconBlock:
description: "The [`BeaconBlock`](https://github.com/ethereum/consensus-specs/blob/master/specs/EIP4844/beacon-chain.md#beaconblock) object from the CL EIP-4844 spec."
allOf:
- $ref: '../altair/block.yaml#/Altair/BeaconBlockCommon'
- type: object
properties:
body:
$ref: '#/EIP4844/BeaconBlockBody'

SignedBeaconBlock:
type: object
description: "The [`SignedBeaconBlock`](https://github.com/ethereum/consensus-specs/blob/master/specs/eip4844/beacon-chain.md#signedbeaconblock) object envelope from the CL EIP-4844 spec."
properties:
message:
$ref: "#/EIP4844/BeaconBlock"
signature:
$ref: "../primitive.yaml#/Signature"

BlindedBeaconBlockBody:
description: "A variant of the [`BeaconBlockBody`](https://github.com/ethereum/consensus-specs/blob/master/specs/eip4844/beacon-chain.md#beaconblockbody) object from the CL EIP-4844 spec, which contains a transactions root rather than a full transactions list."
allOf:
- $ref: '#/EIP4844/BeaconBlockBodyCommon'
- type: object
properties:
execution_payload_header:
$ref: './execution_payload.yaml#/EIP4844/ExecutionPayloadHeader'

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

SignedBlindedBeaconBlock:
type: object
description: "A variant of the the the [`SignedBeaconBlock`](https://github.com/ethereum/consensus-specs/blob/master/specs/eip4844/beacon-chain.md#signedbeaconblock) object envelope from the CL EIP-4844 spec, which contains a `BlindedBeaconBlock` rather than a `BeaconBlock`."
properties:
message:
$ref: "#/EIP4844/BlindedBeaconBlock"
signature:
$ref: "../primitive.yaml#/Signature"
29 changes: 29 additions & 0 deletions types/eip4844/block_and_blobs_sidecar.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
EIP4844:
BlobsSidecar:
type: object
description: "The `BlobsSidecar` object from the EIP-4844 CL spec."
properties:
beacon_block_root:
$ref: "../primitive.yaml#/Root"
beacon_block_slot:
$ref: "../primitive.yaml#/Uint64"
blobs:
type: array
maxItems: 4
minItems: 0
items:
$ref: "#/EIP4844/Blob"
kzg_aggregated_proof:
$ref: "#/EIP4844/KZGProof"

KZGProof:
type: string
format: hex
pattern: "^0x[a-fA-F0-9]{96}$"
description: "An aggregated KZG proof. Same check as `KZGCommitment`"

Blob:
type: string
format: hex
pattern: "^0x[a-fA-F0-9]{262144}$"
description: "A blob is `FIELD_ELEMENTS_PER_BLOB * size_of(BLSFieldElement) = 4096 * 32 = 131072` bytes (`DATA`) representing a SSZ-encoded Blob as defined in EIP-4844"
56 changes: 56 additions & 0 deletions types/eip4844/execution_payload.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
EIP4844:
ExecutionPayloadCommon:
# An abstract object to collect the common fields between the ExecutionPayload and the ExecutionPayloadHeader objects.
type: object
description: "The [`ExecutionPayload`](https://github.com/ethereum/consensus-specs/blob/master/specs/eip4844/beacon-chain.md#executionpayload) object from the CL EIP-4844 spec."
properties:
parent_hash:
$ref: '../primitive.yaml#/Root'
fee_recipient:
$ref: '../primitive.yaml#/ExecutionAddress'
state_root:
$ref: '../primitive.yaml#/Root'
receipts_root:
$ref: '../primitive.yaml#/Root'
logs_bloom:
$ref: '../primitive.yaml#/LogsBloom'
prev_randao:
$ref: '../primitive.yaml#/Bytes32'
block_number:
$ref: '../primitive.yaml#/Uint64'
gas_limit:
$ref: '../primitive.yaml#/Uint64'
gas_used:
$ref: '../primitive.yaml#/Uint64'
timestamp:
$ref: '../primitive.yaml#/Uint64'
extra_data:
$ref: '../primitive.yaml#/ExtraData'
base_fee_per_gas:
$ref: '../primitive.yaml#/Uint256'
excess_data_gas:
$ref: '../primitive.yaml#/Uint256'
block_hash:
$ref: '../primitive.yaml#/Root'


ExecutionPayload:
allOf:
- $ref: '#/EIP4844/ExecutionPayloadCommon'
- type: object
properties:
transactions:
$ref: '../capella/transactions.yaml#/Capella/Transactions'
withdrawals:
$ref: '../capella/withdrawals.yaml#/Capella/Withdrawals'

ExecutionPayloadHeader:
description: "The [`ExecutionPayloadHeader`](https://github.com/ethereum/consensus-specs/blob/master/specs/eip4844/beacon-chain.md#executionpayloadheader) object from the CL EIP-4844 spec."
allOf:
- $ref: '#/EIP4844/ExecutionPayloadCommon'
- type: object
properties:
transactions_root:
$ref: '../primitive.yaml#/Root'
withdrawals_root:
$ref: '../primitive.yaml#/Root'
Loading