-
Notifications
You must be signed in to change notification settings - Fork 90
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
p2p: invert peer discovery integration #989
Conversation
// UDPNode wraps a discv5 udp node and adds the bootnodes relays. | ||
type UDPNode struct { | ||
*discover.UDPv5 | ||
Relays []Peer | ||
} |
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.
not used
@@ -71,7 +71,7 @@ func TestP2PConnGating(t *testing.T) { | |||
|
|||
err = nodeA.Connect(context.Background(), addr) | |||
require.Error(t, err) | |||
require.Contains(t, err.Error(), fmt.Sprintf("gater rejected connection with peer %s and addr %s", addr.ID, addr.Addrs[0])) |
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.
flapping test, somehow used ipv6 on my local machine
Codecov Report
@@ Coverage Diff @@
## main #989 +/- ##
==========================================
- Coverage 54.44% 54.29% -0.16%
==========================================
Files 117 117
Lines 12954 12994 +40
==========================================
+ Hits 7053 7055 +2
- Misses 4879 4916 +37
- Partials 1022 1023 +1
Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here. |
@@ -133,3 +137,62 @@ func NewLocalEnode(config Config, key *ecdsa.PrivateKey) (*enode.LocalNode, *eno | |||
|
|||
return node, db, nil | |||
} | |||
|
|||
// NewDiscoveryAdapter returns a life cycle hook that links discv5 to libp2p by | |||
// continuously polling discv5 for latest peer ERNs and adding then to libp2p peer store. |
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.
// continuously polling discv5 for latest peer ERNs and adding then to libp2p peer store. | |
// continuously polling discv5 for latest peer ENRs and adding then to libp2p peer store. |
ctx = log.WithTopic(ctx, "p2p") | ||
ttl := peerstore.TempAddrTTL | ||
baseDelay := expbackoff.WithBaseDelay(time.Millisecond * 100) // Poll quickly on startup | ||
maxDelay := expbackoff.WithMaxDelay(ttl * 9 / 10) // Slow down to 90% of ttl |
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.
nit:
maxDelay := expbackoff.WithMaxDelay(ttl * 9 / 10) // Slow down to 90% of ttl | |
maxDelay := expbackoff.WithMaxDelay(ttl * 0.9) // Slow down to 90% of ttl |
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.
doesn't compile
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.
Looks good!
Inverts relay address routing from pull based to pull based. category: refactor ticket: #989 feature_flag: invert_libp2p_routing
Inverts the integration between discv5 and libp2p from pull to push.
category: refactor
ticket: #985
feature_flag: invert_discv5