-
Notifications
You must be signed in to change notification settings - Fork 54
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
GS: Relay messages to direct peers #949
Conversation
Codecov Report
@@ Coverage Diff @@
## unstable #949 +/- ##
============================================
- Coverage 83.10% 83.08% -0.02%
============================================
Files 91 91
Lines 15235 15238 +3
============================================
Hits 12661 12661
- Misses 2574 2577 +3
|
@@ -359,6 +359,10 @@ proc validateAndRelay(g: GossipSub, | |||
break | |||
toSendPeers.excl(seenPeers) | |||
|
|||
# add always direct peers | |||
for topic in msg.topicIds: | |||
toSendPeers.incl(g.explicit.getOrDefault(topic)) |
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 we can use a more descriptive name for direct peers than "explicit"
trace "Attempting to dial a direct peer", peer = id | ||
if g.switch.isConnected(id): | ||
info "We are connected to a direct peer, but GossipSub isn't setup with him!", id |
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.
info "We are connected to a direct peer, but GossipSub isn't setup with him!", id | |
debug "We are connected to a direct peer, but it isn't a GossipSub peer!", id |
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.
Btw should we do something more in this case? If it's unexpected, maybe it should be a warn.
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's basically a user error, but not critical, so info seems like a good fit
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'd use debug or warn.
if peer.peerId in g.parameters.directPeers: | ||
# receiving a graft from a direct peer should yield a more prominent warning (protocol violation) | ||
warn "an explicit peer attempted to graft us, peering agreements should be reciprocal", | ||
warn "a direct peer attempted to graft us, peering agreements should be reciprocal", |
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 can cause a log spam issue if they keep doing this
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 think we are supposed to trust them somewhat
The other solution would be to remove them from the trusted set in that case
(descoring isn't an option as we will never kick them due to bad score)
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.
hm, right about the trust - let's make a comment about it
@@ -359,6 +359,10 @@ proc validateAndRelay(g: GossipSub, | |||
break | |||
toSendPeers.excl(seenPeers) | |||
|
|||
# add always direct peers | |||
for topic in msg.topicIds: | |||
toSendPeers.incl(g.subscribedDirectPeers.getOrDefault(topic)) |
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'll assume this gets filtered somewhere so we don't send to peers that have already seen the message?
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 wasn't, fixed
Currently, only the published messages are relayed to direct peers
However the spec states that all valid messages should be
Also, forceDial the direct peers to dial them even if we are full