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

Commit 4e93dd5

Browse files
authored
fix: update to latest libp2p interfaces (#4111)
Update all deps to `@libp2p/[email protected]`
1 parent 7165bf7 commit 4e93dd5

File tree

6 files changed

+19
-29
lines changed

6 files changed

+19
-29
lines changed

packages/ipfs-core/package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@
7575
"@libp2p/crypto": "^0.22.9",
7676
"@libp2p/delegated-content-routing": "^1.0.3",
7777
"@libp2p/delegated-peer-routing": "^1.0.3",
78-
"@libp2p/interfaces": "^1.3.32",
78+
"@libp2p/interfaces": "^2.0.2",
7979
"@libp2p/kad-dht": "^1.0.3",
8080
"@libp2p/logger": "^1.1.4",
8181
"@libp2p/mplex": "^1.0.5",
@@ -125,7 +125,7 @@
125125
"it-tar": "^5.0.0",
126126
"it-to-buffer": "^2.0.0",
127127
"just-safe-set": "^4.0.2",
128-
"libp2p": "^0.37.0",
128+
"libp2p": "^0.37.1",
129129
"merge-options": "^3.0.4",
130130
"mortice": "^3.0.0",
131131
"multiformats": "^9.5.1",

packages/ipfs-core/src/components/libp2p.js

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -115,8 +115,10 @@ function getLibp2pOptions ({ options, config, datastore, keychainConfig, peerId,
115115
minConnections: get(options, 'config.Swarm.ConnMgr.LowWater', get(config, 'Swarm.ConnMgr.LowWater'))
116116
}),
117117
keychain: keychainConfig,
118-
host: {
119-
agentVersion: `js-ipfs/${pkgversion}`
118+
identify: {
119+
host: {
120+
agentVersion: `js-ipfs/${pkgversion}`
121+
}
120122
},
121123
contentRouters: [],
122124
peerRouters: [],

packages/ipfs-core/test/create-node.spec.js

Lines changed: 9 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,6 @@ describe('create node', function () {
2727

2828
const node = await IPFS.create({
2929
repo: tmpDir(),
30-
init: { bits: 512 },
3130
config: {
3231
Addresses: {
3332
Swarm: []
@@ -47,7 +46,6 @@ describe('create node', function () {
4746

4847
const node = await IPFS.create({
4948
repo: tempRepo,
50-
init: { bits: 512 },
5149
config: {
5250
Addresses: {
5351
Swarm: []
@@ -81,7 +79,6 @@ describe('create node', function () {
8179

8280
it('should create and initialize but not start', async () => {
8381
const ipfs = await IPFS.create({
84-
init: { bits: 512 },
8582
start: false,
8683
repo: tempRepo,
8784
config: { Addresses: { Swarm: [] } }
@@ -111,7 +108,7 @@ describe('create node', function () {
111108
})).to.eventually.be.rejected()
112109
})
113110

114-
it('should init with 1024 key bits', async function () {
111+
it('should init RSA key with 1024 key bits', async function () {
115112
this.timeout(80 * 1000)
116113

117114
const node = await IPFS.create({
@@ -144,7 +141,6 @@ describe('create node', function () {
144141
const ipfs = await IPFS.create({
145142
silent: true,
146143
repo: tempRepo,
147-
init: { bits: 512 },
148144
config: {
149145
Addresses: {
150146
Swarm: []
@@ -166,7 +162,6 @@ describe('create node', function () {
166162

167163
const node = await IPFS.create({
168164
repo: tempRepo,
169-
init: { bits: 512 },
170165
config: {
171166
Addresses: {
172167
Swarm: ['/ip4/127.0.0.1/tcp/9977']
@@ -188,8 +183,11 @@ describe('create node', function () {
188183

189184
const node = await IPFS.create({
190185
repo: tempRepo,
191-
init: { bits: 512 },
192186
config: {
187+
Addresses: {
188+
Swarm: []
189+
},
190+
Bootstrap: [],
193191
Pubsub: {
194192
Enabled: false
195193
}
@@ -208,7 +206,6 @@ describe('create node', function () {
208206

209207
const node = await IPFS.create({
210208
repo: tempRepo,
211-
init: { bits: 512 },
212209
config: {
213210
Addresses: {
214211
Swarm: []
@@ -226,29 +223,22 @@ describe('create node', function () {
226223
it('should not share identity with a simultaneously created node', async function () {
227224
this.timeout(2 * 60 * 1000)
228225

229-
let _nodeNumber = 0
230226
/**
231227
* @param {import('ipfs-repo').IPFSRepo} repo
232228
* @returns
233229
*/
234230
function createNode (repo) {
235-
_nodeNumber++
236231
return IPFS.create({
237232
repo,
238-
init: { bits: 512, emptyRepo: true },
233+
init: { emptyRepo: true },
239234
config: {
240235
Addresses: {
241-
API: `/ip4/127.0.0.1/tcp/${5010 + _nodeNumber}`,
242-
Gateway: `/ip4/127.0.0.1/tcp/${9090 + _nodeNumber}`,
243-
Swarm: isNode
244-
? [
245-
`/ip4/0.0.0.0/tcp/${4010 + _nodeNumber * 2}`
246-
]
247-
: []
236+
Swarm: []
248237
},
249238
Bootstrap: []
250239
},
251-
preload: { enabled: false }
240+
preload: { enabled: false },
241+
start: false
252242
})
253243
}
254244

@@ -267,7 +257,6 @@ describe('create node', function () {
267257

268258
const node = await IPFS.create({
269259
repo: tempRepo,
270-
init: { bits: 512 },
271260
config: {
272261
Addresses: {
273262
Swarm: []
@@ -283,7 +272,6 @@ describe('create node', function () {
283272
it('should error when receiving websocket-star swarm addresses', async () => {
284273
const node = await IPFS.create({
285274
repo: tempRepo,
286-
init: { bits: 512 },
287275
start: false,
288276
config: {
289277
Addresses: {

packages/ipfs-daemon/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@
4949
"ipfs-http-gateway": "^0.9.2",
5050
"ipfs-http-server": "^0.11.2",
5151
"ipfs-utils": "^9.0.6",
52-
"libp2p": "^0.37.0"
52+
"libp2p": "^0.37.1"
5353
},
5454
"devDependencies": {
5555
"aegir": "^37.0.11",

packages/ipfs-http-server/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@
4545
"@hapi/content": "^5.0.2",
4646
"@hapi/hapi": "^20.0.0",
4747
"@ipld/dag-pb": "^2.1.3",
48-
"@libp2p/interfaces": "^1.3.32",
48+
"@libp2p/interfaces": "^2.0.2",
4949
"@libp2p/logger": "^1.1.4",
5050
"@libp2p/peer-id": "^1.1.10",
5151
"any-signal": "^3.0.0",

packages/ipfs-message-port-server/src/server.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -253,10 +253,10 @@ export class Server {
253253
query.fail(error)
254254
}
255255
} else {
256-
query.fail(new RangeError(`Method '${method}' is not found`))
256+
query.fail(new RangeError(`Method '${String(method)}' is not found`))
257257
}
258258
} else {
259-
query.fail(new RangeError(`Namespace '${namespace}' is not found`))
259+
query.fail(new RangeError(`Namespace '${String(namespace)}' is not found`))
260260
}
261261
}
262262

0 commit comments

Comments
 (0)