From e85caa10bc700fe27ca75a346a12b78c3412fd17 Mon Sep 17 00:00:00 2001 From: Chris Hager Date: Mon, 10 Oct 2022 13:09:34 +0200 Subject: [PATCH] Request SSZ encoding for getHeader response (with Accept header) --- .spectral.yml | 2 +- apis/builder/blinded_blocks.yaml | 13 +++++++++++++ apis/builder/header.yaml | 17 +++++++++++++++++ 3 files changed, 31 insertions(+), 1 deletion(-) diff --git a/.spectral.yml b/.spectral.yml index e60e786..88523ba 100644 --- a/.spectral.yml +++ b/.spectral.yml @@ -35,7 +35,7 @@ rules: recommended: true severity: error message: "{{description}}: {{error}}" - given: $.paths.[*].requestBody.content[?(@property.indexOf('json') === -1)]^ + given: $.paths.[*].requestBody.content[0(@property.indexOf('json') === -1)]^ then: function: falsy diff --git a/apis/builder/blinded_blocks.yaml b/apis/builder/blinded_blocks.yaml index affa7ad..a1ae825 100644 --- a/apis/builder/blinded_blocks.yaml +++ b/apis/builder/blinded_blocks.yaml @@ -9,6 +9,10 @@ post: If the builder is not able to unblind the corresponding `ExecutionPayloadHeader`, it must error. + + The request body can be encoded as JSON (application/json) or SSZ (application/octet-stream). + Note: SSZ support can be determined by requesting an SSZ encoded response in the `getHeader` + request. tags: - Builder requestBody: @@ -22,6 +26,9 @@ post: examples: bellatrix: $ref: "../../builder-oapi.yaml#/components/examples/Bellatrix.SignedBlindedBeaconBlock" + application/octet-stream: + schema: + title: SignedBlindedBeaconBlock responses: "200": @@ -42,6 +49,12 @@ post: examples: bellatrix: $ref: "../../builder-oapi.yaml#/components/examples/Bellatrix.ExecutionPayload" + application/octet-stream: + schema: + title: SubmitBlindedBlockResponse + type: string + format: binary + description: SSZ encoded SubmitBlindedBlockResponse "400": description: Error response. content: diff --git a/apis/builder/header.yaml b/apis/builder/header.yaml index cc07973..44a80f8 100644 --- a/apis/builder/header.yaml +++ b/apis/builder/header.yaml @@ -18,6 +18,9 @@ get: builder must return a header that moves `gas_limit` the maximum amount allowed under the rules of consensus (currently `parent.gas_limit +/- parent.gas_limit / 1024`). + + A SSZ encoded response can be requested using the `Accept` request header: + `Accept: application/octet-stream`. tags: - Builder parameters: @@ -39,6 +42,13 @@ get: description: The validator's BLS public key. schema: $ref: "../../builder-oapi.yaml#/components/schemas/Pubkey" + - name: accept + in: header + description: "requested encoding: `application/octet-stream` (SSZ), `application/json`, or a combination." + example: "application/octet-stream;q=1,application/json;q=0.9" + required: false + schema: + type: string responses: "200": description: Success response. @@ -58,6 +68,13 @@ get: examples: bellatrix: $ref: "../../builder-oapi.yaml#/components/examples/Bellatrix.SignedBuilderBid" + application/octet-stream: + schema: + title: GetHeaderResponse + type: string + format: binary + description: SSZ encoded GetHeaderResponse + "204": description: No header is available. "400":