-
Notifications
You must be signed in to change notification settings - Fork 43
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: add iwant request tracking #107
Conversation
2beb0c7
to
b3942e4
Compare
Codecov Report
@@ Coverage Diff @@
## gsv1.1 #107 +/- ##
=======================================
Coverage 91.66% 91.66%
=======================================
Files 2 2
Lines 24 24
=======================================
Hits 22 22
Misses 2 2
Continue to review full report at Codecov.
|
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.
Overall this looks good to me. Just found some minor things that wanted to raise
|
||
/** | ||
* Someone delivered a message, stop tracking promises for it | ||
* @param {string} p 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.
It seems that we are not using the peerID
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.
The idea is to have the same function signature as PeerScore#deliverMessage
.
So that we might in the future abstract the different 'tracers' as in go-libp2p-pubsub
See https://github.com/libp2p/go-libp2p-pubsub/blob/master/pubsub.go#L972
Eg: they don't call each one individually:
this.score.deliverMessage(p, msg)
this.gossipTracer.deliverMessage(p, msg)
this.tagTracer.deliverMessage(p, msg)
They have some sort of registration for each of their tracers, then all tracers get called on a single call to deliverMessage
.
Note the go-libp2p-pubsub tracer functionality is happening on the pubsub layer, not the gossipsub layer. Aggregating our "tracers" together would be a first step towards moving in that direction. Not saying thats what we should do, but aligning function signatures is a prereq.
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.
ok, sounds good
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.
LGTM
Implements https://github.com/libp2p/specs/blob/master/pubsub/gossipsub/gossipsub-v1.1.md#spam-protection-measures bullet point 4
Follows go-libp2p-pubsub implementation closely
Suffers from issues related to #105
eg: in cases where a peer has signaled that they IHAVE a message, we send a IWANT, they send the message, but don't include a signature on a message when we have strict signing, the peer should be penalized twice, once for the invalid message, and once more if they fail to deliver on their promise to send the IWANTed message.
Right now, they only get the first penalty, from the invalid message.