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

Commit 5f20a68

Browse files
committed
feat: gossipsub as default pubsub
1 parent 65622aa commit 5f20a68

File tree

7 files changed

+53
-23
lines changed

7 files changed

+53
-23
lines changed

package.json

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -121,11 +121,13 @@
121121
"just-flatten-it": "^2.1.0",
122122
"just-safe-set": "^2.1.0",
123123
"kind-of": "^6.0.2",
124-
"libp2p": "~0.25.4",
124+
"libp2p": "libp2p/js-libp2p#feat/integrate-gossipsub-by-default",
125125
"libp2p-bootstrap": "~0.9.3",
126126
"libp2p-crypto": "~0.16.0",
127127
"libp2p-delegated-content-routing": "^0.2.3",
128128
"libp2p-delegated-peer-routing": "^0.2.3",
129+
"libp2p-floodsub": "^0.17.0",
130+
"libp2p-gossipsub": "ChainSafe/gossipsub-js#feat/self-emit-option",
129131
"libp2p-kad-dht": "~0.15.2",
130132
"libp2p-keychain": "~0.4.2",
131133
"libp2p-mdns": "~0.12.0",
@@ -190,7 +192,7 @@
190192
"execa": "^2.0.3",
191193
"form-data": "^2.5.0",
192194
"hat": "0.0.3",
193-
"interface-ipfs-core": "~0.107.3",
195+
"interface-ipfs-core": "ipfs/interface-ipfs-core#chore/integrate-libp2p-new-pubsub-routing",
194196
"ipfsd-ctl": "^0.43.0",
195197
"libp2p-websocket-star": "~0.10.2",
196198
"ncp": "^2.0.0",

src/core/components/libp2p.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -105,8 +105,8 @@ function defaultBundle ({ datastore, peerInfo, peerBook, options, config }) {
105105
ipns: ipnsUtils.selector
106106
}
107107
},
108-
EXPERIMENTAL: {
109-
pubsub: get(options, 'EXPERIMENTAL.pubsub', false)
108+
pubsub: {
109+
enabled: get(options, 'EXPERIMENTAL.pubsub', false)
110110
}
111111
},
112112
connectionManager: get(options, 'connectionManager',

src/core/runtime/libp2p-browser.js

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ const Multiplex = require('pull-mplex')
77
const SECIO = require('libp2p-secio')
88
const Bootstrap = require('libp2p-bootstrap')
99
const KadDHT = require('libp2p-kad-dht')
10+
const GossipSub = require('libp2p-gossipsub')
1011
const libp2p = require('libp2p')
1112
const mergeOptions = require('merge-options')
1213
const multiaddr = require('multiaddr')
@@ -46,7 +47,8 @@ class Node extends libp2p {
4647
wsstar.discovery,
4748
Bootstrap
4849
],
49-
dht: KadDHT
50+
dht: KadDHT,
51+
pubsub: GossipSub
5052
},
5153
config: {
5254
peerDiscovery: {
@@ -64,8 +66,8 @@ class Node extends libp2p {
6466
dht: {
6567
enabled: false
6668
},
67-
EXPERIMENTAL: {
68-
pubsub: false
69+
pubsub: {
70+
enabled: false
6971
}
7072
}
7173
}

src/core/runtime/libp2p-nodejs.js

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ const WS = require('libp2p-websockets')
66
const WebSocketStarMulti = require('libp2p-websocket-star-multi')
77
const Bootstrap = require('libp2p-bootstrap')
88
const KadDHT = require('libp2p-kad-dht')
9+
const GossipSub = require('libp2p-gossipsub')
910
const Multiplex = require('pull-mplex')
1011
const SECIO = require('libp2p-secio')
1112
const libp2p = require('libp2p')
@@ -45,7 +46,8 @@ class Node extends libp2p {
4546
Bootstrap,
4647
wsstar.discovery
4748
],
48-
dht: KadDHT
49+
dht: KadDHT,
50+
pubsub: GossipSub
4951
},
5052
config: {
5153
peerDiscovery: {
@@ -67,8 +69,8 @@ class Node extends libp2p {
6769
enabled: false
6870
}
6971
},
70-
EXPERIMENTAL: {
71-
pubsub: false
72+
pubsub: {
73+
enabled: false
7274
}
7375
}
7476
}

test/core/interface.spec.js

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,23 @@ describe('interface-ipfs-core tests', function () {
2323
}]
2424
})
2525

26+
tests.config(defaultCommonFactory, {
27+
skip: [
28+
{
29+
name: 'should set a number',
30+
reason: 'Failing - needs to be fixed'
31+
},
32+
{
33+
name: 'should output changes but not save them for dry run',
34+
reason: 'not implemented'
35+
},
36+
{
37+
name: 'should set a config profile',
38+
reason: 'not implemented'
39+
}
40+
]
41+
})
42+
2643
tests.dag(defaultCommonFactory)
2744

2845
tests.dht(CommonFactory.create({

test/core/libp2p.spec.js

Lines changed: 6 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -45,8 +45,8 @@ describe('libp2p customization', function () {
4545
Enabled: false
4646
}
4747
},
48-
EXPERIMENTAL: {
49-
pubsub: false
48+
pubsub: {
49+
enabled: false
5050
}
5151
}
5252
datastore = new MemoryStore()
@@ -149,8 +149,8 @@ describe('libp2p customization', function () {
149149
enabled: true
150150
}
151151
},
152-
EXPERIMENTAL: {
153-
pubsub: false
152+
pubsub: {
153+
enabled: false
154154
}
155155
})
156156
expect(_libp2p._transport).to.have.length(3)
@@ -177,8 +177,8 @@ describe('libp2p customization', function () {
177177
}
178178
}
179179
},
180-
EXPERIMENTAL: {
181-
pubsub: true
180+
pubsub: {
181+
enabled: true
182182
},
183183
libp2p: {
184184
modules: {
@@ -213,9 +213,6 @@ describe('libp2p customization', function () {
213213
websocketStar: {
214214
enabled: true
215215
}
216-
},
217-
EXPERIMENTAL: {
218-
pubsub: true
219216
}
220217
})
221218
expect(_libp2p._transport).to.have.length(1)

test/http-api/interface.js

Lines changed: 14 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -17,10 +17,20 @@ describe('interface-ipfs-core over ipfs-http-client tests', () => {
1717
tests.bootstrap(defaultCommonFactory)
1818

1919
tests.config(defaultCommonFactory, {
20-
skip: [{
21-
name: 'should set a number',
22-
reason: 'Failing - needs to be fixed'
23-
}]
20+
skip: [
21+
{
22+
name: 'should set a number',
23+
reason: 'Failing - needs to be fixed'
24+
},
25+
{
26+
name: 'should output changes but not save them for dry run',
27+
reason: 'not implemented'
28+
},
29+
{
30+
name: 'should set a config profile',
31+
reason: 'not implemented'
32+
}
33+
]
2434
})
2535

2636
tests.dag(defaultCommonFactory, {

0 commit comments

Comments
 (0)