-
Notifications
You must be signed in to change notification settings - Fork 16
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
feat(p2p)!: remove conngater dependency #107
base: main
Are you sure you want to change the base?
Conversation
Codecov Report
@@ Coverage Diff @@
## main #107 +/- ##
=======================================
Coverage 68.60% 68.60%
=======================================
Files 37 37
Lines 2934 2934
=======================================
Hits 2013 2013
Misses 770 770
Partials 151 151
|
gater *conngater.BasicConnectionGater, | ||
blacklistPeer func(id peer.ID) error, |
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.
There is an interface https://github.com/libp2p/go-libp2p/blob/master/core/connmgr/gater.go
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.
It is different one, used as dialer interceptor
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.
It does not have BlockPeer()
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.
I see, that's confusing
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.
Fine with me but please mark as breaking @walldiss
Well, actually, it would be nice to make a local interface, that has BlockPeer on it. In the future when we need more methods of PeerGater, we will then just add them, instead of breaking again. |
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.
Comment above
If we create a interface and change it later, it would break api, because implementations satisfying old interface will not satisfy new one. So we can defer creation of extra abstraction until we need it. |
I mean adding more methods of PeerGater interface which BasicConnGater satisfies |
libp2p conngater
is exact type and not an interface, which makes it impossible to modify or mock its functionality on client side. Replaces libp2p conngater dependency with callback func, to allow easy mocking for clients.Required by celestiaorg/celestia-node#2702 to provided conngater with white list instead of basic one.