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

Add verifications in getHeader handler #182

Merged
merged 3 commits into from
Jul 4, 2022
Merged

Add verifications in getHeader handler #182

merged 3 commits into from
Jul 4, 2022

Conversation

0xpanoramix
Copy link
Contributor

@0xpanoramix 0xpanoramix commented Jun 30, 2022

📝 Summary

This PR adds the following verification(s) in the getHeader handler :

  • Checks if the parent_hash in the response (given by the relay) is the same as the one in the request (the one given by the proposer)
  • The same way, checks if the public_key in the response is the same as the one in the request

It closes #174.

⛱ Motivation and Context

More context about this PR can be found in #174.

📚 References

The getHeader handler is defined here


✅ I have run these commands

  • make lint
  • make test
  • make run-mergemock-integration
  • go mod tidy

Signed-off-by: Luca Georges Francois <[email protected]>
server/service.go Outdated Show resolved Hide resolved
@@ -20,6 +20,7 @@ import (
var (
errInvalidSlot = errors.New("invalid slot")
errInvalidHash = errors.New("invalid hash")
errInvalidParentHash = errors.New("invalid parent hash")
Copy link
Collaborator

Choose a reason for hiding this comment

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

let's remove that if it's only used in the error message, to avoid accumulating unnecessary things

@@ -279,6 +280,12 @@ func (m *BoostService) handleGetHeader(w http.ResponseWriter, req *http.Request)
return
}

// Verify response coherence with proposer's input data
if responsePayload.Data != nil && responsePayload.Data.Message.Header.ParentHash.String() != parentHashHex {
log.WithError(errInvalidParentHash).Error("proposer and relay parent hashes are not the same")
Copy link
Collaborator

Choose a reason for hiding this comment

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

maybe could add the relevant fields to the message (log.WithFields)

@metachris
Copy link
Collaborator

great, thanks!

0xpanoramix and others added 2 commits June 30, 2022 22:39
Signed-off-by: Luca Georges Francois <[email protected]>
@metachris metachris merged commit 3721723 into flashbots:main Jul 4, 2022
@metachris
Copy link
Collaborator

ty

screwyprof pushed a commit to screwyprof/mev-boost that referenced this pull request Feb 3, 2023
* Add parent hash verification in getHeader

Signed-off-by: Luca Georges Francois <[email protected]>

* Remove unnecessary nil check

Co-authored-by: Chris Hager <[email protected]>

* Update error log in getHeader handler

Signed-off-by: Luca Georges Francois <[email protected]>

Co-authored-by: Chris Hager <[email protected]>
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.

Verify parentHash on getHeader response
2 participants