-
Notifications
You must be signed in to change notification settings - Fork 225
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
Add verifications in getHeader handler #182
Conversation
Signed-off-by: Luca Georges Francois <[email protected]>
server/service.go
Outdated
@@ -20,6 +20,7 @@ import ( | |||
var ( | |||
errInvalidSlot = errors.New("invalid slot") | |||
errInvalidHash = errors.New("invalid hash") | |||
errInvalidParentHash = errors.New("invalid parent hash") |
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.
let's remove that if it's only used in the error message, to avoid accumulating unnecessary things
server/service.go
Outdated
@@ -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") |
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.
maybe could add the relevant fields to the message (log.WithFields
)
great, thanks! |
Co-authored-by: Chris Hager <[email protected]>
Signed-off-by: Luca Georges Francois <[email protected]>
ty |
* 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]>
📝 Summary
This PR adds the following verification(s) in the
getHeader
handler :parent_hash
in the response (given by the relay) is the same as the one in the request (the one given by the proposer)public_key
in the response is the same as the one in the requestIt 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