Skip to content
This repository has been archived by the owner on Feb 12, 2024. It is now read-only.

Commit

Permalink
feat: gossipsub as default pubsub
Browse files Browse the repository at this point in the history
  • Loading branch information
vasco-santos committed Jul 24, 2019
1 parent 65622aa commit 5f20a68
Show file tree
Hide file tree
Showing 7 changed files with 53 additions and 23 deletions.
6 changes: 4 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -121,11 +121,13 @@
"just-flatten-it": "^2.1.0",
"just-safe-set": "^2.1.0",
"kind-of": "^6.0.2",
"libp2p": "~0.25.4",
"libp2p": "libp2p/js-libp2p#feat/integrate-gossipsub-by-default",
"libp2p-bootstrap": "~0.9.3",
"libp2p-crypto": "~0.16.0",
"libp2p-delegated-content-routing": "^0.2.3",
"libp2p-delegated-peer-routing": "^0.2.3",
"libp2p-floodsub": "^0.17.0",
"libp2p-gossipsub": "ChainSafe/gossipsub-js#feat/self-emit-option",
"libp2p-kad-dht": "~0.15.2",
"libp2p-keychain": "~0.4.2",
"libp2p-mdns": "~0.12.0",
Expand Down Expand Up @@ -190,7 +192,7 @@
"execa": "^2.0.3",
"form-data": "^2.5.0",
"hat": "0.0.3",
"interface-ipfs-core": "~0.107.3",
"interface-ipfs-core": "ipfs/interface-ipfs-core#chore/integrate-libp2p-new-pubsub-routing",
"ipfsd-ctl": "^0.43.0",
"libp2p-websocket-star": "~0.10.2",
"ncp": "^2.0.0",
Expand Down
4 changes: 2 additions & 2 deletions src/core/components/libp2p.js
Original file line number Diff line number Diff line change
Expand Up @@ -105,8 +105,8 @@ function defaultBundle ({ datastore, peerInfo, peerBook, options, config }) {
ipns: ipnsUtils.selector
}
},
EXPERIMENTAL: {
pubsub: get(options, 'EXPERIMENTAL.pubsub', false)
pubsub: {
enabled: get(options, 'EXPERIMENTAL.pubsub', false)
}
},
connectionManager: get(options, 'connectionManager',
Expand Down
8 changes: 5 additions & 3 deletions src/core/runtime/libp2p-browser.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ const Multiplex = require('pull-mplex')
const SECIO = require('libp2p-secio')
const Bootstrap = require('libp2p-bootstrap')
const KadDHT = require('libp2p-kad-dht')
const GossipSub = require('libp2p-gossipsub')
const libp2p = require('libp2p')
const mergeOptions = require('merge-options')
const multiaddr = require('multiaddr')
Expand Down Expand Up @@ -46,7 +47,8 @@ class Node extends libp2p {
wsstar.discovery,
Bootstrap
],
dht: KadDHT
dht: KadDHT,
pubsub: GossipSub
},
config: {
peerDiscovery: {
Expand All @@ -64,8 +66,8 @@ class Node extends libp2p {
dht: {
enabled: false
},
EXPERIMENTAL: {
pubsub: false
pubsub: {
enabled: false
}
}
}
Expand Down
8 changes: 5 additions & 3 deletions src/core/runtime/libp2p-nodejs.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ const WS = require('libp2p-websockets')
const WebSocketStarMulti = require('libp2p-websocket-star-multi')
const Bootstrap = require('libp2p-bootstrap')
const KadDHT = require('libp2p-kad-dht')
const GossipSub = require('libp2p-gossipsub')
const Multiplex = require('pull-mplex')
const SECIO = require('libp2p-secio')
const libp2p = require('libp2p')
Expand Down Expand Up @@ -45,7 +46,8 @@ class Node extends libp2p {
Bootstrap,
wsstar.discovery
],
dht: KadDHT
dht: KadDHT,
pubsub: GossipSub
},
config: {
peerDiscovery: {
Expand All @@ -67,8 +69,8 @@ class Node extends libp2p {
enabled: false
}
},
EXPERIMENTAL: {
pubsub: false
pubsub: {
enabled: false
}
}
}
Expand Down
17 changes: 17 additions & 0 deletions test/core/interface.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,23 @@ describe('interface-ipfs-core tests', function () {
}]
})

tests.config(defaultCommonFactory, {
skip: [
{
name: 'should set a number',
reason: 'Failing - needs to be fixed'
},
{
name: 'should output changes but not save them for dry run',
reason: 'not implemented'
},
{
name: 'should set a config profile',
reason: 'not implemented'
}
]
})

tests.dag(defaultCommonFactory)

tests.dht(CommonFactory.create({
Expand Down
15 changes: 6 additions & 9 deletions test/core/libp2p.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -45,8 +45,8 @@ describe('libp2p customization', function () {
Enabled: false
}
},
EXPERIMENTAL: {
pubsub: false
pubsub: {
enabled: false
}
}
datastore = new MemoryStore()
Expand Down Expand Up @@ -149,8 +149,8 @@ describe('libp2p customization', function () {
enabled: true
}
},
EXPERIMENTAL: {
pubsub: false
pubsub: {
enabled: false
}
})
expect(_libp2p._transport).to.have.length(3)
Expand All @@ -177,8 +177,8 @@ describe('libp2p customization', function () {
}
}
},
EXPERIMENTAL: {
pubsub: true
pubsub: {
enabled: true
},
libp2p: {
modules: {
Expand Down Expand Up @@ -213,9 +213,6 @@ describe('libp2p customization', function () {
websocketStar: {
enabled: true
}
},
EXPERIMENTAL: {
pubsub: true
}
})
expect(_libp2p._transport).to.have.length(1)
Expand Down
18 changes: 14 additions & 4 deletions test/http-api/interface.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,20 @@ describe('interface-ipfs-core over ipfs-http-client tests', () => {
tests.bootstrap(defaultCommonFactory)

tests.config(defaultCommonFactory, {
skip: [{
name: 'should set a number',
reason: 'Failing - needs to be fixed'
}]
skip: [
{
name: 'should set a number',
reason: 'Failing - needs to be fixed'
},
{
name: 'should output changes but not save them for dry run',
reason: 'not implemented'
},
{
name: 'should set a config profile',
reason: 'not implemented'
}
]
})

tests.dag(defaultCommonFactory, {
Expand Down

0 comments on commit 5f20a68

Please sign in to comment.