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

fix: update to latest libp2p interfaces #4111

Merged
merged 2 commits into from
May 27, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions packages/ipfs-core/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@
"@libp2p/crypto": "^0.22.9",
"@libp2p/delegated-content-routing": "^1.0.3",
"@libp2p/delegated-peer-routing": "^1.0.3",
"@libp2p/interfaces": "^1.3.32",
"@libp2p/interfaces": "^2.0.2",
"@libp2p/kad-dht": "^1.0.3",
"@libp2p/logger": "^1.1.4",
"@libp2p/mplex": "^1.0.5",
Expand Down Expand Up @@ -125,7 +125,7 @@
"it-tar": "^5.0.0",
"it-to-buffer": "^2.0.0",
"just-safe-set": "^4.0.2",
"libp2p": "^0.37.0",
"libp2p": "^0.37.1",
"merge-options": "^3.0.4",
"mortice": "^3.0.0",
"multiformats": "^9.5.1",
Expand Down
6 changes: 4 additions & 2 deletions packages/ipfs-core/src/components/libp2p.js
Original file line number Diff line number Diff line change
Expand Up @@ -115,8 +115,10 @@ function getLibp2pOptions ({ options, config, datastore, keychainConfig, peerId,
minConnections: get(options, 'config.Swarm.ConnMgr.LowWater', get(config, 'Swarm.ConnMgr.LowWater'))
}),
keychain: keychainConfig,
host: {
agentVersion: `js-ipfs/${pkgversion}`
identify: {
host: {
agentVersion: `js-ipfs/${pkgversion}`
}
},
contentRouters: [],
peerRouters: [],
Expand Down
30 changes: 9 additions & 21 deletions packages/ipfs-core/test/create-node.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@ describe('create node', function () {

const node = await IPFS.create({
repo: tmpDir(),
init: { bits: 512 },
config: {
Addresses: {
Swarm: []
Expand All @@ -47,7 +46,6 @@ describe('create node', function () {

const node = await IPFS.create({
repo: tempRepo,
init: { bits: 512 },
config: {
Addresses: {
Swarm: []
Expand Down Expand Up @@ -81,7 +79,6 @@ describe('create node', function () {

it('should create and initialize but not start', async () => {
const ipfs = await IPFS.create({
init: { bits: 512 },
start: false,
repo: tempRepo,
config: { Addresses: { Swarm: [] } }
Expand Down Expand Up @@ -111,7 +108,7 @@ describe('create node', function () {
})).to.eventually.be.rejected()
})

it('should init with 1024 key bits', async function () {
it('should init RSA key with 1024 key bits', async function () {
this.timeout(80 * 1000)

const node = await IPFS.create({
Expand Down Expand Up @@ -144,7 +141,6 @@ describe('create node', function () {
const ipfs = await IPFS.create({
silent: true,
repo: tempRepo,
init: { bits: 512 },
config: {
Addresses: {
Swarm: []
Expand All @@ -166,7 +162,6 @@ describe('create node', function () {

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

const node = await IPFS.create({
repo: tempRepo,
init: { bits: 512 },
config: {
Addresses: {
Swarm: []
},
Bootstrap: [],
Pubsub: {
Enabled: false
}
Expand All @@ -208,7 +206,6 @@ describe('create node', function () {

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

let _nodeNumber = 0
/**
* @param {import('ipfs-repo').IPFSRepo} repo
* @returns
*/
function createNode (repo) {
_nodeNumber++
return IPFS.create({
repo,
init: { bits: 512, emptyRepo: true },
init: { emptyRepo: true },
config: {
Addresses: {
API: `/ip4/127.0.0.1/tcp/${5010 + _nodeNumber}`,
Gateway: `/ip4/127.0.0.1/tcp/${9090 + _nodeNumber}`,
Swarm: isNode
? [
`/ip4/0.0.0.0/tcp/${4010 + _nodeNumber * 2}`
]
: []
Swarm: []
},
Bootstrap: []
},
preload: { enabled: false }
preload: { enabled: false },
start: false
})
}

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

const node = await IPFS.create({
repo: tempRepo,
init: { bits: 512 },
config: {
Addresses: {
Swarm: []
Expand All @@ -283,7 +272,6 @@ describe('create node', function () {
it('should error when receiving websocket-star swarm addresses', async () => {
const node = await IPFS.create({
repo: tempRepo,
init: { bits: 512 },
start: false,
config: {
Addresses: {
Expand Down
2 changes: 1 addition & 1 deletion packages/ipfs-daemon/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@
"ipfs-http-gateway": "^0.9.2",
"ipfs-http-server": "^0.11.2",
"ipfs-utils": "^9.0.6",
"libp2p": "^0.37.0"
"libp2p": "^0.37.1"
},
"devDependencies": {
"aegir": "^37.0.11",
Expand Down
2 changes: 1 addition & 1 deletion packages/ipfs-http-server/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@
"@hapi/content": "^5.0.2",
"@hapi/hapi": "^20.0.0",
"@ipld/dag-pb": "^2.1.3",
"@libp2p/interfaces": "^1.3.32",
"@libp2p/interfaces": "^2.0.2",
"@libp2p/logger": "^1.1.4",
"@libp2p/peer-id": "^1.1.10",
"any-signal": "^3.0.0",
Expand Down
4 changes: 2 additions & 2 deletions packages/ipfs-message-port-server/src/server.js
Original file line number Diff line number Diff line change
Expand Up @@ -253,10 +253,10 @@ export class Server {
query.fail(error)
}
} else {
query.fail(new RangeError(`Method '${method}' is not found`))
query.fail(new RangeError(`Method '${String(method)}' is not found`))
}
} else {
query.fail(new RangeError(`Namespace '${namespace}' is not found`))
query.fail(new RangeError(`Namespace '${String(namespace)}' is not found`))
}
}

Expand Down