-
Notifications
You must be signed in to change notification settings - Fork 215
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 signature verifications #138
Add signature verifications #138
Conversation
Signed-off-by: Luca Georges Francois <[email protected]>
Signed-off-by: Luca Georges Francois <[email protected]>
Signed-off-by: Luca Georges Francois <[email protected]>
Signed-off-by: Luca Georges Francois <[email protected]>
Signed-off-by: Luca Georges Francois <[email protected]>
|
||
ok, err := types.VerifySignature(registration.Message, types.DomainBuilder, registration.Message.Pubkey[:], registration.Signature[:]) | ||
if err != nil { | ||
http.Error(w, err.Error(), http.StatusBadRequest) |
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.
we should probably log the error (with log.Error
), for visibility for the operator
return | ||
} | ||
if !ok { | ||
http.Error(w, errInvalidSignature.Error(), http.StatusBadRequest) |
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.
same as above. maybe even wrap the error and add a bit of context 🤔
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.
Totally agree, added in a1c0a4d
@@ -218,7 +228,7 @@ func (m *BoostService) handleGetHeader(w http.ResponseWriter, req *http.Request) | |||
var wg sync.WaitGroup | |||
for _, relay := range m.relays { | |||
wg.Add(1) | |||
go func(relayAddr string) { | |||
go func(relayAddr string, relayPubKey types.PublicKey) { |
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.
do we want to pass in the relay alltogether instead of the individual fields?
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.
This way, we can only read the data. It slows down a little bit the process due to copies but honestly not that much.
very nice! 🙏 |
Signed-off-by: Luca Georges Francois <[email protected]>
Codecov Report
@@ Coverage Diff @@
## main #138 +/- ##
==========================================
- Coverage 71.56% 68.77% -2.80%
==========================================
Files 6 6
Lines 517 538 +21
==========================================
Hits 370 370
- Misses 121 137 +16
- Partials 26 31 +5
Flags with carried forward coverage won't be shown. Click here to find out more.
Continue to review full report at Codecov.
|
Signed-off-by: Luca Georges Francois <[email protected]>
merging into the develop branch |
* Add signature verification for getHeader response Signed-off-by: Luca Georges Francois <[email protected]> * Remove typo Signed-off-by: Luca Georges Francois <[email protected]> * Add signature verification for registerValidator request Signed-off-by: Luca Georges Francois <[email protected]> * Update mergemock integration tests Signed-off-by: Luca Georges Francois <[email protected]> * Fix typo in flag Signed-off-by: Luca Georges Francois <[email protected]> * Add error logging Signed-off-by: Luca Georges Francois <[email protected]> * Add signature verification tests Signed-off-by: Luca Georges Francois <[email protected]>
* Add signature verifications (#138) * Add signature verification for getHeader response Signed-off-by: Luca Georges Francois <[email protected]> * Remove typo Signed-off-by: Luca Georges Francois <[email protected]> * Add signature verification for registerValidator request Signed-off-by: Luca Georges Francois <[email protected]> * Update mergemock integration tests Signed-off-by: Luca Georges Francois <[email protected]> * Fix typo in flag Signed-off-by: Luca Georges Francois <[email protected]> * Add error logging Signed-off-by: Luca Georges Francois <[email protected]> * Add signature verification tests Signed-off-by: Luca Georges Francois <[email protected]> * Require the relay pubkey (#143) * mev-boost cli flags for setting genesis fork version, computing correct domain (#148) * better errors on failed signature validation (#151) Co-authored-by: Luca G.F <[email protected]>
* Add signature verifications (flashbots#138) * Add signature verification for getHeader response Signed-off-by: Luca Georges Francois <[email protected]> * Remove typo Signed-off-by: Luca Georges Francois <[email protected]> * Add signature verification for registerValidator request Signed-off-by: Luca Georges Francois <[email protected]> * Update mergemock integration tests Signed-off-by: Luca Georges Francois <[email protected]> * Fix typo in flag Signed-off-by: Luca Georges Francois <[email protected]> * Add error logging Signed-off-by: Luca Georges Francois <[email protected]> * Add signature verification tests Signed-off-by: Luca Georges Francois <[email protected]> * Require the relay pubkey (flashbots#143) * mev-boost cli flags for setting genesis fork version, computing correct domain (flashbots#148) * better errors on failed signature validation (flashbots#151) Co-authored-by: Luca G.F <[email protected]>
Description:
This PR adds support for signature verifications in the following handlers :
registerValidator
getHeader
getPayload
Problem(s) & goal(s):
See #95 for more context.
I have run these commands:
make lint
make test
make run-mergemock-integration
go mod tidy
Additional comments:
For now, mergemock integration tests do not pass because the relay generates a random private key for each run and mev-boost does not have a way to know which one it is.
I've created a PR which allows to provide a private key to mergemock's relay.