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

Builder ssz #14976

Open
wants to merge 20 commits into
base: develop
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
445 changes: 361 additions & 84 deletions api/client/builder/client.go

Large diffs are not rendered by default.

724 changes: 678 additions & 46 deletions api/client/builder/client_test.go

Large diffs are not rendered by default.

6 changes: 6 additions & 0 deletions api/client/builder/errors.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,3 +15,9 @@ var ErrBadRequest = errors.Wrap(ErrNotOK, "recv 400 BadRequest response from API
// ErrNoContent specifically means that a '204 - No Content' response was received from the API.
// Typically, a 204 is a success but in this case for the Header API means No header is available
var ErrNoContent = errors.New("recv 204 no content response from API, No header is available")

// ErrUnsupportedMediaType specifically means that a '415 - Unsupported Media Type' was received from the API.
var ErrUnsupportedMediaType = errors.Wrap(ErrNotOK, "The media type in \"Content-Type\" header is unsupported, and the request has been rejected. This occurs when a HTTP request supplies a payload in a content-type that the server is not able to handle.")

// ErrNotAcceptable specifically means that a '406 - Not Acceptable' was received from the API.
var ErrNotAcceptable = errors.Wrap(ErrNotOK, "The accept header value is not acceptable")
7 changes: 6 additions & 1 deletion beacon-chain/builder/option.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,15 @@ type Option func(s *Service) error
// FlagOptions for builder service flag configurations.
func FlagOptions(c *cli.Context) ([]Option, error) {
endpoint := c.String(flags.MevRelayEndpoint.Name)
sszEnabled := c.Bool(flags.EnableBuilderSSZ.Name)
var client *builder.Client
if endpoint != "" {
var opts []builder.ClientOpt
if sszEnabled {
opts = append(opts, builder.WithSSZ())
}
var err error
client, err = builder.NewClient(endpoint)
client, err = builder.NewClient(endpoint, opts...)
if err != nil {
return nil, err
}
Expand Down
3 changes: 3 additions & 0 deletions changelog/james-prysm_builder-ssz.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
### Added

- enable SSZ for builder API calls
8 changes: 8 additions & 0 deletions cmd/beacon-chain/flags/base.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,14 @@ var (
Usage: "A MEV builder relay string http endpoint, this will be used to interact MEV builder network using API defined in: https://ethereum.github.io/builder-specs/#/Builder",
Value: "",
}

// EnableBuilderSSZ enables Builder APIs to send and receive in SSZ format
EnableBuilderSSZ = &cli.BoolFlag{
Name: "enable-builder-ssz",
Aliases: []string{"builder-ssz"},
Copy link
Contributor

Choose a reason for hiding this comment

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

Why defining an alias here?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

just as a shorter name, some other clients have it as this I think.

Usage: "Enables Builder APIs to send and receive in SSZ format",
}

MaxBuilderConsecutiveMissedSlots = &cli.IntFlag{
Name: "max-builder-consecutive-missed-slots",
Usage: "Number of consecutive skip slot to fallback from using relay/builder to local execution engine for block construction",
Expand Down
1 change: 1 addition & 0 deletions cmd/beacon-chain/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,7 @@ var appFlags = []cli.Flag{
flags.MinBuilderDiff,
flags.BeaconDBPruning,
flags.PrunerRetentionEpochs,
flags.EnableBuilderSSZ,
cmd.BackupWebhookOutputDir,
cmd.MinimalConfigFlag,
cmd.E2EConfigFlag,
Expand Down
1 change: 1 addition & 0 deletions cmd/beacon-chain/usage.go
Original file line number Diff line number Diff line change
Expand Up @@ -136,6 +136,7 @@ var appHelpFlagGroups = []flagGroup{
flags.MinBuilderBid,
flags.MinBuilderDiff,
flags.SuggestedFeeRecipient,
flags.EnableBuilderSSZ,
},
},
{ // Flags relevant to syncing the beacon chain.
Expand Down
1 change: 1 addition & 0 deletions proto/engine/v1/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ ssz_gen_marshal(
"ExecutionPayloadHeaderCapella",
"ExecutionPayloadHeaderDeneb",
"ExecutionPayloadDeneb",
'ExecutionPayloadDenebAndBlobsBundle',
"BlindedBlobsBundle",
"BlobsBundle",
"Withdrawal",
Expand Down
128 changes: 128 additions & 0 deletions proto/engine/v1/engine.ssz.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading
Loading