Merge branch 'master' into feat/shard-peer-selection

This commit is contained in:
Danish Arora 2024-01-18 00:25:34 +05:30 committed by GitHub
commit 434f974601
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
6 changed files with 107 additions and 68 deletions

147
package-lock.json generated
View File

@ -25,7 +25,7 @@
"@size-limit/preset-big-lib": "^8.2.4",
"@typescript-eslint/eslint-plugin": "^6.6.0",
"@typescript-eslint/parser": "^6.7.5",
"eslint": "^8.47.0",
"eslint": "^8.56.0",
"eslint-config-prettier": "^9.0.0",
"eslint-plugin-eslint-comments": "^3.2.0",
"eslint-plugin-functional": "^6.0.0",
@ -1836,8 +1836,9 @@
}
},
"node_modules/@eslint/eslintrc": {
"version": "2.1.2",
"license": "MIT",
"version": "2.1.4",
"resolved": "https://registry.npmjs.org/@eslint/eslintrc/-/eslintrc-2.1.4.tgz",
"integrity": "sha512-269Z39MS6wVJtsoUl10L60WdkhJVdPG24Q4eZTH3nnF6lpvSShEK3wQjDX9JRWAUPvPh7COouPpU9IrqaZFvtQ==",
"dependencies": {
"ajv": "^6.12.4",
"debug": "^4.3.2",
@ -1857,8 +1858,9 @@
}
},
"node_modules/@eslint/js": {
"version": "8.49.0",
"license": "MIT",
"version": "8.56.0",
"resolved": "https://registry.npmjs.org/@eslint/js/-/js-8.56.0.tgz",
"integrity": "sha512-gMsVel9D7f2HLkBma9VbtzZRehRogVRfbr++f06nL2vnCGCNlzOD+/MUov/F4p8myyAHspEhVobgjpX64q5m6A==",
"engines": {
"node": "^12.22.0 || ^14.17.0 || >=16.0.0"
}
@ -1921,11 +1923,12 @@
}
},
"node_modules/@humanwhocodes/config-array": {
"version": "0.11.11",
"license": "Apache-2.0",
"version": "0.11.14",
"resolved": "https://registry.npmjs.org/@humanwhocodes/config-array/-/config-array-0.11.14.tgz",
"integrity": "sha512-3T8LkOmg45BV5FICb15QQMsyUSWrQ8AygVfC7ZG32zOalnqrilm018ZVCw0eapXux8FtA33q8PSRSstjee3jSg==",
"dependencies": {
"@humanwhocodes/object-schema": "^1.2.1",
"debug": "^4.1.1",
"@humanwhocodes/object-schema": "^2.0.2",
"debug": "^4.3.1",
"minimatch": "^3.0.5"
},
"engines": {
@ -1944,8 +1947,9 @@
}
},
"node_modules/@humanwhocodes/object-schema": {
"version": "1.2.1",
"license": "BSD-3-Clause"
"version": "2.0.2",
"resolved": "https://registry.npmjs.org/@humanwhocodes/object-schema/-/object-schema-2.0.2.tgz",
"integrity": "sha512-6EwiSjwWYP7pTckG6I5eyFANjPhmPjUX9JRLUSfNPC7FX7zK9gyZAfUEaECL6ALTpGX5AjnBq3C9XmVWPitNpw=="
},
"node_modules/@isaacs/cliui": {
"version": "8.0.2",
@ -9475,16 +9479,18 @@
}
},
"node_modules/eslint": {
"version": "8.49.0",
"license": "MIT",
"version": "8.56.0",
"resolved": "https://registry.npmjs.org/eslint/-/eslint-8.56.0.tgz",
"integrity": "sha512-Go19xM6T9puCOWntie1/P997aXxFsOi37JIHRWI514Hc6ZnaHGKY9xFhrU65RT6CcBEzZoGG1e6Nq+DT04ZtZQ==",
"dependencies": {
"@eslint-community/eslint-utils": "^4.2.0",
"@eslint-community/regexpp": "^4.6.1",
"@eslint/eslintrc": "^2.1.2",
"@eslint/js": "8.49.0",
"@humanwhocodes/config-array": "^0.11.11",
"@eslint/eslintrc": "^2.1.4",
"@eslint/js": "8.56.0",
"@humanwhocodes/config-array": "^0.11.13",
"@humanwhocodes/module-importer": "^1.0.1",
"@nodelib/fs.walk": "^1.2.8",
"@ungap/structured-clone": "^1.2.0",
"ajv": "^6.12.4",
"chalk": "^4.0.0",
"cross-spawn": "^7.0.2",
@ -11236,8 +11242,9 @@
}
},
"node_modules/globals": {
"version": "13.22.0",
"license": "MIT",
"version": "13.24.0",
"resolved": "https://registry.npmjs.org/globals/-/globals-13.24.0.tgz",
"integrity": "sha512-AhO5QUcj8llrbG09iWhPU2B204J1xnPeL8kQmVorSsy+Sjj1sk8gIyh6cUocGmH4L0UuhAJy+hJMRA4mgA4mFQ==",
"dependencies": {
"type-fest": "^0.20.2"
},
@ -11766,28 +11773,25 @@
}
},
"node_modules/interface-datastore": {
"version": "8.2.5",
"license": "Apache-2.0 OR MIT",
"version": "8.2.10",
"resolved": "https://registry.npmjs.org/interface-datastore/-/interface-datastore-8.2.10.tgz",
"integrity": "sha512-D8RuxMdjOPB+j6WMDJ+I2aXTDzUT6DIVjgzo1E+ODL7w8WrSFl9FXD2SYmgj6vVzdb7Kb5qmAI9pEnDZJz7ifg==",
"dependencies": {
"interface-store": "^5.0.0",
"nanoid": "^4.0.0",
"uint8arrays": "^4.0.2"
"uint8arrays": "^5.0.0"
}
},
"node_modules/interface-datastore/node_modules/nanoid": {
"version": "4.0.2",
"funding": [
{
"type": "github",
"url": "https://github.com/sponsors/ai"
}
],
"license": "MIT",
"bin": {
"nanoid": "bin/nanoid.js"
},
"engines": {
"node": "^14 || ^16 || >=18"
"node_modules/interface-datastore/node_modules/multiformats": {
"version": "13.0.1",
"resolved": "https://registry.npmjs.org/multiformats/-/multiformats-13.0.1.tgz",
"integrity": "sha512-bt3R5iXe2O8xpp3wkmQhC73b/lC4S2ihU8Dndwcsysqbydqb8N+bpP116qMcClZ17g58iSIwtXUTcg2zT4sniA=="
},
"node_modules/interface-datastore/node_modules/uint8arrays": {
"version": "5.0.1",
"resolved": "https://registry.npmjs.org/uint8arrays/-/uint8arrays-5.0.1.tgz",
"integrity": "sha512-ND5RpJAnPgHmZT7hWD/2T4BwRp04j8NLKvMKC/7bhiEwEjUMkQ4kvBKiH6hOqbljd6qJ2xS8reL3vl1e33grOQ==",
"dependencies": {
"multiformats": "^13.0.0"
}
},
"node_modules/interface-store": {
@ -24903,7 +24907,8 @@
},
"node_modules/type-fest": {
"version": "0.20.2",
"license": "(MIT OR CC0-1.0)",
"resolved": "https://registry.npmjs.org/type-fest/-/type-fest-0.20.2.tgz",
"integrity": "sha512-Ne+eE4r0/iWnpAxD852z3A+N0Bt5RN//NjJwRd2VFHEmrywxf5vsZlh4R6lixl6B+wz/8d+maTSAkN1FIkI3LQ==",
"engines": {
"node": ">=10"
},
@ -26596,7 +26601,7 @@
"@rollup/plugin-node-resolve": "^15.2.3",
"@waku/build-utils": "*",
"cspell": "^7.3.2",
"interface-datastore": "^8.2.5",
"interface-datastore": "^8.2.10",
"npm-run-all": "^4.1.5",
"rollup": "^4.6.0"
},
@ -26643,7 +26648,7 @@
"cspell": "^7.3.2",
"datastore-core": "^9.2.7",
"debug": "^4.3.4",
"interface-datastore": "^8.2.5",
"interface-datastore": "^8.2.10",
"libp2p": "^0.46.14",
"mocha": "^10.2.0",
"mocha-multi-reporters": "^1.5.1",
@ -27840,7 +27845,9 @@
"version": "4.8.1"
},
"@eslint/eslintrc": {
"version": "2.1.2",
"version": "2.1.4",
"resolved": "https://registry.npmjs.org/@eslint/eslintrc/-/eslintrc-2.1.4.tgz",
"integrity": "sha512-269Z39MS6wVJtsoUl10L60WdkhJVdPG24Q4eZTH3nnF6lpvSShEK3wQjDX9JRWAUPvPh7COouPpU9IrqaZFvtQ==",
"requires": {
"ajv": "^6.12.4",
"debug": "^4.3.2",
@ -27854,7 +27861,9 @@
}
},
"@eslint/js": {
"version": "8.49.0"
"version": "8.56.0",
"resolved": "https://registry.npmjs.org/@eslint/js/-/js-8.56.0.tgz",
"integrity": "sha512-gMsVel9D7f2HLkBma9VbtzZRehRogVRfbr++f06nL2vnCGCNlzOD+/MUov/F4p8myyAHspEhVobgjpX64q5m6A=="
},
"@ethersproject/bytes": {
"version": "5.7.0",
@ -27878,10 +27887,12 @@
"integrity": "sha512-+KpH+QxZU7O4675t3mnkQKcZZg56u+K/Ct2K+N2AZYNVK8kyeo/bI18tI8aPm3tvNNRyTWfj6s5tnGNlcbQRsA=="
},
"@humanwhocodes/config-array": {
"version": "0.11.11",
"version": "0.11.14",
"resolved": "https://registry.npmjs.org/@humanwhocodes/config-array/-/config-array-0.11.14.tgz",
"integrity": "sha512-3T8LkOmg45BV5FICb15QQMsyUSWrQ8AygVfC7ZG32zOalnqrilm018ZVCw0eapXux8FtA33q8PSRSstjee3jSg==",
"requires": {
"@humanwhocodes/object-schema": "^1.2.1",
"debug": "^4.1.1",
"@humanwhocodes/object-schema": "^2.0.2",
"debug": "^4.3.1",
"minimatch": "^3.0.5"
}
},
@ -27889,7 +27900,9 @@
"version": "1.0.1"
},
"@humanwhocodes/object-schema": {
"version": "1.2.1"
"version": "2.0.2",
"resolved": "https://registry.npmjs.org/@humanwhocodes/object-schema/-/object-schema-2.0.2.tgz",
"integrity": "sha512-6EwiSjwWYP7pTckG6I5eyFANjPhmPjUX9JRLUSfNPC7FX7zK9gyZAfUEaECL6ALTpGX5AjnBq3C9XmVWPitNpw=="
},
"@isaacs/cliui": {
"version": "8.0.2",
@ -30058,7 +30071,7 @@
"@waku/relay": "0.0.9",
"@waku/utils": "0.0.14",
"cspell": "^7.3.2",
"interface-datastore": "^8.2.5",
"interface-datastore": "^8.2.10",
"libp2p": "^0.46.14",
"npm-run-all": "^4.1.5",
"rollup": "^4.6.0"
@ -30093,7 +30106,7 @@
"debug": "^4.3.4",
"dockerode": "^3.3.5",
"fast-check": "^3.15.0",
"interface-datastore": "^8.2.5",
"interface-datastore": "^8.2.10",
"libp2p": "^0.46.14",
"mocha": "^10.2.0",
"mocha-multi-reporters": "^1.5.1",
@ -32956,15 +32969,18 @@
}
},
"eslint": {
"version": "8.49.0",
"version": "8.56.0",
"resolved": "https://registry.npmjs.org/eslint/-/eslint-8.56.0.tgz",
"integrity": "sha512-Go19xM6T9puCOWntie1/P997aXxFsOi37JIHRWI514Hc6ZnaHGKY9xFhrU65RT6CcBEzZoGG1e6Nq+DT04ZtZQ==",
"requires": {
"@eslint-community/eslint-utils": "^4.2.0",
"@eslint-community/regexpp": "^4.6.1",
"@eslint/eslintrc": "^2.1.2",
"@eslint/js": "8.49.0",
"@humanwhocodes/config-array": "^0.11.11",
"@eslint/eslintrc": "^2.1.4",
"@eslint/js": "8.56.0",
"@humanwhocodes/config-array": "^0.11.13",
"@humanwhocodes/module-importer": "^1.0.1",
"@nodelib/fs.walk": "^1.2.8",
"@ungap/structured-clone": "^1.2.0",
"ajv": "^6.12.4",
"chalk": "^4.0.0",
"cross-spawn": "^7.0.2",
@ -33992,7 +34008,9 @@
}
},
"globals": {
"version": "13.22.0",
"version": "13.24.0",
"resolved": "https://registry.npmjs.org/globals/-/globals-13.24.0.tgz",
"integrity": "sha512-AhO5QUcj8llrbG09iWhPU2B204J1xnPeL8kQmVorSsy+Sjj1sk8gIyh6cUocGmH4L0UuhAJy+hJMRA4mgA4mFQ==",
"requires": {
"type-fest": "^0.20.2"
}
@ -34279,15 +34297,26 @@
"version": "2.0.0"
},
"interface-datastore": {
"version": "8.2.5",
"version": "8.2.10",
"resolved": "https://registry.npmjs.org/interface-datastore/-/interface-datastore-8.2.10.tgz",
"integrity": "sha512-D8RuxMdjOPB+j6WMDJ+I2aXTDzUT6DIVjgzo1E+ODL7w8WrSFl9FXD2SYmgj6vVzdb7Kb5qmAI9pEnDZJz7ifg==",
"requires": {
"interface-store": "^5.0.0",
"nanoid": "^4.0.0",
"uint8arrays": "^4.0.2"
"uint8arrays": "^5.0.0"
},
"dependencies": {
"nanoid": {
"version": "4.0.2"
"multiformats": {
"version": "13.0.1",
"resolved": "https://registry.npmjs.org/multiformats/-/multiformats-13.0.1.tgz",
"integrity": "sha512-bt3R5iXe2O8xpp3wkmQhC73b/lC4S2ihU8Dndwcsysqbydqb8N+bpP116qMcClZ17g58iSIwtXUTcg2zT4sniA=="
},
"uint8arrays": {
"version": "5.0.1",
"resolved": "https://registry.npmjs.org/uint8arrays/-/uint8arrays-5.0.1.tgz",
"integrity": "sha512-ND5RpJAnPgHmZT7hWD/2T4BwRp04j8NLKvMKC/7bhiEwEjUMkQ4kvBKiH6hOqbljd6qJ2xS8reL3vl1e33grOQ==",
"requires": {
"multiformats": "^13.0.0"
}
}
}
},
@ -42224,7 +42253,9 @@
"version": "4.0.8"
},
"type-fest": {
"version": "0.20.2"
"version": "0.20.2",
"resolved": "https://registry.npmjs.org/type-fest/-/type-fest-0.20.2.tgz",
"integrity": "sha512-Ne+eE4r0/iWnpAxD852z3A+N0Bt5RN//NjJwRd2VFHEmrywxf5vsZlh4R6lixl6B+wz/8d+maTSAkN1FIkI3LQ=="
},
"type-is": {
"version": "1.6.18",

View File

@ -42,7 +42,7 @@
"@size-limit/preset-big-lib": "^8.2.4",
"@typescript-eslint/eslint-plugin": "^6.6.0",
"@typescript-eslint/parser": "^6.7.5",
"eslint": "^8.47.0",
"eslint": "^8.56.0",
"eslint-config-prettier": "^9.0.0",
"eslint-plugin-eslint-comments": "^3.2.0",
"eslint-plugin-functional": "^6.0.0",

View File

@ -79,7 +79,7 @@
"@rollup/plugin-node-resolve": "^15.2.3",
"@waku/build-utils": "*",
"cspell": "^7.3.2",
"interface-datastore": "^8.2.5",
"interface-datastore": "^8.2.10",
"npm-run-all": "^4.1.5",
"rollup": "^4.6.0"
},

View File

@ -212,8 +212,7 @@ export async function defaultLibp2p(
options?: Partial<CreateLibp2pOptions>,
userAgent?: string
): Promise<Libp2p> {
// Log the info log unless we are running tests or the user has disabled it
if (!options?.hideWebSocketInfo || process.env.NODE_ENV !== "test") {
if (!options?.hideWebSocketInfo && process.env.NODE_ENV !== "test") {
/* eslint-disable no-console */
console.info(
"%cIgnore WebSocket connection failures",

View File

@ -84,7 +84,7 @@
"cspell": "^7.3.2",
"datastore-core": "^9.2.7",
"debug": "^4.3.4",
"interface-datastore": "^8.2.5",
"interface-datastore": "^8.2.10",
"libp2p": "^0.46.14",
"mocha": "^10.2.0",
"mocha-multi-reporters": "^1.5.1",

View File

@ -14,18 +14,27 @@ describe("Create node", () => {
afterEach(async () => {
consoleInfoSpy.restore();
sinon.restore();
await tearDownNodes([], waku);
});
it("should log info about WebSocket failures to console when hideWebSocketInfo disabled", async () => {
it("should log info about WebSocket failures to console when hideWebSocketInfo disabled and NODE_ENV is not test", async () => {
sinon.stub(process.env, "NODE_ENV").value("undefined");
waku = await createLightNode();
expect(consoleInfoSpy.callCount).to.be.equal(2);
});
it("should not log info about WebSocket failures to console when hideWebSocketInfo enabled", async () => {
waku = await createLightNode({
libp2p: { hideWebSocketInfo: true }
[
["test", false],
["test", true],
[undefined, true]
].map(([env, hideWebSocketInfo]) => {
it(`should not log info about WebSocket failures to console when NODE_ENV=${env} and hideWebSocketInfo=${hideWebSocketInfo}`, async () => {
sinon.stub(process.env, "NODE_ENV").value(env);
waku = await createLightNode({
libp2p: { hideWebSocketInfo: !!hideWebSocketInfo }
});
expect(consoleInfoSpy.callCount).to.be.equal(0);
});
expect(consoleInfoSpy.callCount).to.be.equal(0);
});
});