-
Notifications
You must be signed in to change notification settings - Fork 48
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: use libp2p 0.28.x #217
Conversation
17e3747
to
f83007d
Compare
ae16874
to
494d63e
Compare
28fe2fd
to
4d05404
Compare
6abb64d
to
7e19612
Compare
test: wait for provide to finish
9e98092
to
a2114fa
Compare
1f9a2bb
to
5fc188b
Compare
@dirkmc @achingbrain this is ready for review. Once this and ipfs/js-ipfs#3019 is good to go, we should release the final version of |
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, just a few small nits & needs libp2p@0.28.x to be released before merging
package.json
Outdated
@@ -52,8 +52,8 @@ | |||
"iso-random-stream": "^1.1.1", | |||
"it-all": "^1.0.2", | |||
"it-drain": "^1.0.1", | |||
"libp2p": "^0.27.0", | |||
"libp2p-kad-dht": "^0.18.3", | |||
"libp2p": "^0.28.0-rc.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.
Needs to change to final, non-rc version before merging
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.
Sorry Vasco I missed the notifications somehow.
LGTM 👍
FYI I addressed the review and we are now only pending on the final release of I will let you know once that happens |
I was experiencing intermittent issues using this in Let's consider the following scenario:
The issue here was that PeerB got notified of the connection between both peers and it should be notified only when that peer is dialable on bitswap protocol. I needed to change that flow to use the libp2p/js-libp2p-interfaces//topology. This will trigger the onConnect when the identify protocol ran and the peer knowns that the other peer is running one of the multicodecs of bitswap. By this time, the peer already added the other peer multiaddrs to the AddressBook and this intermittent issue does not happen. It is important pointing out that this is a breaking change in the bitswap API, since start and stop will now return Promise |
src/network.js
Outdated
onDisconnect: this._onPeerDisconnect | ||
} | ||
}) | ||
this._registrarId = await this.libp2p.registrar.register(topology) |
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.
Does this need to be async? The Registrar.register
method doesn't appear to be an async method: https://github.com/libp2p/js-libp2p/blob/master/src/registrar.js#L64-L78
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.
lol, yes my bad! 😓We had it async before, but not anymore. I will change this according
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 amended the previous commit removing the async part, as well as the breaking change message. Thanks for noticing this
Thanks for the update vasco, I appreciate that you're doing such thorough testing that you found this 👍 |
ed0b7de
to
06f01b9
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.
1 missing todo, otherwise LGTM
test/network/network.node.js
Outdated
@@ -134,7 +136,8 @@ describe('network', () => { | |||
|
|||
bitswapMockB._receiveError = (err) => deferred.reject(err) | |||
|
|||
const { stream } = await p2pA.dialProtocol(p2pB.peerInfo, '/ipfs/bitswap/' + version.num) | |||
// TODO: set addr |
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.
@vasco-santos the address should be added. The previous test is causing this to pass but if that changes this will break
final comments were addressed in the last commit |
Once
js-libp2p@0.28
ships, we will have to update its breaking changes in here andjs-ipfs
.For what is relevant for this module, we are deprecating
peer-info
, changing howjs-libp2p
gathers its listening multiaddr, changing theConnectionManager
,PeerStore
andDHT
APIs.Needs:
ConnectionManager
API instead of Registrar for getting connectionslibp2p@0.28
final releaseBREAKING CHANGE: bitswap start and stop return a promise