-
Notifications
You must be signed in to change notification settings - Fork 231
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
Add getHeader SSZ support #734
Conversation
I think they are fine, but two things that caught my attention:
First thought that addresses both of these and simplifies things a bit is if we define a doRequest function inside doRequest := func(accept string) (*http.Response, error) {
req, err := http.NewRequestWithContext(context.Background(), http.MethodGet, url, nil)
if err != nil {
return nil, err
}
// <insert request prep>
req.Header.Set("Accept", accept)
return m.httpClientGetHeader.Do(req)
} Then we can do something like: // ssz attempt
resp, err := doRequest("application/octet-stream")
if err != nil {
…
return
}
// json if relay does not support ssz
if resp.StatusCode == http.StatusNotAcceptable {
resp.Body.Close()
logRelay.Debug("SSZ not accepted, trying JSON")
resp, err = doRequest("application/json")
if err != nil {
…
return
}
}
defer resp.Body.Close()
// continue rest of execution
... edit: |
This reverts commit b1cda56.
server/service.go
Outdated
proposerPreferredContentType = MediaTypeJSON | ||
} | ||
|
||
// If every relay returned the bid in JSON, that means that none |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
is this logic actually necessary? the bid is decoded already anyway, why not directly return in the proposer preference?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
So if we return SSZ here, the proposer will send SSZ in its getPayload request and then mev-boost will need to convert it back to JSON for each relay. If we return JSON here it saves us the conversion.
It's not strictly necessary. I could remove it if you prefer.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just pushed a commit to remove this.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nice! thanks
📝 Summary
This PR adds SSZ support for
getHeader
endpoint. Please see:✅ I have run these commands
make lint
make test-race
go mod tidy