-
Notifications
You must be signed in to change notification settings - Fork 446
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: exchange signed peer records in identify #682
feat: exchange signed peer records in identify #682
Conversation
fd20b89
to
12022ab
Compare
1b3bd46
to
93966b9
Compare
a947283
to
4792ebb
Compare
3dc300d
to
e3bd773
Compare
e3bd773
to
c2fa11a
Compare
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.
Just some minor things and questions. I didn't look too much at the tests yet since those will be better verified in the certified addressbook pr.
src/identify/consts.js
Outdated
module.exports.MULTICODEC_IDENTIFY = '/ipfs/id/1.0.0' | ||
module.exports.MULTICODEC_IDENTIFY_PUSH = '/ipfs/id/push/1.0.0' | ||
module.exports.MULTICODEC_IDENTIFY = '/p2p/id/1.1.0' | ||
module.exports.MULTICODEC_IDENTIFY_PUSH = '/p2p/id/push/1.1.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.
Where are the versions listed, I was having trouble finding the updates. Is this in the specs repo or in go-libp2p?
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 commit added them: libp2p/go-libp2p@077a818#diff-98be6dba669aa4123b7ef190fe7113e8
However, now that I looked further, the same protocol is now being used and go reverted this change per libp2p/go-libp2p#907 (comment)
I am doing the same
src/identify/index.js
Outdated
@@ -172,8 +183,40 @@ class IdentifyService { | |||
// Get the observedAddr if there is one | |||
observedAddr = IdentifyService.getCleanMultiaddr(observedAddr) | |||
|
|||
// LEGACY: differentiate message with SignedPeerRecord | |||
if (protocol === MULTICODEC_IDENTIFY_1_0_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.
No need to check the protocol, I'd just check the existence of signedPeerRecord
. I think it might be better to catch and log the errors unmarshalling the signed peer record and then fallback to adding the listenAddrs
. If for some reason the payload is malformed this will allow us to easily fallback.
c2a8b86
to
d67190b
Compare
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.
Looking good, just a couple more things
Co-authored-by: Jacob Heun <jacobheun@gmail.com>
d76fe0c
to
931b71b
Compare
eaafd44
to
d935021
Compare
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, feel free to merge
This PR adds the exchange of signed peer records in identify as part of #653
Needs:
In the context of using signed peer records on identify, the protocols were updated
For the time being,
js-libp2p
will fallback to the legacy protocols if the negotiated stream is using them, so that we stil have compatibility with peers using older versions of libp2p.This PR will have a follow up PR to store the certified multiaddrs properly, as the multiaddrs are still being stored in the AddressBook as a regular multiaddr discovered.