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

[wip] SSZ encoding for getHeader and getPayload #54

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
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
2 changes: 1 addition & 1 deletion .spectral.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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

13 changes: 13 additions & 0 deletions apis/builder/blinded_blocks.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand All @@ -22,6 +26,9 @@ post:
examples:
bellatrix:
$ref: "../../builder-oapi.yaml#/components/examples/Bellatrix.SignedBlindedBeaconBlock"
application/octet-stream:
schema:
title: SignedBlindedBeaconBlock

responses:
"200":
Expand All @@ -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:
Expand Down
17 changes: 17 additions & 0 deletions apis/builder/header.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand All @@ -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.
Expand All @@ -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":
Expand Down