Merge pull request #1789 from waku-org/chore/bump-libp2p-packages

chore: bump all libp2p packages to latest version
This commit is contained in:
Arseniy Klempner 2024-01-17 12:57:45 -08:00 committed by GitHub
commit a859243b76
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
50 changed files with 9916 additions and 6469 deletions

16112
package-lock.json generated

File diff suppressed because it is too large Load Diff

View File

@ -72,6 +72,7 @@
"node": ">=18" "node": ">=18"
}, },
"dependencies": { "dependencies": {
"@libp2p/ping": "^1.0.9",
"@noble/hashes": "^1.3.2", "@noble/hashes": "^1.3.2",
"@waku/enr": "^0.0.20", "@waku/enr": "^0.0.20",
"@waku/interfaces": "0.0.21", "@waku/interfaces": "0.0.21",
@ -107,7 +108,7 @@
}, },
"peerDependencies": { "peerDependencies": {
"@multiformats/multiaddr": "^12.0.0", "@multiformats/multiaddr": "^12.0.0",
"libp2p": "^0.46.3" "libp2p": "^1.1.2"
}, },
"peerDependenciesMeta": { "peerDependenciesMeta": {
"@multiformats/multiaddr": { "@multiformats/multiaddr": {

View File

@ -1,6 +1,5 @@
import type { Libp2p } from "@libp2p/interface"; import type { Libp2p } from "@libp2p/interface";
import type { Stream } from "@libp2p/interface/connection"; import type { Peer, PeerStore, Stream } from "@libp2p/interface";
import { Peer, PeerStore } from "@libp2p/interface/peer-store";
import type { import type {
IBaseProtocol, IBaseProtocol,
Libp2pComponents, Libp2pComponents,

View File

@ -1,8 +1,5 @@
import type { PeerId } from "@libp2p/interface/peer-id"; import type { Peer, PeerId, PeerInfo, PeerStore } from "@libp2p/interface";
import type { PeerInfo } from "@libp2p/interface/peer-info"; import { CustomEvent, TypedEventEmitter } from "@libp2p/interface";
import type { Peer } from "@libp2p/interface/peer-store";
import type { PeerStore } from "@libp2p/interface/peer-store";
import { CustomEvent, EventEmitter } from "@libp2p/interfaces/events";
import { decodeRelayShard } from "@waku/enr"; import { decodeRelayShard } from "@waku/enr";
import { import {
ConnectionManagerOptions, ConnectionManagerOptions,
@ -30,7 +27,7 @@ export const DEFAULT_MAX_DIAL_ATTEMPTS_FOR_PEER = 3;
export const DEFAULT_MAX_PARALLEL_DIALS = 3; export const DEFAULT_MAX_PARALLEL_DIALS = 3;
export class ConnectionManager export class ConnectionManager
extends EventEmitter<IPeersByDiscoveryEvents & IConnectionStateEvents> extends TypedEventEmitter<IPeersByDiscoveryEvents & IConnectionStateEvents>
implements IConnectionManager implements IConnectionManager
{ {
private static instances = new Map<string, ConnectionManager>(); private static instances = new Map<string, ConnectionManager>();

View File

@ -1,6 +1,6 @@
import { Stream } from "@libp2p/interface/connection"; import { Stream } from "@libp2p/interface";
import type { Peer } from "@libp2p/interface/peer-store"; import type { Peer } from "@libp2p/interface";
import type { IncomingStreamData } from "@libp2p/interface-internal/registrar"; import type { IncomingStreamData } from "@libp2p/interface-internal";
import type { import type {
Callback, Callback,
ContentTopic, ContentTopic,

View File

@ -1,5 +1,5 @@
import { Peer } from "@libp2p/interface/peer-store"; import { Peer } from "@libp2p/interface";
import type { Tag } from "@libp2p/interface/peer-store"; import type { Tag } from "@libp2p/interface";
import { createSecp256k1PeerId } from "@libp2p/peer-id-factory"; import { createSecp256k1PeerId } from "@libp2p/peer-id-factory";
import { Tags } from "@waku/interfaces"; import { Tags } from "@waku/interfaces";
import { expect } from "chai"; import { expect } from "chai";

View File

@ -1,4 +1,4 @@
import { Peer } from "@libp2p/interface/peer-store"; import { Peer } from "@libp2p/interface";
import { Tags } from "@waku/interfaces"; import { Tags } from "@waku/interfaces";
/** /**

View File

@ -1,10 +1,9 @@
import type { PeerId } from "@libp2p/interface/peer-id"; import type { PeerId, PeerStore } from "@libp2p/interface";
import type { PeerStore } from "@libp2p/interface/peer-store"; import type { PingService } from "@libp2p/ping";
import type { IRelay, PeerIdStr } from "@waku/interfaces"; import type { IRelay, PeerIdStr } from "@waku/interfaces";
import type { KeepAliveOptions } from "@waku/interfaces"; import type { KeepAliveOptions } from "@waku/interfaces";
import { Logger, pubsubTopicToSingleShardInfo } from "@waku/utils"; import { Logger, pubsubTopicToSingleShardInfo } from "@waku/utils";
import { utf8ToBytes } from "@waku/utils/bytes"; import { utf8ToBytes } from "@waku/utils/bytes";
import type { PingService } from "libp2p/ping";
import { createEncoder } from "./message/version_0.js"; import { createEncoder } from "./message/version_0.js";

View File

@ -1,5 +1,4 @@
import type { Stream } from "@libp2p/interface/connection"; import type { PeerId, Stream } from "@libp2p/interface";
import type { PeerId } from "@libp2p/interface/peer-id";
import { import {
IEncoder, IEncoder,
ILightPush, ILightPush,

View File

@ -1,5 +1,5 @@
import type { PeerId } from "@libp2p/interface/peer-id"; import type { PeerId } from "@libp2p/interface";
import { IncomingStreamData } from "@libp2p/interface/stream-handler"; import { IncomingStreamData } from "@libp2p/interface";
import { encodeRelayShard } from "@waku/enr"; import { encodeRelayShard } from "@waku/enr";
import type { import type {
IMetadata, IMetadata,

View File

@ -1,4 +1,4 @@
import type { Stream } from "@libp2p/interface/connection"; import type { Stream } from "@libp2p/interface";
import { sha256 } from "@noble/hashes/sha256"; import { sha256 } from "@noble/hashes/sha256";
import { import {
Cursor, Cursor,

View File

@ -1,6 +1,5 @@
import type { PeerUpdate } from "@libp2p/interface"; import type { PeerUpdate, Stream } from "@libp2p/interface";
import type { Stream } from "@libp2p/interface/connection"; import { Peer } from "@libp2p/interface";
import { Peer } from "@libp2p/interface/peer-store";
import { Libp2p } from "@waku/interfaces"; import { Libp2p } from "@waku/interfaces";
import { Logger } from "@waku/utils"; import { Logger } from "@waku/utils";
import { selectConnection } from "@waku/utils/libp2p"; import { selectConnection } from "@waku/utils/libp2p";

View File

@ -1,5 +1,5 @@
import type { Stream } from "@libp2p/interface/connection"; import type { Stream } from "@libp2p/interface";
import { isPeerId, PeerId } from "@libp2p/interface/peer-id"; import { isPeerId, PeerId } from "@libp2p/interface";
import { multiaddr, Multiaddr, MultiaddrInput } from "@multiformats/multiaddr"; import { multiaddr, Multiaddr, MultiaddrInput } from "@multiformats/multiaddr";
import type { import type {
IFilter, IFilter,
@ -185,7 +185,7 @@ export class WakuNode implements Waku {
} }
isStarted(): boolean { isStarted(): boolean {
return this.libp2p.isStarted(); return this.libp2p.status == "started";
} }
isConnected(): boolean { isConnected(): boolean {

View File

@ -59,8 +59,8 @@
"uint8arrays": "^4.0.4" "uint8arrays": "^4.0.4"
}, },
"devDependencies": { "devDependencies": {
"@libp2p/peer-id": "^3.0.3", "@libp2p/peer-id": "^4.0.4",
"@libp2p/peer-id-factory": "^3.0.3", "@libp2p/peer-id-factory": "^4.0.4",
"@multiformats/multiaddr": "^12.0.0", "@multiformats/multiaddr": "^12.0.0",
"@rollup/plugin-commonjs": "^25.0.7", "@rollup/plugin-commonjs": "^25.0.7",
"@rollup/plugin-json": "^6.0.0", "@rollup/plugin-json": "^6.0.0",

View File

@ -1,10 +1,11 @@
import { CustomEvent, EventEmitter } from "@libp2p/interface/events"; import {
import type { CustomEvent,
PeerDiscovery, PeerDiscovery,
PeerDiscoveryEvents PeerDiscoveryEvents,
} from "@libp2p/interface/peer-discovery"; TypedEventEmitter
import { peerDiscovery as symbol } from "@libp2p/interface/peer-discovery"; } from "@libp2p/interface";
import type { PeerInfo } from "@libp2p/interface/peer-info"; import { peerDiscoverySymbol as symbol } from "@libp2p/interface";
import type { PeerInfo } from "@libp2p/interface";
import { encodeRelayShard } from "@waku/enr"; import { encodeRelayShard } from "@waku/enr";
import type { import type {
DnsDiscOptions, DnsDiscOptions,
@ -28,7 +29,7 @@ const log = new Logger("peer-discovery-dns");
* Parse options and expose function to return bootstrap peer addresses. * Parse options and expose function to return bootstrap peer addresses.
*/ */
export class PeerDiscoveryDns export class PeerDiscoveryDns
extends EventEmitter<PeerDiscoveryEvents> extends TypedEventEmitter<PeerDiscoveryEvents>
implements PeerDiscovery implements PeerDiscovery
{ {
private nextPeer: (() => AsyncGenerator<IEnr>) | undefined; private nextPeer: (() => AsyncGenerator<IEnr>) | undefined;

View File

@ -52,8 +52,8 @@
}, },
"dependencies": { "dependencies": {
"@ethersproject/rlp": "^5.7.0", "@ethersproject/rlp": "^5.7.0",
"@libp2p/crypto": "^3.0.2", "@libp2p/crypto": "^4.0.0",
"@libp2p/peer-id": "^3.0.3", "@libp2p/peer-id": "^4.0.4",
"@multiformats/multiaddr": "^12.0.0", "@multiformats/multiaddr": "^12.0.0",
"@noble/secp256k1": "^1.7.1", "@noble/secp256k1": "^1.7.1",
"@waku/utils": "0.0.14", "@waku/utils": "0.0.14",
@ -61,7 +61,7 @@
"js-sha3": "^0.9.2" "js-sha3": "^0.9.2"
}, },
"devDependencies": { "devDependencies": {
"@libp2p/peer-id-factory": "^3.0.3", "@libp2p/peer-id-factory": "^4.0.4",
"@rollup/plugin-commonjs": "^25.0.7", "@rollup/plugin-commonjs": "^25.0.7",
"@rollup/plugin-json": "^6.0.0", "@rollup/plugin-json": "^6.0.0",
"@rollup/plugin-node-resolve": "^15.2.3", "@rollup/plugin-node-resolve": "^15.2.3",

View File

@ -1,4 +1,4 @@
import type { PeerId } from "@libp2p/interface/peer-id"; import type { PeerId } from "@libp2p/interface";
import type { ENRKey, ENRValue } from "@waku/interfaces"; import type { ENRKey, ENRValue } from "@waku/interfaces";
import { utf8ToBytes } from "@waku/utils/bytes"; import { utf8ToBytes } from "@waku/utils/bytes";

View File

@ -1,4 +1,4 @@
import type { PeerId } from "@libp2p/interface/peer-id"; import type { PeerId } from "@libp2p/interface";
import { createSecp256k1PeerId } from "@libp2p/peer-id-factory"; import { createSecp256k1PeerId } from "@libp2p/peer-id-factory";
import { multiaddr } from "@multiformats/multiaddr"; import { multiaddr } from "@multiformats/multiaddr";
import * as secp from "@noble/secp256k1"; import * as secp from "@noble/secp256k1";

View File

@ -1,5 +1,4 @@
import type { PeerId } from "@libp2p/interface/peer-id"; import type { PeerId, PeerInfo } from "@libp2p/interface";
import type { PeerInfo } from "@libp2p/interface/peer-info";
import type { Multiaddr } from "@multiformats/multiaddr"; import type { Multiaddr } from "@multiformats/multiaddr";
import type { import type {
ENRKey, ENRKey,
@ -116,8 +115,7 @@ export class ENR extends RawEnr implements IEnr {
if (!id) return; if (!id) return;
return { return {
id, id,
multiaddrs: this.getAllLocationMultiaddrs(), multiaddrs: this.getAllLocationMultiaddrs()
protocols: []
}; };
} }

View File

@ -1,6 +1,6 @@
import { unmarshalPrivateKey, unmarshalPublicKey } from "@libp2p/crypto/keys"; import { unmarshalPrivateKey, unmarshalPublicKey } from "@libp2p/crypto/keys";
import { supportedKeys } from "@libp2p/crypto/keys"; import { supportedKeys } from "@libp2p/crypto/keys";
import type { PeerId } from "@libp2p/interface/peer-id"; import type { PeerId } from "@libp2p/interface";
import { peerIdFromKeys } from "@libp2p/peer-id"; import { peerIdFromKeys } from "@libp2p/peer-id";
export function createPeerIdFromPublicKey( export function createPeerIdFromPublicKey(

View File

@ -47,11 +47,11 @@
"node": ">=18" "node": ">=18"
}, },
"devDependencies": { "devDependencies": {
"@chainsafe/libp2p-gossipsub": "^10.1.1", "@chainsafe/libp2p-gossipsub": "^11.0.1",
"@multiformats/multiaddr": "^12.0.0", "@multiformats/multiaddr": "^12.0.0",
"cspell": "^7.3.2", "cspell": "^7.3.2",
"npm-run-all": "^4.1.5", "npm-run-all": "^4.1.5",
"libp2p": "^0.46.14" "libp2p": "^1.1.2"
}, },
"files": [ "files": [
"dist", "dist",

View File

@ -1,6 +1,4 @@
import type { PeerId } from "@libp2p/interface/peer-id"; import type { Peer, PeerId, TypedEventEmitter } from "@libp2p/interface";
import type { Peer } from "@libp2p/interface/peer-store";
import type { EventEmitter } from "@libp2p/interfaces/events";
export enum Tags { export enum Tags {
BOOTSTRAP = "bootstrap", BOOTSTRAP = "bootstrap",
@ -59,7 +57,7 @@ export interface IConnectionStateEvents {
} }
export interface IConnectionManager export interface IConnectionManager
extends EventEmitter<IPeersByDiscoveryEvents & IConnectionStateEvents> { extends TypedEventEmitter<IPeersByDiscoveryEvents & IConnectionStateEvents> {
getPeersByDiscovery(): Promise<PeersByDiscoveryResult>; getPeersByDiscovery(): Promise<PeersByDiscoveryResult>;
stop(): void; stop(): void;
} }

View File

@ -1,4 +1,4 @@
import { PeerStore } from "@libp2p/interface/peer-store"; import { PeerStore } from "@libp2p/interface";
export type SearchContext = { export type SearchContext = {
domain: string; domain: string;

View File

@ -1,5 +1,5 @@
import type { PeerId } from "@libp2p/interface/peer-id"; import type { PeerId } from "@libp2p/interface";
import type { PeerInfo } from "@libp2p/interface/peer-info"; import type { PeerInfo } from "@libp2p/interface";
import type { Multiaddr } from "@multiformats/multiaddr"; import type { Multiaddr } from "@multiformats/multiaddr";
export type ENRKey = string; export type ENRKey = string;

View File

@ -1,4 +1,4 @@
import type { PeerId } from "@libp2p/interface/peer-id"; import type { PeerId } from "@libp2p/interface";
import type { IDecodedMessage, IDecoder, SingleShardInfo } from "./message.js"; import type { IDecodedMessage, IDecoder, SingleShardInfo } from "./message.js";
import type { ContentTopic, PubsubTopic } from "./misc.js"; import type { ContentTopic, PubsubTopic } from "./misc.js";

View File

@ -1,8 +1,8 @@
import type { GossipSub } from "@chainsafe/libp2p-gossipsub"; import type { GossipSub } from "@chainsafe/libp2p-gossipsub";
import type { identify } from "@libp2p/identify";
import type { Libp2p as BaseLibp2p } from "@libp2p/interface"; import type { Libp2p as BaseLibp2p } from "@libp2p/interface";
import type { PingService } from "@libp2p/ping";
import type { Libp2pInit, Libp2pOptions } from "libp2p"; import type { Libp2pInit, Libp2pOptions } from "libp2p";
import type { identifyService } from "libp2p/identify";
import type { PingService } from "libp2p/ping";
import { IMetadata } from "./metadata"; import { IMetadata } from "./metadata";
@ -10,7 +10,7 @@ export type Libp2pServices = {
ping: PingService; ping: PingService;
metadata?: IMetadata; metadata?: IMetadata;
pubsub?: GossipSub; pubsub?: GossipSub;
identify: ReturnType<ReturnType<typeof identifyService>>; identify: ReturnType<ReturnType<typeof identify>>;
}; };
// TODO: Get libp2p to export this. // TODO: Get libp2p to export this.

View File

@ -1,4 +1,4 @@
import type { PeerId } from "@libp2p/interface/peer-id"; import type { PeerId } from "@libp2p/interface";
import type { ShardInfo } from "./enr.js"; import type { ShardInfo } from "./enr.js";
import type { IBaseProtocol } from "./protocols.js"; import type { IBaseProtocol } from "./protocols.js";

View File

@ -1,6 +1,6 @@
import type { PeerId } from "@libp2p/interface/peer-id"; import type { PeerId } from "@libp2p/interface";
import type { PeerStore } from "@libp2p/interface/peer-store"; import type { PeerStore } from "@libp2p/interface";
import type { ConnectionManager } from "@libp2p/interface-internal/connection-manager"; import type { ConnectionManager } from "@libp2p/interface-internal";
import { IEnr } from "./enr.js"; import { IEnr } from "./enr.js";
import { IBaseProtocol } from "./protocols.js"; import { IBaseProtocol } from "./protocols.js";

View File

@ -1,6 +1,6 @@
import type { Libp2p } from "@libp2p/interface"; import type { Libp2p } from "@libp2p/interface";
import type { PeerId } from "@libp2p/interface/peer-id"; import type { PeerId } from "@libp2p/interface";
import type { Peer, PeerStore } from "@libp2p/interface/peer-store"; import type { Peer, PeerStore } from "@libp2p/interface";
import type { ShardInfo } from "./enr.js"; import type { ShardInfo } from "./enr.js";
import type { CreateLibp2pOptions } from "./libp2p.js"; import type { CreateLibp2pOptions } from "./libp2p.js";

View File

@ -1,5 +1,4 @@
import type { Stream } from "@libp2p/interface/connection"; import type { PeerId, Stream } from "@libp2p/interface";
import type { PeerId } from "@libp2p/interface/peer-id";
import type { Multiaddr } from "@multiformats/multiaddr"; import type { Multiaddr } from "@multiformats/multiaddr";
import { IConnectionManager } from "./connection_manager.js"; import { IConnectionManager } from "./connection_manager.js";

View File

@ -1,12 +1,12 @@
import type { IdentifyResult } from "@libp2p/interface"; import { CustomEvent, TypedEventEmitter } from "@libp2p/interface";
import { CustomEvent, EventEmitter } from "@libp2p/interface/events"; import { peerDiscoverySymbol as symbol } from "@libp2p/interface";
import type { import type {
IdentifyResult,
PeerDiscovery, PeerDiscovery,
PeerDiscoveryEvents PeerDiscoveryEvents,
} from "@libp2p/interface/peer-discovery"; PeerId,
import { peerDiscovery as symbol } from "@libp2p/interface/peer-discovery"; PeerInfo
import type { PeerId } from "@libp2p/interface/peer-id"; } from "@libp2p/interface";
import type { PeerInfo } from "@libp2p/interface/peer-info";
import { encodeRelayShard } from "@waku/enr"; import { encodeRelayShard } from "@waku/enr";
import { Libp2pComponents, Tags } from "@waku/interfaces"; import { Libp2pComponents, Tags } from "@waku/interfaces";
import { Logger } from "@waku/utils"; import { Logger } from "@waku/utils";
@ -51,7 +51,7 @@ const DEFAULT_PEER_EXCHANGE_TAG_VALUE = 50;
const DEFAULT_PEER_EXCHANGE_TAG_TTL = 100_000_000; const DEFAULT_PEER_EXCHANGE_TAG_TTL = 100_000_000;
export class PeerExchangeDiscovery export class PeerExchangeDiscovery
extends EventEmitter<PeerDiscoveryEvents> extends TypedEventEmitter<PeerDiscoveryEvents>
implements PeerDiscovery implements PeerDiscovery
{ {
private readonly components: Libp2pComponents; private readonly components: Libp2pComponents;
@ -206,7 +206,6 @@ export class PeerExchangeDiscovery
new CustomEvent<PeerInfo>("peer", { new CustomEvent<PeerInfo>("peer", {
detail: { detail: {
id: peerId, id: peerId,
protocols: [],
multiaddrs: peerInfo.multiaddrs multiaddrs: peerInfo.multiaddrs
} }
}) })

View File

@ -49,7 +49,7 @@
"node": ">=18" "node": ">=18"
}, },
"dependencies": { "dependencies": {
"@chainsafe/libp2p-gossipsub": "^10.1.1", "@chainsafe/libp2p-gossipsub": "^11.0.1",
"@noble/hashes": "^1.3.2", "@noble/hashes": "^1.3.2",
"@waku/core": "0.0.26", "@waku/core": "0.0.26",
"@waku/interfaces": "0.0.21", "@waku/interfaces": "0.0.21",

View File

@ -6,8 +6,7 @@ import {
} from "@chainsafe/libp2p-gossipsub"; } from "@chainsafe/libp2p-gossipsub";
import type { PeerIdStr, TopicStr } from "@chainsafe/libp2p-gossipsub/types"; import type { PeerIdStr, TopicStr } from "@chainsafe/libp2p-gossipsub/types";
import { SignaturePolicy } from "@chainsafe/libp2p-gossipsub/types"; import { SignaturePolicy } from "@chainsafe/libp2p-gossipsub/types";
import type { PeerId } from "@libp2p/interface/peer-id"; import type { PubSub as Libp2pPubsub, PeerId } from "@libp2p/interface";
import type { PubSub as Libp2pPubsub } from "@libp2p/interface/pubsub";
import { sha256 } from "@noble/hashes/sha256"; import { sha256 } from "@noble/hashes/sha256";
import { import {
ActiveSubscriptions, ActiveSubscriptions,

View File

@ -1,5 +1,5 @@
import { TopicValidatorResult } from "@libp2p/interface/pubsub"; import { TopicValidatorResult } from "@libp2p/interface";
import type { UnsignedMessage } from "@libp2p/interface/pubsub"; import type { UnsignedMessage } from "@libp2p/interface";
import { createSecp256k1PeerId } from "@libp2p/peer-id-factory"; import { createSecp256k1PeerId } from "@libp2p/peer-id-factory";
import { createEncoder } from "@waku/core"; import { createEncoder } from "@waku/core";
import { expect } from "chai"; import { expect } from "chai";

View File

@ -1,6 +1,5 @@
import type { PeerId } from "@libp2p/interface/peer-id"; import type { Message, PeerId } from "@libp2p/interface";
import type { Message } from "@libp2p/interface/pubsub"; import { TopicValidatorResult } from "@libp2p/interface";
import { TopicValidatorResult } from "@libp2p/interface/pubsub";
import { proto_message as proto } from "@waku/proto"; import { proto_message as proto } from "@waku/proto";
import { Logger } from "@waku/utils"; import { Logger } from "@waku/utils";

View File

@ -61,19 +61,21 @@
"node": ">=18" "node": ">=18"
}, },
"dependencies": { "dependencies": {
"@chainsafe/libp2p-noise": "^13.0.4", "@chainsafe/libp2p-noise": "^14.1.0",
"@libp2p/mplex": "^9.0.10", "@libp2p/identify": "^1.0.10",
"@libp2p/websockets": "^7.0.5", "@libp2p/mplex": "^10.0.11",
"@waku/utils": "0.0.14", "@libp2p/ping": "^1.0.9",
"@waku/relay": "0.0.9", "@libp2p/websockets": "^8.0.11",
"@waku/core": "0.0.26", "@waku/core": "0.0.26",
"@waku/dns-discovery": "0.0.20", "@waku/dns-discovery": "0.0.20",
"@waku/interfaces": "0.0.21", "@waku/interfaces": "0.0.21",
"@waku/peer-exchange": "^0.0.19", "@waku/peer-exchange": "^0.0.19",
"libp2p": "^0.46.14" "@waku/relay": "0.0.9",
"@waku/utils": "0.0.14",
"libp2p": "^1.1.2"
}, },
"devDependencies": { "devDependencies": {
"@chainsafe/libp2p-gossipsub": "^10.1.1", "@chainsafe/libp2p-gossipsub": "^11.0.1",
"@rollup/plugin-commonjs": "^25.0.7", "@rollup/plugin-commonjs": "^25.0.7",
"@rollup/plugin-json": "^6.0.0", "@rollup/plugin-json": "^6.0.0",
"@rollup/plugin-node-resolve": "^15.2.3", "@rollup/plugin-node-resolve": "^15.2.3",

View File

@ -1,7 +1,9 @@
import type { GossipSub } from "@chainsafe/libp2p-gossipsub"; import type { GossipSub } from "@chainsafe/libp2p-gossipsub";
import { noise } from "@chainsafe/libp2p-noise"; import { noise } from "@chainsafe/libp2p-noise";
import type { PeerDiscovery } from "@libp2p/interface/peer-discovery"; import { identify } from "@libp2p/identify";
import type { PeerDiscovery } from "@libp2p/interface";
import { mplex } from "@libp2p/mplex"; import { mplex } from "@libp2p/mplex";
import { ping } from "@libp2p/ping";
import { webSockets } from "@libp2p/websockets"; import { webSockets } from "@libp2p/websockets";
import { all as filterAll } from "@libp2p/websockets/filters"; import { all as filterAll } from "@libp2p/websockets/filters";
import { import {
@ -27,8 +29,6 @@ import type {
import { wakuPeerExchangeDiscovery } from "@waku/peer-exchange"; import { wakuPeerExchangeDiscovery } from "@waku/peer-exchange";
import { RelayCreateOptions, wakuGossipSub, wakuRelay } from "@waku/relay"; import { RelayCreateOptions, wakuGossipSub, wakuRelay } from "@waku/relay";
import { createLibp2p } from "libp2p"; import { createLibp2p } from "libp2p";
import { identifyService } from "libp2p/identify";
import { pingService } from "libp2p/ping";
const DEFAULT_NODE_REQUIREMENTS = { const DEFAULT_NODE_REQUIREMENTS = {
lightPush: 1, lightPush: 1,
@ -242,10 +242,10 @@ export async function defaultLibp2p(
connectionEncryption: [noise()], connectionEncryption: [noise()],
...options, ...options,
services: { services: {
identify: identifyService({ identify: identify({
agentVersion: userAgent ?? DefaultUserAgent agentVersion: userAgent ?? DefaultUserAgent
}), }),
ping: pingService(), ping: ping(),
...metadataService, ...metadataService,
...pubsubService, ...pubsubService,
...options?.services ...options?.services

View File

@ -50,8 +50,8 @@
"node": ">=18" "node": ">=18"
}, },
"dependencies": { "dependencies": {
"@libp2p/interface-compliance-tests": "^4.1.0", "@libp2p/interface-compliance-tests": "^5.1.2",
"@libp2p/peer-id": "^3.0.3", "@libp2p/peer-id": "^4.0.4",
"@waku/core": "*", "@waku/core": "*",
"@waku/enr": "*", "@waku/enr": "*",
"@waku/interfaces": "*", "@waku/interfaces": "*",
@ -68,7 +68,7 @@
"tail": "^2.2.6" "tail": "^2.2.6"
}, },
"devDependencies": { "devDependencies": {
"@libp2p/bootstrap": "^9.0.10", "@libp2p/bootstrap": "^10.0.11",
"@types/chai": "^4.3.11", "@types/chai": "^4.3.11",
"@types/dockerode": "^3.3.19", "@types/dockerode": "^3.3.19",
"@types/mocha": "^10.0.1", "@types/mocha": "^10.0.1",
@ -85,7 +85,7 @@
"datastore-core": "^9.2.7", "datastore-core": "^9.2.7",
"debug": "^4.3.4", "debug": "^4.3.4",
"interface-datastore": "^8.2.10", "interface-datastore": "^8.2.10",
"libp2p": "^0.46.14", "libp2p": "^1.1.2",
"mocha": "^10.2.0", "mocha": "^10.2.0",
"mocha-multi-reporters": "^1.5.1", "mocha-multi-reporters": "^1.5.1",
"npm-run-all": "^4.1.5" "npm-run-all": "^4.1.5"

View File

@ -1,4 +1,4 @@
import type { PeerId } from "@libp2p/interface/peer-id"; import type { PeerId } from "@libp2p/interface";
import { peerIdFromString } from "@libp2p/peer-id"; import { peerIdFromString } from "@libp2p/peer-id";
import { Multiaddr, multiaddr } from "@multiformats/multiaddr"; import { Multiaddr, multiaddr } from "@multiformats/multiaddr";
import { DefaultPubsubTopic } from "@waku/interfaces"; import { DefaultPubsubTopic } from "@waku/interfaces";

View File

@ -1,5 +1,5 @@
import type { IdentifyResult } from "@libp2p/interface"; import type { IdentifyResult } from "@libp2p/interface";
import type { PeerId } from "@libp2p/interface/peer-id"; import type { PeerId } from "@libp2p/interface";
import type { LightNode } from "@waku/interfaces"; import type { LightNode } from "@waku/interfaces";
/** /**

View File

@ -1,6 +1,5 @@
import type { PeerId } from "@libp2p/interface/peer-id"; import type { PeerId, PeerInfo } from "@libp2p/interface";
import type { PeerInfo } from "@libp2p/interface/peer-info"; import { CustomEvent } from "@libp2p/interface";
import { CustomEvent } from "@libp2p/interfaces/events";
import { createSecp256k1PeerId } from "@libp2p/peer-id-factory"; import { createSecp256k1PeerId } from "@libp2p/peer-id-factory";
import { Multiaddr } from "@multiformats/multiaddr"; import { Multiaddr } from "@multiformats/multiaddr";
import { import {
@ -62,8 +61,7 @@ describe("ConnectionManager", function () {
new CustomEvent<PeerInfo>("peer:discovery", { new CustomEvent<PeerInfo>("peer:discovery", {
detail: { detail: {
id: peerIdBootstrap, id: peerIdBootstrap,
multiaddrs: [], multiaddrs: []
protocols: []
} }
}) })
); );
@ -96,8 +94,7 @@ describe("ConnectionManager", function () {
new CustomEvent<PeerInfo>("peer:discovery", { new CustomEvent<PeerInfo>("peer:discovery", {
detail: { detail: {
id: peerIdPx, id: peerIdPx,
multiaddrs: [], multiaddrs: []
protocols: []
} }
}) })
); );
@ -312,8 +309,7 @@ describe("ConnectionManager", function () {
new CustomEvent<PeerInfo>("peer:discovery", { new CustomEvent<PeerInfo>("peer:discovery", {
detail: { detail: {
id: await createSecp256k1PeerId(), id: await createSecp256k1PeerId(),
multiaddrs: [], multiaddrs: []
protocols: []
} }
}) })
); );
@ -377,7 +373,7 @@ describe("ConnectionManager", function () {
// emit a peer:discovery event // emit a peer:discovery event
waku.libp2p.dispatchEvent( waku.libp2p.dispatchEvent(
new CustomEvent<PeerInfo>("peer:discovery", { new CustomEvent<PeerInfo>("peer:discovery", {
detail: { id: bootstrapPeer, multiaddrs: [], protocols: [] } detail: { id: bootstrapPeer, multiaddrs: [] }
}) })
); );
@ -399,8 +395,7 @@ describe("ConnectionManager", function () {
new CustomEvent<PeerInfo>("peer:discovery", { new CustomEvent<PeerInfo>("peer:discovery", {
detail: { detail: {
id: await createSecp256k1PeerId(), id: await createSecp256k1PeerId(),
multiaddrs: [], multiaddrs: []
protocols: []
} }
}) })
); );
@ -417,8 +412,7 @@ describe("ConnectionManager", function () {
new CustomEvent<PeerInfo>("peer:discovery", { new CustomEvent<PeerInfo>("peer:discovery", {
detail: { detail: {
id: await createSecp256k1PeerId(), id: await createSecp256k1PeerId(),
multiaddrs: [], multiaddrs: []
protocols: []
} }
}) })
); );
@ -443,8 +437,7 @@ describe("ConnectionManager", function () {
new CustomEvent<PeerInfo>("peer:discovery", { new CustomEvent<PeerInfo>("peer:discovery", {
detail: { detail: {
id: pxPeer, id: pxPeer,
multiaddrs: [], multiaddrs: []
protocols: []
} }
}) })
); );
@ -469,8 +462,7 @@ describe("ConnectionManager", function () {
new CustomEvent<PeerInfo>("peer:discovery", { new CustomEvent<PeerInfo>("peer:discovery", {
detail: { detail: {
id: await createSecp256k1PeerId(), id: await createSecp256k1PeerId(),
multiaddrs: [], multiaddrs: []
protocols: []
} }
}) })
); );

View File

@ -1,5 +1,6 @@
import { EventEmitter } from "@libp2p/interface/events"; import { TypedEventEmitter } from "@libp2p/interface";
import tests from "@libp2p/interface-compliance-tests/peer-discovery"; import tests from "@libp2p/interface-compliance-tests/peer-discovery";
import { prefixLogger } from "@libp2p/logger";
import { createSecp256k1PeerId } from "@libp2p/peer-id-factory"; import { createSecp256k1PeerId } from "@libp2p/peer-id-factory";
import { PersistentPeerStore } from "@libp2p/peer-store"; import { PersistentPeerStore } from "@libp2p/peer-store";
import { import {
@ -24,9 +25,10 @@ describe("DNS Discovery: Compliance Test", function () {
// create libp2p mock peerStore // create libp2p mock peerStore
const components = { const components = {
peerStore: new PersistentPeerStore({ peerStore: new PersistentPeerStore({
events: new EventEmitter(), events: new TypedEventEmitter(),
peerId: await createSecp256k1PeerId(), peerId: await createSecp256k1PeerId(),
datastore: new MemoryDatastore() datastore: new MemoryDatastore(),
logger: prefixLogger("dns-peer-discovery.spec.ts")
}) })
} as unknown as Libp2pComponents; } as unknown as Libp2pComponents;

View File

@ -1,6 +1,4 @@
import type { Connection } from "@libp2p/interface/connection"; import type { Connection, Peer, PeerStore } from "@libp2p/interface";
import type { PeerStore } from "@libp2p/interface/peer-store";
import type { Peer } from "@libp2p/interface/peer-store";
import { createSecp256k1PeerId } from "@libp2p/peer-id-factory"; import { createSecp256k1PeerId } from "@libp2p/peer-id-factory";
import { import {
createLightNode, createLightNode,

View File

@ -1,4 +1,4 @@
import type { PeerId } from "@libp2p/interface/peer-id"; import type { PeerId } from "@libp2p/interface";
import { createEncoder, waitForRemotePeer } from "@waku/core"; import { createEncoder, waitForRemotePeer } from "@waku/core";
import { import {
ContentTopicInfo, ContentTopicInfo,

View File

@ -1,6 +1,6 @@
import { CustomEvent } from "@libp2p/interface/events"; import type { PeerId } from "@libp2p/interface";
import type { PeerId } from "@libp2p/interface/peer-id"; import type { PeerInfo } from "@libp2p/interface";
import type { PeerInfo } from "@libp2p/interface/peer-info"; import { CustomEvent } from "@libp2p/interface";
import { multiaddr } from "@multiformats/multiaddr"; import { multiaddr } from "@multiformats/multiaddr";
import type { Multiaddr } from "@multiformats/multiaddr"; import type { Multiaddr } from "@multiformats/multiaddr";
import type { Waku } from "@waku/interfaces"; import type { Waku } from "@waku/interfaces";
@ -84,7 +84,6 @@ describe("multiaddr: dialing", function () {
new CustomEvent<PeerInfo>("peer:discovery", { new CustomEvent<PeerInfo>("peer:discovery", {
detail: { detail: {
id: peerId, id: peerId,
protocols: [],
multiaddrs: [multiaddr] multiaddrs: [multiaddr]
} }
}) })

View File

@ -1,4 +1,4 @@
import type { PeerId } from "@libp2p/interface/peer-id"; import type { PeerId } from "@libp2p/interface";
import tests from "@libp2p/interface-compliance-tests/peer-discovery"; import tests from "@libp2p/interface-compliance-tests/peer-discovery";
import type { Multiaddr } from "@multiformats/multiaddr"; import type { Multiaddr } from "@multiformats/multiaddr";
import type { LightNode, PeerInfo } from "@waku/interfaces"; import type { LightNode, PeerInfo } from "@waku/interfaces";

View File

@ -1,4 +1,4 @@
import type { PeerId } from "@libp2p/interface/peer-id"; import type { PeerId } from "@libp2p/interface";
import { DecodedMessage, waitForRemotePeer } from "@waku/core"; import { DecodedMessage, waitForRemotePeer } from "@waku/core";
import { DefaultPubsubTopic, Protocols, RelayNode } from "@waku/interfaces"; import { DefaultPubsubTopic, Protocols, RelayNode } from "@waku/interfaces";
import { createRelayNode } from "@waku/sdk/relay"; import { createRelayNode } from "@waku/sdk/relay";

View File

@ -1,5 +1,5 @@
import { bootstrap } from "@libp2p/bootstrap"; import { bootstrap } from "@libp2p/bootstrap";
import type { PeerId } from "@libp2p/interface/peer-id"; import type { PeerId } from "@libp2p/interface";
import { wakuPeerExchangeDiscovery } from "@waku/peer-exchange"; import { wakuPeerExchangeDiscovery } from "@waku/peer-exchange";
import { import {
ContentTopicInfo, ContentTopicInfo,

View File

@ -1,5 +1,5 @@
import { bootstrap } from "@libp2p/bootstrap"; import { bootstrap } from "@libp2p/bootstrap";
import type { PeerId } from "@libp2p/interface/peer-id"; import type { PeerId } from "@libp2p/interface";
import { import {
DecodedMessage, DecodedMessage,
DefaultUserAgent, DefaultUserAgent,

View File

@ -1,5 +1,4 @@
import type { Connection } from "@libp2p/interface/connection"; import type { Connection, Peer, PeerStore } from "@libp2p/interface";
import type { Peer, PeerStore } from "@libp2p/interface/peer-store";
import { bytesToUtf8 } from "../bytes/index.js"; import { bytesToUtf8 } from "../bytes/index.js";