From 4b08c0ba2dff05606a203c8dc2a46fe575132041 Mon Sep 17 00:00:00 2001 From: Cayman Date: Mon, 28 Oct 2024 10:08:25 -0400 Subject: [PATCH 1/3] chore: revert "chore: upgrade to js-libp2p 2.0 (#7077)" (#7202) Revert "chore: upgrade to js-libp2p 2.0 (#7077)" This reverts commit d37bdb0eb8a6e8deedd019fd6b7b3413f3fcf6d4. --- package.json | 2 +- packages/beacon-node/package.json | 35 +- .../src/network/core/networkCore.ts | 17 +- .../src/network/core/networkCoreWorker.ts | 8 +- .../network/core/networkCoreWorkerHandler.ts | 10 +- .../beacon-node/src/network/core/types.ts | 2 +- .../beacon-node/src/network/discv5/index.ts | 14 +- .../beacon-node/src/network/discv5/types.ts | 2 +- .../beacon-node/src/network/discv5/worker.ts | 13 +- .../src/network/gossip/gossipsub.ts | 4 - packages/beacon-node/src/network/interface.ts | 4 +- .../beacon-node/src/network/libp2p/index.ts | 21 +- packages/beacon-node/src/network/network.ts | 18 +- .../src/network/peers/datastore.ts | 3 +- .../beacon-node/src/network/peers/discover.ts | 10 +- .../src/network/peers/peerManager.ts | 5 +- .../peers/utils/getConnectedPeerIds.ts | 4 +- packages/beacon-node/src/network/util.ts | 4 +- packages/beacon-node/src/node/nodejs.ts | 8 +- packages/beacon-node/src/util/peerId.ts | 2 +- .../beacon-node/test/e2e/network/mdns.test.ts | 16 +- .../e2e/network/peers/peerManager.test.ts | 12 +- .../test/e2e/network/reqrespEncode.test.ts | 2 +- .../test/perf/network/noise/sendData.test.ts | 17 +- .../peers/util/prioritizePeers.test.ts | 6 +- .../unit/network/peers/priorization.test.ts | 9 +- packages/beacon-node/test/utils/network.ts | 15 +- .../test/utils/networkWithMockDb.ts | 6 +- .../beacon-node/test/utils/node/beacon.ts | 12 +- packages/beacon-node/test/utils/peer.ts | 8 +- packages/cli/package.json | 10 +- packages/cli/src/cmds/beacon/handler.ts | 10 +- .../cli/src/cmds/beacon/initPeerIdAndEnr.ts | 54 +- packages/cli/src/cmds/bootnode/handler.ts | 14 +- packages/cli/src/config/peerId.ts | 68 +- packages/cli/test/unit/cmds/beacon.test.ts | 57 +- .../test/unit/cmds/initPeerIdAndEnr.test.ts | 13 +- packages/cli/test/unit/config/peerId.test.ts | 12 +- packages/reqresp/package.json | 6 +- packages/reqresp/test/utils/peer.ts | 5 +- yarn.lock | 816 ++++++++---------- 41 files changed, 600 insertions(+), 754 deletions(-) diff --git a/package.json b/package.json index e6de076cf494..7399b4ba6c1e 100644 --- a/package.json +++ b/package.json @@ -60,7 +60,7 @@ "https-browserify": "^1.0.0", "jsdom": "^23.0.1", "lerna": "^7.3.0", - "libp2p": "2.1.7", + "libp2p": "1.4.3", "mocha": "^10.2.0", "node-gyp": "^9.4.0", "npm-run-all": "^4.1.5", diff --git a/packages/beacon-node/package.json b/packages/beacon-node/package.json index 3213504334e3..fcaf5b715216 100644 --- a/packages/beacon-node/package.json +++ b/packages/beacon-node/package.json @@ -96,10 +96,11 @@ "dependencies": { "@chainsafe/as-sha256": "^0.5.0", "@chainsafe/blst": "^2.1.0", - "@chainsafe/discv5": "^10.0.1", - "@chainsafe/enr": "^4.0.1", - "@chainsafe/libp2p-gossipsub": "^14.1.0", - "@chainsafe/libp2p-noise": "^16.0.0", + "@chainsafe/discv5": "^9.0.0", + "@chainsafe/enr": "^3.0.0", + "@chainsafe/libp2p-gossipsub": "^13.0.0", + "@chainsafe/libp2p-identify": "^1.0.0", + "@chainsafe/libp2p-noise": "^15.0.0", "@chainsafe/persistent-merkle-tree": "^0.8.0", "@chainsafe/prometheus-gc-stats": "^1.0.0", "@chainsafe/ssz": "^0.18.0", @@ -110,15 +111,15 @@ "@fastify/cors": "^10.0.1", "@fastify/swagger": "^9.0.0", "@fastify/swagger-ui": "^5.0.1", - "@libp2p/bootstrap": "^11.0.4", - "@libp2p/crypto": "^5.0.4", - "@libp2p/identify": "^3.0.4", - "@libp2p/interface": "^2.1.2", - "@libp2p/mdns": "^11.0.4", - "@libp2p/mplex": "^11.0.4", - "@libp2p/peer-id": "^5.0.4", - "@libp2p/prometheus-metrics": "^4.1.2", - "@libp2p/tcp": "10.0.4", + "@libp2p/bootstrap": "^10.0.21", + "@libp2p/identify": "^1.0.20", + "@libp2p/interface": "^1.3.0", + "@libp2p/mdns": "^10.0.21", + "@libp2p/mplex": "^10.0.21", + "@libp2p/peer-id": "^4.1.0", + "@libp2p/peer-id-factory": "^4.1.0", + "@libp2p/prometheus-metrics": "^3.0.21", + "@libp2p/tcp": "9.0.23", "@lodestar/api": "^1.22.0", "@lodestar/config": "^1.22.0", "@lodestar/db": "^1.22.0", @@ -133,15 +134,15 @@ "@lodestar/validator": "^1.22.0", "@multiformats/multiaddr": "^12.1.3", "c-kzg": "^2.1.2", - "datastore-core": "^10.0.0", - "datastore-level": "^11.0.0", + "datastore-core": "^9.1.1", + "datastore-level": "^10.1.1", "deepmerge": "^4.3.1", "fastify": "^5.0.0", - "interface-datastore": "^8.3.0", + "interface-datastore": "^8.2.7", "it-all": "^3.0.4", "it-pipe": "^3.0.1", "jwt-simple": "0.5.6", - "libp2p": "2.1.7", + "libp2p": "1.4.3", "multiformats": "^11.0.1", "prom-client": "^15.1.0", "qs": "^6.11.1", diff --git a/packages/beacon-node/src/network/core/networkCore.ts b/packages/beacon-node/src/network/core/networkCore.ts index b000d184e0eb..d47fcabd4146 100644 --- a/packages/beacon-node/src/network/core/networkCore.ts +++ b/packages/beacon-node/src/network/core/networkCore.ts @@ -1,4 +1,4 @@ -import {Connection, PrivateKey} from "@libp2p/interface"; +import {Connection, PeerId} from "@libp2p/interface"; import {multiaddr} from "@multiformats/multiaddr"; import {PublishOpts} from "@chainsafe/libp2p-gossipsub/types"; import {PeerScoreStatsDump} from "@chainsafe/libp2p-gossipsub/dist/src/score/peer-score.js"; @@ -55,7 +55,7 @@ type Mods = { export type BaseNetworkInit = { opts: NetworkOptions; config: BeaconConfig; - privateKey: PrivateKey; + peerId: PeerId; peerStoreDir: string | undefined; logger: LoggerNode; metricsRegistry: RegistryMetricCreator | null; @@ -126,7 +126,7 @@ export class NetworkCore implements INetworkCore { static async init({ opts, config, - privateKey, + peerId, peerStoreDir, logger, metricsRegistry, @@ -136,7 +136,7 @@ export class NetworkCore implements INetworkCore { activeValidatorCount, initialStatus, }: BaseNetworkInit): Promise { - const libp2p = await createNodeJsLibp2p(privateKey, opts, { + const libp2p = await createNodeJsLibp2p(peerId, opts, { peerStoreDir, metrics: Boolean(metricsRegistry), metricsRegistry: metricsRegistry ?? undefined, @@ -200,9 +200,8 @@ export class NetworkCore implements INetworkCore { const peerManager = await PeerManager.init( { - privateKey, libp2p, - gossip, + gossip: gossip, reqResp, attnetsService, syncnetsService, @@ -363,11 +362,7 @@ export class NetworkCore implements INetworkCore { } getConnectionsByPeer(): Map { - const m = new Map(); - for (const [k, v] of getConnectionsMap(this.libp2p).entries()) { - m.set(k, v.value); - } - return m; + return getConnectionsMap(this.libp2p); } async getConnectedPeers(): Promise { diff --git a/packages/beacon-node/src/network/core/networkCoreWorker.ts b/packages/beacon-node/src/network/core/networkCoreWorker.ts index 07b6de828b6c..5e4b057402d8 100644 --- a/packages/beacon-node/src/network/core/networkCoreWorker.ts +++ b/packages/beacon-node/src/network/core/networkCoreWorker.ts @@ -3,8 +3,7 @@ import path from "node:path"; import worker from "node:worker_threads"; import type {ModuleThread} from "@chainsafe/threads"; import {expose} from "@chainsafe/threads/worker"; -import {privateKeyFromProtobuf} from "@libp2p/crypto/keys"; -import {peerIdFromPrivateKey} from "@libp2p/peer-id"; +import {createFromProtobuf} from "@libp2p/peer-id-factory"; import {chainConfigFromJson, createBeaconConfig} from "@lodestar/config"; import {getNodeLogger} from "@lodestar/logger/node"; import {RegistryMetricCreator, collectNodeJSMetrics} from "../../metrics/index.js"; @@ -33,8 +32,7 @@ if (!workerData) throw Error("workerData must be defined"); if (!parentPort) throw Error("parentPort must be defined"); const config = createBeaconConfig(chainConfigFromJson(workerData.chainConfigJson), workerData.genesisValidatorsRoot); -const privateKey = privateKeyFromProtobuf(workerData.privateKeyProto); -const peerId = peerIdFromPrivateKey(privateKey); +const peerId = await createFromProtobuf(workerData.peerIdProto); // TODO: Pass options from main thread for logging // TODO: Logging won't be visible in file loggers @@ -94,7 +92,7 @@ if (networkCoreWorkerMetrics) { const core = await NetworkCore.init({ opts: workerData.opts, config, - privateKey, + peerId, peerStoreDir: workerData.peerStoreDir, logger, metricsRegistry: metricsRegister, diff --git a/packages/beacon-node/src/network/core/networkCoreWorkerHandler.ts b/packages/beacon-node/src/network/core/networkCoreWorkerHandler.ts index e883476b5e65..bd66a21e726b 100644 --- a/packages/beacon-node/src/network/core/networkCoreWorkerHandler.ts +++ b/packages/beacon-node/src/network/core/networkCoreWorkerHandler.ts @@ -3,8 +3,8 @@ import workerThreads from "node:worker_threads"; import {PeerScoreStatsDump} from "@chainsafe/libp2p-gossipsub/dist/src/score/peer-score.js"; import {PublishOpts} from "@chainsafe/libp2p-gossipsub/types"; import {ModuleThread, Thread, Worker, spawn} from "@chainsafe/threads"; -import {PrivateKey} from "@libp2p/interface"; -import {privateKeyToProtobuf} from "@libp2p/crypto/keys"; +import {PeerId, Secp256k1PeerId} from "@libp2p/interface"; +import {exportToProtobuf} from "@libp2p/peer-id-factory"; import {routes} from "@lodestar/api"; import {BeaconConfig, chainConfigToJson} from "@lodestar/config"; import type {LoggerNode} from "@lodestar/logger/node"; @@ -44,7 +44,7 @@ export type WorkerNetworkCoreInitModules = { opts: WorkerNetworkCoreOpts; config: BeaconConfig; logger: LoggerNode; - privateKey: PrivateKey; + peerId: PeerId; events: NetworkEventBus; metrics: Metrics | null; getReqRespHandler: GetReqRespHandlerFn; @@ -103,14 +103,14 @@ export class WorkerNetworkCore implements INetworkCore { } static async init(modules: WorkerNetworkCoreInitModules): Promise { - const {opts, config, privateKey} = modules; + const {opts, config, peerId} = modules; const {genesisTime, peerStoreDir, activeValidatorCount, localMultiaddrs, metricsEnabled, initialStatus} = opts; const workerData: NetworkWorkerData = { opts, chainConfigJson: chainConfigToJson(config), genesisValidatorsRoot: config.genesisValidatorsRoot, - privateKeyProto: privateKeyToProtobuf(privateKey), + peerIdProto: exportToProtobuf(peerId as Secp256k1PeerId), localMultiaddrs, metricsEnabled, peerStoreDir, diff --git a/packages/beacon-node/src/network/core/types.ts b/packages/beacon-node/src/network/core/types.ts index d2f56c8fa2f1..4eeaf96e1903 100644 --- a/packages/beacon-node/src/network/core/types.ts +++ b/packages/beacon-node/src/network/core/types.ts @@ -78,7 +78,7 @@ export type NetworkWorkerData = { genesisTime: number; activeValidatorCount: number; initialStatus: phase0.Status; - privateKeyProto: Uint8Array; + peerIdProto: Uint8Array; localMultiaddrs: string[]; metricsEnabled: boolean; peerStoreDir?: string; diff --git a/packages/beacon-node/src/network/discv5/index.ts b/packages/beacon-node/src/network/discv5/index.ts index 34990d404c90..745b3171c38d 100644 --- a/packages/beacon-node/src/network/discv5/index.ts +++ b/packages/beacon-node/src/network/discv5/index.ts @@ -1,8 +1,8 @@ import EventEmitter from "node:events"; -import {privateKeyToProtobuf} from "@libp2p/crypto/keys"; -import {PrivateKey} from "@libp2p/interface"; +import {PeerId, Secp256k1PeerId} from "@libp2p/interface"; import {StrictEventEmitter} from "strict-event-emitter-types"; -import {ENR, ENRData, SignableENR} from "@chainsafe/enr"; +import {exportToProtobuf} from "@libp2p/peer-id-factory"; +import {createPrivateKeyFromPeerId, ENR, ENRData, SignableENR} from "@chainsafe/enr"; import {spawn, Thread, Worker} from "@chainsafe/threads"; import {chainConfigFromJson, chainConfigToJson, BeaconConfig} from "@lodestar/config"; import {LoggerNode} from "@lodestar/logger/node"; @@ -10,7 +10,7 @@ import {NetworkCoreMetrics} from "../core/metrics.js"; import {Discv5WorkerApi, Discv5WorkerData, LodestarDiscv5Opts} from "./types.js"; export type Discv5Opts = { - privateKey: PrivateKey; + peerId: PeerId; discv5: LodestarDiscv5Opts; logger: LoggerNode; config: BeaconConfig; @@ -25,6 +25,7 @@ export type Discv5Events = { * Wrapper class abstracting the details of discv5 worker instantiation and message-passing */ export class Discv5Worker extends (EventEmitter as {new (): StrictEventEmitter}) { + private readonly keypair; private readonly subscription: {unsubscribe: () => void}; private closed = false; @@ -34,13 +35,14 @@ export class Discv5Worker extends (EventEmitter as {new (): StrictEventEmitter this.onDiscovered(enrObj)); } static async init(opts: Discv5Opts): Promise { const workerData: Discv5WorkerData = { enr: opts.discv5.enr, - privateKeyProto: privateKeyToProtobuf(opts.privateKey), + peerIdProto: exportToProtobuf(opts.peerId as Secp256k1PeerId), bindAddrs: opts.discv5.bindAddrs, config: opts.discv5.config ?? {}, bootEnrs: opts.discv5.bootEnrs, @@ -78,7 +80,7 @@ export class Discv5Worker extends (EventEmitter as {new (): StrictEventEmitter { const obj = await this.workerApi.enr(); - return new SignableENR(obj.kvs, obj.seq, this.opts.privateKey.raw); + return new SignableENR(obj.kvs, obj.seq, this.keypair.privateKey); } setEnrValue(key: string, value: Uint8Array): Promise { diff --git a/packages/beacon-node/src/network/discv5/types.ts b/packages/beacon-node/src/network/discv5/types.ts index cbaf2423f87f..63c5cd52b6fe 100644 --- a/packages/beacon-node/src/network/discv5/types.ts +++ b/packages/beacon-node/src/network/discv5/types.ts @@ -31,7 +31,7 @@ export type LodestarDiscv5Opts = { /** discv5 worker constructor data */ export interface Discv5WorkerData { enr: string; - privateKeyProto: Uint8Array; + peerIdProto: Uint8Array; bindAddrs: BindAddrs; config: Discv5Config; bootEnrs: string[]; diff --git a/packages/beacon-node/src/network/discv5/worker.ts b/packages/beacon-node/src/network/discv5/worker.ts index 40eb08f7af92..8e96751d5fe7 100644 --- a/packages/beacon-node/src/network/discv5/worker.ts +++ b/packages/beacon-node/src/network/discv5/worker.ts @@ -1,13 +1,12 @@ import worker from "node:worker_threads"; import path from "node:path"; import fs from "node:fs"; +import {createFromProtobuf} from "@libp2p/peer-id-factory"; import {Multiaddr, multiaddr} from "@multiformats/multiaddr"; import {expose} from "@chainsafe/threads/worker"; import {Observable, Subject} from "@chainsafe/threads/observable"; import {Discv5} from "@chainsafe/discv5"; -import {ENR, ENRData, SignableENR, SignableENRData} from "@chainsafe/enr"; -import {privateKeyFromProtobuf} from "@libp2p/crypto/keys"; -import {peerIdFromPrivateKey} from "@libp2p/peer-id"; +import {createPrivateKeyFromPeerId, ENR, ENRData, SignableENR, SignableENRData} from "@chainsafe/enr"; import {createBeaconConfig} from "@lodestar/config"; import {getNodeLogger} from "@lodestar/logger/node"; import {Gauge} from "@lodestar/utils"; @@ -43,15 +42,15 @@ if (workerData.metrics) { }); } -const privateKey = privateKeyFromProtobuf(workerData.privateKeyProto); -const peerId = peerIdFromPrivateKey(privateKey); +const peerId = await createFromProtobuf(workerData.peerIdProto); +const keypair = createPrivateKeyFromPeerId(peerId); const config = createBeaconConfig(workerData.chainConfig, workerData.genesisValidatorsRoot); // Initialize discv5 const discv5 = Discv5.create({ - enr: SignableENR.decodeTxt(workerData.enr, privateKey.raw), - privateKey, + enr: SignableENR.decodeTxt(workerData.enr, keypair.privateKey), + peerId, bindAddrs: { ip4: (workerData.bindAddrs.ip4 ? multiaddr(workerData.bindAddrs.ip4) : undefined) as Multiaddr, ip6: workerData.bindAddrs.ip6 ? multiaddr(workerData.bindAddrs.ip6) : undefined, diff --git a/packages/beacon-node/src/network/gossip/gossipsub.ts b/packages/beacon-node/src/network/gossip/gossipsub.ts index 83bb913325bf..76e1330cd4a1 100644 --- a/packages/beacon-node/src/network/gossip/gossipsub.ts +++ b/packages/beacon-node/src/network/gossip/gossipsub.ts @@ -135,10 +135,6 @@ export class Eth2Gossipsub extends GossipSub { // if this is false, only publish to mesh peers. If there is not enough GOSSIP_D mesh peers, // publish to some more topic peers to make sure we always publish to at least GOSSIP_D peers floodPublish: !opts?.disableFloodPublish, - // Only send IDONTWANT messages if the message size is larger than this - // This should be large enough to not send IDONTWANT for "small" messages - // See https://github.com/ChainSafe/lodestar/pull/7077#issuecomment-2383679472 - idontwantMinDataSize: 16829, }); this.scoreParams = scoreParams; this.config = config; diff --git a/packages/beacon-node/src/network/interface.ts b/packages/beacon-node/src/network/interface.ts index ccb5ddecb557..8d73379af221 100644 --- a/packages/beacon-node/src/network/interface.ts +++ b/packages/beacon-node/src/network/interface.ts @@ -12,11 +12,10 @@ import { PeerRouting, PeerStore, Upgrader, - PrivateKey, } from "@libp2p/interface"; import type {AddressManager, ConnectionManager, Registrar, TransportManager} from "@libp2p/interface-internal"; import type {Datastore} from "interface-datastore"; -import {Identify} from "@libp2p/identify"; +import {Identify} from "@chainsafe/libp2p-identify"; import { LightClientFinalityUpdate, LightClientOptimisticUpdate, @@ -94,7 +93,6 @@ export interface INetwork extends INetworkCorePublic { export type LodestarComponents = { peerId: PeerId; - privateKey: PrivateKey; nodeInfo: NodeInfo; logger: ComponentLogger; events: TypedEventTarget; diff --git a/packages/beacon-node/src/network/libp2p/index.ts b/packages/beacon-node/src/network/libp2p/index.ts index 7697dbcb49a7..a0d58033cf2f 100644 --- a/packages/beacon-node/src/network/libp2p/index.ts +++ b/packages/beacon-node/src/network/libp2p/index.ts @@ -1,7 +1,8 @@ -import {PrivateKey} from "@libp2p/interface"; +import {PeerId} from "@libp2p/interface"; import {Registry} from "prom-client"; import {ENR} from "@chainsafe/enr"; -import {identify} from "@libp2p/identify"; +// TODO: We should use this fork until https://github.com/libp2p/js-libp2p/pull/2387 +import {identify} from "@chainsafe/libp2p-identify"; import {bootstrap} from "@libp2p/bootstrap"; import {mdns} from "@libp2p/mdns"; import {createLibp2p} from "libp2p"; @@ -33,7 +34,7 @@ export async function getDiscv5Multiaddrs(bootEnrs: string[]): Promise } export async function createNodeJsLibp2p( - privateKey: PrivateKey, + peerId: PeerId, networkOpts: Partial = {}, nodeJsLibp2pOpts: NodeJsLibp2pOpts = {} ): Promise { @@ -64,12 +65,12 @@ export async function createNodeJsLibp2p( } return createLibp2p({ - privateKey, + peerId, addresses: { listen: localMultiaddrs, announce: [], }, - connectionEncrypters: [noise()], + connectionEncryption: [noise()], // Reject connections when the server's connection count gets high transports: [ tcp({ @@ -98,14 +99,15 @@ export async function createNodeJsLibp2p( maxParallelDials: 100, maxPeerAddrsToDial: 4, dialTimeout: 30_000, + + // Rely entirely on lodestar's peer manager to prune connections + //maxConnections: options.maxConnections, + // DOCS: There is no way to turn off autodial other than setting minConnections to 0 + minConnections: 0, // the maximum number of pending connections libp2p will accept before it starts rejecting incoming connections. // make it the same to backlog option above maxIncomingPendingConnections: 5, }, - // rely on lodestar's peer manager to ping peers - connectionMonitor: { - enabled: false, - }, datastore, services: { identify: identify({ @@ -116,7 +118,6 @@ export async function createNodeJsLibp2p( // and passing it here directly causes problems downstream, not to mention is slowwww components: (components: LodestarComponents) => ({ peerId: components.peerId, - privateKey: components.privateKey, nodeInfo: components.nodeInfo, logger: components.logger, events: components.events, diff --git a/packages/beacon-node/src/network/network.ts b/packages/beacon-node/src/network/network.ts index 73208f497d66..1b3ccaaaf75a 100644 --- a/packages/beacon-node/src/network/network.ts +++ b/packages/beacon-node/src/network/network.ts @@ -1,7 +1,6 @@ -import {PeerId, PrivateKey} from "@libp2p/interface"; +import {PeerId} from "@libp2p/interface"; import {PublishOpts} from "@chainsafe/libp2p-gossipsub/types"; import {PeerScoreStatsDump} from "@chainsafe/libp2p-gossipsub/score"; -import {peerIdFromPrivateKey} from "@libp2p/peer-id"; import {BeaconConfig} from "@lodestar/config"; import {sleep} from "@lodestar/utils"; import {LoggerNode} from "@lodestar/logger/node"; @@ -51,7 +50,7 @@ import {getActiveForks} from "./forks.js"; type NetworkModules = { opts: NetworkOptions; - privateKey: PrivateKey; + peerId: PeerId; config: BeaconConfig; logger: LoggerNode; chain: IBeaconChain; @@ -64,7 +63,7 @@ type NetworkModules = { export type NetworkInitModules = { opts: NetworkOptions; config: BeaconConfig; - privateKey: PrivateKey; + peerId: PeerId; peerStoreDir?: string; logger: LoggerNode; metrics: Metrics | null; @@ -105,7 +104,7 @@ export class Network implements INetwork { private regossipBlsChangesPromise: Promise | null = null; constructor(modules: NetworkModules) { - this.peerId = peerIdFromPrivateKey(modules.privateKey); + this.peerId = modules.peerId; this.config = modules.config; this.logger = modules.logger; this.chain = modules.chain; @@ -135,7 +134,7 @@ export class Network implements INetwork { chain, db, gossipHandlers, - privateKey, + peerId, peerStoreDir, getReqRespHandler, }: NetworkInitModules): Promise { @@ -160,7 +159,7 @@ export class Network implements INetwork { initialStatus, }, config, - privateKey, + peerId, logger, events, metrics, @@ -169,7 +168,7 @@ export class Network implements INetwork { : await NetworkCore.init({ opts, config, - privateKey, + peerId, peerStoreDir, logger, clock: chain.clock, @@ -186,12 +185,11 @@ export class Network implements INetwork { ); const multiaddresses = opts.localMultiaddrs?.join(","); - const peerId = peerIdFromPrivateKey(privateKey); logger.info(`PeerId ${peerIdToString(peerId)}, Multiaddrs ${multiaddresses}`); return new Network({ opts, - privateKey, + peerId, config, logger, chain, diff --git a/packages/beacon-node/src/network/peers/datastore.ts b/packages/beacon-node/src/network/peers/datastore.ts index e0f2001c26ee..88a7a6f5f2d6 100644 --- a/packages/beacon-node/src/network/peers/datastore.ts +++ b/packages/beacon-node/src/network/peers/datastore.ts @@ -1,4 +1,3 @@ -import {AbortOptions} from "@libp2p/interface"; import {BaseDatastore} from "datastore-core"; import {LevelDatastore} from "datastore-level"; import {Key, KeyQuery, Query, Pair} from "interface-datastore"; @@ -58,7 +57,7 @@ export class Eth2PeerDataStore extends BaseDatastore { return this._dbDatastore.close(); } - async put(key: Key, val: Uint8Array, _options?: AbortOptions): Promise { + async put(key: Key, val: Uint8Array): Promise { return this._put(key, val, false); } diff --git a/packages/beacon-node/src/network/peers/discover.ts b/packages/beacon-node/src/network/peers/discover.ts index 0ca67caf74fa..2b03656064e4 100644 --- a/packages/beacon-node/src/network/peers/discover.ts +++ b/packages/beacon-node/src/network/peers/discover.ts @@ -1,5 +1,5 @@ import {Multiaddr} from "@multiformats/multiaddr"; -import type {PeerId, PeerInfo, PrivateKey} from "@libp2p/interface"; +import type {PeerId, PeerInfo} from "@libp2p/interface"; import {ENR} from "@chainsafe/enr"; import {BeaconConfig} from "@lodestar/config"; import {pruneSetToMax, sleep} from "@lodestar/utils"; @@ -27,7 +27,6 @@ export type PeerDiscoveryOpts = { }; export type PeerDiscoveryModules = { - privateKey: PrivateKey; libp2p: Libp2p; peerRpcScores: IPeerRpcScoreStore; metrics: NetworkCoreMetrics | null; @@ -159,7 +158,7 @@ export class PeerDiscovery { static async init(modules: PeerDiscoveryModules, opts: PeerDiscoveryOpts): Promise { const discv5 = await Discv5Worker.init({ discv5: opts.discv5, - privateKey: modules.privateKey, + peerId: modules.libp2p.peerId, metrics: modules.metrics ?? undefined, logger: modules.logger, config: modules.config, @@ -323,7 +322,8 @@ export class PeerDiscovery { if (this.randomNodeQuery.code === QueryStatusCode.Active) { this.randomNodeQuery.count++; } - const peerId = enr.peerId; + // async due to some crypto that's no longer necessary + const peerId = await enr.peerId(); // tcp multiaddr is known to be be present, checked inside the worker const multiaddrTCP = enr.getLocationMultiaddr(ENRKey.tcp); if (!multiaddrTCP) { @@ -472,7 +472,7 @@ export class PeerDiscovery { /** Check if there is 1+ open connection with this peer */ private isPeerConnected(peerIdStr: PeerIdStr): boolean { const connections = getConnectionsMap(this.libp2p).get(peerIdStr); - return Boolean(connections?.value.some((connection) => connection.status === "open")); + return Boolean(connections?.some((connection) => connection.status === "open")); } } diff --git a/packages/beacon-node/src/network/peers/peerManager.ts b/packages/beacon-node/src/network/peers/peerManager.ts index b076285b0d21..b8742789d4fb 100644 --- a/packages/beacon-node/src/network/peers/peerManager.ts +++ b/packages/beacon-node/src/network/peers/peerManager.ts @@ -1,4 +1,4 @@ -import {Connection, PeerId, PrivateKey} from "@libp2p/interface"; +import {Connection, PeerId} from "@libp2p/interface"; import {BitArray} from "@chainsafe/ssz"; import {SYNC_COMMITTEE_SUBNET_COUNT} from "@lodestar/params"; import {BeaconConfig} from "@lodestar/config"; @@ -94,7 +94,6 @@ export interface IReqRespBeaconNodePeerManager { } export type PeerManagerModules = { - privateKey: PrivateKey; libp2p: Libp2p; logger: LoggerNode; metrics: NetworkCoreMetrics | null; @@ -689,7 +688,7 @@ export class PeerManager { } for (const connections of getConnectionsMap(this.libp2p).values()) { - const openCnx = connections.value.find((cnx) => cnx.status === "open"); + const openCnx = connections.find((cnx) => cnx.status === "open"); if (openCnx) { const direction = openCnx.direction; peersByDirection.set(direction, 1 + (peersByDirection.get(direction) ?? 0)); diff --git a/packages/beacon-node/src/network/peers/utils/getConnectedPeerIds.ts b/packages/beacon-node/src/network/peers/utils/getConnectedPeerIds.ts index d001c0d8892a..8542df605b06 100644 --- a/packages/beacon-node/src/network/peers/utils/getConnectedPeerIds.ts +++ b/packages/beacon-node/src/network/peers/utils/getConnectedPeerIds.ts @@ -8,7 +8,7 @@ import {getConnectionsMap} from "../../util.js"; export function getConnectedPeerIds(libp2p: Libp2p): PeerId[] { const peerIds: PeerId[] = []; for (const connections of getConnectionsMap(libp2p).values()) { - const openConnection = connections.value.find(isConnectionOpen); + const openConnection = connections.find(isConnectionOpen); if (openConnection) { peerIds.push(openConnection.remotePeer); } @@ -21,7 +21,7 @@ export function getConnectedPeerIds(libp2p: Libp2p): PeerId[] { */ export function hasSomeConnectedPeer(libp2p: Libp2p): boolean { for (const connections of getConnectionsMap(libp2p).values()) { - if (connections.value.some(isConnectionOpen)) { + if (connections.some(isConnectionOpen)) { return true; } } diff --git a/packages/beacon-node/src/network/util.ts b/packages/beacon-node/src/network/util.ts index f1d6b917b5e4..13eb13331f74 100644 --- a/packages/beacon-node/src/network/util.ts +++ b/packages/beacon-node/src/network/util.ts @@ -14,13 +14,13 @@ export function prettyPrintPeerIdStr(id: PeerIdStr): string { * Get the connections map from a connection manager */ // Compat function for efficiency reasons -export function getConnectionsMap(libp2p: Libp2p): Map { +export function getConnectionsMap(libp2p: Libp2p): Map { // biome-ignore lint/complexity/useLiteralKeys: `map` is a private attribute return libp2p.services.components.connectionManager.getConnectionsMap()["map"]; } export function getConnection(libp2p: Libp2p, peerIdStr: string): Connection | undefined { - return getConnectionsMap(libp2p).get(peerIdStr)?.value[0] ?? undefined; + return getConnectionsMap(libp2p).get(peerIdStr)?.[0] ?? undefined; } // https://github.com/ChainSafe/js-libp2p-gossipsub/blob/3475242ed254f7647798ab7f36b21909f6cb61da/src/index.ts#L2009 diff --git a/packages/beacon-node/src/node/nodejs.ts b/packages/beacon-node/src/node/nodejs.ts index 0e51b15e514b..701ab0fde070 100644 --- a/packages/beacon-node/src/node/nodejs.ts +++ b/packages/beacon-node/src/node/nodejs.ts @@ -1,7 +1,7 @@ import {setMaxListeners} from "node:events"; import {Registry} from "prom-client"; -import {PrivateKey} from "@libp2p/interface"; +import {PeerId} from "@libp2p/interface"; import {BeaconConfig} from "@lodestar/config"; import {phase0} from "@lodestar/types"; import {sleep} from "@lodestar/utils"; @@ -49,7 +49,7 @@ export type BeaconNodeInitModules = { db: IBeaconDb; logger: LoggerNode; processShutdownCallback: ProcessShutdownCallback; - privateKey: PrivateKey; + peerId: PeerId; peerStoreDir?: string; anchorState: BeaconStateAllForks; wsCheckpoint?: phase0.Checkpoint; @@ -146,7 +146,7 @@ export class BeaconNode { db, logger, processShutdownCallback, - privateKey, + peerId, peerStoreDir, anchorState, wsCheckpoint, @@ -243,7 +243,7 @@ export class BeaconNode { metrics, chain, db, - privateKey, + peerId, peerStoreDir, getReqRespHandler: getReqRespHandlers({db, chain}), }); diff --git a/packages/beacon-node/src/util/peerId.ts b/packages/beacon-node/src/util/peerId.ts index c62f5416cdfe..2afb9bed390e 100644 --- a/packages/beacon-node/src/util/peerId.ts +++ b/packages/beacon-node/src/util/peerId.ts @@ -12,5 +12,5 @@ export type PeerIdStr = string; export {peerIdFromString}; export function peerIdToString(peerId: PeerId): string { - return base58btc.encode(peerId.toMultihash().bytes).slice(1); + return base58btc.encode(peerId.multihash.bytes).slice(1); } diff --git a/packages/beacon-node/test/e2e/network/mdns.test.ts b/packages/beacon-node/test/e2e/network/mdns.test.ts index 6a1be8094137..f8b55d8afae7 100644 --- a/packages/beacon-node/test/e2e/network/mdns.test.ts +++ b/packages/beacon-node/test/e2e/network/mdns.test.ts @@ -1,8 +1,8 @@ import {describe, it, afterEach, beforeEach, expect, vi} from "vitest"; -import {PrivateKey} from "@libp2p/interface"; +import {PeerId} from "@libp2p/interface"; import {multiaddr} from "@multiformats/multiaddr"; +import {createSecp256k1PeerId} from "@libp2p/peer-id-factory"; import {SignableENR} from "@chainsafe/enr"; -import {generateKeyPair} from "@libp2p/crypto/keys"; import {createBeaconConfig} from "@lodestar/config"; import {config} from "@lodestar/config/default"; import {ssz} from "@lodestar/types"; @@ -35,9 +35,9 @@ describe.skip("mdns", () => { controller.abort(); }); - async function getOpts(privateKey: PrivateKey): Promise { + async function getOpts(peerId: PeerId): Promise { const bindAddrUdp = `/ip4/0.0.0.0/udp/${port++}`; - const enr = SignableENR.createFromPrivateKey(privateKey); + const enr = SignableENR.createFromPeerId(peerId); enr.setLocationMultiaddr(multiaddr(bindAddrUdp)); return { @@ -81,12 +81,12 @@ describe.skip("mdns", () => { const db = getMockedBeaconDb(); const gossipHandlers = {} as GossipHandlers; - const privateKey = await generateKeyPair("secp256k1"); + const peerId = await createSecp256k1PeerId(); const logger = testLogger(nodeName); - const opts = await getOpts(privateKey); + const opts = await getOpts(peerId); - const modules: Omit = { + const modules: Omit = { config, chain, db, @@ -97,7 +97,7 @@ describe.skip("mdns", () => { const network = await Network.init({ ...modules, - ...(await createNetworkModules(mu, privateKey, {...opts, mdns: true})), + ...(await createNetworkModules(mu, peerId, {...opts, mdns: true})), logger, }); diff --git a/packages/beacon-node/test/e2e/network/peers/peerManager.test.ts b/packages/beacon-node/test/e2e/network/peers/peerManager.test.ts index b46e151cadb3..d0b94399c01d 100644 --- a/packages/beacon-node/test/e2e/network/peers/peerManager.test.ts +++ b/packages/beacon-node/test/e2e/network/peers/peerManager.test.ts @@ -1,7 +1,7 @@ import {describe, it, afterEach, expect, vi} from "vitest"; import {Connection} from "@libp2p/interface"; +import {CustomEvent} from "@libp2p/interface"; import {BitArray} from "@chainsafe/ssz"; -import {generateKeyPair} from "@libp2p/crypto/keys"; import {config} from "@lodestar/config/default"; import {altair, phase0, ssz} from "@lodestar/types"; import {sleep} from "@lodestar/utils"; @@ -47,8 +47,7 @@ describe("network / peers / PeerManager", () => { const clock = new Clock({config: beaconConfig, genesisTime: 0, signal: controller.signal}); const status = ssz.phase0.Status.defaultValue(); const statusCache = new LocalStatusCache(status); - const privateKey = await generateKeyPair("secp256k1"); - const libp2p = await createNode("/ip4/127.0.0.1/tcp/0", privateKey); + const libp2p = await createNode("/ip4/127.0.0.1/tcp/0"); afterEachCallbacks.push(async () => { controller.abort(); @@ -69,7 +68,6 @@ describe("network / peers / PeerManager", () => { const peerManager = new PeerManager( { - privateKey, libp2p, reqResp, logger, @@ -160,7 +158,7 @@ describe("network / peers / PeerManager", () => { const {statusCache, libp2p, networkEventBus} = await mockModules(); // Simualate a peer connection, get() should return truthy - getConnectionsMap(libp2p).set(peerId1.toString(), {key: peerId1, value: [libp2pConnectionOutboud]}); + getConnectionsMap(libp2p).set(peerId1.toString(), [libp2pConnectionOutboud]); // Subscribe to `peerConnected` event, which must fire after checking peer relevance const peerConnectedPromise = waitForEvent(networkEventBus, NetworkEvent.peerConnected, 2000); @@ -179,7 +177,7 @@ describe("network / peers / PeerManager", () => { const {statusCache, libp2p, reqResp, peerManager, networkEventBus} = await mockModules(); // Simualate a peer connection, get() should return truthy - getConnectionsMap(libp2p).set(peerId1.toString(), {key: peerId1, value: [libp2pConnectionOutboud]}); + getConnectionsMap(libp2p).set(peerId1.toString(), [libp2pConnectionOutboud]); // Subscribe to `peerConnected` event, which must fire after checking peer relevance const peerConnectedPromise = waitForEvent(networkEventBus, NetworkEvent.peerConnected, 2000); @@ -192,7 +190,7 @@ describe("network / peers / PeerManager", () => { reqResp.sendMetadata.mockResolvedValue(remoteMetadata); // Simualate a peer connection, get() should return truthy - getConnectionsMap(libp2p).set(peerId1.toString(), {key: peerId1, value: [libp2pConnectionOutboud]}); + getConnectionsMap(libp2p).set(peerId1.toString(), [libp2pConnectionOutboud]); libp2p.services.components.events.dispatchEvent( new CustomEvent("connection:open", {detail: libp2pConnectionOutboud}) ); diff --git a/packages/beacon-node/test/e2e/network/reqrespEncode.test.ts b/packages/beacon-node/test/e2e/network/reqrespEncode.test.ts index eb994d2e848c..ae916bdd0ab7 100644 --- a/packages/beacon-node/test/e2e/network/reqrespEncode.test.ts +++ b/packages/beacon-node/test/e2e/network/reqrespEncode.test.ts @@ -40,7 +40,7 @@ describe("reqresp encoder", () => { const libp2p = await createLibp2p({ transports: [tcp()], streamMuxers: [mplex()], - connectionEncrypters: [noise()], + connectionEncryption: [noise()], addresses: { listen: [listen], }, diff --git a/packages/beacon-node/test/perf/network/noise/sendData.test.ts b/packages/beacon-node/test/perf/network/noise/sendData.test.ts index 49e37980a598..35538a417adf 100644 --- a/packages/beacon-node/test/perf/network/noise/sendData.test.ts +++ b/packages/beacon-node/test/perf/network/noise/sendData.test.ts @@ -1,12 +1,11 @@ import {itBench} from "@dapplion/benchmark"; import {duplexPair} from "it-pair/duplex"; +import {createSecp256k1PeerId} from "@libp2p/peer-id-factory"; import {pipe} from "it-pipe"; import drain from "it-drain"; import {defaultLogger} from "@libp2p/logger"; import {noise} from "@chainsafe/libp2p-noise"; import {Uint8ArrayList} from "uint8arraylist"; -import {generateKeyPair} from "@libp2p/crypto/keys"; -import {peerIdFromPrivateKey} from "@libp2p/peer-id"; describe("network / noise / sendData", () => { const numberOfMessages = 1000; @@ -25,17 +24,15 @@ describe("network / noise / sendData", () => { itBench({ id: `send data - ${numberOfMessages} ${messageLength}B messages`, beforeEach: async () => { - const privateKeyA = await generateKeyPair("secp256k1"); - const privateKeyB = await generateKeyPair("secp256k1"); - const peerA = peerIdFromPrivateKey(privateKeyA); - const peerB = peerIdFromPrivateKey(privateKeyB); - const noiseA = noise()({logger: defaultLogger(), privateKey: privateKeyA, peerId: peerA}); - const noiseB = noise()({logger: defaultLogger(), privateKey: privateKeyB, peerId: peerB}); + const peerA = await createSecp256k1PeerId(); + const peerB = await createSecp256k1PeerId(); + const noiseA = noise()({logger: defaultLogger()}); + const noiseB = noise()({logger: defaultLogger()}); const [inboundConnection, outboundConnection] = duplexPair(); const [outbound, inbound] = await Promise.all([ - noiseA.secureOutbound(outboundConnection, {remotePeer: peerB}), - noiseB.secureInbound(inboundConnection, {remotePeer: peerA}), + noiseA.secureOutbound(peerA, outboundConnection, peerB), + noiseB.secureInbound(peerB, inboundConnection, peerA), ]); return {connA: outbound.conn, connB: inbound.conn, data: new Uint8Array(messageLength)}; diff --git a/packages/beacon-node/test/perf/network/peers/util/prioritizePeers.test.ts b/packages/beacon-node/test/perf/network/peers/util/prioritizePeers.test.ts index 18dca2c670cd..d5a6b4e9cb25 100644 --- a/packages/beacon-node/test/perf/network/peers/util/prioritizePeers.test.ts +++ b/packages/beacon-node/test/perf/network/peers/util/prioritizePeers.test.ts @@ -1,7 +1,6 @@ import {itBench} from "@dapplion/benchmark"; import {PeerId} from "@libp2p/interface"; -import {generateKeyPair} from "@libp2p/crypto/keys"; -import {peerIdFromPrivateKey} from "@libp2p/peer-id"; +import {createSecp256k1PeerId} from "@libp2p/peer-id-factory"; import {ATTESTATION_SUBNET_COUNT, SYNC_COMMITTEE_SUBNET_COUNT} from "@lodestar/params"; import {altair, phase0} from "@lodestar/types"; import {defaultNetworkOptions} from "../../../../../src/network/options.js"; @@ -13,8 +12,7 @@ describe("prioritizePeers", () => { before(async () => { for (let i = 0; i < defaultNetworkOptions.maxPeers; i++) { - const pk = await generateKeyPair("secp256k1"); - const peer = peerIdFromPrivateKey(pk); + const peer = await createSecp256k1PeerId(); peer.toString = () => `peer-${i}`; seedPeers.push({ id: peer, diff --git a/packages/beacon-node/test/unit/network/peers/priorization.test.ts b/packages/beacon-node/test/unit/network/peers/priorization.test.ts index e72cc32ce28c..26f8d8c9e535 100644 --- a/packages/beacon-node/test/unit/network/peers/priorization.test.ts +++ b/packages/beacon-node/test/unit/network/peers/priorization.test.ts @@ -1,8 +1,7 @@ import {PeerId} from "@libp2p/interface"; +import {createSecp256k1PeerId} from "@libp2p/peer-id-factory"; import {BitArray} from "@chainsafe/ssz"; import {describe, it, expect} from "vitest"; -import {generateKeyPair} from "@libp2p/crypto/keys"; -import {peerIdFromPrivateKey} from "@libp2p/peer-id"; import {ATTESTATION_SUBNET_COUNT} from "@lodestar/params"; import { ExcessPeerDisconnectReason, @@ -18,8 +17,7 @@ type Result = ReturnType; describe("network / peers / priorization", async () => { const peers: PeerId[] = []; for (let i = 0; i < 8; i++) { - const pk = await generateKeyPair("secp256k1"); - const peer = peerIdFromPrivateKey(pk); + const peer = await createSecp256k1PeerId(); peer.toString = () => `peer-${i}`; peers.push(peer); } @@ -268,8 +266,7 @@ describe("network / peers / priorization", async () => { describe("sortPeersToPrune", async () => { const peers: PeerId[] = []; for (let i = 0; i < 8; i++) { - const pk = await generateKeyPair("secp256k1"); - const peer = peerIdFromPrivateKey(pk); + const peer = await createSecp256k1PeerId(); peer.toString = () => `peer-${i}`; peers.push(peer); } diff --git a/packages/beacon-node/test/utils/network.ts b/packages/beacon-node/test/utils/network.ts index 71bb0bd255da..56c831b269f5 100644 --- a/packages/beacon-node/test/utils/network.ts +++ b/packages/beacon-node/test/utils/network.ts @@ -1,6 +1,6 @@ import {BitArray} from "@chainsafe/ssz"; -import {PrivateKey} from "@libp2p/interface"; -import {generateKeyPair} from "@libp2p/crypto/keys"; +import {PeerId} from "@libp2p/interface"; +import {createSecp256k1PeerId} from "@libp2p/peer-id-factory"; import {ATTESTATION_SUBNET_COUNT, SYNC_COMMITTEE_SUBNET_COUNT} from "@lodestar/params"; import {INetwork, Network, NetworkEvent} from "../../src/network/index.js"; import {Libp2p} from "../../src/network/interface.js"; @@ -8,17 +8,18 @@ import {createNodeJsLibp2p} from "../../src/network/libp2p/index.js"; import {NetworkOptions, defaultNetworkOptions} from "../../src/network/options.js"; import {PeerIdStr} from "../../src/util/peerId.js"; -export async function createNode(multiaddr: string, privateKey?: PrivateKey): Promise { - return createNodeJsLibp2p(privateKey ?? (await generateKeyPair("secp256k1")), {localMultiaddrs: [multiaddr]}); +export async function createNode(multiaddr: string, inPeerId?: PeerId): Promise { + const peerId = inPeerId || (await createSecp256k1PeerId()); + return createNodeJsLibp2p(peerId, {localMultiaddrs: [multiaddr]}); } export async function createNetworkModules( multiaddr: string, - privateKey?: PrivateKey, + peerId?: PeerId, opts?: Partial -): Promise<{opts: NetworkOptions; privateKey: PrivateKey}> { +): Promise<{opts: NetworkOptions; peerId: PeerId}> { return { - privateKey: privateKey ?? (await generateKeyPair("secp256k1")), + peerId: peerId ?? (await createSecp256k1PeerId()), opts: {...defaultNetworkOptions, ...opts, localMultiaddrs: [multiaddr]}, }; } diff --git a/packages/beacon-node/test/utils/networkWithMockDb.ts b/packages/beacon-node/test/utils/networkWithMockDb.ts index 84c3821bb22c..689d332ebbce 100644 --- a/packages/beacon-node/test/utils/networkWithMockDb.ts +++ b/packages/beacon-node/test/utils/networkWithMockDb.ts @@ -1,4 +1,4 @@ -import {generateKeyPair} from "@libp2p/crypto/keys"; +import {createSecp256k1PeerId} from "@libp2p/peer-id-factory"; import {ChainForkConfig, createBeaconConfig} from "@lodestar/config"; import {ssz} from "@lodestar/types"; import {BeaconChain} from "../../src/chain/chain.js"; @@ -72,7 +72,7 @@ export async function getNetworkForTest( } ); - const modules: Omit = { + const modules: Omit = { config: beaconConfig, chain, db, @@ -83,7 +83,7 @@ export async function getNetworkForTest( const network = await Network.init({ ...modules, - privateKey: await generateKeyPair("secp256k1"), + peerId: await createSecp256k1PeerId(), opts: { ...defaultNetworkOptions, maxPeers: 1, diff --git a/packages/beacon-node/test/utils/node/beacon.ts b/packages/beacon-node/test/utils/node/beacon.ts index 746c2cde5fd4..0163fa148102 100644 --- a/packages/beacon-node/test/utils/node/beacon.ts +++ b/packages/beacon-node/test/utils/node/beacon.ts @@ -1,7 +1,7 @@ import deepmerge from "deepmerge"; import tmp from "tmp"; -import {PrivateKey} from "@libp2p/interface"; -import {generateKeyPair} from "@libp2p/crypto/keys"; +import {PeerId} from "@libp2p/interface"; +import {createSecp256k1PeerId} from "@libp2p/peer-id-factory"; import {config as minimalConfig} from "@lodestar/config/default"; import {createBeaconConfig, createChainForkConfig, ChainConfig} from "@lodestar/config"; import {RecursivePartial} from "@lodestar/utils"; @@ -26,16 +26,16 @@ export async function getDevBeaconNode( options?: RecursivePartial; validatorCount?: number; logger?: LoggerNode; - privateKey?: PrivateKey; + peerId?: PeerId; peerStoreDir?: string; anchorState?: BeaconStateAllForks; wsCheckpoint?: phase0.Checkpoint; } & InteropStateOpts ): Promise { const {params, validatorCount = 8, peerStoreDir} = opts; - let {options = {}, logger, privateKey} = opts; + let {options = {}, logger, peerId} = opts; - if (!privateKey) privateKey = await generateKeyPair("secp256k1"); + if (!peerId) peerId = await createSecp256k1PeerId(); const tmpDir = tmp.dirSync({unsafeCleanup: true}); const config = createChainForkConfig({...minimalConfig, ...params}); logger = logger ?? testLogger(); @@ -93,7 +93,7 @@ export async function getDevBeaconNode( db, logger, processShutdownCallback: () => {}, - privateKey, + peerId, peerStoreDir, anchorState, wsCheckpoint: opts.wsCheckpoint, diff --git a/packages/beacon-node/test/utils/peer.ts b/packages/beacon-node/test/utils/peer.ts index aeec92bf994e..8bd5c6c67be8 100644 --- a/packages/beacon-node/test/utils/peer.ts +++ b/packages/beacon-node/test/utils/peer.ts @@ -1,6 +1,6 @@ import {PeerId} from "@libp2p/interface"; -import {peerIdFromPrivateKey, peerIdFromPublicKey} from "@libp2p/peer-id"; -import {generateKeyPair, publicKeyFromProtobuf} from "@libp2p/crypto/keys"; +import {createSecp256k1PeerId} from "@libp2p/peer-id-factory"; +import {peerIdFromBytes} from "@libp2p/peer-id"; import {peerIdToString} from "../../src/util/peerId.js"; /** @@ -9,11 +9,11 @@ import {peerIdToString} from "../../src/util/peerId.js"; */ export function getValidPeerId(): PeerId { const id = Buffer.from("002508021221039481269fe831799b1a0f1d521c1395b4831514859e4559c44d155eae46f03819", "hex"); - return peerIdFromPublicKey(publicKeyFromProtobuf(id)); + return peerIdFromBytes(id); } export async function getRandPeerIdStr(): Promise { - return peerIdToString(peerIdFromPrivateKey(await generateKeyPair("secp256k1"))); + return peerIdToString(await createSecp256k1PeerId()); } export const validPeerIdStr = peerIdToString(getValidPeerId()); diff --git a/packages/cli/package.json b/packages/cli/package.json index e1c14f6cd9c3..3634ccd84424 100644 --- a/packages/cli/package.json +++ b/packages/cli/package.json @@ -54,14 +54,14 @@ "@chainsafe/bls-keygen": "^0.4.0", "@chainsafe/bls-keystore": "^3.1.0", "@chainsafe/blst": "^2.1.0", - "@chainsafe/discv5": "^10.0.1", - "@chainsafe/enr": "^4.0.1", + "@chainsafe/discv5": "^9.0.0", + "@chainsafe/enr": "^3.0.0", "@chainsafe/persistent-merkle-tree": "^0.8.0", "@chainsafe/ssz": "^0.18.0", "@chainsafe/threads": "^1.11.1", - "@libp2p/crypto": "^5.0.4", - "@libp2p/interface": "^2.1.2", - "@libp2p/peer-id": "^5.0.4", + "@libp2p/crypto": "^4.1.0", + "@libp2p/peer-id": "^4.1.0", + "@libp2p/peer-id-factory": "^4.1.0", "@lodestar/api": "^1.22.0", "@lodestar/beacon-node": "^1.22.0", "@lodestar/config": "^1.22.0", diff --git a/packages/cli/src/cmds/beacon/handler.ts b/packages/cli/src/cmds/beacon/handler.ts index 2a0238fede20..ea424e04824a 100644 --- a/packages/cli/src/cmds/beacon/handler.ts +++ b/packages/cli/src/cmds/beacon/handler.ts @@ -24,7 +24,7 @@ import {LogArgs} from "../../options/logOptions.js"; import {BeaconArgs} from "./options.js"; import {getBeaconPaths} from "./paths.js"; import {initBeaconState} from "./initBeaconState.js"; -import {initPrivateKeyAndEnr} from "./initPeerIdAndEnr.js"; +import {initPeerIdAndEnr} from "./initPeerIdAndEnr.js"; const DEFAULT_RETENTION_SSZ_OBJECTS_HOURS = 15 * 24; const HOURS_TO_MS = 3600 * 1000; @@ -34,7 +34,7 @@ const EIGHT_GB = 8 * 1024 * 1024 * 1024; * Runs a beacon node. */ export async function beaconHandler(args: BeaconArgs & GlobalArgs): Promise { - const {config, options, beaconPaths, network, version, commit, privateKey, logger} = await beaconHandlerInit(args); + const {config, options, beaconPaths, network, version, commit, peerId, logger} = await beaconHandlerInit(args); const heapSizeLimit = getHeapStatistics().heap_size_limit; if (heapSizeLimit < EIGHT_GB) { @@ -80,7 +80,7 @@ export async function beaconHandler(args: BeaconArgs & GlobalArgs): Promise { +): Promise<{peerId: PeerId; enr: SignableENR}> { const {persistNetworkIdentity} = args; - const newPrivateKeyAndENR = async (): Promise<{privateKey: PrivateKey; enr: SignableENR}> => { - const privateKey = await generateKeyPair("secp256k1"); - const enr = SignableENR.createFromPrivateKey(privateKey); - return {privateKey, enr}; + const newPeerIdAndENR = async (): Promise<{peerId: PeerId; enr: SignableENR}> => { + const peerId = await createSecp256k1PeerId(); + const enr = SignableENR.createV4(createPrivateKeyFromPeerId(peerId).privateKey); + return {peerId, enr}; }; - const readPersistedPrivateKeyAndENR = async ( + const readPersistedPeerIdAndENR = async ( peerIdFile: string, enrFile: string - ): Promise<{privateKey: PrivateKey; enr: SignableENR; newEnr: boolean}> => { - let privateKey: PrivateKey; + ): Promise<{peerId: PeerId; enr: SignableENR; newEnr: boolean}> => { + let peerId: PeerId; let enr: SignableENR; // attempt to read stored peer id try { - privateKey = readPrivateKey(peerIdFile); + peerId = await readPeerId(peerIdFile); } catch (_e) { logger.warn("Unable to read peerIdFile, creating a new peer id"); - return {...(await newPrivateKeyAndENR()), newEnr: true}; + return {...(await newPeerIdAndENR()), newEnr: true}; } // attempt to read stored enr try { - enr = SignableENR.decodeTxt(fs.readFileSync(enrFile, "utf-8"), privateKey.raw); + enr = SignableENR.decodeTxt(fs.readFileSync(enrFile, "utf-8"), createPrivateKeyFromPeerId(peerId).privateKey); } catch (_e) { logger.warn("Unable to decode stored local ENR, creating a new ENR"); - enr = SignableENR.createFromPrivateKey(privateKey); - return {privateKey, enr, newEnr: true}; + enr = SignableENR.createV4(createPrivateKeyFromPeerId(peerId).privateKey); + return {peerId, enr, newEnr: true}; } // check stored peer id against stored enr - if (!privateKey.equals(enr.peerId)) { + if (!peerId.equals(await enr.peerId())) { logger.warn("Stored local ENR doesn't match peerIdFile, creating a new ENR"); - enr = SignableENR.createFromPrivateKey(privateKey); - return {privateKey, enr, newEnr: true}; + enr = SignableENR.createV4(createPrivateKeyFromPeerId(peerId).privateKey); + return {peerId, enr, newEnr: true}; } - return {privateKey, enr, newEnr: false}; + return {peerId, enr, newEnr: false}; }; if (persistNetworkIdentity) { const enrFile = path.join(beaconDir, "enr"); const peerIdFile = path.join(beaconDir, "peer-id.json"); - const {privateKey, enr, newEnr} = await readPersistedPrivateKeyAndENR(peerIdFile, enrFile); + const {peerId, enr, newEnr} = await readPersistedPeerIdAndENR(peerIdFile, enrFile); overwriteEnrWithCliArgs(enr, args, logger, {newEnr, bootnode}); // Re-persist peer-id and enr - writeFile600Perm(peerIdFile, exportToJSON(privateKey)); + writeFile600Perm(peerIdFile, exportToJSON(peerId)); writeFile600Perm(enrFile, enr.encodeTxt()); - return {privateKey, enr}; + return {peerId, enr}; } - const {privateKey, enr} = await newPrivateKeyAndENR(); + const {peerId, enr} = await newPeerIdAndENR(); overwriteEnrWithCliArgs(enr, args, logger, {newEnr: true, bootnode}); - return {privateKey, enr}; + return {peerId, enr}; } diff --git a/packages/cli/src/cmds/bootnode/handler.ts b/packages/cli/src/cmds/bootnode/handler.ts index 9c093eed1272..8a262d8f12b7 100644 --- a/packages/cli/src/cmds/bootnode/handler.ts +++ b/packages/cli/src/cmds/bootnode/handler.ts @@ -10,7 +10,7 @@ import {getBeaconConfigFromArgs} from "../../config/index.js"; import {getNetworkBootnodes, isKnownNetworkName, readBootnodes} from "../../networks/index.js"; import {onGracefulShutdown, mkdir, writeFile600Perm} from "../../util/index.js"; import {getVersionData} from "../../util/version.js"; -import {initPrivateKeyAndEnr} from "../beacon/initPeerIdAndEnr.js"; +import {initPeerIdAndEnr} from "../beacon/initPeerIdAndEnr.js"; import {parseArgs as parseMetricsArgs} from "../../options/beaconNodeOptions/metrics.js"; import {parseArgs as parseNetworkArgs} from "../../options/beaconNodeOptions/network.js"; import {getBeaconPaths} from "../beacon/paths.js"; @@ -22,7 +22,7 @@ import {BootnodeArgs} from "./options.js"; * Runs a bootnode. */ export async function bootnodeHandler(args: BootnodeArgs & GlobalArgs): Promise { - const {discv5Args, metricsArgs, bootnodeDir, network, version, commit, privateKey, enr, logger} = + const {discv5Args, metricsArgs, bootnodeDir, network, version, commit, peerId, enr, logger} = await bootnodeHandlerInit(args); const abortController = new AbortController(); @@ -34,7 +34,7 @@ export async function bootnodeHandler(args: BootnodeArgs & GlobalArgs): Promise< ip4: enr.getLocationMultiaddr("udp4")?.toString(), ip6: enr.getLocationMultiaddr("udp6")?.toString(), }); - logger.info("Identity", {peerId: enr.peerId.toString(), nodeId: enr.nodeId}); + logger.info("Identity", {peerId: peerId.toString(), nodeId: enr.nodeId}); logger.info("ENR", {enr: enr.encodeTxt()}); // bootnode setup @@ -53,7 +53,7 @@ export async function bootnodeHandler(args: BootnodeArgs & GlobalArgs): Promise< const discv5 = Discv5.create({ enr, - privateKey, + peerId, bindAddrs: { ip4: (bindAddrs.ip4 ? multiaddr(bindAddrs.ip4) : undefined) as Multiaddr, ip6: bindAddrs.ip6 ? multiaddr(bindAddrs.ip6) : undefined, @@ -68,7 +68,7 @@ export async function bootnodeHandler(args: BootnodeArgs & GlobalArgs): Promise< logger.info("Adding bootnode", { ip4: bootEnr.getLocationMultiaddr("udp4")?.toString(), ip6: bootEnr.getLocationMultiaddr("udp6")?.toString(), - peerId: bootEnr.peerId.toString(), + peerId: (await bootEnr.peerId()).toString(), nodeId: enr.nodeId, }); discv5.addEnr(bootEnr); @@ -180,7 +180,7 @@ export async function bootnodeHandlerInit(args: BootnodeArgs & GlobalArgs) { ); const logger = initLogger(args, beaconPaths.dataDir, config, "bootnode.log"); - const {privateKey, enr} = await initPrivateKeyAndEnr(args as unknown as BeaconArgs, bootnodeDir, logger, true); + const {peerId, enr} = await initPeerIdAndEnr(args as unknown as BeaconArgs, bootnodeDir, logger, true); - return {discv5Args, metricsArgs, bootnodeDir, network, version, commit, privateKey, enr, logger}; + return {discv5Args, metricsArgs, bootnodeDir, network, version, commit, peerId, enr, logger}; } diff --git a/packages/cli/src/config/peerId.ts b/packages/cli/src/config/peerId.ts index 91390696c2f4..576a99e6980e 100644 --- a/packages/cli/src/config/peerId.ts +++ b/packages/cli/src/config/peerId.ts @@ -1,11 +1,7 @@ -import type {PrivateKey} from "@libp2p/interface"; -import {peerIdFromPrivateKey, peerIdFromString} from "@libp2p/peer-id"; -import { - privateKeyFromProtobuf, - privateKeyToProtobuf, - publicKeyFromProtobuf, - publicKeyToProtobuf, -} from "@libp2p/crypto/keys"; +import type {PeerId} from "@libp2p/interface"; +import {peerIdFromBytes} from "@libp2p/peer-id"; +import {createFromPrivKey, createFromPubKey} from "@libp2p/peer-id-factory"; +import {unmarshalPrivateKey, unmarshalPublicKey} from "@libp2p/crypto/keys"; import {fromString as uint8ArrayFromString} from "uint8arrays/from-string"; import {toString as uint8ArrayToString} from "uint8arrays/to-string"; import {writeFile600Perm, readFile} from "../util/index.js"; @@ -13,38 +9,46 @@ import {writeFile600Perm, readFile} from "../util/index.js"; // Peer id to / from JSON taken from peer-id-factory // See https://github.com/libp2p/js-libp2p-peer-id/pull/9 for more details -// after libp2p 2.0, PeerId no longer contains a private key -// but we retain a semi-backwards-compatible on-disk format -// Note: all properties are required -export type PeerIdJSON = {id: string; pubKey: string; privKey: string}; +async function createFromParts(multihash: Uint8Array, privKey?: Uint8Array, pubKey?: Uint8Array): Promise { + if (privKey != null) { + const key = await unmarshalPrivateKey(privKey); -export function exportToJSON(privateKey: PrivateKey): PeerIdJSON { - const publicKey = privateKey.publicKey; - const peerId = peerIdFromPrivateKey(privateKey); + return createFromPrivKey(key); + } + if (pubKey != null) { + const key = unmarshalPublicKey(pubKey); + + return createFromPubKey(key); + } + + return peerIdFromBytes(multihash); +} + +export type PeerIdJSON = {id: string; pubKey?: string; privKey?: string}; + +export function exportToJSON(peerId: PeerId, excludePrivateKey?: boolean): PeerIdJSON { return { - id: peerId.toString(), - pubKey: uint8ArrayToString(publicKeyToProtobuf(publicKey), "base64pad"), - privKey: uint8ArrayToString(privateKeyToProtobuf(privateKey), "base64pad"), + id: uint8ArrayToString(peerId.toBytes(), "base58btc"), + pubKey: peerId.publicKey != null ? uint8ArrayToString(peerId.publicKey, "base64pad") : undefined, + privKey: + excludePrivateKey === true || peerId.privateKey == null + ? undefined + : uint8ArrayToString(peerId.privateKey, "base64pad"), }; } -export function createFromJSON(obj: PeerIdJSON): PrivateKey { - const privateKey = privateKeyFromProtobuf(uint8ArrayFromString(obj.privKey, "base64pad")); - const publicKey = publicKeyFromProtobuf(uint8ArrayFromString(obj.pubKey, "base64pad")); - const peerId = peerIdFromString(obj.id); - if (!publicKey.equals(privateKey.publicKey)) { - throw new Error("Public key does not match private key"); - } - if (!peerId.equals(peerIdFromPrivateKey(privateKey))) { - throw new Error("Peer ID does not match private key"); - } - return privateKey; +export async function createFromJSON(obj: PeerIdJSON): Promise { + return createFromParts( + uint8ArrayFromString(obj.id, "base58btc"), + obj.privKey != null ? uint8ArrayFromString(obj.privKey, "base64pad") : undefined, + obj.pubKey != null ? uint8ArrayFromString(obj.pubKey, "base64pad") : undefined + ); } -export function writePrivateKey(filepath: string, privateKey: PrivateKey): void { - writeFile600Perm(filepath, exportToJSON(privateKey)); +export function writePeerId(filepath: string, peerId: PeerId): void { + writeFile600Perm(filepath, exportToJSON(peerId)); } -export function readPrivateKey(filepath: string): PrivateKey { +export async function readPeerId(filepath: string): Promise { return createFromJSON(readFile(filepath)); } diff --git a/packages/cli/test/unit/cmds/beacon.test.ts b/packages/cli/test/unit/cmds/beacon.test.ts index 74cde026b1ad..6e7b7f389a29 100644 --- a/packages/cli/test/unit/cmds/beacon.test.ts +++ b/packages/cli/test/unit/cmds/beacon.test.ts @@ -1,16 +1,15 @@ import path from "node:path"; import fs from "node:fs"; import {describe, it, expect} from "vitest"; +import {createFromJSON, createSecp256k1PeerId} from "@libp2p/peer-id-factory"; import {multiaddr} from "@multiformats/multiaddr"; -import {ENR, SignableENR} from "@chainsafe/enr"; -import {generateKeyPair} from "@libp2p/crypto/keys"; -import {peerIdFromPrivateKey} from "@libp2p/peer-id"; +import {createPrivateKeyFromPeerId, ENR, SignableENR} from "@chainsafe/enr"; import {chainConfig} from "@lodestar/config/default"; import {chainConfigToJson} from "@lodestar/config"; import {LogLevel} from "@lodestar/utils"; -import {createFromJSON, exportToJSON} from "../../../src/config/peerId.js"; +import {exportToJSON} from "../../../src/config/peerId.js"; import {beaconHandlerInit} from "../../../src/cmds/beacon/handler.js"; -import {initPrivateKeyAndEnr, isLocalMultiAddr} from "../../../src/cmds/beacon/initPeerIdAndEnr.js"; +import {initPeerIdAndEnr, isLocalMultiAddr} from "../../../src/cmds/beacon/initPeerIdAndEnr.js"; import {BeaconArgs} from "../../../src/cmds/beacon/options.js"; import {GlobalArgs} from "../../../src/options/globalOptions.js"; import {testFilesDir, testLogger} from "../../utils.js"; @@ -56,26 +55,26 @@ describe("cmds / beacon / args handler", () => { }); it("Create different PeerId every run", async () => { - const {privateKey: pk1} = await runBeaconHandlerInit({}); - const {privateKey: pk2} = await runBeaconHandlerInit({}); + const {peerId: peerId1} = await runBeaconHandlerInit({}); + const {peerId: peerId2} = await runBeaconHandlerInit({}); - expect(pk1.equals(pk2)).toBe(false); + expect(peerId1.toString()).not.toBe(peerId2.toString()); }); it("Re-use existing peer", async () => { - const prevPk = await generateKeyPair("secp256k1"); + const prevPeerId = await createSecp256k1PeerId(); const peerIdFile = path.join(testFilesDir, "peer-id.json"); - fs.writeFileSync(peerIdFile, JSON.stringify(exportToJSON(prevPk))); - const enr = SignableENR.createFromPrivateKey(prevPk); + fs.writeFileSync(peerIdFile, JSON.stringify(exportToJSON(prevPeerId))); + const enr = SignableENR.createV4(createPrivateKeyFromPeerId(prevPeerId).privateKey); const enrFilePath = path.join(testFilesDir, "enr"); fs.writeFileSync(enrFilePath, enr.encodeTxt()); - const {privateKey} = await runBeaconHandlerInit({ + const {peerId} = await runBeaconHandlerInit({ persistNetworkIdentity: true, }); - expect(privateKey.equals(prevPk)).toBe(true); + expect(peerId.toString()).toBe(prevPeerId.toString()); }); it("Set known deposit contract", async () => { @@ -118,48 +117,48 @@ describe("Test isLocalMultiAddr", () => { describe("initPeerIdAndEnr", () => { it("should not reuse peer id, persistNetworkIdentity=false", async () => { - const {privateKey: pk1} = await initPrivateKeyAndEnr( + const {peerId: peerId1} = await initPeerIdAndEnr( {persistNetworkIdentity: false} as BeaconArgs, testFilesDir, testLogger() ); - const {privateKey: pk2} = await initPrivateKeyAndEnr( + const {peerId: peerId2} = await initPeerIdAndEnr( {persistNetworkIdentity: false} as BeaconArgs, testFilesDir, testLogger() ); - expect(pk1.equals(pk2)).toBe(false); + expect(peerId1.toString()).not.toBe(peerId2.toString()); }); it("should reuse peer id, persistNetworkIdentity=true", async () => { - const {privateKey: pk1} = await initPrivateKeyAndEnr( + const {peerId: peerId1} = await initPeerIdAndEnr( {persistNetworkIdentity: true} as BeaconArgs, testFilesDir, testLogger() ); - const {privateKey: pk2} = await initPrivateKeyAndEnr( + const {peerId: peerId2} = await initPeerIdAndEnr( {persistNetworkIdentity: true} as BeaconArgs, testFilesDir, testLogger() ); - expect(pk1.equals(pk2)).toBe(true); + expect(peerId1.toString()).toBe(peerId2.toString()); }); it("should overwrite invalid peer id", async () => { const peerIdFile = path.join(testFilesDir, "peer-id.json"); - const pk1Str = "wrong peer id file content"; - fs.writeFileSync(peerIdFile, pk1Str); - const {privateKey: pk2} = await initPrivateKeyAndEnr( + const peerId1Str = "wrong peer id file content"; + fs.writeFileSync(peerIdFile, peerId1Str); + const {peerId: peerId2} = await initPeerIdAndEnr( {persistNetworkIdentity: true} as BeaconArgs, testFilesDir, testLogger() ); - const filePk = createFromJSON(JSON.parse(fs.readFileSync(peerIdFile, "utf-8"))); + const filePeerId = await createFromJSON(JSON.parse(fs.readFileSync(peerIdFile, "utf-8"))); - expect(pk1Str).not.toBe(peerIdFromPrivateKey(pk2).toString()); - expect(filePk.equals(pk2)).toBe(true); + expect(peerId1Str).not.toBe(peerId2.toString()); + expect(filePeerId.toString()).toBe(peerId2.toString()); }); it("should overwrite invalid enr", async () => { @@ -167,7 +166,7 @@ describe("initPeerIdAndEnr", () => { const invalidEnr = "wrong enr file content"; fs.writeFileSync(enrFilePath, invalidEnr); - await initPrivateKeyAndEnr({persistNetworkIdentity: true} as BeaconArgs, testFilesDir, testLogger()); + await initPeerIdAndEnr({persistNetworkIdentity: true} as BeaconArgs, testFilesDir, testLogger()); const validEnr = fs.readFileSync(enrFilePath, "utf-8"); @@ -175,13 +174,13 @@ describe("initPeerIdAndEnr", () => { }); it("should overwrite enr that doesn't match peer id", async () => { - const otherPk = await generateKeyPair("secp256k1"); - const otherEnr = SignableENR.createFromPrivateKey(otherPk); + const otherPeerId = await createSecp256k1PeerId(); + const otherEnr = SignableENR.createFromPeerId(otherPeerId); const enrFilePath = path.join(testFilesDir, "enr"); const otherEnrStr = otherEnr.encodeTxt(); fs.writeFileSync(enrFilePath, otherEnrStr); - const {enr} = await initPrivateKeyAndEnr({persistNetworkIdentity: true} as BeaconArgs, testFilesDir, testLogger()); + const {enr} = await initPeerIdAndEnr({persistNetworkIdentity: true} as BeaconArgs, testFilesDir, testLogger()); expect(enr.nodeId).not.toBe(otherEnr); }); diff --git a/packages/cli/test/unit/cmds/initPeerIdAndEnr.test.ts b/packages/cli/test/unit/cmds/initPeerIdAndEnr.test.ts index 3dd9b48c298d..a207e0c0f59d 100644 --- a/packages/cli/test/unit/cmds/initPeerIdAndEnr.test.ts +++ b/packages/cli/test/unit/cmds/initPeerIdAndEnr.test.ts @@ -1,8 +1,7 @@ import fs from "node:fs"; import {describe, it, expect, beforeEach, afterEach} from "vitest"; import tmp from "tmp"; -import {peerIdFromPrivateKey} from "@libp2p/peer-id"; -import {initPrivateKeyAndEnr} from "../../../src/cmds/beacon/initPeerIdAndEnr.js"; +import {initPeerIdAndEnr} from "../../../src/cmds/beacon/initPeerIdAndEnr.js"; import {BeaconArgs} from "../../../src/cmds/beacon/options.js"; import {testLogger} from "../../utils.js"; @@ -18,35 +17,35 @@ describe("initPeerIdAndEnr", () => { }); it("first time should create a new enr and peer id", async () => { - const {enr, privateKey} = await initPrivateKeyAndEnr( + const {enr, peerId} = await initPeerIdAndEnr( {persistNetworkIdentity: true} as unknown as BeaconArgs, tmpDir.name, testLogger(), true ); // "enr peer id doesn't equal the returned peer id" - expect(enr.peerId.toString()).toBe(peerIdFromPrivateKey(privateKey).toString()); + expect((await enr.peerId()).toString()).toBe(peerId.toString()); expect(enr.seq).toBe(BigInt(1)); expect(enr.tcp).toBeUndefined(); expect(enr.tcp6).toBeUndefined(); }); it("second time should use ths existing enr and peer id", async () => { - const run1 = await initPrivateKeyAndEnr( + const run1 = await initPeerIdAndEnr( {persistNetworkIdentity: true} as unknown as BeaconArgs, tmpDir.name, testLogger(), true ); - const run2 = await initPrivateKeyAndEnr( + const run2 = await initPeerIdAndEnr( {persistNetworkIdentity: true} as unknown as BeaconArgs, tmpDir.name, testLogger(), true ); - expect(run1.privateKey.equals(run2.privateKey)).toBe(true); + expect(run1.peerId.toString()).toBe(run2.peerId.toString()); expect(run1.enr.encodeTxt()).toBe(run2.enr.encodeTxt()); }); }); diff --git a/packages/cli/test/unit/config/peerId.test.ts b/packages/cli/test/unit/config/peerId.test.ts index 120a5e931749..c0cdc8cff1a9 100644 --- a/packages/cli/test/unit/config/peerId.test.ts +++ b/packages/cli/test/unit/config/peerId.test.ts @@ -1,16 +1,16 @@ import {describe, it, expect} from "vitest"; -import {generateKeyPair} from "@libp2p/crypto/keys"; +import {createSecp256k1PeerId} from "@libp2p/peer-id-factory"; import {getTestdirPath} from "../../utils.js"; -import {writePrivateKey, readPrivateKey} from "../../../src/config/index.js"; +import {writePeerId, readPeerId} from "../../../src/config/index.js"; describe("config / peerId", () => { const peerIdFilepath = getTestdirPath("./test-peer-id.json"); it("create, write and read PeerId", async () => { - const privateKey = await generateKeyPair("secp256k1"); - writePrivateKey(peerIdFilepath, privateKey); - const pkRead = readPrivateKey(peerIdFilepath); + const peerId = await createSecp256k1PeerId(); + writePeerId(peerIdFilepath, peerId); + const peerIdRead = await readPeerId(peerIdFilepath); - expect(pkRead.toString()).toBe(privateKey.toString()); + expect(peerIdRead.toString()).toBe(peerId.toString()); }); }); diff --git a/packages/reqresp/package.json b/packages/reqresp/package.json index d6d4fbd2b5c2..9bd9775ba2c0 100644 --- a/packages/reqresp/package.json +++ b/packages/reqresp/package.json @@ -53,7 +53,7 @@ }, "dependencies": { "@chainsafe/fast-crc32c": "^4.1.1", - "@libp2p/interface": "^2.1.2", + "@libp2p/interface": "^1.3.0", "@lodestar/config": "^1.22.0", "@lodestar/params": "^1.22.0", "@lodestar/utils": "^1.22.0", @@ -67,10 +67,10 @@ "devDependencies": { "@lodestar/logger": "^1.22.0", "@lodestar/types": "^1.22.0", - "libp2p": "2.1.7" + "libp2p": "1.4.3" }, "peerDependencies": { - "libp2p": "~2.1.7" + "libp2p": "~1.4.3" }, "keywords": [ "ethereum", diff --git a/packages/reqresp/test/utils/peer.ts b/packages/reqresp/test/utils/peer.ts index cbc21eca370f..43edaefbafdd 100644 --- a/packages/reqresp/test/utils/peer.ts +++ b/packages/reqresp/test/utils/peer.ts @@ -1,6 +1,5 @@ import {PeerId} from "@libp2p/interface"; -import {peerIdFromPublicKey} from "@libp2p/peer-id"; -import {publicKeyFromProtobuf} from "@libp2p/crypto/keys"; +import {peerIdFromBytes} from "@libp2p/peer-id"; /** * Returns a valid PeerId with opts `bits: 256, keyType: "secp256k1"` @@ -8,5 +7,5 @@ import {publicKeyFromProtobuf} from "@libp2p/crypto/keys"; */ export function getValidPeerId(): PeerId { const id = Buffer.from("002508021221039481269fe831799b1a0f1d521c1395b4831514859e4559c44d155eae46f03819", "hex"); - return peerIdFromPublicKey(publicKeyFromProtobuf(id)); + return peerIdFromBytes(id); } diff --git a/yarn.lock b/yarn.lock index 8519ed6434bf..a9cb9ebe4fdc 100644 --- a/yarn.lock +++ b/yarn.lock @@ -456,14 +456,14 @@ "@chainsafe/blst-linux-x64-musl" "2.1.0" "@chainsafe/blst-win32-x64-msvc" "2.1.0" -"@chainsafe/discv5@^10.0.1": - version "10.0.1" - resolved "https://registry.yarnpkg.com/@chainsafe/discv5/-/discv5-10.0.1.tgz#1aefe3826b19b1f66e76c737a7a49ae7c77d7664" - integrity sha512-YpvqOMOn/sQMHU97lonvRnbtLZQW1Vqjcwtofd0hOJ6ohtxn+Ne7Cos8qCOFkhRHirGG6irHej4akh/BlBscSA== +"@chainsafe/discv5@^9.0.0": + version "9.0.0" + resolved "https://registry.yarnpkg.com/@chainsafe/discv5/-/discv5-9.0.0.tgz#05d4d9d671894b41f0fafa8f32c48ae3ed761bd1" + integrity sha512-7s23ziqsHG/KRgkX79qB/w8kuqPrY8aJaF2aRDy9cScJocJ6ZaOnXhEc8Ku1AcSyrvfGp+tY8R4rDABcxRY+Wg== dependencies: - "@chainsafe/enr" "^4.0.1" - "@libp2p/crypto" "^5.0.1" - "@libp2p/interface" "^2.0.1" + "@chainsafe/enr" "^3.0.0" + "@libp2p/crypto" "^4.0.1" + "@libp2p/interface" "^1.1.1" "@multiformats/multiaddr" "^12.1.10" bcrypto "^5.4.0" bigint-buffer "^1.1.5" @@ -472,17 +472,17 @@ rlp "^2.2.6" strict-event-emitter-types "^2.0.0" -"@chainsafe/enr@^4.0.1": - version "4.0.1" - resolved "https://registry.yarnpkg.com/@chainsafe/enr/-/enr-4.0.1.tgz#9c9ad8cd84aedc1242d7e7ac99d670c0f8ee3c0d" - integrity sha512-eYGZC6Wq9UNtD5AZLO21w9DctRkEAhMZ/kIa+eggT5lVRcVSI06O7PmSXOSRW6z+Td/9MQKGEDtuyYa1esWlSg== +"@chainsafe/enr@^3.0.0": + version "3.0.0" + resolved "https://registry.yarnpkg.com/@chainsafe/enr/-/enr-3.0.0.tgz#71c83d4381d703bbcd19245ce733eb7c779a30ed" + integrity sha512-D8M8sqnvOim0jWlTdr2IhLyVe0GSUgpk+QO6UaLY4pQVdW1myJP8REp7xdbv1193ULVEkJQFTJAZexTOtmu3jw== dependencies: - "@libp2p/crypto" "^5.0.1" - "@libp2p/interface" "^2.0.1" - "@libp2p/peer-id" "^5.0.1" + "@libp2p/crypto" "^4.0.1" + "@libp2p/interface" "^1.1.1" + "@libp2p/peer-id" "^4.0.4" "@multiformats/multiaddr" "^12.1.10" bigint-buffer "^1.1.5" - ethereum-cryptography "^2.2.0" + ethereum-cryptography "^2.1.3" rlp "^2.2.6" uint8-varint "^2.0.2" uint8arrays "^5.0.1" @@ -528,37 +528,54 @@ resolved "https://registry.yarnpkg.com/@chainsafe/is-ip/-/is-ip-2.0.2.tgz#7311e7403f11d8c5cfa48111f56fcecaac37c9f6" integrity sha512-ndGqEMG1W5WkGagaqOZHpPU172AGdxr+LD15sv3WIUvT5oCFUrG1Y0CW/v2Egwj4JXEvSibaIIIqImsm98y1nA== -"@chainsafe/libp2p-gossipsub@^14.1.0": - version "14.1.0" - resolved "https://registry.yarnpkg.com/@chainsafe/libp2p-gossipsub/-/libp2p-gossipsub-14.1.0.tgz#0003a214c2a88b04ab7c256c70ec439717958f09" - integrity sha512-nzFBbHOoRFa/bXUSzmJaXOgHI+EttTldhLJ33yWcM0DxnWhLKychHkCDLoJO3THa1+dnzrDJoxj3N3/V0WoPVw== +"@chainsafe/libp2p-gossipsub@^13.0.0": + version "13.0.0" + resolved "https://registry.yarnpkg.com/@chainsafe/libp2p-gossipsub/-/libp2p-gossipsub-13.0.0.tgz#b1dfa5c2d455d77ab8dfc97f5eb8961861bb623e" + integrity sha512-2q+v429uZjMl6N3d+j9QCMj8YO0aiYvLSN1t0aTdpMXQHCHLJaaT9PtNn845B1Li7/uZjYESmikgVt8r7keH0w== dependencies: - "@libp2p/crypto" "^5.0.0" - "@libp2p/interface" "^2.0.0" - "@libp2p/interface-internal" "^2.0.0" - "@libp2p/peer-id" "^5.0.0" - "@libp2p/pubsub" "^10.0.0" + "@libp2p/crypto" "^4.0.1" + "@libp2p/interface" "^1.1.2" + "@libp2p/interface-internal" "^1.0.7" + "@libp2p/peer-id" "^4.0.5" + "@libp2p/pubsub" "^9.0.8" "@multiformats/multiaddr" "^12.1.14" denque "^2.1.0" it-length-prefixed "^9.0.4" it-pipe "^3.0.1" it-pushable "^3.2.3" multiformats "^13.0.1" - protons-runtime "^5.5.0" + protons-runtime "5.4.0" uint8arraylist "^2.4.8" uint8arrays "^5.0.1" -"@chainsafe/libp2p-noise@^16.0.0": - version "16.0.0" - resolved "https://registry.yarnpkg.com/@chainsafe/libp2p-noise/-/libp2p-noise-16.0.0.tgz#52bb558490065439b0026950d7d99567da5c2c96" - integrity sha512-8rqr8V1RD2/lVbfL0Bb//N8iPOFof11cUe8v8z8xJT7fUhCAbtCCSM4jbwI4HCnw0MvHLmcpmAfDCFRwcWzoeA== +"@chainsafe/libp2p-identify@^1.0.0": + version "1.0.0" + resolved "https://registry.yarnpkg.com/@chainsafe/libp2p-identify/-/libp2p-identify-1.0.0.tgz#28191e619715a87c140d8b516ee85cb7d39e41e0" + integrity sha512-X+VWUC0xeCFIulE4BU5M8FmTxZ/OKzku+9/1UaX2EG1LcqQkCDrPi6CCODbE0SraqImG4aVHRbiCFWxKEfE8wQ== + dependencies: + "@libp2p/interface" "^1.1.2" + "@libp2p/interface-internal" "^1.0.7" + "@libp2p/peer-id" "^4.0.5" + "@libp2p/peer-record" "^7.0.7" + "@multiformats/multiaddr" "^12.1.10" + "@multiformats/multiaddr-matcher" "^1.1.0" + it-protobuf-stream "^1.1.1" + protons-runtime "^5.0.0" + uint8arraylist "^2.4.7" + uint8arrays "^5.0.0" + wherearewe "^2.0.1" + +"@chainsafe/libp2p-noise@^15.0.0": + version "15.0.0" + resolved "https://registry.yarnpkg.com/@chainsafe/libp2p-noise/-/libp2p-noise-15.0.0.tgz#c3f38a31d03d96b475f7e35b592a22f5fe9269a0" + integrity sha512-O8Y/WVU4J/qrnG72jwVhbmdXiBzv1dT9B3PMClCRmZ9z/5vVPEGRVXE/SVYeGF3bNuBTLoh+F+GaKG/9UHlMhg== dependencies: "@chainsafe/as-chacha20poly1305" "^0.1.0" "@chainsafe/as-sha256" "^0.4.1" - "@libp2p/crypto" "^5.0.0" - "@libp2p/interface" "^2.0.0" - "@libp2p/peer-id" "^5.0.0" - "@noble/ciphers" "^0.6.0" + "@libp2p/crypto" "^4.0.0" + "@libp2p/interface" "^1.0.0" + "@libp2p/peer-id" "^4.0.0" + "@noble/ciphers" "^0.4.0" "@noble/curves" "^1.1.0" "@noble/hashes" "^1.3.1" it-length-prefixed "^9.0.1" @@ -566,7 +583,7 @@ it-pair "^2.0.6" it-pipe "^3.0.1" it-stream-types "^2.0.1" - protons-runtime "^5.5.0" + protons-runtime "^5.0.0" uint8arraylist "^2.4.3" uint8arrays "^5.0.0" wherearewe "^2.0.1" @@ -1669,277 +1686,247 @@ yargs "16.2.0" yargs-parser "20.2.4" -"@libp2p/bootstrap@^11.0.4": - version "11.0.7" - resolved "https://registry.yarnpkg.com/@libp2p/bootstrap/-/bootstrap-11.0.7.tgz#ecb14834fff03a184a3a7fd211d2ef85b3002fc6" - integrity sha512-PRDMVXf67+ASYTco6APqPy4HF03mQ8UX+BbBZcMAMpnlPsetYfWgQg3YiBe56J+PVQLs0FPsGpfLmAg7PUguQA== +"@libp2p/bootstrap@^10.0.21": + version "10.0.21" + resolved "https://registry.yarnpkg.com/@libp2p/bootstrap/-/bootstrap-10.0.21.tgz#be8b528604dc9634002f54d978ce6d5648d6a3ff" + integrity sha512-a9OGwyRM1ucq7ECUaxB4HdNoxCj21vXHcKce9khf44V5rUngF8Qzy07DI6/OaPyxJlXlDS19IJ7igaiYKx0TJw== dependencies: - "@libp2p/interface" "^2.1.2" - "@libp2p/interface-internal" "^2.0.7" - "@libp2p/peer-id" "^5.0.4" + "@libp2p/interface" "^1.3.0" + "@libp2p/peer-id" "^4.1.0" "@multiformats/mafmt" "^12.1.6" - "@multiformats/multiaddr" "^12.2.3" + "@multiformats/multiaddr" "^12.2.1" -"@libp2p/crypto@^5.0.0", "@libp2p/crypto@^5.0.1", "@libp2p/crypto@^5.0.4": - version "5.0.4" - resolved "https://registry.yarnpkg.com/@libp2p/crypto/-/crypto-5.0.4.tgz#26f24025f3dd2be959360c6b58c94ccadb04ed63" - integrity sha512-v5xsngOlDu8JP3GQDvK+2YYzTELl7/aPfXPbIzKEcy7ON2hu79t1BZMuavjPsr+WWIPNg5yKst6IJfRilzwXRQ== +"@libp2p/crypto@^4.0.0", "@libp2p/crypto@^4.0.1", "@libp2p/crypto@^4.1.0": + version "4.1.0" + resolved "https://registry.yarnpkg.com/@libp2p/crypto/-/crypto-4.1.0.tgz#722060a77ced262dc89c7e42fc19ae67506b74ac" + integrity sha512-Gu4jkSdrVk1LOeyiOAuktmtN5pbSq6b9byzch2CfclFGZgXrHg3b46I0Fy63nZBc60Wq2KID3MQMVuRkVkDwAw== dependencies: - "@libp2p/interface" "^2.1.2" + "@libp2p/interface" "^1.3.0" "@noble/curves" "^1.4.0" "@noble/hashes" "^1.4.0" asn1js "^3.0.5" multiformats "^13.1.0" protons-runtime "^5.4.0" uint8arraylist "^2.4.8" - uint8arrays "^5.1.0" - -"@libp2p/identify@^3.0.4": - version "3.0.7" - resolved "https://registry.yarnpkg.com/@libp2p/identify/-/identify-3.0.7.tgz#a7541d6775cf652314bf2209b281b402e8dedc35" - integrity sha512-4Ns/0HN9lvQAox8eaJruKXakOtikduk6kPlz+KYmFMgVE5/kRBRf7h0aK/8cyU9sQPbSZLCaJ3gBWoDrfMIu2w== - dependencies: - "@libp2p/crypto" "^5.0.4" - "@libp2p/interface" "^2.1.2" - "@libp2p/interface-internal" "^2.0.7" - "@libp2p/peer-id" "^5.0.4" - "@libp2p/peer-record" "^8.0.7" - "@libp2p/utils" "^6.1.0" - "@multiformats/multiaddr" "^12.2.3" - "@multiformats/multiaddr-matcher" "^1.2.1" - it-drain "^3.0.7" - it-parallel "^3.0.7" - it-protobuf-stream "^1.1.3" + uint8arrays "^5.0.3" + +"@libp2p/identify@^1.0.20": + version "1.0.20" + resolved "https://registry.yarnpkg.com/@libp2p/identify/-/identify-1.0.20.tgz#cce6c4efad77afe6c0b26b0704a902f2fdbaeab2" + integrity sha512-bhn57ZI4MIMn0p3S6YNc8Sr5ReA8We8bVU25lNAefVUO3gMeQOMZ6FdTVJKbxoSumvZ+q8ciB2IOvu4rMU7o1g== + dependencies: + "@libp2p/interface" "^1.3.0" + "@libp2p/interface-internal" "^1.1.1" + "@libp2p/peer-id" "^4.1.0" + "@libp2p/peer-record" "^7.0.15" + "@multiformats/multiaddr" "^12.2.1" + "@multiformats/multiaddr-matcher" "^1.2.0" + it-protobuf-stream "^1.1.2" protons-runtime "^5.4.0" uint8arraylist "^2.4.8" - uint8arrays "^5.1.0" + uint8arrays "^5.0.3" wherearewe "^2.0.1" -"@libp2p/interface-internal@^2.0.0", "@libp2p/interface-internal@^2.0.7": - version "2.0.7" - resolved "https://registry.yarnpkg.com/@libp2p/interface-internal/-/interface-internal-2.0.7.tgz#ceefa71553ce5aec9be793fcc646680f7d289806" - integrity sha512-numJBYHajL7W1BuURkQ4tlZ4sUGNGI3GWkhTmL2fS+LxYS2hUVTxcemHtUZGpcJQ17GiCqq+j4GE3bkBagOb0g== - dependencies: - "@libp2p/interface" "^2.1.2" - "@libp2p/peer-collections" "^6.0.7" - "@multiformats/multiaddr" "^12.2.3" - progress-events "^1.0.0" - uint8arraylist "^2.4.8" - -"@libp2p/interface@^1.7.0": - version "1.7.0" - resolved "https://registry.yarnpkg.com/@libp2p/interface/-/interface-1.7.0.tgz#b75b6032a6b0d0d5a13e551dcf4d481a8ca9a88f" - integrity sha512-/zFyaIaIGW0aihhsH7/93vQdpWInUzFocxF11RO/029Y6h0SVjs24HHbils+DqaFDTqN+L7oNlBx2rM2MnmTjA== +"@libp2p/interface-internal@^1.0.7", "@libp2p/interface-internal@^1.1.1": + version "1.1.1" + resolved "https://registry.yarnpkg.com/@libp2p/interface-internal/-/interface-internal-1.1.1.tgz#ff16b4fee4a3d3e39121e26eeeab42e9257f5f49" + integrity sha512-lLPd7yysXqpb1oiPZAn57w3CQdD33C+mu6pfUuPYI5yWMgwWq8V3XE4IMG1IyHUGEYZAuGglghAH9YQNbtticw== dependencies: - "@multiformats/multiaddr" "^12.2.3" - it-pushable "^3.2.3" - it-stream-types "^2.0.1" - multiformats "^13.1.0" - progress-events "^1.0.0" + "@libp2p/interface" "^1.3.0" + "@libp2p/peer-collections" "^5.1.11" + "@multiformats/multiaddr" "^12.2.1" uint8arraylist "^2.4.8" -"@libp2p/interface@^2.0.0", "@libp2p/interface@^2.0.1", "@libp2p/interface@^2.1.2": - version "2.1.2" - resolved "https://registry.yarnpkg.com/@libp2p/interface/-/interface-2.1.2.tgz#7b38047a7d2d35a6a4e0f0f22fbdeeec98b85321" - integrity sha512-uD4NapC+1qGX7RmgC1aehQm3pMs1MpO1DwuhUlAo1M6CyNxfs1Ha9jhg2T+G4u4CAJM6wffZTyPGnKnrR+M8Fw== +"@libp2p/interface@^1.0.0", "@libp2p/interface@^1.1.1", "@libp2p/interface@^1.1.2", "@libp2p/interface@^1.3.0": + version "1.3.0" + resolved "https://registry.yarnpkg.com/@libp2p/interface/-/interface-1.3.0.tgz#c4fcee2878aa8d37357974b6c7395cb2a645eb50" + integrity sha512-K72Km0Co1Z+pXpggWuoAvUUbvwZYvjCcywrHj2Ym3jt2anTE3hzL4rlZrrkzA0YhNTRFRiZ04dnu6WMXT5/4+A== dependencies: - "@multiformats/multiaddr" "^12.2.3" + "@multiformats/multiaddr" "^12.2.1" it-pushable "^3.2.3" it-stream-types "^2.0.1" multiformats "^13.1.0" progress-events "^1.0.0" uint8arraylist "^2.4.8" -"@libp2p/logger@^4.0.6": - version "4.0.20" - resolved "https://registry.yarnpkg.com/@libp2p/logger/-/logger-4.0.20.tgz#bcb7fa83f3803d8ec37926747a18108728589c13" - integrity sha512-TTh2dhHsOTAlMPxSa9ncFPHa/0jTt+0AQxwHdlxg/OGLAgc9VRhnrhHUbJZp07Crcw4T/MOfS4KhjlxgqYgJRw== +"@libp2p/logger@^4.0.11", "@libp2p/logger@^4.0.6": + version "4.0.11" + resolved "https://registry.yarnpkg.com/@libp2p/logger/-/logger-4.0.11.tgz#671692a0cceee73a0c0bf9b5f05ea14fde05f5e5" + integrity sha512-WsZBup1Q+ec4C7i2YiCx0elFrejqJea3Fmkzy3t4fAek7Ofyh4GQonk3A4R7XsG5yq8+Hu1fpsGhIK8EVQsqZQ== dependencies: - "@libp2p/interface" "^1.7.0" - "@multiformats/multiaddr" "^12.2.3" + "@libp2p/interface" "^1.3.0" + "@multiformats/multiaddr" "^12.2.1" + debug "^4.3.4" interface-datastore "^8.2.11" multiformats "^13.1.0" - weald "^1.0.2" -"@libp2p/logger@^5.1.0": - version "5.1.0" - resolved "https://registry.yarnpkg.com/@libp2p/logger/-/logger-5.1.0.tgz#d580e2ee89e3f4224129cc12d727b45494aad6e5" - integrity sha512-hmkk1TONYRe+kKs5QTxkayIfj9qicp8hcrJ1Ac9QfTW/jdaUlnqd1uop4QcOD5GV6qNMq+v1qaMFWFYSN9RcPA== +"@libp2p/mdns@^10.0.21": + version "10.0.21" + resolved "https://registry.yarnpkg.com/@libp2p/mdns/-/mdns-10.0.21.tgz#028a388b73de703e4c762fd4937f217648c8128c" + integrity sha512-/lmjsZJvhfEXeSodqKECiRZk8mqApESc3OI6MhHxNvRBsfncY93IZM7lR6jwlmyQ2DOL5rCkm2rcr9geIsVzmQ== dependencies: - "@libp2p/interface" "^2.1.2" - "@multiformats/multiaddr" "^12.2.3" - interface-datastore "^8.3.0" - multiformats "^13.1.0" - weald "^1.0.2" - -"@libp2p/mdns@^11.0.4": - version "11.0.7" - resolved "https://registry.yarnpkg.com/@libp2p/mdns/-/mdns-11.0.7.tgz#ab968f952085a59d3ea829727e79f631fa049376" - integrity sha512-CW0MbN2bQvSVsZmYT8Ul5a2TOiwhU3aBKyHyCuf5WA70Nu6Lc72YSc+vRT2EIw5Ihb+dbxC/mXrhY1xKdXaWCg== - dependencies: - "@libp2p/interface" "^2.1.2" - "@libp2p/interface-internal" "^2.0.7" - "@libp2p/peer-id" "^5.0.4" - "@libp2p/utils" "^6.1.0" - "@multiformats/multiaddr" "^12.2.3" + "@libp2p/interface" "^1.3.0" + "@libp2p/interface-internal" "^1.1.1" + "@libp2p/peer-id" "^4.1.0" + "@libp2p/utils" "^5.3.2" + "@multiformats/multiaddr" "^12.2.1" "@types/multicast-dns" "^7.2.4" dns-packet "^5.6.1" multicast-dns "^7.2.5" -"@libp2p/mplex@^11.0.4": - version "11.0.7" - resolved "https://registry.yarnpkg.com/@libp2p/mplex/-/mplex-11.0.7.tgz#18f5af4d59bbd9bdf64c9ddda30020c6b674010d" - integrity sha512-q13aTXf6+kEQk67bnlDnXBy8TAU19zxrNrxzwTTW3m9HEyPEKoA1YJuSqZuDjxfP31BbMshs3xxnlXgph5SpUw== +"@libp2p/mplex@^10.0.21": + version "10.0.21" + resolved "https://registry.yarnpkg.com/@libp2p/mplex/-/mplex-10.0.21.tgz#530de45f23dd36d5ac35e21a1c259767c5bfdab1" + integrity sha512-F7pK/xG9LNG3KhZBMb6SsiR7MI18na1x1e1qr8EvlyJcmdT0OiiHCnjDXWrmy+wh6uTD2qhRM+ea1vQEhKANXw== dependencies: - "@libp2p/interface" "^2.1.2" - "@libp2p/utils" "^6.1.0" + "@libp2p/interface" "^1.3.0" + "@libp2p/utils" "^5.3.2" it-pipe "^3.0.1" it-pushable "^3.2.3" it-stream-types "^2.0.1" uint8-varint "^2.0.4" uint8arraylist "^2.4.8" - uint8arrays "^5.1.0" + uint8arrays "^5.0.3" -"@libp2p/multistream-select@^6.0.5": - version "6.0.5" - resolved "https://registry.yarnpkg.com/@libp2p/multistream-select/-/multistream-select-6.0.5.tgz#919c923ac13573a44de6945695f1d1882ba35da4" - integrity sha512-iOMHcF/NzeShmnRLf9KI39bgfxptklbf6Tv9NvBbICfYO/IJB6KDI6bOif5eXXqUqZjHrQJ3jrRppOEwk2HV4g== +"@libp2p/multistream-select@^5.1.8": + version "5.1.8" + resolved "https://registry.yarnpkg.com/@libp2p/multistream-select/-/multistream-select-5.1.8.tgz#c484534496625da2a20873874b33e90d3ef2a95e" + integrity sha512-mYbYyjKhNOGIaS3kefs+koofGmiBvLukcnS+BVCZDGjYxAjhaes9PB++VyuX/D0lTZSk08P3cIBvw2sN+amOVQ== dependencies: - "@libp2p/interface" "^2.1.2" + "@libp2p/interface" "^1.3.0" it-length-prefixed "^9.0.4" - it-length-prefixed-stream "^1.1.7" + it-length-prefixed-stream "^1.1.6" it-stream-types "^2.0.1" p-defer "^4.0.1" race-signal "^1.0.2" uint8-varint "^2.0.4" uint8arraylist "^2.4.8" - uint8arrays "^5.1.0" + uint8arrays "^5.0.3" -"@libp2p/peer-collections@^6.0.7": - version "6.0.7" - resolved "https://registry.yarnpkg.com/@libp2p/peer-collections/-/peer-collections-6.0.7.tgz#8347e08aebbdf4a39962bb87e5ae86cc0aadfcb4" - integrity sha512-e3o994iEUvPR58x8Y5iE6lvrkv48oJXp/A1XIxMB4D/kA4OlY5BjDpHpR4nE4+EkzhIbslbMLAfip2FStyjtHg== +"@libp2p/peer-collections@^5.1.11": + version "5.1.11" + resolved "https://registry.yarnpkg.com/@libp2p/peer-collections/-/peer-collections-5.1.11.tgz#55589fccb4daf6a9f611f3e4126d2721d856aaca" + integrity sha512-w8ZeXfsAxBQiYgRnvpD3mxGORxwAXFsIhAOxFXl8scFhuE1j086PoTfRTuKYfp4DAyNHWkhUd+LQaXN0OG/Fgg== dependencies: - "@libp2p/interface" "^2.1.2" - "@libp2p/peer-id" "^5.0.4" - "@libp2p/utils" "^6.1.0" - multiformats "^13.2.2" + "@libp2p/interface" "^1.3.0" + "@libp2p/peer-id" "^4.1.0" -"@libp2p/peer-id@^5.0.0", "@libp2p/peer-id@^5.0.1", "@libp2p/peer-id@^5.0.4": - version "5.0.4" - resolved "https://registry.yarnpkg.com/@libp2p/peer-id/-/peer-id-5.0.4.tgz#5a71f449b97098a5b12631b6be898a016a82c6bb" - integrity sha512-CHNbQ4Odlc+YDTtv6BzWdGSaJ1I3Wb6iHNV7YB59v0ivSsd0NzlR31qWpK/ByUAMT+hfzQzR1dK9s3e7zS4/zQ== +"@libp2p/peer-id-factory@^4.1.0": + version "4.1.0" + resolved "https://registry.yarnpkg.com/@libp2p/peer-id-factory/-/peer-id-factory-4.1.0.tgz#e134ff61c38d1a0fd210bf1fbdcd9116a74f2919" + integrity sha512-EMovpqtqj+5s+QpzSkVundoPQ88/GQMShB79Y6zLUkGZ73VtqWds/9e1WsrHBx6HhvmkmXFOrzcW8qfml3sE7A== + dependencies: + "@libp2p/crypto" "^4.1.0" + "@libp2p/interface" "^1.3.0" + "@libp2p/peer-id" "^4.1.0" + protons-runtime "^5.4.0" + uint8arraylist "^2.4.8" + uint8arrays "^5.0.3" + +"@libp2p/peer-id@^4.0.0", "@libp2p/peer-id@^4.0.4", "@libp2p/peer-id@^4.0.5", "@libp2p/peer-id@^4.1.0": + version "4.1.0" + resolved "https://registry.yarnpkg.com/@libp2p/peer-id/-/peer-id-4.1.0.tgz#460e07d5b25339cf80afcb5e30c4f701423d1755" + integrity sha512-XmuqEfz3H+Cwq72V3opXg7wK2WnB08VEnG5nLILefLg+qo1KMlUP5pCP3ffyvYIvxMnsRla/xPYRDEBtL2JMpg== dependencies: - "@libp2p/crypto" "^5.0.4" - "@libp2p/interface" "^2.1.2" + "@libp2p/interface" "^1.3.0" multiformats "^13.1.0" - uint8arrays "^5.1.0" - -"@libp2p/peer-record@^8.0.7": - version "8.0.7" - resolved "https://registry.yarnpkg.com/@libp2p/peer-record/-/peer-record-8.0.7.tgz#a092b2405e1130b8211f8ef15748b453096029d8" - integrity sha512-YsN8R+5O0MQwYQ0UGqERJJVRx7hAU4/nxiby91wzbgdfuL4qVPXHG4k0OAAtxVGLYa0q7KeXBpBG8qoaKhOXMQ== - dependencies: - "@libp2p/crypto" "^5.0.4" - "@libp2p/interface" "^2.1.2" - "@libp2p/peer-id" "^5.0.4" - "@libp2p/utils" "^6.1.0" - "@multiformats/multiaddr" "^12.2.3" - multiformats "^13.2.2" + uint8arrays "^5.0.3" + +"@libp2p/peer-record@^7.0.15", "@libp2p/peer-record@^7.0.7": + version "7.0.15" + resolved "https://registry.yarnpkg.com/@libp2p/peer-record/-/peer-record-7.0.15.tgz#063f302fb52ebe6c548a4533e3fa3b910efdfc84" + integrity sha512-VNDjLAuDF+CHf50+50CZQeT341kJm0GuWhuOqlzonOlJihpm5314Xe1BV3oeLgrtdp1ikLvQ099JqZN/l4KIQQ== + dependencies: + "@libp2p/crypto" "^4.1.0" + "@libp2p/interface" "^1.3.0" + "@libp2p/peer-id" "^4.1.0" + "@libp2p/utils" "^5.3.2" + "@multiformats/multiaddr" "^12.2.1" protons-runtime "^5.4.0" uint8-varint "^2.0.4" uint8arraylist "^2.4.8" - uint8arrays "^5.1.0" - -"@libp2p/peer-store@^11.0.7": - version "11.0.7" - resolved "https://registry.yarnpkg.com/@libp2p/peer-store/-/peer-store-11.0.7.tgz#e9a57d8a0ce1b3d0559a11b7e6633620f4297276" - integrity sha512-h8W/XVYfKTmJhhnh2Mdub23CzPv24l5g1RRwFsEKCkWAe95M/fvDMPTM2ahRUB64qfnFT5X4XNFFyJFMsVtjLA== - dependencies: - "@libp2p/crypto" "^5.0.4" - "@libp2p/interface" "^2.1.2" - "@libp2p/peer-collections" "^6.0.7" - "@libp2p/peer-id" "^5.0.4" - "@libp2p/peer-record" "^8.0.7" - "@multiformats/multiaddr" "^12.2.3" - interface-datastore "^8.3.0" - it-all "^3.0.6" + uint8arrays "^5.0.3" + +"@libp2p/peer-store@^10.0.16": + version "10.0.16" + resolved "https://registry.yarnpkg.com/@libp2p/peer-store/-/peer-store-10.0.16.tgz#0bde6e2185e416a137d8adb7b2c381bfe4acf535" + integrity sha512-xzitLNXnCG8eAs3KT5j0sBkK0ooChv4QDqjEzCNr+Gzwryi2fn386KlPoCGNkbeAUsIHS81TY/ldK8o8NBac7Q== + dependencies: + "@libp2p/interface" "^1.3.0" + "@libp2p/peer-collections" "^5.1.11" + "@libp2p/peer-id" "^4.1.0" + "@libp2p/peer-record" "^7.0.15" + "@multiformats/multiaddr" "^12.2.1" + interface-datastore "^8.2.11" + it-all "^3.0.4" mortice "^3.0.4" multiformats "^13.1.0" protons-runtime "^5.4.0" uint8arraylist "^2.4.8" - uint8arrays "^5.1.0" + uint8arrays "^5.0.3" -"@libp2p/prometheus-metrics@^4.1.2": - version "4.2.1" - resolved "https://registry.yarnpkg.com/@libp2p/prometheus-metrics/-/prometheus-metrics-4.2.1.tgz#a563e05cac1f67a161824301cacdfd659bc3052c" - integrity sha512-Mt93FWjP1Jz5G/FsG7cf0J4Y1nYs4eQvx1RjtuEghoQcSzD8nSupeMt67YRQG87R/qrs0jdiGtYxmoCoagsIDw== +"@libp2p/prometheus-metrics@^3.0.21": + version "3.0.21" + resolved "https://registry.yarnpkg.com/@libp2p/prometheus-metrics/-/prometheus-metrics-3.0.21.tgz#78b3327a614aacc62886597d6c6eb67c5597b8db" + integrity sha512-sqU8pI9CG/b86YUEt3IaE3ZSbauBfKbxFRdSiYVRN8EbliGxQC9blgwUcGDfWW2qcXZEgM4m2FTDLZrujFDbzA== dependencies: - "@libp2p/interface" "^2.1.2" - it-foreach "^2.1.0" + "@libp2p/interface" "^1.3.0" + it-foreach "^2.0.6" it-stream-types "^2.0.1" - prom-client "^15.1.2" + prom-client "^15.1.1" uint8arraylist "^2.4.8" -"@libp2p/pubsub@^10.0.0": - version "10.0.7" - resolved "https://registry.yarnpkg.com/@libp2p/pubsub/-/pubsub-10.0.7.tgz#1b7e0b7e96b75a8a1f557171ef4d72c17879e5c0" - integrity sha512-XYAYaASilesqxonjhiEENF/jXoT3jcftNYySkiyajrw3rZnLVkfJMRese3lkFqkIZqy7K/7aAtYEDJLeSrJDiQ== - dependencies: - "@libp2p/crypto" "^5.0.4" - "@libp2p/interface" "^2.1.2" - "@libp2p/interface-internal" "^2.0.7" - "@libp2p/peer-collections" "^6.0.7" - "@libp2p/peer-id" "^5.0.4" - "@libp2p/utils" "^6.1.0" +"@libp2p/pubsub@^9.0.8": + version "9.0.16" + resolved "https://registry.yarnpkg.com/@libp2p/pubsub/-/pubsub-9.0.16.tgz#90857f494213f7a596df15081956514728e14aa2" + integrity sha512-SCV0eZuYMyhHhBFzUBslHjvfwKfL2UMZSSr08c7MsTrqvQQSVdiCEeGKfoR70h7BUvBBQkPLcCqTFZGRoYX8dA== + dependencies: + "@libp2p/crypto" "^4.1.0" + "@libp2p/interface" "^1.3.0" + "@libp2p/interface-internal" "^1.1.1" + "@libp2p/peer-collections" "^5.1.11" + "@libp2p/peer-id" "^4.1.0" + "@libp2p/utils" "^5.3.2" it-length-prefixed "^9.0.4" it-pipe "^3.0.1" it-pushable "^3.2.3" multiformats "^13.1.0" p-queue "^8.0.1" uint8arraylist "^2.4.8" - uint8arrays "^5.1.0" + uint8arrays "^5.0.3" -"@libp2p/tcp@10.0.4": - version "10.0.4" - resolved "https://registry.yarnpkg.com/@libp2p/tcp/-/tcp-10.0.4.tgz#9fdcd4ef5940816d366ee29e7e8150a5a4bd2f11" - integrity sha512-53WIxkKNMHJphTK/VUJvL5jPrkEitZpZqUSA8zN7e02OXwwOC/X3U03xvVFdrjGL32rW524+7I+SrvS+hVdNCw== +"@libp2p/tcp@9.0.23": + version "9.0.23" + resolved "https://registry.yarnpkg.com/@libp2p/tcp/-/tcp-9.0.23.tgz#44eed016fdbe4725726d451a67af548507f5591b" + integrity sha512-ERX7b//PEmy4AwhjkjLx83ZpfwTlrbDt12TEn4+ZDqtsx1lzgCjuNVUy3joSWMu9ySIvMjnzxm7mxlkAJd8buw== dependencies: - "@libp2p/interface" "^2.1.2" - "@libp2p/utils" "^6.0.4" + "@libp2p/interface" "^1.3.0" + "@libp2p/utils" "^5.3.2" "@multiformats/mafmt" "^12.1.6" - "@multiformats/multiaddr" "^12.2.3" + "@multiformats/multiaddr" "^12.2.1" "@types/sinon" "^17.0.3" - progress-events "^1.0.0" - stream-to-it "^1.0.1" + stream-to-it "^1.0.0" -"@libp2p/utils@^6.0.4", "@libp2p/utils@^6.1.0": - version "6.1.0" - resolved "https://registry.yarnpkg.com/@libp2p/utils/-/utils-6.1.0.tgz#5ccece78a38bec2c2d759136ccc78494838c2b87" - integrity sha512-pxuUI8QgeS06bMZRpy0JnACPhrrCJS5/rVNTcnQK8lV1ag2bjwkGG/359AwjeEolzYQeLrmmqnZyawd1Y74wpw== +"@libp2p/utils@^5.3.2": + version "5.3.2" + resolved "https://registry.yarnpkg.com/@libp2p/utils/-/utils-5.3.2.tgz#044881910350fb22ed0f9db35e6f68f7e8948801" + integrity sha512-3HVixx17xT7JCEY931Gd2E2WmtY0RQirDeb6OZ1YD0T3VdWUMxH7pdf1gZpCHjQTg18ISIItZnFCGy+NyoYv6Q== dependencies: "@chainsafe/is-ip" "^2.0.2" - "@libp2p/crypto" "^5.0.4" - "@libp2p/interface" "^2.1.2" - "@libp2p/logger" "^5.1.0" - "@multiformats/multiaddr" "^12.2.3" - "@sindresorhus/fnv1a" "^3.1.0" - "@types/murmurhash3js-revisited" "^3.0.3" - any-signal "^4.1.1" + "@libp2p/interface" "^1.3.0" + "@libp2p/logger" "^4.0.11" + "@multiformats/multiaddr" "^12.2.1" + "@multiformats/multiaddr-matcher" "^1.2.0" delay "^6.0.0" get-iterator "^2.0.1" is-loopback-addr "^2.0.2" - it-foreach "^2.1.1" - it-pipe "^3.0.1" it-pushable "^3.2.3" it-stream-types "^2.0.1" - murmurhash3js-revisited "^3.0.0" netmask "^2.0.2" p-defer "^4.0.1" - race-event "^1.3.0" + race-event "^1.2.0" race-signal "^1.0.2" uint8arraylist "^2.4.8" - uint8arrays "^5.1.0" "@lukeed/ms@^2.0.2": version "2.0.2" @@ -2006,7 +1993,7 @@ outvariant "^1.2.1" strict-event-emitter "^0.5.1" -"@multiformats/dns@^1.0.3", "@multiformats/dns@^1.0.6": +"@multiformats/dns@^1.0.3", "@multiformats/dns@^1.0.5": version "1.0.6" resolved "https://registry.yarnpkg.com/@multiformats/dns/-/dns-1.0.6.tgz#b8c7de11459a02a5f4e609d35d3cdb95cb6ad152" integrity sha512-nt/5UqjMPtyvkG9BQYdJ4GfLK3nMqGpFZOzf4hAmIa0sJh2LlS9YKXZ4FgwBDsaHvzZqR/rUFIywIc7pkHNNuw== @@ -2026,22 +2013,23 @@ dependencies: "@multiformats/multiaddr" "^12.0.0" -"@multiformats/multiaddr-matcher@^1.2.1": - version "1.2.4" - resolved "https://registry.yarnpkg.com/@multiformats/multiaddr-matcher/-/multiaddr-matcher-1.2.4.tgz#affb3c63b5cd83b44156be19583981651373ec2e" - integrity sha512-GgpqzQFL4Mj8t7cLNHC5nuYUuSm0kTtSUyYswiyWwTSUY3XwRAMx0UiFWQg+ETk0u+/IvFaHxfnyEoH3tasvwg== +"@multiformats/multiaddr-matcher@^1.1.0", "@multiformats/multiaddr-matcher@^1.2.0": + version "1.2.0" + resolved "https://registry.yarnpkg.com/@multiformats/multiaddr-matcher/-/multiaddr-matcher-1.2.0.tgz#8a2beae9eff394861668e6a2776fb1e7bf719c81" + integrity sha512-LH6yR7h3HSNKcxuvvi2UpLuowuVkYC6H9Y3jqmKuTai8XtKnXtW6NcDZFD/ooTBY+H4yX/scoJpjOalHrk5qdQ== dependencies: "@chainsafe/is-ip" "^2.0.1" "@multiformats/multiaddr" "^12.0.0" multiformats "^13.0.0" -"@multiformats/multiaddr@^12.0.0", "@multiformats/multiaddr@^12.1.10", "@multiformats/multiaddr@^12.1.14", "@multiformats/multiaddr@^12.1.3", "@multiformats/multiaddr@^12.2.3": - version "12.3.1" - resolved "https://registry.yarnpkg.com/@multiformats/multiaddr/-/multiaddr-12.3.1.tgz#953ceb4ae3b39125b7b2c721230ea7b398cf49fe" - integrity sha512-yoGODQY4nIj41ENJClucS8FtBoe8w682bzbKldEQr9lSlfdHqAsRC+vpJAOBpiMwPps1tHua4kxrDmvprdhoDQ== +"@multiformats/multiaddr@^12.0.0", "@multiformats/multiaddr@^12.1.10", "@multiformats/multiaddr@^12.1.14", "@multiformats/multiaddr@^12.1.3", "@multiformats/multiaddr@^12.2.1": + version "12.2.1" + resolved "https://registry.yarnpkg.com/@multiformats/multiaddr/-/multiaddr-12.2.1.tgz#d95d1590b17dbe39dcefbb4d832d14434d3fe075" + integrity sha512-UwjoArBbv64FlaetV4DDwh+PUMfzXUBltxQwdh+uTYnGFzVa8ZfJsn1vt1RJlJ6+Xtrm3RMekF/B+K338i2L5Q== dependencies: "@chainsafe/is-ip" "^2.0.1" "@chainsafe/netmask" "^2.0.0" + "@libp2p/interface" "^1.0.0" "@multiformats/dns" "^1.0.3" multiformats "^13.0.0" uint8-varint "^2.0.1" @@ -2112,19 +2100,12 @@ resolved "https://registry.yarnpkg.com/@napi-rs/snappy-win32-x64-msvc/-/snappy-win32-x64-msvc-7.2.2.tgz#4f598d3a5d50904d9f72433819f68b21eaec4f7d" integrity sha512-a43cyx1nK0daw6BZxVcvDEXxKMFLSBSDTAhsFD0VqSKcC7MGUBMaqyoWUcMiI7LBSz4bxUmxDWKfCYzpEmeb3w== -"@noble/ciphers@^0.6.0": - version "0.6.0" - resolved "https://registry.yarnpkg.com/@noble/ciphers/-/ciphers-0.6.0.tgz#a3d82c72ce71ba43128e7eb71757b5ecb75b1273" - integrity sha512-mIbq/R9QXk5/cTfESb1OKtyFnk7oc1Om/8onA1158K9/OZUQFDEVy55jVTato+xmp3XX6F6Qh0zz0Nc1AxAlRQ== - -"@noble/curves@1.4.2", "@noble/curves@~1.4.0": - version "1.4.2" - resolved "https://registry.yarnpkg.com/@noble/curves/-/curves-1.4.2.tgz#40309198c76ed71bc6dbf7ba24e81ceb4d0d1fe9" - integrity sha512-TavHr8qycMChk8UwMld0ZDRvatedkzWfH8IiaeGCfymOP5i0hSCozz9vHOL0nkwk7HRMlFnAiKpS2jrUmSybcw== - dependencies: - "@noble/hashes" "1.4.0" +"@noble/ciphers@^0.4.0": + version "0.4.0" + resolved "https://registry.yarnpkg.com/@noble/ciphers/-/ciphers-0.4.0.tgz#e3f69e3ce935683dd8dadb636652a5cb5cd5958c" + integrity sha512-xaUaUUDWbHIFSxaQ/pIe+33VG2mfJp6N/KxKLmZr5biWdNznCAmfu24QRhX10BbVAuqOahAoyp0S4M9md6GPDw== -"@noble/curves@^1.1.0": +"@noble/curves@1.3.0", "@noble/curves@^1.1.0", "@noble/curves@~1.3.0": version "1.3.0" resolved "https://registry.yarnpkg.com/@noble/curves/-/curves-1.3.0.tgz#01be46da4fd195822dab821e72f71bf4aeec635e" integrity sha512-t01iSXPuN+Eqzb4eBX0S5oubSqXbK/xXa1Ne18Hj8f9pStxztHCE2gfboSp/dZRLSqfuLpRK2nDXDK+W9puocA== @@ -2143,12 +2124,12 @@ resolved "https://registry.yarnpkg.com/@noble/hashes/-/hashes-1.1.2.tgz#e9e035b9b166ca0af657a7848eb2718f0f22f183" integrity sha512-KYRCASVTv6aeUi1tsF8/vpyR7zpfs3FUzy2Jqm+MU+LmUKhQ0y2FpfwqkCcxSg2ua4GALJd8k2R76WxwZGbQpA== -"@noble/hashes@1.3.3", "@noble/hashes@^1.0.0", "@noble/hashes@^1.3.0", "@noble/hashes@^1.3.1": +"@noble/hashes@1.3.3", "@noble/hashes@^1.0.0", "@noble/hashes@^1.3.0", "@noble/hashes@^1.3.1", "@noble/hashes@~1.3.2": version "1.3.3" resolved "https://registry.yarnpkg.com/@noble/hashes/-/hashes-1.3.3.tgz#39908da56a4adc270147bb07968bf3b16cfe1699" integrity sha512-V7/fPHgl+jsVPXqqeOzT8egNj2iBIVt+ECeMMG8TdcnTikP3oaBtUVqpT/gYCR68aEBJSF+XbYUxStjbFMqIIA== -"@noble/hashes@1.4.0", "@noble/hashes@^1.4.0", "@noble/hashes@~1.4.0": +"@noble/hashes@1.4.0", "@noble/hashes@^1.4.0": version "1.4.0" resolved "https://registry.yarnpkg.com/@noble/hashes/-/hashes-1.4.0.tgz#45814aa329f30e4fe0ba49426f49dfccdd066426" integrity sha512-V1JJ1WTRUqHHrOSh597hURcMqVKVGL/ea3kv0gSnEdsEZ0/+VyPghM1lMNGc00z7CIQorSvbKpuJkxvuHbvdbg== @@ -2721,11 +2702,11 @@ integrity sha512-2LuNTFBIO0m7kKIQvvPHN6UE63VjpmL9rnEEaOOaiSPbZK+zUOYIzBAWcED+3XYzhYsd/0mD57VdxAEqqV52CQ== "@puppeteer/browsers@1.4.6", "@puppeteer/browsers@^1.6.0", "@puppeteer/browsers@^2.1.0": - version "2.4.0" - resolved "https://registry.yarnpkg.com/@puppeteer/browsers/-/browsers-2.4.0.tgz#a0dd0f4e381e53f509109ae83b891db5972750f5" - integrity sha512-x8J1csfIygOwf6D6qUAZ0ASk3z63zPb7wkNeHRerCMh82qWKUrOgkuP005AJC8lDL6/evtXETGEJVcwykKT4/g== + version "2.3.0" + resolved "https://registry.yarnpkg.com/@puppeteer/browsers/-/browsers-2.3.0.tgz#791ea7d80450fea24eb19fb1d70c367ad4e08cae" + integrity sha512-ioXoq9gPxkss4MYhD+SFaU9p1IHFUX0ILAWFPyjGaBdjLsYAlZw6j1iLA0N/m12uVHLFDfSYNF7EQccjinIMDA== dependencies: - debug "^4.3.6" + debug "^4.3.5" extract-zip "^2.0.1" progress "^2.0.3" proxy-agent "^6.4.0" @@ -2889,27 +2870,27 @@ resolved "https://registry.yarnpkg.com/@scure/base/-/base-1.0.0.tgz#109fb595021de285f05a7db6806f2f48296fcee7" integrity sha512-gIVaYhUsy+9s58m/ETjSJVKHhKTBMmcRb9cEV5/5dwvfDlfORjKrFsDeDHWRrm6RjcPvCLZFwGJjAjLj1gg4HA== -"@scure/base@~1.1.6": - version "1.1.8" - resolved "https://registry.yarnpkg.com/@scure/base/-/base-1.1.8.tgz#8f23646c352f020c83bca750a82789e246d42b50" - integrity sha512-6CyAclxj3Nb0XT7GHK6K4zK6k2xJm6E4Ft0Ohjt4WgegiFUHEtFb2CGzmPmGBwoIhrLsqNLYfLr04Y1GePrzZg== +"@scure/base@~1.1.4": + version "1.1.5" + resolved "https://registry.yarnpkg.com/@scure/base/-/base-1.1.5.tgz#1d85d17269fe97694b9c592552dd9e5e33552157" + integrity sha512-Brj9FiG2W1MRQSTB212YVPRrcbjkv48FoZi/u4l/zds/ieRrqsh7aUf6CLwkAq61oKXr/ZlTzlY66gLIj3TFTQ== -"@scure/bip32@1.4.0": - version "1.4.0" - resolved "https://registry.yarnpkg.com/@scure/bip32/-/bip32-1.4.0.tgz#4e1f1e196abedcef395b33b9674a042524e20d67" - integrity sha512-sVUpc0Vq3tXCkDGYVWGIZTRfnvu8LoTDaev7vbwh0omSvVORONr960MQWdKqJDCReIEmTj3PAr73O3aoxz7OPg== +"@scure/bip32@1.3.3": + version "1.3.3" + resolved "https://registry.yarnpkg.com/@scure/bip32/-/bip32-1.3.3.tgz#a9624991dc8767087c57999a5d79488f48eae6c8" + integrity sha512-LJaN3HwRbfQK0X1xFSi0Q9amqOgzQnnDngIt+ZlsBC3Bm7/nE7K0kwshZHyaru79yIVRv/e1mQAjZyuZG6jOFQ== dependencies: - "@noble/curves" "~1.4.0" - "@noble/hashes" "~1.4.0" - "@scure/base" "~1.1.6" + "@noble/curves" "~1.3.0" + "@noble/hashes" "~1.3.2" + "@scure/base" "~1.1.4" -"@scure/bip39@1.3.0": - version "1.3.0" - resolved "https://registry.yarnpkg.com/@scure/bip39/-/bip39-1.3.0.tgz#0f258c16823ddd00739461ac31398b4e7d6a18c3" - integrity sha512-disdg7gHuTDZtY+ZdkmLpPCk7fxZSu3gBiEGuoC1XYxv9cGx3Z6cpTggCgW6odSOOIXCiDjuGejW+aJKCY/pIQ== +"@scure/bip39@1.2.2": + version "1.2.2" + resolved "https://registry.yarnpkg.com/@scure/bip39/-/bip39-1.2.2.tgz#f3426813f4ced11a47489cbcf7294aa963966527" + integrity sha512-HYf9TUXG80beW+hGAt3TRM8wU6pQoYur9iNypTROm42dorCGmLnFe3eWjz3gOq6G62H2WRh0FCzAR1PI+29zIA== dependencies: - "@noble/hashes" "~1.4.0" - "@scure/base" "~1.1.6" + "@noble/hashes" "~1.3.2" + "@scure/base" "~1.1.4" "@scure/bip39@^1.0.0": version "1.0.0" @@ -2953,11 +2934,6 @@ resolved "https://registry.yarnpkg.com/@sinclair/typebox/-/typebox-0.27.8.tgz#6667fac16c436b5434a387a34dedb013198f6e6e" integrity sha512-+Fj43pSMwJs4KRrH/938Uf+uAELIgVBmQzg/q1YG10djyfA3TnrU8N8XzqCh/okZdszqBQTZf96idMfE5lnwTA== -"@sindresorhus/fnv1a@^3.1.0": - version "3.1.0" - resolved "https://registry.yarnpkg.com/@sindresorhus/fnv1a/-/fnv1a-3.1.0.tgz#f8e46597298f6fd4c12dc901cdd4e73beb4d24fa" - integrity sha512-KV321z5m/0nuAg83W1dPLy85HpHDk7Sdi4fJbwvacWsEhAh+rZUW4ZfGcXmUIvjZg4ss2bcwNlRhJ7GBEUG08w== - "@sindresorhus/is@^4.0.0": version "4.6.0" resolved "https://registry.yarnpkg.com/@sindresorhus/is/-/is-4.6.0.tgz#3c7c9c46e678feefe7a2e5bb609d3dbd665ffb3f" @@ -3272,11 +3248,6 @@ "@types/dns-packet" "*" "@types/node" "*" -"@types/murmurhash3js-revisited@^3.0.3": - version "3.0.3" - resolved "https://registry.yarnpkg.com/@types/murmurhash3js-revisited/-/murmurhash3js-revisited-3.0.3.tgz#94e247168a18342477639126da8f01353437e8d0" - integrity sha512-QvlqvYtGBYIDeO8dFdY4djkRubcrc+yTJtBc7n8VZPlJDUS/00A+PssbvERM8f9bYRmcaSEHPZgZojeQj7kzAA== - "@types/mute-stream@^0.0.4": version "0.0.4" resolved "https://registry.yarnpkg.com/@types/mute-stream/-/mute-stream-0.0.4.tgz#77208e56a08767af6c5e1237be8888e2f255c478" @@ -3365,11 +3336,6 @@ resolved "https://registry.npmjs.org/@types/retry/-/retry-0.12.1.tgz" integrity sha512-xoDlM2S4ortawSWORYqsdU+2rxdh4LRW9ytc3zmT37RIKQh6IHyKwwtKhKis9ah8ol07DCkZxPt8BBvPjC6v4g== -"@types/retry@0.12.2": - version "0.12.2" - resolved "https://registry.yarnpkg.com/@types/retry/-/retry-0.12.2.tgz#ed279a64fa438bb69f2480eda44937912bb7480a" - integrity sha512-XISRgDJ2Tc5q4TRqvgJtzsRkFYNJzZrhTdtMoGVBttwzzQJkPnS3WWTFc7kuDRoPtPakl+T+OfdEUjYJj7Jbow== - "@types/sinon@^17.0.3": version "17.0.3" resolved "https://registry.yarnpkg.com/@types/sinon/-/sinon-17.0.3.tgz#9aa7e62f0a323b9ead177ed23a36ea757141a5fa" @@ -3752,19 +3718,6 @@ abstract-level@^1.0.0, abstract-level@^1.0.2, abstract-level@^1.0.3: module-error "^1.0.1" queue-microtask "^1.2.3" -abstract-level@^1.0.4: - version "1.0.4" - resolved "https://registry.yarnpkg.com/abstract-level/-/abstract-level-1.0.4.tgz#3ad8d684c51cc9cbc9cf9612a7100b716c414b57" - integrity sha512-eUP/6pbXBkMbXFdx4IH2fVgvB7M0JvR7/lIL33zcs0IBcwjdzSSl31TOJsaCzmKSSDF9h8QYSOJux4Nd4YJqFg== - dependencies: - buffer "^6.0.3" - catering "^2.1.0" - is-buffer "^2.0.5" - level-supports "^4.0.0" - level-transcoder "^1.0.1" - module-error "^1.0.1" - queue-microtask "^1.2.3" - abstract-logging@^2.0.1: version "2.0.1" resolved "https://registry.yarnpkg.com/abstract-logging/-/abstract-logging-2.0.1.tgz#6b0c371df212db7129b57d2e7fcf282b8bf1c839" @@ -5396,14 +5349,15 @@ data-urls@^5.0.0: whatwg-mimetype "^4.0.0" whatwg-url "^14.0.0" -datastore-core@10.0.0, datastore-core@^10.0.0: - version "10.0.0" - resolved "https://registry.yarnpkg.com/datastore-core/-/datastore-core-10.0.0.tgz#86abe346338e88c3326fb7aeb90eff3613cf542f" - integrity sha512-/b5KDmSAIFizS/ZzTTU+ZdfOcQc6mRmbc4/EK/WOzbEO5c0KWyjRLsZ3DWwh9wiPu93V7pX1oC+Or61k8UPPsg== +datastore-core@^9.0.0, datastore-core@^9.1.1, datastore-core@^9.2.9: + version "9.2.9" + resolved "https://registry.yarnpkg.com/datastore-core/-/datastore-core-9.2.9.tgz#74b4dd53d4597b59038488ba5f92a7f81769f8df" + integrity sha512-wraWTPsbtdE7FFaVo3pwPuTB/zXsgwGGAm8BgBYwYAuzZCTS0MfXmd/HH1vR9s0/NFFjOVmBkGiWCvKxZ+QjVw== dependencies: "@libp2p/logger" "^4.0.6" + err-code "^3.0.1" interface-datastore "^8.0.0" - interface-store "6.0.0" + interface-store "^5.0.0" it-drain "^3.0.5" it-filter "^3.0.4" it-map "^3.0.5" @@ -5413,19 +5367,18 @@ datastore-core@10.0.0, datastore-core@^10.0.0: it-sort "^3.0.4" it-take "^3.0.4" -datastore-level@*, datastore-level@^11.0.0: - version "11.0.0" - resolved "https://registry.yarnpkg.com/datastore-level/-/datastore-level-11.0.0.tgz#c0f7324bd74e15bec01f2911f5740fbf59c344f7" - integrity sha512-ATSEfGoWTAHgDeZaYukeHu0FgyhjW3FKUw3XtcIpfBl4UF2kLNnYRBfzCeH+3RA0QaZvbSWpgYk6Gwf7m1oCtg== +datastore-level@*, datastore-level@^10.1.1: + version "10.1.1" + resolved "https://registry.yarnpkg.com/datastore-level/-/datastore-level-10.1.1.tgz#390dc6ca17dc691947a3e81c984b4b6064812e81" + integrity sha512-4fQPf/6fIXdcC0XZPGMiNuoOmF82Vhdz+LPTmbzR+CbbnCri6eOcFdzBPnDsAAuPOCV6Zld1EhgM2cRArw1+sQ== dependencies: - datastore-core "10.0.0" + datastore-core "^9.0.0" interface-datastore "^8.0.0" - interface-store "6.0.0" - it-filter "^3.0.4" - it-map "^3.0.5" - it-sort "^3.0.4" - it-take "^3.0.4" - level "^8.0.1" + it-filter "^3.0.0" + it-map "^3.0.1" + it-sort "^3.0.1" + it-take "^3.0.1" + level "^8.0.0" dateformat@^3.0.3: version "3.0.3" @@ -5451,13 +5404,6 @@ debug@^4.3.5: dependencies: ms "2.1.2" -debug@^4.3.6: - version "4.3.7" - resolved "https://registry.yarnpkg.com/debug/-/debug-4.3.7.tgz#87945b4151a011d76d95a198d7111c865c360a52" - integrity sha512-Er2nc/H7RrMXZBFCEim6TCmMk02Z8vLC2Rbi1KEBggpo0fS6l0S1nnapwmIi3yW/+GOJap1Krg4w0Hg80oCqgQ== - dependencies: - ms "^2.1.3" - decamelize-keys@^1.1.0: version "1.1.0" resolved "https://registry.yarnpkg.com/decamelize-keys/-/decamelize-keys-1.1.0.tgz#d171a87933252807eb3cb61dc1c1445d078df2d9" @@ -6055,15 +6001,15 @@ esutils@^2.0.2: resolved "https://registry.npmjs.org/esutils/-/esutils-2.0.3.tgz" integrity sha512-kVscqXk4OCp68SZ0dkgEKVi6/8ij300KBWTJq32P/dYeWTSwK41WyTxalN1eRmA5Z9UU/LX9D7FWSmV9SAYx6g== -ethereum-cryptography@^2.0.0, ethereum-cryptography@^2.2.0: - version "2.2.1" - resolved "https://registry.yarnpkg.com/ethereum-cryptography/-/ethereum-cryptography-2.2.1.tgz#58f2810f8e020aecb97de8c8c76147600b0b8ccf" - integrity sha512-r/W8lkHSiTLxUxW8Rf3u4HGB0xQweG2RyETjywylKZSzLWoWAijRz8WCuOtJ6wah+avllXBqZuk29HCCvhEIRg== +ethereum-cryptography@^2.0.0, ethereum-cryptography@^2.1.3: + version "2.1.3" + resolved "https://registry.yarnpkg.com/ethereum-cryptography/-/ethereum-cryptography-2.1.3.tgz#1352270ed3b339fe25af5ceeadcf1b9c8e30768a" + integrity sha512-BlwbIL7/P45W8FGW2r7LGuvoEZ+7PWsniMvQ4p5s2xCyw9tmaDlpfsN9HjAucbF+t/qpVHwZUisgfK24TCW8aA== dependencies: - "@noble/curves" "1.4.2" - "@noble/hashes" "1.4.0" - "@scure/bip32" "1.4.0" - "@scure/bip39" "1.3.0" + "@noble/curves" "1.3.0" + "@noble/hashes" "1.3.3" + "@scure/bip32" "1.3.3" + "@scure/bip39" "1.2.2" ethers@^5.7.1: version "5.7.2" @@ -7450,18 +7396,18 @@ inquirer@^9.1.5: through "^2.3.6" wrap-ansi "^8.1.0" -interface-datastore@^8.0.0, interface-datastore@^8.2.11, interface-datastore@^8.3.0: - version "8.3.0" - resolved "https://registry.yarnpkg.com/interface-datastore/-/interface-datastore-8.3.0.tgz#0ce9a2f0f61f9fbe1c1734c6d10a0265193689f7" - integrity sha512-RM/rTSmRcnoCwGZIHrPm+nlGYVoT4R0lcFvNnDyhdFT4R6BuHHhfFP47UldVEjs98SfxLuMhaNMsyjI918saHw== +interface-datastore@^8.0.0, interface-datastore@^8.2.11, interface-datastore@^8.2.7: + version "8.2.11" + resolved "https://registry.yarnpkg.com/interface-datastore/-/interface-datastore-8.2.11.tgz#1d555ce6218ab6cba6291fc361debe9713590207" + integrity sha512-9E0iXehfp/j0UbZ2mvlYB4K9pP7uQBCppfuy8WHs1EHF6wLQrM9+zwyX+8Qt6HnH4GKZRyXX/CNXm6oD4+QYgA== dependencies: - interface-store "6.0.0" + interface-store "^5.0.0" uint8arrays "^5.0.2" -interface-store@6.0.0: - version "6.0.0" - resolved "https://registry.yarnpkg.com/interface-store/-/interface-store-6.0.0.tgz#8d8277a582f69d819134e125b686e147099a4728" - integrity sha512-HkjsDPsjA7SKkCr+TH1elUQApAAM3X3JPwrz3vFzaf614wI+ZD6GVvwKGZCHYcbSRqeZP/uzVPqezzeISeo5kA== +interface-store@^5.0.0: + version "5.1.0" + resolved "https://registry.yarnpkg.com/interface-store/-/interface-store-5.1.0.tgz#1735cead844fe452d62c307fafbaaa1d261e6ff3" + integrity sha512-mjUwX3XSoreoxCS3sXS3pSRsGnUjl9T06KBqt/T7AgE9Sgp4diH64ZyURJKnj2T5WmCvTbC0Dm+mwQV5hfLSBQ== internal-slot@^1.0.5: version "1.0.5" @@ -7647,11 +7593,6 @@ is-negative-zero@^2.0.2: resolved "https://registry.yarnpkg.com/is-negative-zero/-/is-negative-zero-2.0.2.tgz#7bf6f03a28003b8b3965de3ac26f664d765f3150" integrity sha512-dqJvarLawXsFbNDeJW7zAz8ItJ9cd28YufuuFzh0G8pNHjJMnY08Dv7sYX2uF5UpQOwieAeOExEYAWWfu7ZZUA== -is-network-error@^1.0.0: - version "1.1.0" - resolved "https://registry.yarnpkg.com/is-network-error/-/is-network-error-1.1.0.tgz#d26a760e3770226d11c169052f266a4803d9c997" - integrity sha512-tUdRRAnhT+OtCZR/LxZelH/C7QtjtFrTu5tXCA8pl55eTUElUHT+GPYV8MBMBvea/j+NxQqVt3LbWMRir7Gx9g== - is-node-process@^1.2.0: version "1.2.0" resolved "https://registry.yarnpkg.com/is-node-process/-/is-node-process-1.2.0.tgz#ea02a1b90ddb3934a19aea414e88edef7e11d134" @@ -7876,11 +7817,6 @@ it-all@^3.0.0, it-all@^3.0.4: resolved "https://registry.yarnpkg.com/it-all/-/it-all-3.0.4.tgz#08f2e3eb3df04fa4525a343dcacfbdf91ffee162" integrity sha512-UMiy0i9DqCHBdWvMbzdYvVGa5/w4t1cc4nchpbnjdLhklglv8mQeEYnii0gvKESJuL1zV32Cqdb33R6/GPfxpQ== -it-all@^3.0.6: - version "3.0.6" - resolved "https://registry.yarnpkg.com/it-all/-/it-all-3.0.6.tgz#30a4f922ae9ca0945b0f720d3478ae6f5b6707ab" - integrity sha512-HXZWbxCgQZJfrv5rXvaVeaayXED8nTKx9tj9fpBhmcUJcedVZshMMMqTj0RG2+scGypb9Ut1zd1ifbf3lA8L+Q== - it-byte-stream@^1.0.0: version "1.0.0" resolved "https://registry.yarnpkg.com/it-byte-stream/-/it-byte-stream-1.0.0.tgz#07645e1c94444760bc7abecebf187b83777b0351" @@ -7890,38 +7826,29 @@ it-byte-stream@^1.0.0: it-stream-types "^2.0.1" uint8arraylist "^2.4.1" -it-byte-stream@^1.0.12: - version "1.1.0" - resolved "https://registry.yarnpkg.com/it-byte-stream/-/it-byte-stream-1.1.0.tgz#f5b80b713fb71a34cbff2390b7232b103cf625bb" - integrity sha512-WWponBWdKEa6o2U3NX+wGMY8X1EkWXcQvpC+3CUqKb4ZzK30q3EPqiTjFxLf9tNVgdF/MNAtx/XclpVfgaz9KQ== - dependencies: - it-queueless-pushable "^1.0.0" - it-stream-types "^2.0.1" - uint8arraylist "^2.4.8" - -it-drain@^3.0.3, it-drain@^3.0.5, it-drain@^3.0.7: +it-drain@^3.0.3, it-drain@^3.0.5: version "3.0.7" resolved "https://registry.yarnpkg.com/it-drain/-/it-drain-3.0.7.tgz#671a5d0220802c5bce9e68fc2b07088540fbc674" integrity sha512-vy6S1JKjjHSIFHgBpLpD1zhkCRl3z1zYWUxE14+kAYf+BL9ssWSFImJfhl361IIcwr0ofw8etzg11VqqB+ntUA== -it-filter@^3.0.4: +it-filter@^3.0.0, it-filter@^3.0.4: version "3.1.0" resolved "https://registry.yarnpkg.com/it-filter/-/it-filter-3.1.0.tgz#16e2914f7f54de44a19c03eb8289027643f33a1b" integrity sha512-FiYuzdsUhmMZJTJQ8YLdgX3ArjQmAtCG1lyrtZd+92/2eC6YO9UoybdrwVj/yyZkuXAPykrSipLuZ+KSKpt29A== dependencies: it-peekable "^3.0.0" -it-foreach@^2.1.0, it-foreach@^2.1.1: - version "2.1.1" - resolved "https://registry.yarnpkg.com/it-foreach/-/it-foreach-2.1.1.tgz#93e311a1057dd0ff7631f914dc9c2c963f27a4b8" - integrity sha512-ID4Gxnavk/LVQLQESAQ9hR6dR63Ih6X+8VdxEktX8rpz2dCGAbZpey/eljTNbMfV2UKXHiu6UsneoNBZuac97g== +it-foreach@^2.0.6: + version "2.1.0" + resolved "https://registry.yarnpkg.com/it-foreach/-/it-foreach-2.1.0.tgz#37dd606d92d93ac82ee3fdeffeec7f9f8dd76cf8" + integrity sha512-nobWUecq9E2ED1kcXz2o27yN6KePauSdmxJNMwCduWByrF4WNB2UgBHjr9QV2jPXpEWPDuzxZas9fVhQj1Vovg== dependencies: it-peekable "^3.0.0" -it-length-prefixed-stream@^1.0.0, it-length-prefixed-stream@^1.1.7: - version "1.2.0" - resolved "https://registry.yarnpkg.com/it-length-prefixed-stream/-/it-length-prefixed-stream-1.2.0.tgz#1f6ad78c60dea3b16364f86a0b78058f4d66a04e" - integrity sha512-vX7dzSl/2UMYYsAr0FQdPNVR5xYEETaeboZ+eXxNBjgARuvxnWA6OedW8lC5/J3ebMTC98JhA3eH76eTijUOsA== +it-length-prefixed-stream@^1.0.0, it-length-prefixed-stream@^1.1.6: + version "1.1.7" + resolved "https://registry.yarnpkg.com/it-length-prefixed-stream/-/it-length-prefixed-stream-1.1.7.tgz#de4fec7da005f9a593e3eccd901c183154be09f9" + integrity sha512-tH38h/wChpR6As/PD6yWZlpoMuB4wDW2Rxf3QbSt4+O1HTsLYbyZasNhTyIuvQqhebQ30OYrdM0yr9ig5qUvYQ== dependencies: it-byte-stream "^1.0.0" it-stream-types "^2.0.1" @@ -7940,14 +7867,14 @@ it-length-prefixed@^9.0.1, it-length-prefixed@^9.0.4: uint8arraylist "^2.0.0" uint8arrays "^5.0.1" -it-map@^3.0.5: +it-map@^3.0.1, it-map@^3.0.5: version "3.1.0" resolved "https://registry.yarnpkg.com/it-map/-/it-map-3.1.0.tgz#a66e5447d2ed8167ff90d19b183f6a3f8ae6e1b9" integrity sha512-B7zNmHYRE0qes8oTiNYU7jXEF5WvKZNAUosskCks1JT9Z4DNwRClrQyd+C/hgITG8ewDbVZMGx9VXAx3KMY2kA== dependencies: it-peekable "^3.0.0" -it-merge@^3.0.0, it-merge@^3.0.3, it-merge@^3.0.5: +it-merge@^3.0.0, it-merge@^3.0.3: version "3.0.5" resolved "https://registry.yarnpkg.com/it-merge/-/it-merge-3.0.5.tgz#2b0d1d07c825b9d20c4c2889aab8e07322fd803e" integrity sha512-2l7+mPf85pyRF5pqi0dKcA54E5Jm/2FyY5GsOaN51Ta0ipC7YZ3szuAsH8wOoB6eKY4XsU4k2X+mzPmFBMayEA== @@ -7962,12 +7889,12 @@ it-pair@^2.0.6: it-stream-types "^2.0.1" p-defer "^4.0.0" -it-parallel@^3.0.7: - version "3.0.8" - resolved "https://registry.yarnpkg.com/it-parallel/-/it-parallel-3.0.8.tgz#fb4a5344732ddae9eff7c7b21908aa1f223638d4" - integrity sha512-URLhs6eG4Hdr4OdvgBBPDzOjBeSSmI+Kqex2rv/aAyYClME26RYHirLVhZsZP5M+ZP6M34iRlXk8Wlqtezuqpg== +it-parallel@^3.0.6: + version "3.0.6" + resolved "https://registry.yarnpkg.com/it-parallel/-/it-parallel-3.0.6.tgz#d8f9efa56dac5f960545b3a148d2ca171694d228" + integrity sha512-i7UM7I9LTkDJw3YIqXHFAPZX6CWYzGc+X3irdNrVExI4vPazrJdI7t5OqrSVN8CONXLAunCiqaSV/zZRbQR56A== dependencies: - p-defer "^4.0.1" + p-defer "^4.0.0" it-peekable@^3.0.0: version "3.0.1" @@ -7983,10 +7910,10 @@ it-pipe@^3.0.1: it-pushable "^3.1.2" it-stream-types "^2.0.1" -it-protobuf-stream@^1.1.3: - version "1.1.5" - resolved "https://registry.yarnpkg.com/it-protobuf-stream/-/it-protobuf-stream-1.1.5.tgz#70da43abfb6beaaf7c53262d8cfd176d463b08f0" - integrity sha512-H70idW45As3cEbU4uSoZ9IYHUIV3YM69/2mmXYR7gOlPabWjuyNi3/abK11geiiq3la27Sos/mXr68JljjKtEQ== +it-protobuf-stream@^1.1.1, it-protobuf-stream@^1.1.2: + version "1.1.3" + resolved "https://registry.yarnpkg.com/it-protobuf-stream/-/it-protobuf-stream-1.1.3.tgz#66d95ad55b66827fbd057e45bd411917437bc116" + integrity sha512-96n+e6X8CXL0JerxTJuEnfivmfLzGKpIGAlJLoH7HEGo2nPRrMe+HxeWGwDF4Un3FphI/Z62JNxSvq/5DxfiQw== dependencies: it-length-prefixed-stream "^1.0.0" it-stream-types "^2.0.1" @@ -7999,14 +7926,6 @@ it-pushable@^3.1.2, it-pushable@^3.2.0, it-pushable@^3.2.3: dependencies: p-defer "^4.0.0" -it-queueless-pushable@^1.0.0: - version "1.0.0" - resolved "https://registry.yarnpkg.com/it-queueless-pushable/-/it-queueless-pushable-1.0.0.tgz#917b52964cd6465d6436f923552c407c5ee3d11c" - integrity sha512-HbcAbcuQj7a9EBxiRCZ+77FxWutgs/pY5ZvEyQnylWPGNFojCLAUwhcZjf5OuEQ9+y+vSa7w1GQBe8xJdmIn5A== - dependencies: - p-defer "^4.0.1" - race-signal "^1.0.2" - it-reader@^6.0.1: version "6.0.4" resolved "https://registry.yarnpkg.com/it-reader/-/it-reader-6.0.4.tgz#439cb88225dcd15116be0ffde9e846a928c3871a" @@ -8015,7 +7934,7 @@ it-reader@^6.0.1: it-stream-types "^2.0.1" uint8arraylist "^2.0.0" -it-sort@^3.0.4: +it-sort@^3.0.1, it-sort@^3.0.4: version "3.0.5" resolved "https://registry.yarnpkg.com/it-sort/-/it-sort-3.0.5.tgz#7209710c64e83e130659e00b2e42df4b36643f7e" integrity sha512-vFo3wYR+aRDwklp8iH8LKeePmWqXGQrS8JqEdZmbJ58DIGj67n0RT/t5BR8iYps/C/v5IdWsbow1bOCEUfY+hA== @@ -8027,7 +7946,7 @@ it-stream-types@^2.0.1: resolved "https://registry.yarnpkg.com/it-stream-types/-/it-stream-types-2.0.1.tgz#69cb4d7e79e707b8257a8997e02751ccb6c3af32" integrity sha512-6DmOs5r7ERDbvS4q8yLKENcj6Yecr7QQTqWApbZdfAUTEC947d+PEha7PCqhm//9oxaLYL7TWRekwhoXl2s6fg== -it-take@^3.0.4: +it-take@^3.0.1, it-take@^3.0.4: version "3.0.5" resolved "https://registry.yarnpkg.com/it-take/-/it-take-3.0.5.tgz#c5a82cb160d5d7767954d84c6ce30d680f884b77" integrity sha512-4CzqXzx7FAeXsRYBTH0GhkxerH8Sv0nEGIXrO0ZIpECHth59Dm9ZYZ161VPrCQccWIL/Vu6M9YptlbMiEpCIlQ== @@ -8388,15 +8307,6 @@ level@^8.0.0: browser-level "^1.0.1" classic-level "^1.2.0" -level@^8.0.1: - version "8.0.1" - resolved "https://registry.yarnpkg.com/level/-/level-8.0.1.tgz#737161db1bc317193aca4e7b6f436e7e1df64379" - integrity sha512-oPBGkheysuw7DmzFQYyFe8NAia5jFLAgEnkgWnK3OXAuJr8qFT+xBQIwokAZPME2bhPFzS8hlYcL16m8UZrtwQ== - dependencies: - abstract-level "^1.0.4" - browser-level "^1.0.1" - classic-level "^1.2.0" - libnpmaccess@7.0.2: version "7.0.2" resolved "https://registry.yarnpkg.com/libnpmaccess/-/libnpmaccess-7.0.2.tgz#7f056c8c933dd9c8ba771fa6493556b53c5aac52" @@ -8419,37 +8329,32 @@ libnpmpublish@7.3.0: sigstore "^1.4.0" ssri "^10.0.1" -libp2p@2.1.7: - version "2.1.7" - resolved "https://registry.yarnpkg.com/libp2p/-/libp2p-2.1.7.tgz#e0d921cba459c78c63d783aafea6ead98a75e57f" - integrity sha512-nUxws8eHeI4jREZJFNdif20c8jYnqPkmvioI3y/hICgXchkhcKzgT1E3jEd2CVT+isskr5LnJ1n70aw6bt0m6w== - dependencies: - "@libp2p/crypto" "^5.0.4" - "@libp2p/interface" "^2.1.2" - "@libp2p/interface-internal" "^2.0.7" - "@libp2p/logger" "^5.1.0" - "@libp2p/multistream-select" "^6.0.5" - "@libp2p/peer-collections" "^6.0.7" - "@libp2p/peer-id" "^5.0.4" - "@libp2p/peer-store" "^11.0.7" - "@libp2p/utils" "^6.1.0" - "@multiformats/dns" "^1.0.6" - "@multiformats/multiaddr" "^12.2.3" - "@multiformats/multiaddr-matcher" "^1.2.1" +libp2p@1.4.3: + version "1.4.3" + resolved "https://registry.yarnpkg.com/libp2p/-/libp2p-1.4.3.tgz#830453eec2982e5c0faf79558a0aaa87d1e5b150" + integrity sha512-/J+bqE+bYw6iiyPBlBZk1PrZo182f9W1zSzWcMrNy+CQCG/WdJllft/WxvhNKHK1KuIS/JsL9gvhuRhtpqmMKg== + dependencies: + "@libp2p/crypto" "^4.1.0" + "@libp2p/interface" "^1.3.0" + "@libp2p/interface-internal" "^1.1.1" + "@libp2p/logger" "^4.0.11" + "@libp2p/multistream-select" "^5.1.8" + "@libp2p/peer-collections" "^5.1.11" + "@libp2p/peer-id" "^4.1.0" + "@libp2p/peer-id-factory" "^4.1.0" + "@libp2p/peer-store" "^10.0.16" + "@libp2p/utils" "^5.3.2" + "@multiformats/dns" "^1.0.5" + "@multiformats/multiaddr" "^12.2.1" + "@multiformats/multiaddr-matcher" "^1.2.0" any-signal "^4.1.1" - datastore-core "^10.0.0" - interface-datastore "^8.3.0" - it-byte-stream "^1.0.12" - it-merge "^3.0.5" - it-parallel "^3.0.7" + datastore-core "^9.2.9" + interface-datastore "^8.2.11" + it-merge "^3.0.3" + it-parallel "^3.0.6" merge-options "^3.0.4" multiformats "^13.1.0" - p-defer "^4.0.1" - p-retry "^6.2.0" - progress-events "^1.0.0" - race-event "^1.3.0" - race-signal "^1.0.2" - uint8arrays "^5.1.0" + uint8arrays "^5.0.3" light-my-request@^6.0.0: version "6.0.0" @@ -9272,16 +9177,11 @@ ms@2.1.2: resolved "https://registry.yarnpkg.com/ms/-/ms-2.1.2.tgz#d09d1f357b443f493382a8eb3ccd183872ae6009" integrity sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w== -ms@2.1.3, ms@^2.0.0, ms@^2.1.1, ms@^2.1.3: +ms@2.1.3, ms@^2.0.0, ms@^2.1.1: version "2.1.3" resolved "https://registry.yarnpkg.com/ms/-/ms-2.1.3.tgz#574c8138ce1d2b5861f0b44579dbadd60c6615b2" integrity sha512-6FlzubTLZG3J2a/NVCAleEhjzq5oxgHyaCU9yYXvcLsvoVaHJq/s5xXI6/XXP6tz7R9xAOtHnSO/tXtF3WRTlA== -ms@^3.0.0-canary.1: - version "3.0.0-canary.1" - resolved "https://registry.yarnpkg.com/ms/-/ms-3.0.0-canary.1.tgz#c7b34fbce381492fd0b345d1cf56e14d67b77b80" - integrity sha512-kh8ARjh8rMN7Du2igDRO9QJnqCb2xYTJxyQYK7vJJS4TvLLmsbyhiKpSW+t+y26gyOyMd0riphX0GeWKU3ky5g== - msw@^2.3.1: version "2.3.2" resolved "https://registry.yarnpkg.com/msw/-/msw-2.3.2.tgz#ea4f45b51f833fa3b2215c4093bcda28dbe25a83" @@ -9323,10 +9223,10 @@ multiformats@^11.0.1: resolved "https://registry.yarnpkg.com/multiformats/-/multiformats-11.0.2.tgz#b14735efc42cd8581e73895e66bebb9752151b60" integrity sha512-b5mYMkOkARIuVZCpvijFj9a6m5wMVLC7cf/jIPd5D/ARDOfLC5+IFkbgDXQgcU2goIsTD/O9NY4DI/Mt4OGvlg== -multiformats@^13.0.0, multiformats@^13.0.1, multiformats@^13.1.0, multiformats@^13.2.2: - version "13.2.2" - resolved "https://registry.yarnpkg.com/multiformats/-/multiformats-13.2.2.tgz#16da153ee8b68d8c9da31b52176e90b3cd8b43ef" - integrity sha512-RWI+nyf0q64vyOxL8LbKtjJMki0sogRL/8axvklNtiTM0iFCVtHwME9w6+0P1/v4dQvsIg8A45oT3ka1t/M/+A== +multiformats@^13.0.0, multiformats@^13.0.1, multiformats@^13.1.0: + version "13.1.0" + resolved "https://registry.yarnpkg.com/multiformats/-/multiformats-13.1.0.tgz#5aa9d2175108a448fc3bdb54ba8a3d0b6cab3ac3" + integrity sha512-HzdtdBwxsIkzpeXzhQ5mAhhuxcHbjEHH+JQoxt7hG/2HGFjjwyolLo7hbaexcnhoEuV4e0TNJ8kkpMjiEYY4VQ== multimatch@5.0.0: version "5.0.0" @@ -9339,11 +9239,6 @@ multimatch@5.0.0: arrify "^2.0.1" minimatch "^3.0.4" -murmurhash3js-revisited@^3.0.0: - version "3.0.0" - resolved "https://registry.yarnpkg.com/murmurhash3js-revisited/-/murmurhash3js-revisited-3.0.0.tgz#6bd36e25de8f73394222adc6e41fa3fac08a5869" - integrity sha512-/sF3ee6zvScXMb1XFJ8gDsSnY+X8PbOyjIuBhtgis10W2Jx4ZjIhikUCIF9c4gpJxVnQIsPAFrSwTCuAjicP6g== - mute-stream@0.0.8: version "0.0.8" resolved "https://registry.yarnpkg.com/mute-stream/-/mute-stream-0.0.8.tgz#1630c42b2251ff81e2a283de96a5497ea92e5e0d" @@ -10052,15 +9947,6 @@ p-reduce@2.1.0, p-reduce@^2.0.0, p-reduce@^2.1.0: resolved "https://registry.yarnpkg.com/p-reduce/-/p-reduce-2.1.0.tgz#09408da49507c6c274faa31f28df334bc712b64a" integrity sha512-2USApvnsutq8uoxZBGbbWM0JIYLiEMJ9RlaN7fAzVNb9OZN0SHjjTTfIcb667XynS5Y1VhwDJVDa72TnPzAYWw== -p-retry@^6.2.0: - version "6.2.0" - resolved "https://registry.yarnpkg.com/p-retry/-/p-retry-6.2.0.tgz#8d6df01af298750009691ce2f9b3ad2d5968f3bd" - integrity sha512-JA6nkq6hKyWLLasXQXUrO4z8BUZGUt/LjlJxx8Gb2+2ntodU/SS63YZ8b0LUTbQ8ZB9iwOfhEPhg4ykKnn2KsA== - dependencies: - "@types/retry" "0.12.2" - is-network-error "^1.0.0" - retry "^0.13.1" - p-timeout@^3.2.0: version "3.2.0" resolved "https://registry.yarnpkg.com/p-timeout/-/p-timeout-3.2.0.tgz#c7e17abc971d2a7962ef83626b35d635acf23dfe" @@ -10471,10 +10357,10 @@ progress@^2.0.3: resolved "https://registry.npmjs.org/progress/-/progress-2.0.3.tgz" integrity sha512-7PiHtLll5LdnKIMw100I+8xJXR5gW2QwWYkT6iJva0bXitZKa/XMrSbdmg3r2Xnaidz9Qumd0VPaMrZlF9V9sA== -prom-client@^15.1.0, prom-client@^15.1.2: - version "15.1.3" - resolved "https://registry.yarnpkg.com/prom-client/-/prom-client-15.1.3.tgz#69fa8de93a88bc9783173db5f758dc1c69fa8fc2" - integrity sha512-6ZiOBfCywsD4k1BN9IX0uZhF+tJkV8q8llP64G5Hajs4JOeVLPCwpPVcpXy3BwYiUGgyJzsJJQeOIv7+hDSq8g== +prom-client@^15.1.0, prom-client@^15.1.1: + version "15.1.2" + resolved "https://registry.yarnpkg.com/prom-client/-/prom-client-15.1.2.tgz#78d79f12c35d395ca97edf7111c18210cf07f815" + integrity sha512-on3h1iXb04QFLLThrmVYg1SChBQ9N1c+nKAjebBjokBqipddH3uxmOUcEkTnzmJ8Jh/5TSUnUqS40i2QB2dJHQ== dependencies: "@opentelemetry/api" "^1.4.0" tdigest "^0.1.1" @@ -10520,10 +10406,10 @@ protocols@^2.0.0, protocols@^2.0.1: resolved "https://registry.yarnpkg.com/protocols/-/protocols-2.0.1.tgz#8f155da3fc0f32644e83c5782c8e8212ccf70a86" integrity sha512-/XJ368cyBJ7fzLMwLKv1e4vLxOju2MNAIokcr7meSaNcVbWz/CPcW22cP04mwxOErdA5mwjA8Q6w/cdAQxVn7Q== -protons-runtime@^5.4.0, protons-runtime@^5.5.0: - version "5.5.0" - resolved "https://registry.yarnpkg.com/protons-runtime/-/protons-runtime-5.5.0.tgz#ea06d9ef843aad77ea5de3e1ebafa81b58c24570" - integrity sha512-EsALjF9QsrEk6gbCx3lmfHxVN0ah7nG3cY7GySD4xf4g8cr7g543zB88Foh897Sr1RQJ9yDCUsoT1i1H/cVUFA== +protons-runtime@5.4.0, protons-runtime@^5.0.0, protons-runtime@^5.4.0: + version "5.4.0" + resolved "https://registry.yarnpkg.com/protons-runtime/-/protons-runtime-5.4.0.tgz#2751ce22cae6c35eebba89acfd9d783419ae3726" + integrity sha512-XfA++W/WlQOSyjUyuF5lgYBfXZUEMP01Oh1C2dSwZAlF2e/ZrMRPfWonXj6BGM+o8Xciv7w0tsRMKYwYEuQvaw== dependencies: uint8-varint "^2.0.2" uint8arraylist "^2.4.3" @@ -10672,7 +10558,7 @@ quick-lru@^5.1.1: resolved "https://registry.npmjs.org/quick-lru/-/quick-lru-5.1.1.tgz" integrity sha512-WuyALRjWPDGtt/wzJiadO5AXY+8hZ80hVpe6MyivgraREW751X3SbhRvG3eLKOYN+8VEvqLcf3wdnt44Z4S4SA== -race-event@^1.3.0: +race-event@^1.2.0: version "1.3.0" resolved "https://registry.yarnpkg.com/race-event/-/race-event-1.3.0.tgz#854f34118c31addf877898bd9f8e4dcfac9de7a2" integrity sha512-kaLm7axfOnahIqD3jQ4l1e471FIFcEGebXEnhxyLscuUzV8C94xVHtWEqDDXxll7+yu/6lW0w1Ff4HbtvHvOHg== @@ -10968,11 +10854,6 @@ retry@^0.12.0: resolved "https://registry.yarnpkg.com/retry/-/retry-0.12.0.tgz#1b42a6266a21f07421d1b0b54b7dc167b01c013b" integrity sha512-9LkiTwjUh6rT555DtE9rTX+BKByPfrMzEAtnlEtdEwr3Nkffwiihqe2bWADg+OQRjt9gl6ICdmB/ZFDCGAtSow== -retry@^0.13.1: - version "0.13.1" - resolved "https://registry.yarnpkg.com/retry/-/retry-0.13.1.tgz#185b1587acf67919d63b357349e03537b2484658" - integrity sha512-XQBQ3I8W1Cge0Seh+6gjj03LbmRFWuoszgK9ooCpwYIrhhoO80pfq4cUkU5DkknwfOfFteRwlZ56PYOGYyFWdg== - reusify@^1.0.4: version "1.0.4" resolved "https://registry.yarnpkg.com/reusify/-/reusify-1.0.4.tgz#90da382b1e126efc02146e90845a88db12925d76" @@ -11659,7 +11540,7 @@ stream-http@^3.2.0: readable-stream "^3.6.0" xtend "^4.0.2" -stream-to-it@^1.0.1: +stream-to-it@^1.0.0: version "1.0.1" resolved "https://registry.yarnpkg.com/stream-to-it/-/stream-to-it-1.0.1.tgz#7d5e1b04bab70facd48273279bfa49f0d0165950" integrity sha512-AqHYAYPHcmvMrcLNgncE/q0Aj/ajP6A4qGhxP6EVn7K3YTNs0bJpJyk57wc2Heb7MUL64jurvmnmui8D9kjZgA== @@ -11895,11 +11776,6 @@ supports-color@^7.1.0: dependencies: has-flag "^4.0.0" -supports-color@^9.4.0: - version "9.4.0" - resolved "https://registry.yarnpkg.com/supports-color/-/supports-color-9.4.0.tgz#17bfcf686288f531db3dea3215510621ccb55954" - integrity sha512-VL+lNrEoIXww1coLPOmiEmK/0sGigko5COxI09KzHc2VJXJsQ37UaQ+8quuxjDeA7+KnLGTWRyOXSLLR2Wb4jw== - supports-preserve-symlinks-flag@^1.0.0: version "1.0.0" resolved "https://registry.yarnpkg.com/supports-preserve-symlinks-flag/-/supports-preserve-symlinks-flag-1.0.0.tgz#6eda4bd344a3c94aea376d4cc31bc77311039e09" @@ -12431,10 +12307,10 @@ uint8arraylist@^2.0.0, uint8arraylist@^2.4.1, uint8arraylist@^2.4.3, uint8arrayl dependencies: uint8arrays "^5.0.1" -uint8arrays@^5.0.0, uint8arrays@^5.0.1, uint8arrays@^5.0.2, uint8arrays@^5.1.0: - version "5.1.0" - resolved "https://registry.yarnpkg.com/uint8arrays/-/uint8arrays-5.1.0.tgz#14047c9bdf825d025b7391299436e5e50e7270f1" - integrity sha512-vA6nFepEmlSKkMBnLBaUMVvAC4G3CTmO58C12y4sq6WPDOR7mOFYOi7GlrQ4djeSbP6JG9Pv9tJDM97PedRSww== +uint8arrays@^5.0.0, uint8arrays@^5.0.1, uint8arrays@^5.0.2, uint8arrays@^5.0.3: + version "5.0.3" + resolved "https://registry.yarnpkg.com/uint8arrays/-/uint8arrays-5.0.3.tgz#92b894d9c4269ba97c51544d6e1f279fe6f80d1f" + integrity sha512-6LBuKji28kHjgPJMkQ6GDaBb1lRwIhyOYq6pDGwYMoDPfImE9SkuYENVmR0yu9yGgs2clHUSY9fKDukR+AXfqQ== dependencies: multiformats "^13.0.0" @@ -12799,14 +12675,6 @@ wcwidth@^1.0.0, wcwidth@^1.0.1: dependencies: defaults "^1.0.3" -weald@^1.0.2: - version "1.0.2" - resolved "https://registry.yarnpkg.com/weald/-/weald-1.0.2.tgz#a51fb3a8dbf5fa2b71ef09f9a267c86a46742238" - integrity sha512-iG5cIuBwsPe1ZcoGGd4X6QYlepU1vLr4l4oWpzQWqeJPSo9B8bxxyE6xlnj3TCmThtha7gyVL+uuZgUFkPyfDg== - dependencies: - ms "^3.0.0-canary.1" - supports-color "^9.4.0" - web-streams-polyfill@^3.0.3: version "3.2.1" resolved "https://registry.yarnpkg.com/web-streams-polyfill/-/web-streams-polyfill-3.2.1.tgz#71c2718c52b45fd49dbeee88634b3a60ceab42a6" From 4c757cbe097615fa18b97e122f7bc5d73a05f5ac Mon Sep 17 00:00:00 2001 From: Nico Flaig Date: Mon, 28 Oct 2024 15:15:52 +0000 Subject: [PATCH 2/3] feat: add metric to track default validator configuration (#7194) * Add metric to track default validator configuration * Update validator client dashboard * Rename column --- dashboards/lodestar_validator_client.json | 91 ++++++++++++++++++++++- packages/validator/src/metrics.ts | 10 +++ packages/validator/src/validator.ts | 2 + 3 files changed, 100 insertions(+), 3 deletions(-) diff --git a/dashboards/lodestar_validator_client.json b/dashboards/lodestar_validator_client.json index 5e4459d1d1b9..f954f0a04ccd 100644 --- a/dashboards/lodestar_validator_client.json +++ b/dashboards/lodestar_validator_client.json @@ -497,7 +497,7 @@ }, "gridPos": { "h": 3, - "w": 6, + "w": 3, "x": 12, "y": 2 }, @@ -552,8 +552,8 @@ }, "gridPos": { "h": 3, - "w": 6, - "x": 18, + "w": 3, + "x": 15, "y": 2 }, "id": 37, @@ -590,6 +590,91 @@ "title": "Heap used", "type": "stat" }, + { + "datasource": { + "type": "prometheus", + "uid": "${DS_PROMETHEUS}" + }, + "fieldConfig": { + "defaults": { + "color": { + "mode": "thresholds" + }, + "custom": { + "align": "center", + "cellOptions": { + "type": "color-text" + }, + "inspect": false + }, + "mappings": [] + }, + "overrides": [] + }, + "gridPos": { + "h": 3, + "w": 6, + "x": 18, + "y": 2 + }, + "id": 48, + "options": { + "cellHeight": "sm", + "footer": { + "countRows": false, + "enablePagination": false, + "fields": "", + "reducer": [ + "sum" + ], + "show": false + }, + "showHeader": true + }, + "pluginVersion": "10.4.1", + "targets": [ + { + "datasource": { + "type": "prometheus", + "uid": "${DS_PROMETHEUS}" + }, + "editorMode": "code", + "exemplar": false, + "expr": "vc_default_configuration", + "format": "table", + "instant": true, + "legendFormat": "__auto", + "range": false, + "refId": "A" + } + ], + "transformations": [ + { + "id": "organize", + "options": { + "excludeByName": { + "Time": true, + "Value": true, + "__name__": true, + "client_name": true, + "group": true, + "host_type": true, + "instance": true, + "job": true, + "network": true, + "scrape_location": true + }, + "includeByName": {}, + "indexByName": {}, + "renameByName": { + "broadcastValidation": "Broadcast validation", + "builderSelection": "Builder selection" + } + } + } + ], + "type": "table" + }, { "datasource": { "type": "prometheus", diff --git a/packages/validator/src/metrics.ts b/packages/validator/src/metrics.ts index ca693056fc54..1f49c038a50d 100644 --- a/packages/validator/src/metrics.ts +++ b/packages/validator/src/metrics.ts @@ -1,3 +1,4 @@ +import {routes} from "@lodestar/api"; import {MetricsRegisterExtra} from "@lodestar/utils"; export enum MessageSource { @@ -38,6 +39,15 @@ export function getMetrics(register: MetricsRegisterExtra, gitData: LodestarGitD .set(gitData, 1); return { + defaultConfiguration: register.gauge<{ + builderSelection: routes.validator.BuilderSelection; + broadcastValidation: routes.beacon.BroadcastValidation; + }>({ + name: "vc_default_configuration", + help: "Default validator configuration", + labelNames: ["builderSelection", "broadcastValidation"], + }), + // Attestation journey: // - Wait for block or 1/3, call prepare attestation // - Get attestation, sign, call publish diff --git a/packages/validator/src/validator.ts b/packages/validator/src/validator.ts index 1d370c35cc33..09a3a80062da 100644 --- a/packages/validator/src/validator.ts +++ b/packages/validator/src/validator.ts @@ -329,6 +329,8 @@ export class Validator { strictFeeRecipientCheck, }); + metrics?.defaultConfiguration.set({builderSelection: defaultBuilderSelection, broadcastValidation}, 1); + // Instantiates block and attestation services and runs them once the chain has been started. return Validator.init(opts, genesis, metrics); } From 3cd2f1603f5ca7e4af4ad4ebf5c2f6e4531bf405 Mon Sep 17 00:00:00 2001 From: Nico Flaig Date: Mon, 28 Oct 2024 18:27:43 +0000 Subject: [PATCH 3/3] refactor: move WithBytes to types package (#7201) --- packages/beacon-node/src/network/interface.ts | 3 +-- packages/beacon-node/src/network/network.ts | 3 ++- .../src/network/reqresp/beaconBlocksMaybeBlobsByRange.ts | 4 ++-- packages/beacon-node/src/network/reqresp/utils/collect.ts | 2 +- .../network/reqresp/utils/collectSequentialBlocksInRange.ts | 3 +-- packages/beacon-node/src/sync/backfill/verify.ts | 3 +-- packages/beacon-node/test/unit/sync/backfill/verify.test.ts | 3 +-- packages/types/src/types.ts | 6 ++++++ 8 files changed, 15 insertions(+), 12 deletions(-) diff --git a/packages/beacon-node/src/network/interface.ts b/packages/beacon-node/src/network/interface.ts index 8d73379af221..0d48df42b31e 100644 --- a/packages/beacon-node/src/network/interface.ts +++ b/packages/beacon-node/src/network/interface.ts @@ -27,6 +27,7 @@ import { deneb, phase0, SignedAggregateAndProof, + WithBytes, } from "@lodestar/types"; import {PeerIdStr} from "../util/peerId.js"; import {INetworkEventBus} from "./events.js"; @@ -35,8 +36,6 @@ import {GossipType} from "./gossip/interface.js"; import {PendingGossipsubMessage} from "./processor/types.js"; import {PeerAction} from "./peers/index.js"; -export type WithBytes = {data: T; bytes: Uint8Array}; - /** * The architecture of the network looks like so: * - core: diff --git a/packages/beacon-node/src/network/network.ts b/packages/beacon-node/src/network/network.ts index 1b3ccaaaf75a..15414fcf9138 100644 --- a/packages/beacon-node/src/network/network.ts +++ b/packages/beacon-node/src/network/network.ts @@ -18,6 +18,7 @@ import { LightClientOptimisticUpdate, LightClientUpdate, SignedAggregateAndProof, + WithBytes, } from "@lodestar/types"; import {routes} from "@lodestar/api"; import {ResponseIncoming} from "@lodestar/reqresp"; @@ -28,7 +29,7 @@ import {IBeaconDb} from "../db/interface.js"; import {PeerIdStr, peerIdToString} from "../util/peerId.js"; import {IClock} from "../util/clock.js"; import {NetworkOptions} from "./options.js"; -import {WithBytes, INetwork} from "./interface.js"; +import {INetwork} from "./interface.js"; import {ReqRespMethod} from "./reqresp/index.js"; import {GossipHandlers, GossipTopicMap, GossipType, GossipTypeMap} from "./gossip/index.js"; import {PeerAction, PeerScoreStats} from "./peers/index.js"; diff --git a/packages/beacon-node/src/network/reqresp/beaconBlocksMaybeBlobsByRange.ts b/packages/beacon-node/src/network/reqresp/beaconBlocksMaybeBlobsByRange.ts index 8c69c21679ba..3d71087c8fd8 100644 --- a/packages/beacon-node/src/network/reqresp/beaconBlocksMaybeBlobsByRange.ts +++ b/packages/beacon-node/src/network/reqresp/beaconBlocksMaybeBlobsByRange.ts @@ -1,11 +1,11 @@ import {ChainForkConfig} from "@lodestar/config"; -import {deneb, Epoch, phase0, SignedBeaconBlock, Slot} from "@lodestar/types"; +import {deneb, Epoch, phase0, SignedBeaconBlock, Slot, WithBytes} from "@lodestar/types"; import {ForkSeq} from "@lodestar/params"; import {computeEpochAtSlot} from "@lodestar/state-transition"; import {BlobsSource, BlockInput, BlockSource, getBlockInput, BlockInputDataBlobs} from "../../chain/blocks/types.js"; import {PeerIdStr} from "../../util/peerId.js"; -import {INetwork, WithBytes} from "../interface.js"; +import {INetwork} from "../interface.js"; export async function beaconBlocksMaybeBlobsByRange( config: ChainForkConfig, diff --git a/packages/beacon-node/src/network/reqresp/utils/collect.ts b/packages/beacon-node/src/network/reqresp/utils/collect.ts index 06f3cfc36806..9818b1921f8e 100644 --- a/packages/beacon-node/src/network/reqresp/utils/collect.ts +++ b/packages/beacon-node/src/network/reqresp/utils/collect.ts @@ -1,7 +1,7 @@ import {Type} from "@chainsafe/ssz"; import {ResponseIncoming, RequestErrorCode, RequestError} from "@lodestar/reqresp"; +import {WithBytes} from "@lodestar/types"; import {ResponseTypeGetter} from "../types.js"; -import {WithBytes} from "../../interface.js"; /** * Sink for `*`, from diff --git a/packages/beacon-node/src/network/reqresp/utils/collectSequentialBlocksInRange.ts b/packages/beacon-node/src/network/reqresp/utils/collectSequentialBlocksInRange.ts index c2cf0ad16ea0..2709cb3f64a9 100644 --- a/packages/beacon-node/src/network/reqresp/utils/collectSequentialBlocksInRange.ts +++ b/packages/beacon-node/src/network/reqresp/utils/collectSequentialBlocksInRange.ts @@ -1,7 +1,6 @@ import {ResponseIncoming} from "@lodestar/reqresp"; import {LodestarError} from "@lodestar/utils"; -import {phase0, SignedBeaconBlock} from "@lodestar/types"; -import {WithBytes} from "../../interface.js"; +import {phase0, SignedBeaconBlock, WithBytes} from "@lodestar/types"; import {ReqRespMethod, responseSszTypeByMethod} from "../types.js"; import {sszDeserializeResponse} from "./collect.js"; diff --git a/packages/beacon-node/src/sync/backfill/verify.ts b/packages/beacon-node/src/sync/backfill/verify.ts index 462762a5576f..715cc6621253 100644 --- a/packages/beacon-node/src/sync/backfill/verify.ts +++ b/packages/beacon-node/src/sync/backfill/verify.ts @@ -1,9 +1,8 @@ import {CachedBeaconStateAllForks, ISignatureSet, getBlockProposerSignatureSet} from "@lodestar/state-transition"; import {BeaconConfig} from "@lodestar/config"; -import {Root, ssz, Slot, SignedBeaconBlock} from "@lodestar/types"; +import {Root, ssz, Slot, SignedBeaconBlock, WithBytes} from "@lodestar/types"; import {GENESIS_SLOT} from "@lodestar/params"; import {IBlsVerifier} from "../../chain/bls/index.js"; -import {WithBytes} from "../../network/interface.js"; import {BackfillSyncError, BackfillSyncErrorCode} from "./errors.js"; export type BackfillBlockHeader = { diff --git a/packages/beacon-node/test/unit/sync/backfill/verify.test.ts b/packages/beacon-node/test/unit/sync/backfill/verify.test.ts index bba1f7c93f19..3197013455e3 100644 --- a/packages/beacon-node/test/unit/sync/backfill/verify.test.ts +++ b/packages/beacon-node/test/unit/sync/backfill/verify.test.ts @@ -4,9 +4,8 @@ import {fileURLToPath} from "node:url"; import {describe, it, expect} from "vitest"; import {createBeaconConfig} from "@lodestar/config"; import {config} from "@lodestar/config/default"; -import {phase0, ssz} from "@lodestar/types"; +import {phase0, ssz, WithBytes} from "@lodestar/types"; import {verifyBlockSequence} from "../../../../src/sync/backfill/verify.js"; -import {WithBytes} from "../../../../src/network/interface.js"; import {ZERO_HASH} from "../../../../src/constants/constants.js"; import {BackfillSyncErrorCode, BackfillSyncError} from "./../../../../src/sync/backfill/errors.js"; diff --git a/packages/types/src/types.ts b/packages/types/src/types.ts index 51fa2b12a28e..b1919c2f0842 100644 --- a/packages/types/src/types.ts +++ b/packages/types/src/types.ts @@ -32,6 +32,12 @@ export enum ProducedBlockSource { engine = "engine", } +export type WithBytes = { + data: T; + /** SSZ serialized `data` bytes */ + bytes: Uint8Array; +}; + export type WithOptionalBytes = { data: T; /** SSZ serialized `data` bytes */