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 new relay/relay-monitor flags that can be used multiple times #351

Merged
merged 7 commits into from
Sep 28, 2022
Merged

Add new relay/relay-monitor flags that can be used multiple times #351

merged 7 commits into from
Sep 28, 2022

Conversation

jtraglia
Copy link
Collaborator

@jtraglia jtraglia commented Sep 23, 2022

📝 Summary

  • Add new -relay and -relay-monitor flags that can be specified multiple times.
  • Doesn't break the existing method via -relays and -relay-monitors.

Before:

./mev-boost -mainnet -relay-check \
  -relays https://0xac6e77dfe25ecd6110b8e780608cce0dab71fdd5ebea22a16c0205200f2f8e2e3ad3b71d3499c54ad14d6c21b41a37ae@boost-relay.flashbots.net,https://0x8b5d2e73e2a3a55c6c87b8b6eb92e0149a125c852751db1422fa951e42a09b82c142c3ea98d0d9930b056a3bc9896b8f@bloxroute.max-profit.blxrbdn.com,https://0xad0a8bb54565c2211cee576363f3a347089d2f07cf72679d16911d740262694cadb62d7fd7483f27afd714ca0f1b9118@bloxroute.ethical.blxrbdn.com,https://0xb0b07cd0abef743db4260b0ed50619cf6ad4d82064cb4fbec9d3ec530f7c5e6793d9f286c4e082c0244ffb9f2658fe88@bloxroute.regulated.blxrbdn.com,https://0x9000009807ed12c1f08bf4e81c6da3ba8e3fc3d953898ce0102433094e5f22f21102ec057841fcb81978ed1ea0fa8246@builder-relay-mainnet.blocknative.com,https://0x98650451ba02064f7b000f5768cf0cf4d4e492317d82871bdc87ef841a0743f69f0f1eea11168503240ac35d101c9135@mainnet-relay.securerpc.com,https://0xb3ee7afcf27f1f1259ac1787876318c6584ee353097a50ed84f51a1f21a323b3736f271a895c7ce918c038e4265918be@relay.edennetwork.io

After:

./mev-boost -mainnet -relay-check \
  -relay https://0xac6e77dfe25ecd6110b8e780608cce0dab71fdd5ebea22a16c0205200f2f8e2e3ad3b71d3499c54ad14d6c21b41a37ae@boost-relay.flashbots.net \
  -relay https://0x8b5d2e73e2a3a55c6c87b8b6eb92e0149a125c852751db1422fa951e42a09b82c142c3ea98d0d9930b056a3bc9896b8f@bloxroute.max-profit.blxrbdn.com \
  -relay https://0xad0a8bb54565c2211cee576363f3a347089d2f07cf72679d16911d740262694cadb62d7fd7483f27afd714ca0f1b9118@bloxroute.ethical.blxrbdn.com \
  -relay https://0xb0b07cd0abef743db4260b0ed50619cf6ad4d82064cb4fbec9d3ec530f7c5e6793d9f286c4e082c0244ffb9f2658fe88@bloxroute.regulated.blxrbdn.com \
  -relay https://0x9000009807ed12c1f08bf4e81c6da3ba8e3fc3d953898ce0102433094e5f22f21102ec057841fcb81978ed1ea0fa8246@builder-relay-mainnet.blocknative.com \
  -relay https://0x98650451ba02064f7b000f5768cf0cf4d4e492317d82871bdc87ef841a0743f69f0f1eea11168503240ac35d101c9135@mainnet-relay.securerpc.com \
  -relay https://0xb3ee7afcf27f1f1259ac1787876318c6584ee353097a50ed84f51a1f21a323b3736f271a895c7ce918c038e4265918be@relay.edennetwork.io

Opening as a draft to get initial thoughts. There are still a few more things I want to do too.

Depends on #348 to work properly.

⛱ Motivation and Context

This is another thing that's been kind of bothering me. With the increasing number of relays, adding new relays is easy, but it's really hard to read/modify later; it's a long line of comma-separated relays.

I really do not want to break backwards compatibility. Most people won't want to change their flags to update. This compromise allows those that want to clean up their command to do it this way.


✅ I have run these commands

  • make lint
  • make test-race
  • go mod tidy

@codecov-commenter
Copy link

Codecov Report

Merging #351 (c073770) into main (bca8407) will decrease coverage by 0.58%.
The diff coverage is n/a.

@@            Coverage Diff             @@
##             main     #351      +/-   ##
==========================================
- Coverage   82.50%   81.91%   -0.59%     
==========================================
  Files           5        5              
  Lines         680      680              
==========================================
- Hits          561      557       -4     
- Misses         91       94       +3     
- Partials       28       29       +1     
Flag Coverage Δ
unittests 81.91% <ø> (-0.59%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

Impacted Files Coverage Δ
server/service.go 80.04% <0.00%> (-0.99%) ⬇️

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.

@metachris
Copy link
Collaborator

i think that's nice, seeing people complain about configuring multiple relays comma-separated with a single flag, in particular in service config files.

@jtraglia
Copy link
Collaborator Author

Reimplemented things a bit. The relays specified with the -relays flag will be parsed in the same way the new -relay flag is. It will enforce uniqueness, even if both types of flags are used in conjunction.

@jtraglia jtraglia marked this pull request as ready for review September 26, 2022 14:32
@kailinr kailinr requested a review from avalonche September 28, 2022 03:29
return err
}
if r.Contains(relay) {
return errDuplicateEntry
Copy link
Collaborator

Choose a reason for hiding this comment

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

how about making this function idempotent, by not returning an error on duplicates?

@metachris
Copy link
Collaborator

this is really nice work!

@metachris metachris added the next up It's next up label Sep 28, 2022
@metachris metachris merged commit 81f3483 into flashbots:main Sep 28, 2022
@jtraglia jtraglia deleted the new-relay-flags branch September 28, 2022 13:09
screwyprof pushed a commit to screwyprof/mev-boost that referenced this pull request Feb 3, 2023
…ashbots#351)

* Add new -relay/-relay-monitor flags that can be used multiple times

* Add duplication detection for new flags

* Fix linter issue

* Rename instances of error

* Directly add relay/monitors to new lists

* Update readme
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
next up It's next up
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants