Skip to content

Commit

Permalink
feat: update libp2p deps (#6711)
Browse files Browse the repository at this point in the history
* feat: update libp2p deps

* chore: fix linter/type errors
  • Loading branch information
wemeetagain authored May 1, 2024
1 parent 122a0f8 commit a215ae2
Show file tree
Hide file tree
Showing 11 changed files with 424 additions and 580 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@
"https-browserify": "^1.0.0",
"jsdom": "^23.0.1",
"lerna": "^7.3.0",
"libp2p": "1.1.1",
"libp2p": "1.4.3",
"mocha": "^10.2.0",
"node-gyp": "^9.4.0",
"npm-run-all": "^4.1.5",
Expand Down
24 changes: 12 additions & 12 deletions packages/beacon-node/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -99,9 +99,9 @@
"@chainsafe/blst": "^1.0.0",
"@chainsafe/discv5": "^9.0.0",
"@chainsafe/enr": "^3.0.0",
"@chainsafe/libp2p-gossipsub": "^11.2.1",
"@chainsafe/libp2p-gossipsub": "^13.0.0",
"@chainsafe/libp2p-identify": "^1.0.0",
"@chainsafe/libp2p-noise": "^14.1.0",
"@chainsafe/libp2p-noise": "^15.0.0",
"@chainsafe/persistent-merkle-tree": "^0.7.1",
"@chainsafe/prometheus-gc-stats": "^1.0.0",
"@chainsafe/ssz": "^0.15.1",
Expand All @@ -111,15 +111,15 @@
"@fastify/cors": "^8.2.1",
"@fastify/swagger": "^8.10.0",
"@fastify/swagger-ui": "^1.9.3",
"@libp2p/bootstrap": "^10.0.10",
"@libp2p/identify": "^1.0.9",
"@libp2p/interface": "^1.1.1",
"@libp2p/mdns": "^10.0.10",
"@libp2p/mplex": "^10.0.10",
"@libp2p/peer-id": "^4.0.4",
"@libp2p/peer-id-factory": "^4.0.3",
"@libp2p/prometheus-metrics": "^3.0.10",
"@libp2p/tcp": "9.0.10",
"@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.18.0",
"@lodestar/config": "^1.18.0",
"@lodestar/db": "^1.18.0",
Expand All @@ -142,7 +142,7 @@
"it-all": "^3.0.4",
"it-pipe": "^3.0.1",
"jwt-simple": "0.5.6",
"libp2p": "1.1.1",
"libp2p": "1.4.3",
"multiformats": "^11.0.1",
"prom-client": "^15.1.0",
"qs": "^6.11.1",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ 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 {PeerId} from "@libp2p/interface";
import {PeerId, Secp256k1PeerId} from "@libp2p/interface";
import {exportToProtobuf} from "@libp2p/peer-id-factory";
import {routes} from "@lodestar/api";
import {BeaconConfig, chainConfigToJson} from "@lodestar/config";
Expand Down Expand Up @@ -110,7 +110,7 @@ export class WorkerNetworkCore implements INetworkCore {
opts,
chainConfigJson: chainConfigToJson(config),
genesisValidatorsRoot: config.genesisValidatorsRoot,
peerIdProto: exportToProtobuf(peerId),
peerIdProto: exportToProtobuf(peerId as Secp256k1PeerId),
localMultiaddrs,
metricsEnabled,
peerStoreDir,
Expand Down
4 changes: 2 additions & 2 deletions packages/beacon-node/src/network/discv5/index.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import EventEmitter from "events";
import {PeerId} from "@libp2p/interface";
import {PeerId, Secp256k1PeerId} from "@libp2p/interface";
import {StrictEventEmitter} from "strict-event-emitter-types";
import {exportToProtobuf} from "@libp2p/peer-id-factory";
import {createPrivateKeyFromPeerId, ENR, ENRData, SignableENR} from "@chainsafe/enr";
Expand Down Expand Up @@ -42,7 +42,7 @@ export class Discv5Worker extends (EventEmitter as {new (): StrictEventEmitter<E
static async init(opts: Discv5Opts): Promise<Discv5Worker> {
const workerData: Discv5WorkerData = {
enr: opts.discv5.enr,
peerIdProto: exportToProtobuf(opts.peerId),
peerIdProto: exportToProtobuf(opts.peerId as Secp256k1PeerId),
bindAddrs: opts.discv5.bindAddrs,
config: opts.discv5.config ?? {},
bootEnrs: opts.discv5.bootEnrs,
Expand Down
2 changes: 1 addition & 1 deletion packages/beacon-node/src/network/gossip/encoding.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ const h64Seed = BigInt(Math.floor(Math.random() * 1e9));
* The function used to generate a gossipsub message id
* We use the first 8 bytes of SHA256(data) for content addressing
*/
export function fastMsgIdFn(rpcMsg: RPC.IMessage): string {
export function fastMsgIdFn(rpcMsg: RPC.Message): string {
if (rpcMsg.data) {
return xxhash.h64Raw(rpcMsg.data, h64Seed).toString(16);
} else {
Expand Down
2 changes: 1 addition & 1 deletion packages/beacon-node/src/network/gossip/gossipsub.ts
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ export class Eth2Gossipsub extends GossipSub {
// https://github.com/ethereum/consensus-specs/blob/v1.1.10/specs/phase0/p2p-interface.md#the-gossip-domain-gossipsub
super(modules.libp2p.services.components, {
globalSignaturePolicy: SignaturePolicy.StrictNoSign,
allowPublishToZeroPeers: allowPublishToZeroPeers,
allowPublishToZeroTopicPeers: allowPublishToZeroPeers,
D: gossipsubD ?? GOSSIP_D,
Dlo: gossipsubDLow ?? GOSSIP_D_LOW,
Dhi: gossipsubDHigh ?? GOSSIP_D_HIGH,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,7 @@ describe.skip("data serialization through worker boundary", function () {
getConnectedPeers: [],
getConnectedPeerCount: [],
updateStatus: [statusZero],
publishGossip: ["test-topic", bytes, {allowPublishToZeroPeers: true, ignoreDuplicatePublishError: true}],
publishGossip: ["test-topic", bytes, {allowPublishToZeroTopicPeers: true, ignoreDuplicatePublishError: true}],
close: [],
scrapeMetrics: [],
writeProfile: [0, ""],
Expand Down
6 changes: 3 additions & 3 deletions packages/cli/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -60,9 +60,9 @@
"@chainsafe/persistent-merkle-tree": "^0.7.1",
"@chainsafe/ssz": "^0.15.1",
"@chainsafe/threads": "^1.11.1",
"@libp2p/crypto": "^3.0.4",
"@libp2p/peer-id": "^4.0.4",
"@libp2p/peer-id-factory": "^4.0.3",
"@libp2p/crypto": "^4.1.0",
"@libp2p/peer-id": "^4.1.0",
"@libp2p/peer-id-factory": "^4.1.0",
"@lodestar/api": "^1.18.0",
"@lodestar/beacon-node": "^1.18.0",
"@lodestar/config": "^1.18.0",
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import {concat} from "uint8arrays";
import {concat} from "uint8arrays/concat";
import {digest} from "@chainsafe/as-sha256";
import {createProof, Proof, ProofType} from "@chainsafe/persistent-merkle-tree";
import {routes, ServerApi} from "@lodestar/api";
Expand Down
6 changes: 3 additions & 3 deletions packages/reqresp/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@
},
"dependencies": {
"@chainsafe/fast-crc32c": "^4.1.1",
"@libp2p/interface": "^1.1.1",
"@libp2p/interface": "^1.3.0",
"@lodestar/config": "^1.18.0",
"@lodestar/params": "^1.18.0",
"@lodestar/utils": "^1.18.0",
Expand All @@ -67,10 +67,10 @@
"devDependencies": {
"@lodestar/logger": "^1.18.0",
"@lodestar/types": "^1.18.0",
"libp2p": "1.1.1"
"libp2p": "1.4.3"
},
"peerDependencies": {
"libp2p": "~1.1.1"
"libp2p": "~1.4.3"
},
"keywords": [
"ethereum",
Expand Down
Loading

0 comments on commit a215ae2

Please sign in to comment.