Skip to content
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

Merged
merged 6 commits into from
Jul 15, 2020

Conversation

vasco-santos
Copy link
Member

@vasco-santos vasco-santos commented Jun 22, 2020

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.

This was referenced Jun 22, 2020
src/identify/index.js Outdated Show resolved Hide resolved
src/identify/index.js Outdated Show resolved Hide resolved
@vasco-santos vasco-santos force-pushed the feat/exchange-signed-peer-records-in-identify branch from fd20b89 to 12022ab Compare June 24, 2020 13:37
@vasco-santos vasco-santos mentioned this pull request Jun 25, 2020
3 tasks
@vasco-santos vasco-santos force-pushed the feat/exchange-signed-peer-records-in-identify branch 3 times, most recently from 1b3bd46 to 93966b9 Compare June 29, 2020 12:04
@jacobheun jacobheun force-pushed the 0.29.x branch 2 times, most recently from a947283 to 4792ebb Compare July 14, 2020 20:09
@vasco-santos vasco-santos force-pushed the feat/exchange-signed-peer-records-in-identify branch 3 times, most recently from 3dc300d to e3bd773 Compare July 15, 2020 10:19
@vasco-santos vasco-santos force-pushed the feat/exchange-signed-peer-records-in-identify branch from e3bd773 to c2fa11a Compare July 15, 2020 11:42
@vasco-santos vasco-santos marked this pull request as ready for review July 15, 2020 11:42
Copy link
Contributor

@jacobheun jacobheun left a 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.

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'
Copy link
Contributor

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?

Copy link
Member Author

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

@@ -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) {
Copy link
Contributor

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.

src/identify/index.js Outdated Show resolved Hide resolved
src/identify/index.js Outdated Show resolved Hide resolved
src/identify/index.js Show resolved Hide resolved
@vasco-santos vasco-santos force-pushed the feat/exchange-signed-peer-records-in-identify branch from c2a8b86 to d67190b Compare July 15, 2020 13:50
Copy link
Contributor

@jacobheun jacobheun left a 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

src/identify/index.js Outdated Show resolved Hide resolved
src/identify/index.js Outdated Show resolved Hide resolved
src/identify/index.js Outdated Show resolved Hide resolved
@vasco-santos vasco-santos force-pushed the feat/exchange-signed-peer-records-in-identify branch 3 times, most recently from d76fe0c to 931b71b Compare July 15, 2020 16:43
@vasco-santos vasco-santos force-pushed the feat/exchange-signed-peer-records-in-identify branch from eaafd44 to d935021 Compare July 15, 2020 16:57
Copy link
Contributor

@jacobheun jacobheun left a 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

@vasco-santos vasco-santos merged commit b1ba943 into 0.29.x Jul 15, 2020
@vasco-santos vasco-santos deleted the feat/exchange-signed-peer-records-in-identify branch July 15, 2020 17:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants