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

Introduce SSZ support in Builder API #8994

Merged
merged 4 commits into from
Jan 15, 2025
Merged

Introduce SSZ support in Builder API #8994

merged 4 commits into from
Jan 15, 2025

Conversation

tbenr
Copy link
Contributor

@tbenr tbenr commented Jan 14, 2025

Expands the Builder Rest client to handle ssz in getHeader and postPayload methods.
The general idea is that in getHeader we signal via Accept header that we support ssz and json (with ssz preference).
If we receive the header in ssz, we remember this and on the upcoming postPayload we will post the signed blinded block in ssz format.

possible additional things:

  • (optional) use the new isUnsupportedMediaTypeError in Response to try to fallback to json in postPayload (maybe not really important)
  • (optional) try to post validator registration in ssz too. At immediately fallback to JSON (and remain in JSON) if the first call fails for whatever reason (independently by 415, which could be not implemented on server side). If the first call succeed we could keep sending ssz (not falling back on generic error). This assumes that the relay doesn't change in the mean time from one supporting ssz to another not supporting ssz. But this would be out of spec RN.

Fixed Issue(s)

fixes #8746

Documentation

  • I thought about documentation and added the doc-change-required label to this PR if updates are required.

Changelog

  • I thought about adding a changelog entry, and added one if I deemed necessary.

@tbenr tbenr marked this pull request as ready for review January 14, 2025 15:44
public Response(final T payload) {
this.payload = payload;
this.errorMessage = null;
public static <T> Response<T> fromPayloadReceivedAsJson(final T payload) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

maybe better just as fromJsonPayload

public Response(final T payload, final String errorMessage) {
this.payload = payload;
this.errorMessage = errorMessage;
public static <T> Response<T> fromPayloadReceivedAsSsz(final T payload) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

maybe fromSszPayload

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

but technically the payload has been already decoded at this stage. It indicates how you received the payload rather than the format of the payload passed here. I have mixed feelings

@lucassaldanha
Copy link
Member

to verify that we try to post payload in ssz when only when we receive the header in ssz

we also need to test that we correctly "revert" back to JSON if the getHeader response changes to JSON (e.g. builder software gets downgraded or some config changes).

Copy link
Contributor

@StefanBratanov StefanBratanov left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@tbenr tbenr merged commit 9abd34c into master Jan 15, 2025
18 checks passed
@tbenr tbenr deleted the builder-ssz branch January 15, 2025 13:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Builder API: Add SSZ support to Builder API
4 participants