Skip to content

Commit

Permalink
feat: add yamux stream muxer
Browse files Browse the repository at this point in the history
  • Loading branch information
wemeetagain committed Aug 14, 2023
1 parent 4d5f777 commit 6cb76f0
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 1 deletion.
1 change: 1 addition & 0 deletions packages/beacon-node/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,7 @@
"@chainsafe/discv5": "^5.0.0",
"@chainsafe/libp2p-gossipsub": "^10.0.0",
"@chainsafe/libp2p-noise": "^13.0.0",
"@chainsafe/libp2p-yamux": "^5.0.0",
"@chainsafe/persistent-merkle-tree": "^0.5.0",
"@chainsafe/prometheus-gc-stats": "^1.0.0",
"@chainsafe/ssz": "^0.10.2",
Expand Down
3 changes: 2 additions & 1 deletion packages/beacon-node/src/network/libp2p/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import {bootstrap} from "@libp2p/bootstrap";
import {mdns} from "@libp2p/mdns";
import {createLibp2p} from "libp2p";
import {mplex} from "@libp2p/mplex";
import {yamux} from "@chainsafe/libp2p-yamux";
import {prometheusMetrics} from "@libp2p/prometheus-metrics";
import {tcp} from "@libp2p/tcp";
import {defaultNetworkOptions, NetworkOptions} from "../options.js";
Expand Down Expand Up @@ -85,7 +86,7 @@ export async function createNodeJsLibp2p(
},
}),
],
streamMuxers: [mplex({maxInboundStreams: 256})],
streamMuxers: [yamux({maxInboundStreams: 256}), mplex({maxInboundStreams: 256})],
peerDiscovery,
metrics: nodeJsLibp2pOpts.metrics
? prometheusMetrics({
Expand Down
13 changes: 13 additions & 0 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -606,6 +606,19 @@
uint8arraylist "^2.4.3"
uint8arrays "^4.0.4"

"@chainsafe/libp2p-yamux@^5.0.0":
version "5.0.0"
resolved "https://registry.yarnpkg.com/@chainsafe/libp2p-yamux/-/libp2p-yamux-5.0.0.tgz#c1016fc839870139b5c097daff9408b91c58f2a7"
integrity sha512-aWTnBPR2hJt0A2y579sMtZVB6IqgSSHlZ6Eg+WDxNZQ0zcexafuruZQDj+z3FUTNPz+E8IeuyCi7tjI4IEehjw==
dependencies:
"@libp2p/interface" "^0.1.0"
"@libp2p/logger" "^3.0.0"
abortable-iterator "^5.0.1"
it-foreach "^2.0.3"
it-pipe "^3.0.1"
it-pushable "^3.2.0"
uint8arraylist "^2.4.3"

"@chainsafe/netmask@^2.0.0":
version "2.0.0"
resolved "https://registry.yarnpkg.com/@chainsafe/netmask/-/netmask-2.0.0.tgz#0d4a75f47919f65011da4327a3845c9661f1038a"
Expand Down

0 comments on commit 6cb76f0

Please sign in to comment.