-
Couldn't load subscription status.
- Fork 47
feat: use libp2p 0.28.x #217
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
Merged
Merged
Changes from 3 commits
Commits
Show all changes
8 commits
Select commit
Hold shift + click to select a range
ec3aa81
chore: use libp2p 0.28.x
vasco-santos a2114fa
test: add better routing table check
jacobheun 5fc188b
chore: use libp2p0.28rc0
vasco-santos b7552af
chore: address review
vasco-santos 06f01b9
feat: use libp2p protocol topology
vasco-santos 3b9c502
chore: use final libp2p release
vasco-santos 43bdcad
chore: add addresses to address book before dial
vasco-santos a4a1938
chore: dial to multiaddrs instead of peer-id
vasco-santos File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -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", | ||
| "libp2p-kad-dht": "^0.19.1", | ||
| "libp2p-mplex": "^0.9.2", | ||
| "libp2p-secio": "^0.12.1", | ||
| "libp2p-tcp": "^0.14.2", | ||
|
|
@@ -65,9 +65,7 @@ | |
| "p-defer": "^3.0.0", | ||
| "p-event": "^4.1.0", | ||
| "p-wait-for": "^3.1.0", | ||
| "peer-book": "~0.9.0", | ||
| "peer-id": "^0.13.5", | ||
| "peer-info": "^0.17.0", | ||
| "promisify-es6": "^1.0.3", | ||
| "rimraf": "^3.0.0", | ||
| "sinon": "^9.0.0", | ||
|
|
@@ -92,8 +90,7 @@ | |
| "varint-decoder": "^0.4.0" | ||
| }, | ||
| "pre-push": [ | ||
| "lint", | ||
| "test" | ||
| "lint" | ||
vasco-santos marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| ], | ||
| "contributors": [ | ||
| "David Dias <[email protected]>", | ||
|
|
||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -76,7 +76,7 @@ describe('network', () => { | |
|
|
||
| it('connectTo fail', async () => { | ||
| try { | ||
| await networkA.connectTo(p2pB.peerInfo.id) | ||
| await networkA.connectTo(p2pB.peerId) | ||
| assert.fail() | ||
| } catch (err) { | ||
| expect(err).to.exist() | ||
|
|
@@ -87,24 +87,26 @@ describe('network', () => { | |
| var counter = 0 | ||
|
|
||
| bitswapMockA._onPeerConnected = (peerId) => { | ||
| expect(peerId.toB58String()).to.equal(p2pB.peerInfo.id.toB58String()) | ||
| expect(peerId.toB58String()).to.equal(p2pB.peerId.toB58String()) | ||
| counter++ | ||
| } | ||
|
|
||
| bitswapMockB._onPeerConnected = (peerId) => { | ||
| expect(peerId.toB58String()).to.equal(p2pA.peerInfo.id.toB58String()) | ||
| expect(peerId.toB58String()).to.equal(p2pA.peerId.toB58String()) | ||
| counter++ | ||
| } | ||
|
|
||
| await p2pA.dial(p2pB.peerInfo) | ||
| p2pA.peerStore.addressBook.set(p2pB.peerId, p2pB.multiaddrs) | ||
| await p2pA.dial(p2pB.peerId) | ||
|
|
||
| await pWaitFor(() => counter >= 2) | ||
| bitswapMockA._onPeerConnected = () => {} | ||
| bitswapMockB._onPeerConnected = () => {} | ||
| }) | ||
|
|
||
| it('connectTo success', async () => { | ||
| await networkA.connectTo(p2pB.peerInfo) | ||
| p2pA.peerStore.addressBook.set(p2pB.peerId, p2pB.multiaddrs) | ||
| await networkA.connectTo(p2pB.peerId) | ||
| }) | ||
|
|
||
| const versions = [{ | ||
|
|
@@ -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 | ||
|
||
| const { stream } = await p2pA.dialProtocol(p2pB.peerId, '/ipfs/bitswap/' + version.num) | ||
| await pipe( | ||
| [version.serialize(msg)], | ||
| lp.encode(), | ||
|
|
@@ -165,11 +168,12 @@ describe('network', () => { | |
|
|
||
| bitswapMockB._receiveError = deferred.reject | ||
|
|
||
| await networkA.sendMessage(p2pB.peerInfo.id, msg) | ||
| await networkA.sendMessage(p2pB.peerId, msg) | ||
| }) | ||
|
|
||
| it('dial to peer on Bitswap 1.0.0', async () => { | ||
| const { protocol } = await p2pA.dialProtocol(p2pC.peerInfo, ['/ipfs/bitswap/1.1.0', '/ipfs/bitswap/1.0.0']) | ||
| p2pA.peerStore.addressBook.set(p2pC.peerId, p2pC.multiaddrs) | ||
| const { protocol } = await p2pA.dialProtocol(p2pC.peerId, ['/ipfs/bitswap/1.1.0', '/ipfs/bitswap/1.0.0']) | ||
|
|
||
| expect(protocol).to.equal('/ipfs/bitswap/1.0.0') | ||
| }) | ||
|
|
@@ -194,7 +198,7 @@ describe('network', () => { | |
|
|
||
| bitswapMockC._receiveError = deferred.reject | ||
|
|
||
| await networkA.sendMessage(p2pC.peerInfo.id, msg) | ||
| await networkA.sendMessage(p2pC.peerId, msg) | ||
| await deferred.promise | ||
| }) | ||
|
|
||
|
|
@@ -208,16 +212,15 @@ describe('network', () => { | |
| networkA.start() | ||
| networkB.start() | ||
|
|
||
| // FIXME: have to already be connected as sendMessage only accepts a peer id, not a PeerInfo | ||
| await p2pA.dial(p2pB.peerInfo) | ||
| p2pA.peerStore.addressBook.set(p2pB.peerId, p2pB.multiaddrs) | ||
|
|
||
| const deferred = pDefer() | ||
|
|
||
| bitswapMockB._receiveMessage = () => { | ||
| deferred.resolve() | ||
| } | ||
|
|
||
| await networkA.sendMessage(p2pB.peerInfo.id, new Message(true)) | ||
| await networkA.sendMessage(p2pB.peerId, new Message(true)) | ||
|
|
||
| return deferred | ||
| }) | ||
|
|
||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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