Skip to content

Commit

Permalink
fix!: update dependencies (#273)
Browse files Browse the repository at this point in the history
  • Loading branch information
wemeetagain authored Nov 29, 2023
1 parent ebf2cc1 commit f44d428
Show file tree
Hide file tree
Showing 5 changed files with 119 additions and 37 deletions.
11 changes: 5 additions & 6 deletions packages/discv5/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -65,19 +65,18 @@
},
"homepage": "https://github.com/ChainSafe/discv5#readme",
"devDependencies": {
"@libp2p/peer-id-factory": "^3.0.1",
"@types/lru-cache": "^5.1.1"
"@libp2p/peer-id-factory": "^3.0.9"
},
"dependencies": {
"@chainsafe/enr": "^1.1.0",
"@libp2p/crypto": "^2.0.0",
"@libp2p/interface": "^0.1.2",
"@multiformats/multiaddr": "^12.1.3",
"@libp2p/crypto": "^3.0.0",
"@libp2p/interface": "^1.0.0",
"@multiformats/multiaddr": "^12.1.10",
"bcrypto": "^5.4.0",
"bigint-buffer": "^1.1.5",
"debug": "^4.3.1",
"err-code": "^3.0.1",
"lru-cache": "^6.0.0",
"lru-cache": "^10.1.0",
"rlp": "^2.2.6",
"strict-event-emitter-types": "^2.0.0"
}
Expand Down
11 changes: 3 additions & 8 deletions packages/discv5/src/libp2p/discv5.ts
Original file line number Diff line number Diff line change
@@ -1,11 +1,7 @@
import { PeerId } from "@libp2p/interface/peer-id";
import {
PeerDiscovery,
PeerDiscoveryEvents,
peerDiscovery as peerDiscoverySymbol,
} from "@libp2p/interface/peer-discovery";
import { PeerDiscovery, PeerDiscoveryEvents, peerDiscoverySymbol } from "@libp2p/interface/peer-discovery";
import { PeerInfo } from "@libp2p/interface/peer-info";
import { CustomEvent, EventEmitter } from "@libp2p/interface/events";
import { CustomEvent, TypedEventEmitter } from "@libp2p/interface/events";
import { Multiaddr, multiaddr } from "@multiformats/multiaddr";
import { ENR } from "@chainsafe/enr";

Expand Down Expand Up @@ -63,7 +59,7 @@ export interface IDiscv5DiscoveryOptions extends IDiscv5DiscoveryInputOptions {
/**
* Discv5Discovery is a libp2p peer-discovery compatible module
*/
export class Discv5Discovery extends EventEmitter<PeerDiscoveryEvents> implements PeerDiscovery {
export class Discv5Discovery extends TypedEventEmitter<PeerDiscoveryEvents> implements PeerDiscovery {
[Symbol.toStringTag] = "discv5";
[peerDiscoverySymbol] = this;

Expand Down Expand Up @@ -143,7 +139,6 @@ export class Discv5Discovery extends EventEmitter<PeerDiscoveryEvents> implement
detail: {
id: await enr.peerId(),
multiaddrs,
protocols: [],
},
})
);
Expand Down
16 changes: 8 additions & 8 deletions packages/discv5/src/session/service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ import {
NodeAddressString,
} from "./types.js";
import { getNodeAddress, INodeAddress, INodeContactType, nodeAddressToString, NodeContact } from "./nodeInfo.js";
import LRUCache from "lru-cache";
import { LRUCache } from "lru-cache";
import { TimeoutMap } from "../util/index.js";
import { IDiscv5Metrics } from "../metrics.js";
import { getSocketAddressMultiaddrOnENR } from "../util/ip.js";
Expand Down Expand Up @@ -154,8 +154,8 @@ export class SessionService extends (EventEmitter as { new (): StrictEventEmitte
);
this.activeRequestsNonceMapping = new Map();
this.pendingRequests = new Map();
this.activeChallenges = new LRUCache({ maxAge: config.requestTimeout * 2 });
this.sessions = new LRUCache({ maxAge: config.sessionTimeout, max: config.sessionCacheCapacity });
this.activeChallenges = new LRUCache({ ttl: config.requestTimeout * 2, max: config.sessionCacheCapacity });
this.sessions = new LRUCache({ ttl: config.sessionTimeout, max: config.sessionCacheCapacity });
this.ipMode = this.transport.ipMode;
}

Expand All @@ -178,12 +178,12 @@ export class SessionService extends (EventEmitter as { new (): StrictEventEmitte
this.activeRequests.clear();
this.activeRequestsNonceMapping.clear();
this.pendingRequests.clear();
this.activeChallenges.reset();
this.sessions.reset();
this.activeChallenges.clear();
this.sessions.clear();
}

public sessionsSize(): number {
return this.sessions.length;
return this.sessions.size;
}

/**
Expand Down Expand Up @@ -519,7 +519,7 @@ export class SessionService extends (EventEmitter as { new (): StrictEventEmitte
log("Received an authenticated header without a matching WHOAREYOU request. %o", nodeAddr);
return;
}
this.activeChallenges.del(nodeAddrStr);
this.activeChallenges.delete(nodeAddrStr);

try {
const [session, enr] = Session.establishFromChallenge(
Expand Down Expand Up @@ -833,7 +833,7 @@ export class SessionService extends (EventEmitter as { new (): StrictEventEmitte
private failSession(nodeAddr: INodeAddress, error: RequestErrorType, removeSession: boolean): void {
const nodeAddrStr = nodeAddressToString(nodeAddr);
if (removeSession) {
this.sessions.del(nodeAddrStr);
this.sessions.delete(nodeAddrStr);
}

const requests = this.pendingRequests.get(nodeAddrStr);
Expand Down
10 changes: 5 additions & 5 deletions packages/enr/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -53,14 +53,14 @@
"@types/bn.js": "^4.11.5"
},
"dependencies": {
"@libp2p/crypto": "^2.0.0",
"@libp2p/interface": "^0.1.2",
"@libp2p/peer-id": "^3.0.1",
"@multiformats/multiaddr": "^12.1.3",
"@libp2p/crypto": "^3.0.0",
"@libp2p/interface": "^1.0.0",
"@libp2p/peer-id": "^4.0.0",
"@multiformats/multiaddr": "^12.1.10",
"base64url": "^3.0.1",
"bcrypto": "^5.4.0",
"bigint-buffer": "^1.1.5",
"rlp": "^2.2.6",
"uint8-varint": "^2.0.1"
"uint8-varint": "^2.0.2"
}
}
108 changes: 98 additions & 10 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -504,7 +504,7 @@
yargs "16.2.0"
yargs-parser "20.2.4"

"@libp2p/crypto@^2.0.0", "@libp2p/crypto@^2.0.3":
"@libp2p/crypto@^2.0.3":
version "2.0.3"
resolved "https://registry.npmjs.org/@libp2p/crypto/-/crypto-2.0.3.tgz"
integrity sha512-VLhjdkJe8b/vedHp7SosDs62Yxq1i05Ej/YdVaEdWQdJsBRHCwbRlS4hPg3vm21U5hLF0g958r/927Vd/wamZw==
Expand All @@ -518,6 +518,20 @@
uint8arraylist "^2.4.3"
uint8arrays "^4.0.6"

"@libp2p/crypto@^3.0.0":
version "3.0.0"
resolved "https://registry.yarnpkg.com/@libp2p/crypto/-/crypto-3.0.0.tgz#f5d46180e97bf9443078646e437479099abe44f1"
integrity sha512-NZDz/HaaOEDhgBqbdynoNkmnnq5KLq9/iQc9PU0/fFCKazo1hEYMhXZDN4szzXGBZQg58k9Q7FlduG5K5yTQbg==
dependencies:
"@libp2p/interface" "^1.0.0"
"@noble/curves" "^1.1.0"
"@noble/hashes" "^1.3.1"
multiformats "^12.1.3"
node-forge "^1.1.0"
protons-runtime "^5.0.0"
uint8arraylist "^2.4.3"
uint8arrays "^4.0.6"

"@libp2p/interface@^0.1.1", "@libp2p/interface@^0.1.2":
version "0.1.2"
resolved "https://registry.npmjs.org/@libp2p/interface/-/interface-0.1.2.tgz"
Expand All @@ -531,6 +545,17 @@
p-defer "^4.0.0"
uint8arraylist "^2.4.3"

"@libp2p/interface@^1.0.0":
version "1.0.0"
resolved "https://registry.yarnpkg.com/@libp2p/interface/-/interface-1.0.0.tgz#45a952ba0916489dac42b7e6ee3e56e3c73c54cf"
integrity sha512-Djd3KB3CXsFPdTFqbkwmvinPcZV3ISp+ZqXwPHnBzr2zRdZrU8ptUldPYT4uzx7q7P2IgyBbSQvKlz0Qr/w1/w==
dependencies:
"@multiformats/multiaddr" "^12.1.10"
it-pushable "^3.2.1"
it-stream-types "^2.0.1"
multiformats "^12.1.3"
uint8arraylist "^2.4.3"

"@libp2p/peer-id-factory@^3.0.1":
version "3.0.3"
resolved "https://registry.npmjs.org/@libp2p/peer-id-factory/-/peer-id-factory-3.0.3.tgz"
Expand All @@ -544,7 +569,20 @@
uint8arraylist "^2.4.3"
uint8arrays "^4.0.6"

"@libp2p/peer-id@^3.0.1", "@libp2p/peer-id@^3.0.2":
"@libp2p/peer-id-factory@^3.0.9":
version "3.0.9"
resolved "https://registry.yarnpkg.com/@libp2p/peer-id-factory/-/peer-id-factory-3.0.9.tgz#ecc109f7957456c1e709577e65839e76f3287ad1"
integrity sha512-e5wxUhynltG3Zlrh1dkHP9VSz3gmWl9v4c97ZekaOisJgUlyJDPfryggcNSvNLtdR6A8s7ZTUexlo7S1IkbVeA==
dependencies:
"@libp2p/crypto" "^3.0.0"
"@libp2p/interface" "^1.0.0"
"@libp2p/peer-id" "^4.0.0"
multiformats "^12.1.3"
protons-runtime "^5.0.0"
uint8arraylist "^2.4.3"
uint8arrays "^4.0.6"

"@libp2p/peer-id@^3.0.2":
version "3.0.2"
resolved "https://registry.npmjs.org/@libp2p/peer-id/-/peer-id-3.0.2.tgz"
integrity sha512-133qGXu9UBiqsYm7nBDJaAh4eiKe79DPLKF+/aRu0Z7gKcX7I0+LewEky4kBt3olhYQSF1CAnJIzD8Dmsn40Yw==
Expand All @@ -553,7 +591,29 @@
multiformats "^12.0.1"
uint8arrays "^4.0.6"

"@multiformats/multiaddr@^12.1.3", "@multiformats/multiaddr@^12.1.5":
"@libp2p/peer-id@^4.0.0":
version "4.0.0"
resolved "https://registry.yarnpkg.com/@libp2p/peer-id/-/peer-id-4.0.0.tgz#97096e2f4ded67f8512be71d4a290ade71b1a219"
integrity sha512-ltZqVmtQ27qgTB2ZQE3zsdLPnAxu8ehfGNI63njz87G+H7RWVnEeXFdISaQnxQchyewYda7klNc0Cr+aN0b1IA==
dependencies:
"@libp2p/interface" "^1.0.0"
multiformats "^12.1.3"
uint8arrays "^4.0.6"

"@multiformats/multiaddr@^12.1.10":
version "12.1.10"
resolved "https://registry.yarnpkg.com/@multiformats/multiaddr/-/multiaddr-12.1.10.tgz#a9c771ee84fe3fd4b2e3361aad38d3ff9e36939c"
integrity sha512-Bi3nJ/SE17+te40OLxFOpr9CvRodusZZLYZb3e5a0w9RzQcHzfKnnlfqdysLXZ2W5vXgxCUL/Uhndl51Ff2S+Q==
dependencies:
"@chainsafe/is-ip" "^2.0.1"
"@chainsafe/netmask" "^2.0.0"
"@libp2p/interface" "^0.1.1"
dns-over-http-resolver "3.0.0"
multiformats "^12.0.1"
uint8-varint "^2.0.1"
uint8arrays "^4.0.2"

"@multiformats/multiaddr@^12.1.5":
version "12.1.7"
resolved "https://registry.npmjs.org/@multiformats/multiaddr/-/multiaddr-12.1.7.tgz"
integrity sha512-MZRj+uUrtF2WqgByrsPolrdyPDSFstw7Fe0ewabWgWl27fcOmfDOSrEt2aUVkSzapXbyCG7JQh0QvimmTF4aMA==
Expand Down Expand Up @@ -1127,11 +1187,6 @@
resolved "https://registry.npmjs.org/@types/json-schema/-/json-schema-7.0.11.tgz"
integrity sha512-wOuvG1SN4Us4rez+tylwwwCV1psiNVOkJeM3AUWUNWg/jDQY2+HE/444y5gc+jBmRqASOm2Oeh5c1axHobwRKQ==

"@types/lru-cache@^5.1.1":
version "5.1.1"
resolved "https://registry.npmjs.org/@types/lru-cache/-/lru-cache-5.1.1.tgz"
integrity sha512-ssE3Vlrys7sdIzs5LOxCzTVMsU7i9oa/IaW92wF32JFb3CVczqOkru2xspuKczHEbG3nvmPY7IFqVmGGHdNbYw==

"@types/minimatch@^3.0.3":
version "3.0.5"
resolved "https://registry.yarnpkg.com/@types/minimatch/-/minimatch-3.0.5.tgz#1001cc5e6a3704b83c236027e77f2f58ea010f40"
Expand Down Expand Up @@ -1667,7 +1722,7 @@ bluebird@^3.3.0:

bn.js@^5.2.0:
version "5.2.1"
resolved "https://registry.npmjs.org/bn.js/-/bn.js-5.2.1.tgz"
resolved "https://registry.yarnpkg.com/bn.js/-/bn.js-5.2.1.tgz#0bc527a6a0d18d0aa8d5b0538ce4a77dccfa7b70"
integrity sha512-eXRvHzWyYPBuB4NBy0cmYQjGitUrtqwbvlzP3G6VFnNRbsZQIxQ10PbKKHt8gZ/HW/D/747aDl+QkDqg3KQLMQ==

body-parser@^1.16.1:
Expand Down Expand Up @@ -2438,6 +2493,14 @@ dir-glob@^3.0.1:
dependencies:
path-type "^4.0.0"

dns-over-http-resolver@3.0.0:
version "3.0.0"
resolved "https://registry.yarnpkg.com/dns-over-http-resolver/-/dns-over-http-resolver-3.0.0.tgz#2a8edcfb1c830cc3fff0cd37f01b824a55fa209a"
integrity sha512-5+BI+B7n8LKhNaEZBYErr+CBd9t5nYtjunByLhrLGtZ+i3TRgiU8yE87pCjEBu2KOwNsD9ljpSXEbZ4S8xih5g==
dependencies:
debug "^4.3.4"
receptacle "^1.3.2"

dns-over-http-resolver@^2.1.0:
version "2.1.2"
resolved "https://registry.npmjs.org/dns-over-http-resolver/-/dns-over-http-resolver-2.1.2.tgz"
Expand Down Expand Up @@ -3877,6 +3940,13 @@ it-pushable@^3.2.0:
dependencies:
p-defer "^4.0.0"

it-pushable@^3.2.1:
version "3.2.3"
resolved "https://registry.yarnpkg.com/it-pushable/-/it-pushable-3.2.3.tgz#e2b80aed90cfbcd54b620c0a0785e546d4e5f334"
integrity sha512-gzYnXYK8Y5t5b/BnJUr7glfQLO4U5vyb05gPx/TyTw+4Bv1zM9gFk4YsOrnulWefMewlphCjKkakFvj1y99Tcg==
dependencies:
p-defer "^4.0.0"

it-stream-types@^2.0.1:
version "2.0.1"
resolved "https://registry.npmjs.org/it-stream-types/-/it-stream-types-2.0.1.tgz"
Expand Down Expand Up @@ -4284,6 +4354,11 @@ lru-cache@4.1.x, lru-cache@^4.0.1:
pseudomap "^1.0.2"
yallist "^2.1.2"

lru-cache@^10.1.0:
version "10.1.0"
resolved "https://registry.yarnpkg.com/lru-cache/-/lru-cache-10.1.0.tgz#2098d41c2dc56500e6c88584aa656c84de7d0484"
integrity sha512-/1clY/ui8CzjKFyjdvwPWJUYKiFVXG2I2cY0ssG7h4+hwk+XOIX7ZSG9Q7TW8TW3Kp3BUSqgFWBLgL4PJ+Blag==

lru-cache@^6.0.0:
version "6.0.0"
resolved "https://registry.npmjs.org/lru-cache/-/lru-cache-6.0.0.tgz"
Expand Down Expand Up @@ -4669,6 +4744,11 @@ multiformats@^12.0.1:
resolved "https://registry.npmjs.org/multiformats/-/multiformats-12.1.1.tgz"
integrity sha512-GBSToTmri2vJYs8wqcZQ8kB21dCaeTOzHTIAlr8J06C1eL6UbzqURXFZ5Fl0EYm9GAFz1IlYY8SxGOs9G9NJRg==

multiformats@^12.1.3:
version "12.1.3"
resolved "https://registry.yarnpkg.com/multiformats/-/multiformats-12.1.3.tgz#cbf7a9861e11e74f8228b21376088cb43ba8754e"
integrity sha512-eajQ/ZH7qXZQR2AgtfpmSMizQzmyYVmCql7pdhldPuYQi4atACekbJaQplk6dWyIi10jCaFnd6pqvcEFXjbaJw==

multimatch@5.0.0:
version "5.0.0"
resolved "https://registry.yarnpkg.com/multimatch/-/multimatch-5.0.0.tgz#932b800963cea7a31a033328fa1e0c3a1874dbe6"
Expand Down Expand Up @@ -5776,7 +5856,7 @@ rimraf@^4.4.1:

rlp@^2.2.6:
version "2.2.7"
resolved "https://registry.npmjs.org/rlp/-/rlp-2.2.7.tgz"
resolved "https://registry.yarnpkg.com/rlp/-/rlp-2.2.7.tgz#33f31c4afac81124ac4b283e2bd4d9720b30beaf"
integrity sha512-d5gdPmgQ0Z+AklL2NVXr/IoSjNZFfTVvQWzL/AM2AOcSzYP2xjlb0AC8YyCLc41MSNf6P6QVtjgPdmVtzb+4lQ==
dependencies:
bn.js "^5.2.0"
Expand Down Expand Up @@ -6530,6 +6610,14 @@ uint8-varint@^2.0.1:
uint8arraylist "^2.0.0"
uint8arrays "^4.0.2"

uint8-varint@^2.0.2:
version "2.0.2"
resolved "https://registry.yarnpkg.com/uint8-varint/-/uint8-varint-2.0.2.tgz#bbb140213ecd21da55da77876df954f971da0b90"
integrity sha512-LZXmBT0jiHR7J4oKM1GUhtdLFW1yPauzI8NjJlotXn92TprO9u8VMvEVR4QMk8xhUVUd+2fqfU2/kGbVHYSSWw==
dependencies:
uint8arraylist "^2.0.0"
uint8arrays "^4.0.2"

uint8arraylist@^2.0.0, uint8arraylist@^2.4.3:
version "2.4.3"
resolved "https://registry.npmjs.org/uint8arraylist/-/uint8arraylist-2.4.3.tgz"
Expand Down

0 comments on commit f44d428

Please sign in to comment.