Skip to content

Conversation

james-prysm
Copy link
Contributor

@james-prysm james-prysm commented Feb 21, 2025

What type of PR is this?

Feature

What does this PR do? Why is it needed?

implements ssz mode for using a builder setup, the following endpoints will request and receive responses in ssz format when the --enable-builder-ssz=true flag is passed to the beacon node

  • /eth/v1/builder/header/{{.Slot}}/{{.ParentHash}}/{{.Pubkey}}
  • /eth/v1/builder/blinded_blocks
  • /eth/v1/builder/validators

note: this pr does not update builder E2E to support ssz, this is another todo item for proper testing

Which issues(s) does this PR fix?

Fixes # ethereum/builder-specs#104, ethereum/builder-specs#110

Other notes for review

Acknowledgements

@james-prysm james-prysm marked this pull request as ready for review February 24, 2025 16:33
@james-prysm james-prysm requested a review from a team as a code owner February 24, 2025 16:33
@james-prysm james-prysm marked this pull request as draft February 24, 2025 16:34
@james-prysm james-prysm marked this pull request as ready for review February 24, 2025 17:50
opt := func(r *http.Request) {
r.Header.Set(api.VersionHeader, version.String(sb.Version()))
r.Header.Set("Content-Type", api.OctetStreamMediaType)
r.Header.Set("Accept", api.OctetStreamMediaType)
Copy link
Contributor Author

Choose a reason for hiding this comment

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

should the Accept also have json to properly process error message?

@james-prysm james-prysm requested a review from kasey February 24, 2025 17:56
if ver >= version.Electra {
return c.parseHeaderElectra(data)
case ver >= version.Deneb:
} else if ver >= version.Deneb {
Copy link
Contributor

Choose a reason for hiding this comment

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

Nit: else not needed.

Could be:

if ver >= version.Electra {
   return ...
}

if ver >=  version.Deneb {
   return ...
}

...

return nil, fmt.Errorf("unsupported header version %s", versionHeader)


var errResponseVersionMismatch = errors.New("builder API response uses a different version than requested in " + api.VersionHeader + " header")

func getVersionsBlockToPayload(blockVersion int) (int, error) {
Copy link
Contributor

Choose a reason for hiding this comment

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

Same comment about else.

if endpoint != "" {
var opts []builder.ClientOpt
if sszEnabled {
log.Info("Using Builder APIs with SSZ enabled.")
Copy link
Contributor

Choose a reason for hiding this comment

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

No period . at the end of single sentence log.

Copy link
Contributor

Choose a reason for hiding this comment

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

All logs should have a prefix. Here could be builder.

@james-prysm james-prysm enabled auto-merge March 14, 2025 16:25
@james-prysm james-prysm added this pull request to the merge queue Mar 14, 2025
Merged via the queue into develop with commit 15ae71c Mar 14, 2025
17 checks passed
@james-prysm james-prysm deleted the builder-ssz branch March 14, 2025 17:58
rkapka pushed a commit that referenced this pull request Mar 19, 2025
* wip

* refactoring functions for easier readability

* allow ssz for register validator

* changelog

* adding in blinded block submission tests

* adding in tests for header ssz

* fixing linting and tests

* adding in custom errors and fixing ssz validator registration

* Update api/client/builder/client.go

Co-authored-by: Manu NALEPA <[email protected]>

* Update api/client/builder/client.go

Co-authored-by: Manu NALEPA <[email protected]>

* manu's feedback

* linting

* adding in info log to notify that this setting was turned on

* fixing linting

* manu's feedback

* fixing import

---------

Co-authored-by: Manu NALEPA <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants