From 9df1f3a15646146aa9510b3f1154bb7668455df5 Mon Sep 17 00:00:00 2001 From: realbigsean Date: Fri, 25 Feb 2022 12:56:10 -0500 Subject: [PATCH 01/11] Bellatrix and blinded blocks --- apis/beacon/blocks/blinded_blocks.yaml | 43 +++++++++++ apis/beacon/blocks/block.v2.yaml | 3 +- apis/beacon/blocks/blocks.yaml | 1 + apis/debug/state.v2.yaml | 3 +- apis/validator/blinded_block.yaml | 62 +++++++++++++++ apis/validator/block.v2.yaml | 3 +- beacon-node-oapi.yaml | 18 ++++- types/bellatrix/block.yaml | 90 ++++++++++++++++++++++ types/bellatrix/execution_payload.yaml | 49 ++++++++++++ types/bellatrix/state.yaml | 101 +++++++++++++++++++++++++ types/bellatrix/transactions.yaml | 7 ++ types/primitive.yaml | 21 +++++ 12 files changed, 396 insertions(+), 5 deletions(-) create mode 100644 apis/beacon/blocks/blinded_blocks.yaml create mode 100644 apis/validator/blinded_block.yaml create mode 100644 types/bellatrix/block.yaml create mode 100644 types/bellatrix/execution_payload.yaml create mode 100644 types/bellatrix/state.yaml create mode 100644 types/bellatrix/transactions.yaml diff --git a/apis/beacon/blocks/blinded_blocks.yaml b/apis/beacon/blocks/blinded_blocks.yaml new file mode 100644 index 00000000..b6e88cb0 --- /dev/null +++ b/apis/beacon/blocks/blinded_blocks.yaml @@ -0,0 +1,43 @@ +post: + tags: + - Beacon + - ValidatorRequiredApi + summary: "Publish a signed block." + operationId: "publishBlindedBlock" + description: | + Instructs the beacon node to use the components of the `SignedBlindedBeaconBlock` to construct and publish a + `SignedBeaconBlock` by swapping out the `transactions_root` for the corresponding full list of `transactions` + The beacon node should broadcast a newly constructed `SignedBeaconBlock` to the beacon network, + to be included in the beacon chain. The beacon node is not required to validate the signed + `BeaconBlock`, and a successful response (20X) only indicates that the broadcast has been + successful. The beacon node is expected to integrate the new block into its state, and + therefore validate the block internally, however blocks which fail the validation are still + broadcast but a different status code is returned (202) + + requestBody: + description: "The `SignedBlindedBeaconBlock` object composed of `BlindedBeaconBlock` object (produced by beacon node) and validator signature." + required: true + content: + application/json: + schema: + oneOf: + - $ref: "../../../beacon-node-oapi.yaml#/components/schemas/Bellatrix.SignedBlindedBeaconBlock" + responses: + "200": + description: "The block was validated successfully and has been broadcast. It has also been integrated into the beacon node's database." + "202": + description: "The block failed validation, but was successfully broadcast anyway. It was not integrated into the beacon node's database." + "400": + description: "The `SignedBlindedBeaconBlock` object is invalid" + content: + application/json: + schema: + allOf: + - $ref: "../../../beacon-node-oapi.yaml#/components/schemas/ErrorMessage" + - example: + code: 400 + message: "Invalid block: missing signature" + "500": + $ref: '../../../beacon-node-oapi.yaml#/components/responses/InternalError' + "503": + $ref: '../../../beacon-node-oapi.yaml#/components/responses/CurrentlySyncing' diff --git a/apis/beacon/blocks/block.v2.yaml b/apis/beacon/blocks/block.v2.yaml index edccb3d3..722c7734 100644 --- a/apis/beacon/blocks/block.v2.yaml +++ b/apis/beacon/blocks/block.v2.yaml @@ -24,12 +24,13 @@ get: properties: version: type: string - enum: [phase0, altair] + enum: [phase0, altair, bellatrix] example: "phase0" data: oneOf: - $ref: "../../../beacon-node-oapi.yaml#/components/schemas/SignedBeaconBlock" - $ref: "../../../beacon-node-oapi.yaml#/components/schemas/Altair.SignedBeaconBlock" + - $ref: "../../../beacon-node-oapi.yaml#/components/schemas/Bellatrix.SignedBeaconBlock" application/octet-stream: schema: diff --git a/apis/beacon/blocks/blocks.yaml b/apis/beacon/blocks/blocks.yaml index cd1ab12b..da485b0c 100644 --- a/apis/beacon/blocks/blocks.yaml +++ b/apis/beacon/blocks/blocks.yaml @@ -20,6 +20,7 @@ post: oneOf: - $ref: '../../../beacon-node-oapi.yaml#/components/schemas/SignedBeaconBlock' - $ref: "../../../beacon-node-oapi.yaml#/components/schemas/Altair.SignedBeaconBlock" + - $ref: "../../../beacon-node-oapi.yaml#/components/schemas/Bellatrix.SignedBeaconBlock" responses: "200": description: "The block was validated successfully and has been broadcast. It has also been integrated into the beacon node's database." diff --git a/apis/debug/state.v2.yaml b/apis/debug/state.v2.yaml index c396bf5d..1a51a5f4 100644 --- a/apis/debug/state.v2.yaml +++ b/apis/debug/state.v2.yaml @@ -25,12 +25,13 @@ get: properties: version: type: string - enum: [ phase0, altair ] + enum: [ phase0, altair, bellatrix ] example: "phase0" data: oneOf: - $ref: '../../beacon-node-oapi.yaml#/components/schemas/BeaconState' - $ref: "../../beacon-node-oapi.yaml#/components/schemas/Altair.BeaconState" + - $ref: "../../beacon-node-oapi.yaml#/components/schemas/Bellatrix.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 new file mode 100644 index 00000000..202eb5b1 --- /dev/null +++ b/apis/validator/blinded_block.yaml @@ -0,0 +1,62 @@ +get: + tags: + - ValidatorRequiredApi + - Validator + operationId: "produceBlindedBlock" + summary: "Produce a new blinded block, without signature." + description: | + Requests a beacon node to produce a valid blinded block, which can then be signed by a validator. + A blinded block is a block with only a transactions root, rather than a full transactions list. + + Metadata in the response indicates the type of block produced, and the supported types of block + will be added to as forks progress. + parameters: + - name: slot + in: path + required: true + description: "The slot for which the block should be proposed." + schema: + $ref: "../../beacon-node-oapi.yaml#/components/schemas/Uint64" + - name: randao_reveal + in: query + required: true + description: "The validator's randao reveal value." + schema: + $ref: '../../beacon-node-oapi.yaml#/components/schemas/Signature' + - name: graffiti + in: query + required: false + description: "Arbitrary data validator wants to include in block." + schema: + $ref: '../../beacon-node-oapi.yaml#/components/schemas/Graffiti' + responses: + "200": + description: Success response + content: + application/json: + schema: + title: ProduceBlindedBlockResponse + type: object + properties: + version: + type: string + enum: [ bellatrix ] + example: "bellatrix" + data: + oneOf: + - $ref: "../../beacon-node-oapi.yaml#/components/schemas/Bellatrix.BlindedBeaconBlock" + "400": + description: "Invalid block production request" + content: + application/json: + schema: + $ref: "../../beacon-node-oapi.yaml#/components/schemas/ErrorMessage" + examples: + InvalidRequest: + value: + code: 400 + message: "Invalid request to produce a block" + "500": + $ref: '../../beacon-node-oapi.yaml#/components/responses/InternalError' + "503": + $ref: '../../beacon-node-oapi.yaml#/components/responses/CurrentlySyncing' \ No newline at end of file diff --git a/apis/validator/block.v2.yaml b/apis/validator/block.v2.yaml index f0a4fb53..f3c5f3e7 100644 --- a/apis/validator/block.v2.yaml +++ b/apis/validator/block.v2.yaml @@ -39,12 +39,13 @@ get: properties: version: type: string - enum: [ phase0, altair ] + enum: [ phase0, altair, bellatrix ] 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" "400": description: "Invalid block production request" content: diff --git a/beacon-node-oapi.yaml b/beacon-node-oapi.yaml index 8451193b..97ad7cce 100644 --- a/beacon-node-oapi.yaml +++ b/beacon-node-oapi.yaml @@ -69,6 +69,8 @@ paths: $ref: "./apis/beacon/blocks/header.yaml" /eth/v1/beacon/blocks: $ref: "./apis/beacon/blocks/blocks.yaml" + /eth/v1/beacon/blinded_blocks: + $ref: "./apis/beacon/blocks/blinded_blocks.yaml" /eth/v1/beacon/blocks/{block_id}: $ref: "./apis/beacon/blocks/block.yaml" /eth/v2/beacon/blocks/{block_id}: @@ -127,7 +129,9 @@ paths: /eth/v1/validator/blocks/{slot}: $ref: "./apis/validator/block.yaml" /eth/v2/validator/blocks/{slot}: - $ref: "./apis/validator/block.v2.yaml" + $ref: "./apis/validator/block.v2.yaml" + /eth/v2/validator/blinded_blocks/{slot}: + $ref: "./apis/validator/blinded_block.yaml" /eth/v1/validator/attestation_data: $ref: "./apis/validator/attestation_data.yaml" /eth/v1/validator/aggregate_attestation: @@ -241,6 +245,16 @@ components: $ref: './types/altair/sync_committee.yaml#/Altair/SyncCommitteeByValidatorIndices' ExecutionAddress: $ref: './types/primitive.yaml#/ExecutionAddress' + Bellatrix.BeaconState: + $ref: './types/bellatrix/state.yaml#/Bellatrix/BeaconState' + Bellatrix.BeaconBlock: + $ref: './types/bellatrix/block.yaml#/Bellatrix/BeaconBlock' + Bellatrix.SignedBeaconBlock: + $ref: './types/bellatrix/block.yaml#/Bellatrix/SignedBeaconBlock' + Bellatrix.BlindedBeaconBlock: + $ref: './types/bellatrix/block.yaml#/Bellatrix/BeaconBlock' + Bellatrix.SignedBlindedBeaconBlock: + $ref: './types/bellatrix/block.yaml#/Bellatrix/SignedBlindedBeaconBlock' parameters: StateId: @@ -261,5 +275,5 @@ components: description: Required in response so client can deserialize returned json or ssz data more effectively. schema: type: string - enum: [phase0, altair] + enum: [phase0, altair, bellatrix] example: "phase0" diff --git a/types/bellatrix/block.yaml b/types/bellatrix/block.yaml new file mode 100644 index 00000000..1972f669 --- /dev/null +++ b/types/bellatrix/block.yaml @@ -0,0 +1,90 @@ +Bellatrix: + 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.1.9/specs/bellatrix/beacon-chain.md#beaconblockbody) object from the Eth2.0 Bellatrix 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: + type: string + pattern: "^0x[a-fA-F0-9]{64}$" + 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' + + BeaconBlockBody: + allOf: + - $ref: '#/Bellatrix/BeaconBlockBodyCommon' + - type: object + properties: + execution_payload: + $ref: './execution_payload.yaml#/Bellatrix/ExecutionPayload' + + BeaconBlock: + description: "The [`BeaconBlock`](https://github.com/ethereum/eth2.0-specs/blob/v1.1.9/specs/bellatrix/beacon-chain.md#beaconblock) object from the Eth2.0 Bellatrix spec." + allOf: + - $ref: '../altair/block.yaml#/Altair/BeaconBlockCommon' + - type: object + properties: + body: + $ref: '#/Bellatrix/BeaconBlockBody' + + SignedBeaconBlock: + type: object + description: "The [`SignedBeaconBlock`](https://github.com/ethereum/eth2.0-specs/blob/v1.1.9/specs/bellatrix/beacon-chain.md#signedbeaconblock) object envelope from the Eth2.0 Bellatrix spec." + properties: + message: + $ref: "#/Bellatrix/BeaconBlock" + signature: + $ref: "../primitive.yaml#/Signature" + + BlindedBeaconBlockBody: + description: "A variant of the [`BeaconBlockBody`](https://github.com/ethereum/consensus-specs/blob/v1.1.9/specs/bellatrix/beacon-chain.md#beaconblockbody) object from the Eth2.0 Bellatrix spec, which contains a transactions root rather than a full transactions list." + allOf: + - $ref: '#/Bellatrix/BeaconBlockBodyCommon' + - type: object + properties: + execution_payload_header: + $ref: './execution_payload.yaml#/Bellatrix/ExecutionPayloadHeader' + + BlindedBeaconBlock: + description: "A variant of the the [`BeaconBlock`](https://github.com/ethereum/eth2.0-specs/blob/v1.1.9/specs/bellatrix/beacon-chain.md#beaconblock) object from the Eth2.0 Bellatrix spec, which contains a `BlindedBeaconBlockBody` rather than a `BeaconBlockBody`." + allOf: + - $ref: '../altair/block.yaml#/Altair/BeaconBlockCommon' + - type: object + properties: + body: + $ref: '#/Bellatrix/BlindedBeaconBlockBody' + + SignedBlindedBeaconBlock: + type: object + description: "A variant of the the the [`SignedBeaconBlock`](https://github.com/ethereum/eth2.0-specs/blob/v1.1.9/specs/bellatrix/beacon-chain.md#signedbeaconblock) object envelope from the Eth2.0 Bellatrix spec, which contains a `BlindedBeaconBlock` rather than a `BeaconBlock`." + properties: + message: + $ref: "#/Bellatrix/BlindedBeaconBlock" + signature: + $ref: "../primitive.yaml#/Signature" diff --git a/types/bellatrix/execution_payload.yaml b/types/bellatrix/execution_payload.yaml new file mode 100644 index 00000000..04126552 --- /dev/null +++ b/types/bellatrix/execution_payload.yaml @@ -0,0 +1,49 @@ +Bellatrix: + 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/eth2.0-specs/blob/v1.1.9/specs/bellatrix) object from the Eth2.0 Bellatrix 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#/Root' + 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' + block_hash: + $ref: '../primitive.yaml#/Root' + + + ExecutionPayload: + allOf: + - $ref: '#/Bellatrix/ExecutionPayloadCommon' + - type: object + properties: + transactions: + $ref: './transactions.yaml#/Bellatrix/Transactions' + + ExecutionPayloadHeader: + allOf: + - $ref: '#/Bellatrix/ExecutionPayloadCommon' + - type: object + properties: + transactions_root: + $ref: '../primitive.yaml#/Root' \ No newline at end of file diff --git a/types/bellatrix/state.yaml b/types/bellatrix/state.yaml new file mode 100644 index 00000000..dc65266b --- /dev/null +++ b/types/bellatrix/state.yaml @@ -0,0 +1,101 @@ +Bellatrix: + BeaconState: + type: object + description: "The [`BeaconState`](https://github.com/ethereum/eth2.0-specs/blob/v1.1.0-alpha.3/specs/altair/beacon-chain.md#beaconstate) object from the Eth2.0 Altair spec." + 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 + items: + allOf: + - $ref: '../primitive.yaml#/Root' + minItems: 8192 + maxItems: 8192 + state_roots: + type: array + items: + allOf: + - $ref: '../primitive.yaml#/Root' + minItems: 8192 + maxItems: 8192 + historical_roots: + type: array + items: + allOf: + - $ref: '../primitive.yaml#/Root' + maxItems: 16777216 + eth1_data: + $ref: "../eth1.yaml#/Eth1Data" + eth1_data_votes: + type: array + items: + allOf: + - $ref: '../eth1.yaml#/Eth1Data' + maxItems: 1024 + eth1_deposit_index: + $ref: "../primitive.yaml#/Uint64" + validators: + type: array + maxItems: 1099511627776 + items: + allOf: + - $ref: '../validator.yaml#/Validator' + balances: + type: array + description: "Validator balances in gwei" + maxItems: 1099511627776 + items: + allOf: + - $ref: '../primitive.yaml#/Uint64' + randao_mixes: + type: array + items: + allOf: + - $ref: '../primitive.yaml#/Root' + minItems: 65536 + maxItems: 65536 + slashings: + type: array + description: "Per-epoch sums of slashed effective balances" + items: + allOf: + - $ref: '../primitive.yaml#/Uint64' + minItems: 8192 + maxItems: 8192 + previous_epoch_participation: + $ref: '../altair/epoch_participation.yaml#/Altair/EpochParticipation' + current_epoch_participation: + $ref: '../altair/epoch_participation.yaml#/Altair/EpochParticipation' + justification_bits: + type: string + pattern: "^0x[a-fA-F0-9]+$" + example: "0x01" + 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. New in Altair" + type: array + maxItems: 1099511627776 + items: + allOf: + - $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: './execution_payload.yaml#/Bellatrix/ExecutionPayloadHeader' \ No newline at end of file diff --git a/types/bellatrix/transactions.yaml b/types/bellatrix/transactions.yaml new file mode 100644 index 00000000..59f4e063 --- /dev/null +++ b/types/bellatrix/transactions.yaml @@ -0,0 +1,7 @@ +Bellatrix: + Transactions: + type: array + items: + allOf: + - $ref: '../primitive.yaml#/Transaction' + maxItems: 1048576 \ No newline at end of file diff --git a/types/primitive.yaml b/types/primitive.yaml index 2943b2a9..444db23e 100644 --- a/types/primitive.yaml +++ b/types/primitive.yaml @@ -28,6 +28,10 @@ Uint64: type: string example: "1" +Uint256: + type: string + example: "1" + DependentRoot: allOf: - $ref: "./primitive.yaml#/Root" @@ -64,3 +68,20 @@ ExecutionAddress: description: "An address on the execution (Ethereum 1) network." example: "0xabcf8e0d4e9587369b2301d0790347320302cc09" pattern: "^0x[a-fA-F0-9]{40}$" + +Transaction: + type: string + description: "A transaction on the execution (Ethereum 1) network." + example: "0x02f878831469668303f51d843b9ac9f9843b9aca0082520894c93269b73096998db66be0441e836d873535cb9c8894a19041886f000080c001a031cc29234036afbf9a1fb9476b463367cb1f957ac0b919b69bbc798436e604aaa018c4e9c3914eb27aadd0b91e10b18655739fcf8c1fc398763a9f1beecb8ddc86" + pattern: "^0x[a-fA-F0-9]{1,2147483648}$" + +ExtraData: + type: string + description: "Extra data on the execution (Ethereum 1) network." + example: "0xcf8e0d4e9587369b2301d0790347320302cc0943d5a1884560367e8208d920f2" + pattern: "^0x[a-fA-F0-9]{1,64}$" + +LogsBloom: + type: string + example: "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000" + pattern: "^0x[a-fA-F0-9]{512}$" From 78256b6552c621b807c9d75cc3469358e937deee Mon Sep 17 00:00:00 2001 From: realbigsean Date: Fri, 25 Feb 2022 13:26:35 -0500 Subject: [PATCH 02/11] fix hex size ranges, newlines, comment --- apis/validator/blinded_block.yaml | 2 +- types/bellatrix/execution_payload.yaml | 2 +- types/bellatrix/state.yaml | 4 ++-- types/bellatrix/transactions.yaml | 2 +- types/primitive.yaml | 4 ++-- 5 files changed, 7 insertions(+), 7 deletions(-) diff --git a/apis/validator/blinded_block.yaml b/apis/validator/blinded_block.yaml index 202eb5b1..f73ce3e3 100644 --- a/apis/validator/blinded_block.yaml +++ b/apis/validator/blinded_block.yaml @@ -59,4 +59,4 @@ get: "500": $ref: '../../beacon-node-oapi.yaml#/components/responses/InternalError' "503": - $ref: '../../beacon-node-oapi.yaml#/components/responses/CurrentlySyncing' \ No newline at end of file + $ref: '../../beacon-node-oapi.yaml#/components/responses/CurrentlySyncing' diff --git a/types/bellatrix/execution_payload.yaml b/types/bellatrix/execution_payload.yaml index 04126552..2f56f8f2 100644 --- a/types/bellatrix/execution_payload.yaml +++ b/types/bellatrix/execution_payload.yaml @@ -46,4 +46,4 @@ Bellatrix: - type: object properties: transactions_root: - $ref: '../primitive.yaml#/Root' \ No newline at end of file + $ref: '../primitive.yaml#/Root' diff --git a/types/bellatrix/state.yaml b/types/bellatrix/state.yaml index dc65266b..6176a709 100644 --- a/types/bellatrix/state.yaml +++ b/types/bellatrix/state.yaml @@ -1,7 +1,7 @@ Bellatrix: BeaconState: type: object - description: "The [`BeaconState`](https://github.com/ethereum/eth2.0-specs/blob/v1.1.0-alpha.3/specs/altair/beacon-chain.md#beaconstate) object from the Eth2.0 Altair spec." + description: "The [`BeaconState`](https://github.com/ethereum/consensus-specs/blob/v1.1.9/specs/bellatrix/beacon-chain.md#beaconstate) object from the Eth2.0 Bellatrix spec." properties: genesis_time: $ref: "../primitive.yaml#/Uint64" @@ -98,4 +98,4 @@ Bellatrix: next_sync_committee: $ref: '../altair/sync_committee.yaml#/Altair/SyncCommittee' latest_execution_payload_header: - $ref: './execution_payload.yaml#/Bellatrix/ExecutionPayloadHeader' \ No newline at end of file + $ref: './execution_payload.yaml#/Bellatrix/ExecutionPayloadHeader' diff --git a/types/bellatrix/transactions.yaml b/types/bellatrix/transactions.yaml index 59f4e063..c18bbbc9 100644 --- a/types/bellatrix/transactions.yaml +++ b/types/bellatrix/transactions.yaml @@ -4,4 +4,4 @@ Bellatrix: items: allOf: - $ref: '../primitive.yaml#/Transaction' - maxItems: 1048576 \ No newline at end of file + maxItems: 1048576 diff --git a/types/primitive.yaml b/types/primitive.yaml index 444db23e..8bff1797 100644 --- a/types/primitive.yaml +++ b/types/primitive.yaml @@ -73,13 +73,13 @@ Transaction: type: string description: "A transaction on the execution (Ethereum 1) network." example: "0x02f878831469668303f51d843b9ac9f9843b9aca0082520894c93269b73096998db66be0441e836d873535cb9c8894a19041886f000080c001a031cc29234036afbf9a1fb9476b463367cb1f957ac0b919b69bbc798436e604aaa018c4e9c3914eb27aadd0b91e10b18655739fcf8c1fc398763a9f1beecb8ddc86" - pattern: "^0x[a-fA-F0-9]{1,2147483648}$" + pattern: "^0x[a-fA-F0-9]{0,2147483648}$" ExtraData: type: string description: "Extra data on the execution (Ethereum 1) network." example: "0xcf8e0d4e9587369b2301d0790347320302cc0943d5a1884560367e8208d920f2" - pattern: "^0x[a-fA-F0-9]{1,64}$" + pattern: "^0x[a-fA-F0-9]{0,64}$" LogsBloom: type: string From ee9742bdf7505a1f37e644c65c8cbd3f772ecb0b Mon Sep 17 00:00:00 2001 From: realbigsean Date: Fri, 25 Feb 2022 15:02:53 -0500 Subject: [PATCH 03/11] increase logs bloom example to correct size --- types/primitive.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/types/primitive.yaml b/types/primitive.yaml index 8bff1797..1b060af6 100644 --- a/types/primitive.yaml +++ b/types/primitive.yaml @@ -83,5 +83,5 @@ ExtraData: LogsBloom: type: string - example: "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000" + example: "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000" pattern: "^0x[a-fA-F0-9]{512}$" From 0e93e46248841fd90b266b59607205ac612ef79a Mon Sep 17 00:00:00 2001 From: realbigsean Date: Tue, 1 Mar 2022 10:13:00 -0500 Subject: [PATCH 04/11] Use `Bytes32` instead of `Root` for randao mixes --- types/altair/state.yaml | 2 +- types/bellatrix/execution_payload.yaml | 2 +- types/bellatrix/state.yaml | 2 +- types/primitive.yaml | 5 +++++ types/state.yaml | 2 +- 5 files changed, 9 insertions(+), 4 deletions(-) diff --git a/types/altair/state.yaml b/types/altair/state.yaml index 83dd9a86..0386a4a5 100644 --- a/types/altair/state.yaml +++ b/types/altair/state.yaml @@ -60,7 +60,7 @@ Altair: type: array items: allOf: - - $ref: '../primitive.yaml#/Root' + - $ref: '../primitive.yaml#/Bytes32' minItems: 65536 maxItems: 65536 slashings: diff --git a/types/bellatrix/execution_payload.yaml b/types/bellatrix/execution_payload.yaml index 2f56f8f2..b8b81db1 100644 --- a/types/bellatrix/execution_payload.yaml +++ b/types/bellatrix/execution_payload.yaml @@ -15,7 +15,7 @@ Bellatrix: logs_bloom: $ref: '../primitive.yaml#/LogsBloom' prev_randao: - $ref: '../primitive.yaml#/Root' + $ref: '../primitive.yaml#/Bytes32' block_number: $ref: '../primitive.yaml#/Uint64' gas_limit: diff --git a/types/bellatrix/state.yaml b/types/bellatrix/state.yaml index 6176a709..f3d300ad 100644 --- a/types/bellatrix/state.yaml +++ b/types/bellatrix/state.yaml @@ -60,7 +60,7 @@ Bellatrix: type: array items: allOf: - - $ref: '../primitive.yaml#/Root' + - $ref: '../primitive.yaml#/Bytes32' minItems: 65536 maxItems: 65536 slashings: diff --git a/types/primitive.yaml b/types/primitive.yaml index 1b060af6..7954e273 100644 --- a/types/primitive.yaml +++ b/types/primitive.yaml @@ -42,6 +42,11 @@ Root: example: "0xcf8e0d4e9587369b2301d0790347320302cc0943d5a1884560367e8208d920f2" pattern: "^0x[a-fA-F0-9]{64}$" +Bytes32: + type: string + example: "0xcf8e0d4e9587369b2301d0790347320302cc0943d5a1884560367e8208d920f2" + pattern: "^0x[a-fA-F0-9]{64}$" + Graffiti: type: string format: hex diff --git a/types/state.yaml b/types/state.yaml index 40688db6..11888041 100644 --- a/types/state.yaml +++ b/types/state.yaml @@ -59,7 +59,7 @@ BeaconState: type: array items: allOf: - - $ref: './primitive.yaml#/Root' + - $ref: './primitive.yaml#/Bytes32' minItems: 65536 maxItems: 65536 slashings: From 2494fd88e2e22301000af1bff7e933b04aa5c170 Mon Sep 17 00:00:00 2001 From: realbigsean Date: Tue, 1 Mar 2022 10:14:04 -0500 Subject: [PATCH 05/11] fix reference `BeaconBlock` -> `BlindedBeaconBlock` --- beacon-node-oapi.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/beacon-node-oapi.yaml b/beacon-node-oapi.yaml index 97ad7cce..a5353225 100644 --- a/beacon-node-oapi.yaml +++ b/beacon-node-oapi.yaml @@ -252,7 +252,7 @@ components: Bellatrix.SignedBeaconBlock: $ref: './types/bellatrix/block.yaml#/Bellatrix/SignedBeaconBlock' Bellatrix.BlindedBeaconBlock: - $ref: './types/bellatrix/block.yaml#/Bellatrix/BeaconBlock' + $ref: './types/bellatrix/block.yaml#/Bellatrix/BlindedBeaconBlock' Bellatrix.SignedBlindedBeaconBlock: $ref: './types/bellatrix/block.yaml#/Bellatrix/SignedBlindedBeaconBlock' From 7f911d52adb42fdaee7886f8fe634d8ea8714a4f Mon Sep 17 00:00:00 2001 From: realbigsean Date: Thu, 3 Mar 2022 14:23:41 -0500 Subject: [PATCH 06/11] Update apis/beacon/blocks/blinded_blocks.yaml MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: Radosław Kapka --- apis/beacon/blocks/blinded_blocks.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/apis/beacon/blocks/blinded_blocks.yaml b/apis/beacon/blocks/blinded_blocks.yaml index b6e88cb0..2c72ae02 100644 --- a/apis/beacon/blocks/blinded_blocks.yaml +++ b/apis/beacon/blocks/blinded_blocks.yaml @@ -12,7 +12,7 @@ post: `BeaconBlock`, and a successful response (20X) only indicates that the broadcast has been successful. The beacon node is expected to integrate the new block into its state, and therefore validate the block internally, however blocks which fail the validation are still - broadcast but a different status code is returned (202) + broadcast but a different status code is returned (202). requestBody: description: "The `SignedBlindedBeaconBlock` object composed of `BlindedBeaconBlock` object (produced by beacon node) and validator signature." From 6300a97185200dafacdd1465289e743164d36b87 Mon Sep 17 00:00:00 2001 From: realbigsean Date: Thu, 3 Mar 2022 14:23:48 -0500 Subject: [PATCH 07/11] Update apis/beacon/blocks/blinded_blocks.yaml MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: Radosław Kapka --- apis/beacon/blocks/blinded_blocks.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/apis/beacon/blocks/blinded_blocks.yaml b/apis/beacon/blocks/blinded_blocks.yaml index 2c72ae02..a8991a5a 100644 --- a/apis/beacon/blocks/blinded_blocks.yaml +++ b/apis/beacon/blocks/blinded_blocks.yaml @@ -6,7 +6,7 @@ post: operationId: "publishBlindedBlock" description: | Instructs the beacon node to use the components of the `SignedBlindedBeaconBlock` to construct and publish a - `SignedBeaconBlock` by swapping out the `transactions_root` for the corresponding full list of `transactions` + `SignedBeaconBlock` by swapping out the `transactions_root` for the corresponding full list of `transactions`. The beacon node should broadcast a newly constructed `SignedBeaconBlock` to the beacon network, to be included in the beacon chain. The beacon node is not required to validate the signed `BeaconBlock`, and a successful response (20X) only indicates that the broadcast has been From 7e9438aca3f2eeb998218e787de92071964cff7f Mon Sep 17 00:00:00 2001 From: Marin Date: Thu, 10 Mar 2022 11:25:37 +0100 Subject: [PATCH 08/11] fix: spec linting --- apis/beacon/blocks/attestations.yaml | 1 + apis/beacon/blocks/block.v2.yaml | 1 + apis/beacon/blocks/block.yaml | 1 + apis/beacon/blocks/header.yaml | 1 + apis/beacon/blocks/root.yaml | 1 + 5 files changed, 5 insertions(+) diff --git a/apis/beacon/blocks/attestations.yaml b/apis/beacon/blocks/attestations.yaml index 2f6bf81e..77d39d09 100644 --- a/apis/beacon/blocks/attestations.yaml +++ b/apis/beacon/blocks/attestations.yaml @@ -7,6 +7,7 @@ get: parameters: - name: block_id in: path + required: true $ref: '../../../beacon-node-oapi.yaml#/components/parameters/BlockId' responses: diff --git a/apis/beacon/blocks/block.v2.yaml b/apis/beacon/blocks/block.v2.yaml index 12e26d21..b574e7fb 100644 --- a/apis/beacon/blocks/block.v2.yaml +++ b/apis/beacon/blocks/block.v2.yaml @@ -9,6 +9,7 @@ get: parameters: - name: block_id in: path + required: true $ref: '../../../beacon-node-oapi.yaml#/components/parameters/BlockId' responses: "200": diff --git a/apis/beacon/blocks/block.yaml b/apis/beacon/blocks/block.yaml index fb5700a2..92cd9652 100644 --- a/apis/beacon/blocks/block.yaml +++ b/apis/beacon/blocks/block.yaml @@ -10,6 +10,7 @@ get: parameters: - name: block_id in: path + required: true $ref: '../../../beacon-node-oapi.yaml#/components/parameters/BlockId' responses: "200": diff --git a/apis/beacon/blocks/header.yaml b/apis/beacon/blocks/header.yaml index 69533b1f..62a37ab8 100644 --- a/apis/beacon/blocks/header.yaml +++ b/apis/beacon/blocks/header.yaml @@ -7,6 +7,7 @@ get: parameters: - name: block_id in: path + required: true $ref: '../../../beacon-node-oapi.yaml#/components/parameters/BlockId' responses: "200": diff --git a/apis/beacon/blocks/root.yaml b/apis/beacon/blocks/root.yaml index 3da53125..5d02d499 100644 --- a/apis/beacon/blocks/root.yaml +++ b/apis/beacon/blocks/root.yaml @@ -7,6 +7,7 @@ get: parameters: - name: block_id in: path + required: true $ref: '../../../beacon-node-oapi.yaml#/components/parameters/BlockId' responses: "200": From 176d4f105aa4124ce66a343f5ef00f1f58d0d105 Mon Sep 17 00:00:00 2001 From: realbigsean Date: Thu, 10 Mar 2022 11:08:47 -0500 Subject: [PATCH 09/11] Update beacon-node-oapi.yaml MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: Marin Petrunić --- beacon-node-oapi.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/beacon-node-oapi.yaml b/beacon-node-oapi.yaml index c177cb3d..95aae8b3 100644 --- a/beacon-node-oapi.yaml +++ b/beacon-node-oapi.yaml @@ -132,7 +132,7 @@ paths: $ref: "./apis/validator/block.yaml" /eth/v2/validator/blocks/{slot}: $ref: "./apis/validator/block.v2.yaml" - /eth/v2/validator/blinded_blocks/{slot}: + /eth/v1/validator/blinded_blocks/{slot}: $ref: "./apis/validator/blinded_block.yaml" /eth/v1/validator/attestation_data: $ref: "./apis/validator/attestation_data.yaml" From 28fa540a2fd8ca305088a2ae389487b0a2b104e4 Mon Sep 17 00:00:00 2001 From: realbigsean Date: Thu, 10 Mar 2022 11:19:40 -0500 Subject: [PATCH 10/11] serve/accept full blocks on blinded endpoints pre-bellatrix --- apis/beacon/blocks/blinded_blocks.yaml | 6 ++++-- apis/validator/blinded_block.yaml | 6 +++++- beacon-node-oapi.yaml | 2 +- 3 files changed, 10 insertions(+), 4 deletions(-) diff --git a/apis/beacon/blocks/blinded_blocks.yaml b/apis/beacon/blocks/blinded_blocks.yaml index b6e88cb0..a180b73d 100644 --- a/apis/beacon/blocks/blinded_blocks.yaml +++ b/apis/beacon/blocks/blinded_blocks.yaml @@ -12,8 +12,8 @@ post: `BeaconBlock`, and a successful response (20X) only indicates that the broadcast has been successful. The beacon node is expected to integrate the new block into its state, and therefore validate the block internally, however blocks which fail the validation are still - broadcast but a different status code is returned (202) - + broadcast but a different status code is returned (202). Pre-Bellatrix, this endpoint will accept + a `SignedBeaconBlock`. requestBody: description: "The `SignedBlindedBeaconBlock` object composed of `BlindedBeaconBlock` object (produced by beacon node) and validator signature." required: true @@ -21,6 +21,8 @@ post: application/json: schema: oneOf: + - $ref: '../../../beacon-node-oapi.yaml#/components/schemas/SignedBeaconBlock' + - $ref: "../../../beacon-node-oapi.yaml#/components/schemas/Altair.SignedBeaconBlock" - $ref: "../../../beacon-node-oapi.yaml#/components/schemas/Bellatrix.SignedBlindedBeaconBlock" responses: "200": diff --git a/apis/validator/blinded_block.yaml b/apis/validator/blinded_block.yaml index f73ce3e3..c3095322 100644 --- a/apis/validator/blinded_block.yaml +++ b/apis/validator/blinded_block.yaml @@ -10,6 +10,8 @@ get: Metadata in the response indicates the type of block produced, and the supported types of block will be added to as forks progress. + + Pre-Bellatrix, this endpoint will return a `BeaconBlock`. parameters: - name: slot in: path @@ -40,10 +42,12 @@ get: properties: version: type: string - enum: [ bellatrix ] + enum: [ phase0, altair, bellatrix ] 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" "400": description: "Invalid block production request" diff --git a/beacon-node-oapi.yaml b/beacon-node-oapi.yaml index c177cb3d..95aae8b3 100644 --- a/beacon-node-oapi.yaml +++ b/beacon-node-oapi.yaml @@ -132,7 +132,7 @@ paths: $ref: "./apis/validator/block.yaml" /eth/v2/validator/blocks/{slot}: $ref: "./apis/validator/block.v2.yaml" - /eth/v2/validator/blinded_blocks/{slot}: + /eth/v1/validator/blinded_blocks/{slot}: $ref: "./apis/validator/blinded_block.yaml" /eth/v1/validator/attestation_data: $ref: "./apis/validator/attestation_data.yaml" From a511b090b0771cf52c56be03f89ce752f211d708 Mon Sep 17 00:00:00 2001 From: Marin Date: Mon, 28 Mar 2022 11:01:22 +0200 Subject: [PATCH 11/11] bug: tmp fix issue with block_id ref --- apis/beacon/blocks/block.yaml | 8 +++++++- apis/beacon/blocks/root.yaml | 8 +++++++- 2 files changed, 14 insertions(+), 2 deletions(-) diff --git a/apis/beacon/blocks/block.yaml b/apis/beacon/blocks/block.yaml index 92cd9652..5177eac4 100644 --- a/apis/beacon/blocks/block.yaml +++ b/apis/beacon/blocks/block.yaml @@ -11,7 +11,13 @@ get: - name: block_id in: path required: true - $ref: '../../../beacon-node-oapi.yaml#/components/parameters/BlockId' + example: "head" + schema: + type: string + description: | + Block identifier. + Can be one of: "head" (canonical head in node's view), "genesis", "finalized", \, \. + responses: "200": description: Success diff --git a/apis/beacon/blocks/root.yaml b/apis/beacon/blocks/root.yaml index 5d02d499..316e63b5 100644 --- a/apis/beacon/blocks/root.yaml +++ b/apis/beacon/blocks/root.yaml @@ -8,7 +8,13 @@ get: - name: block_id in: path required: true - $ref: '../../../beacon-node-oapi.yaml#/components/parameters/BlockId' + example: "head" + schema: + type: string + description: | + Block identifier. + Can be one of: "head" (canonical head in node's view), "genesis", "finalized", \, \. + responses: "200": description: Success