fix: Update libp2p deps (#419)

* Update libp2p packages

* Try another libp2p version

* Add test resolutions

* Bump ver

* remove override

* redo removing override

* fix

* Fix

* Fix

* Fix

* Fix

* Deny connections from internal nox network

* Fix eslint

* Fix review
This commit is contained in:
Akim 2024-01-19 16:25:12 +07:00 committed by GitHub
parent 5696e3beba
commit a8a14735b3
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
4 changed files with 3079 additions and 3979 deletions

View File

@ -1,4 +1,5 @@
{
"root": true,
"parser": "@typescript-eslint/parser",
"parserOptions": {
"ecmaVersion": 2022,

View File

@ -30,6 +30,7 @@
"author": "Fluence Labs",
"license": "Apache-2.0",
"dependencies": {
"@libp2p/utils": "5.2.2",
"@chainsafe/libp2p-noise": "14.0.0",
"@chainsafe/libp2p-yamux": "6.0.1",
"@fluencelabs/avm": "0.55.0",
@ -37,21 +38,21 @@
"@fluencelabs/js-client-isomorphic": "workspace:*",
"@fluencelabs/marine-worker": "0.5.1",
"@fluencelabs/threads": "^2.0.0",
"@libp2p/crypto": "3.0.1",
"@libp2p/identify": "1.0.4",
"@libp2p/interface": "1.0.1",
"@libp2p/peer-id": "4.0.1",
"@libp2p/peer-id-factory": "4.0.0",
"@libp2p/ping": "1.0.4",
"@libp2p/websockets": "8.0.5",
"@multiformats/multiaddr": "11.3.0",
"@libp2p/crypto": "4.0.1",
"@libp2p/identify": "1.0.11",
"@libp2p/interface": "1.1.2",
"@libp2p/peer-id": "4.0.5",
"@libp2p/peer-id-factory": "4.0.5",
"@libp2p/ping": "1.0.10",
"@libp2p/websockets": "8.0.12",
"@multiformats/multiaddr": "12.1.12",
"bs58": "5.0.0",
"debug": "4.3.4",
"it-length-prefixed": "9.0.3",
"it-map": "3.0.5",
"it-pipe": "3.0.1",
"js-base64": "3.7.5",
"libp2p": "1.0.7",
"libp2p": "1.2.0",
"multiformats": "11.0.1",
"rxjs": "7.5.5",
"uint8arrays": "4.0.3",

View File

@ -80,6 +80,23 @@ export interface RelayConnectionConfig {
maxOutboundStreams: number;
}
type DenyCondition = (ma: Multiaddr) => boolean;
const dockerNoxDenyCondition: DenyCondition = (ma) => {
const [routingProtocol] = ma.stringTuples();
const host = routingProtocol?.[1];
// Nox proposes 3 multiaddr to discover when used inside docker network,
// e.g.: [/dns/nox-1, /ip4/10.50.10.10, /ip4/127.0.0.1]
// First 2 of them are unreachable outside the docker network
// Libp2p cannot handle these scenarios correctly, creating interruptions which affect e2e tests execution.
return (
host === undefined || host.startsWith("nox-") || host.startsWith("10.50.10")
);
};
const denyConditions = [dockerNoxDenyCondition];
/**
* Implementation for JS peers which connects to Fluence through relay node
*/
@ -128,13 +145,18 @@ export class RelayConnection implements IConnection {
...(this.config.dialTimeoutMs !== undefined
? {
dialTimeout: this.config.dialTimeoutMs,
autoDialInterval: 0,
}
: {}),
},
connectionGater: {
// By default, this function forbids connections to private peers. For example multiaddr with ip 127.0.0.1 isn't allowed
denyDialMultiaddr: () => {
return Promise.resolve(false);
// By default, this function forbids connections to private peers. For example, multiaddr with ip 127.0.0.1 isn't allowed
denyDialMultiaddr: (ma: Multiaddr) => {
return Promise.resolve(
denyConditions.some((dc) => {
return dc(ma);
}),
);
},
},
services: {

7010
pnpm-lock.yaml generated

File diff suppressed because it is too large Load Diff