Skip to content

Commit acbedaf

Browse files
authored
feat: add yamux stream muxer (#5886)
feat: add yamux support
1 parent a187851 commit acbedaf

File tree

3 files changed

+114
-37
lines changed

3 files changed

+114
-37
lines changed

packages/beacon-node/package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -102,6 +102,7 @@
102102
"@chainsafe/libp2p-gossipsub": "^13.0.0",
103103
"@chainsafe/libp2p-identify": "^1.0.0",
104104
"@chainsafe/libp2p-noise": "^15.0.0",
105+
"@chainsafe/libp2p-yamux": "^6.0.2",
105106
"@chainsafe/persistent-merkle-tree": "^0.7.1",
106107
"@chainsafe/prometheus-gc-stats": "^1.0.0",
107108
"@chainsafe/ssz": "^0.15.1",

packages/beacon-node/src/network/libp2p/index.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ import {mplex} from "@libp2p/mplex";
1010
import {prometheusMetrics} from "@libp2p/prometheus-metrics";
1111
import {tcp} from "@libp2p/tcp";
1212
import {noise} from "@chainsafe/libp2p-noise";
13+
import {yamux} from "@chainsafe/libp2p-yamux";
1314
import {defaultNetworkOptions, NetworkOptions} from "../options.js";
1415
import {Eth2PeerDataStore} from "../peers/datastore.js";
1516
import {Libp2p, LodestarComponents} from "../interface.js";
@@ -85,7 +86,7 @@ export async function createNodeJsLibp2p(
8586
},
8687
}),
8788
],
88-
streamMuxers: [mplex({maxInboundStreams: 256})],
89+
streamMuxers: [yamux({maxInboundStreams: 256}), mplex({maxInboundStreams: 256})],
8990
peerDiscovery,
9091
metrics: nodeJsLibp2pOpts.metrics
9192
? prometheusMetrics({

yarn.lock

Lines changed: 111 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -436,6 +436,19 @@
436436
uint8arrays "^5.0.0"
437437
wherearewe "^2.0.1"
438438

439+
"@chainsafe/libp2p-yamux@^6.0.2":
440+
version "6.0.2"
441+
resolved "https://registry.yarnpkg.com/@chainsafe/libp2p-yamux/-/libp2p-yamux-6.0.2.tgz#ba94c38ebfe2761d20b0986ff8d832fc05c2ce15"
442+
integrity sha512-S5OkLHqYhEVMQQ4BTgnRANEIbGTQhaC23glCgBwGdeoTRtMpIozwDiPfljFLCm0RYWdCRJw9oFztO95KUHjptA==
443+
dependencies:
444+
"@libp2p/interface" "^1.1.3"
445+
"@libp2p/utils" "^5.2.5"
446+
get-iterator "^2.0.1"
447+
it-foreach "^2.0.6"
448+
it-pipe "^3.0.1"
449+
it-pushable "^3.2.3"
450+
uint8arraylist "^2.4.8"
451+
439452
"@chainsafe/netmask@^2.0.0":
440453
version "2.0.0"
441454
resolved "https://registry.yarnpkg.com/@chainsafe/netmask/-/netmask-2.0.0.tgz#0d4a75f47919f65011da4327a3845c9661f1038a"
@@ -1530,6 +1543,18 @@
15301543
progress-events "^1.0.0"
15311544
uint8arraylist "^2.4.8"
15321545

1546+
"@libp2p/interface@^1.1.3":
1547+
version "1.2.0"
1548+
resolved "https://registry.yarnpkg.com/@libp2p/interface/-/interface-1.2.0.tgz#3b5fdc5d96cffe17a8c88cc29ed78c70516b0a7f"
1549+
integrity sha512-ImnGNl3El/AukgaojACT8i9SNW1FOsrThcQU/qA3w5tEBR5p84Uwgzl/nxa4X5vGinItUJ9jLEJmtkQJENoiGQ==
1550+
dependencies:
1551+
"@multiformats/multiaddr" "^12.2.1"
1552+
it-pushable "^3.2.3"
1553+
it-stream-types "^2.0.1"
1554+
multiformats "^13.1.0"
1555+
progress-events "^1.0.0"
1556+
uint8arraylist "^2.4.8"
1557+
15331558
"@libp2p/logger@^4.0.11", "@libp2p/logger@^4.0.6":
15341559
version "4.0.11"
15351560
resolved "https://registry.yarnpkg.com/@libp2p/logger/-/logger-4.0.11.tgz#671692a0cceee73a0c0bf9b5f05ea14fde05f5e5"
@@ -1688,6 +1713,27 @@
16881713
"@types/sinon" "^17.0.3"
16891714
stream-to-it "^1.0.0"
16901715

1716+
"@libp2p/utils@^5.2.5":
1717+
version "5.3.1"
1718+
resolved "https://registry.yarnpkg.com/@libp2p/utils/-/utils-5.3.1.tgz#1d3ff7e494f78503f33e1c8df4ad4a13209d594b"
1719+
integrity sha512-FdGzRU50PJLYSEOmVXqqtq27yjUVXkU4QNRZzMVuXF9L/sKgSC2oXwj0Satc9fHx5tG3MCX1ZOSAmYEIl2fu+w==
1720+
dependencies:
1721+
"@chainsafe/is-ip" "^2.0.2"
1722+
"@libp2p/interface" "^1.2.0"
1723+
"@libp2p/logger" "^4.0.10"
1724+
"@multiformats/multiaddr" "^12.2.1"
1725+
"@multiformats/multiaddr-matcher" "^1.2.0"
1726+
delay "^6.0.0"
1727+
get-iterator "^2.0.1"
1728+
is-loopback-addr "^2.0.2"
1729+
it-pushable "^3.2.3"
1730+
it-stream-types "^2.0.1"
1731+
netmask "^2.0.2"
1732+
p-defer "^4.0.1"
1733+
race-event "^1.2.0"
1734+
race-signal "^1.0.2"
1735+
uint8arraylist "^2.4.8"
1736+
16911737
"@libp2p/utils@^5.3.2":
16921738
version "5.3.2"
16931739
resolved "https://registry.yarnpkg.com/@libp2p/utils/-/utils-5.3.2.tgz#044881910350fb22ed0f9db35e6f68f7e8948801"
@@ -3671,6 +3717,13 @@ agent-base@^7.0.2, agent-base@^7.1.0:
36713717
dependencies:
36723718
debug "^4.3.4"
36733719

3720+
agent-base@^7.1.1:
3721+
version "7.1.1"
3722+
resolved "https://registry.yarnpkg.com/agent-base/-/agent-base-7.1.1.tgz#bdbded7dfb096b751a2a087eeeb9664725b2e317"
3723+
integrity sha512-H0TSyFNDMomMNJQBn8wFV5YC/2eJ+VXECwOadZJT554xP6cODZHPX3H9QMQECxvrgiSOP1pHjy1sMWQVYJOUOA==
3724+
dependencies:
3725+
debug "^4.3.4"
3726+
36743727
agentkeepalive@^4.1.3, agentkeepalive@^4.2.1:
36753728
version "4.2.1"
36763729
resolved "https://registry.yarnpkg.com/agentkeepalive/-/agentkeepalive-4.2.1.tgz#a7975cbb9f83b367f06c90cc51ff28fe7d499717"
@@ -7354,7 +7407,7 @@ http-proxy-agent@^7.0.0:
73547407
agent-base "^7.1.0"
73557408
debug "^4.3.4"
73567409

7357-
http-proxy-agent@^7.0.1, http-proxy-agent@^7.0.2:
7410+
http-proxy-agent@^7.0.2:
73587411
version "7.0.2"
73597412
resolved "https://registry.yarnpkg.com/http-proxy-agent/-/http-proxy-agent-7.0.2.tgz#9a8b1f246866c028509486585f62b8f2c18c270e"
73607413
integrity sha512-T1gkAiYYDWYx3V5Bmyu7HcfcvL7mUrTWiM6yOfa3PIphViJ/gFPbvidQ+veqSOHci/PxBcDabeUNCzpOODJZig==
@@ -7400,18 +7453,18 @@ https-proxy-agent@^5.0.0:
74007453
agent-base "6"
74017454
debug "4"
74027455

7403-
https-proxy-agent@^7.0.2:
7404-
version "7.0.2"
7405-
resolved "https://registry.yarnpkg.com/https-proxy-agent/-/https-proxy-agent-7.0.2.tgz#e2645b846b90e96c6e6f347fb5b2e41f1590b09b"
7406-
integrity sha512-NmLNjm6ucYwtcUmL7JQC1ZQ57LmHP4lT15FQ8D61nak1rO6DH+fz5qNK2Ap5UN4ZapYICE3/0KodcLYSPsPbaA==
7456+
https-proxy-agent@^7.0.0, https-proxy-agent@^7.0.4:
7457+
version "7.0.4"
7458+
resolved "https://registry.yarnpkg.com/https-proxy-agent/-/https-proxy-agent-7.0.4.tgz#8e97b841a029ad8ddc8731f26595bad868cb4168"
7459+
integrity sha512-wlwpilI7YdjSkWaQ/7omYBMTliDcmCN8OLihO6I9B86g06lMyAoqgoDpV0XqoaPOKj+0DIdAvnsWfyAAhmimcg==
74077460
dependencies:
74087461
agent-base "^7.0.2"
74097462
debug "4"
74107463

7411-
https-proxy-agent@^7.0.3, https-proxy-agent@^7.0.4:
7412-
version "7.0.4"
7413-
resolved "https://registry.yarnpkg.com/https-proxy-agent/-/https-proxy-agent-7.0.4.tgz#8e97b841a029ad8ddc8731f26595bad868cb4168"
7414-
integrity sha512-wlwpilI7YdjSkWaQ/7omYBMTliDcmCN8OLihO6I9B86g06lMyAoqgoDpV0XqoaPOKj+0DIdAvnsWfyAAhmimcg==
7464+
https-proxy-agent@^7.0.2:
7465+
version "7.0.2"
7466+
resolved "https://registry.yarnpkg.com/https-proxy-agent/-/https-proxy-agent-7.0.2.tgz#e2645b846b90e96c6e6f347fb5b2e41f1590b09b"
7467+
integrity sha512-NmLNjm6ucYwtcUmL7JQC1ZQ57LmHP4lT15FQ8D61nak1rO6DH+fz5qNK2Ap5UN4ZapYICE3/0KodcLYSPsPbaA==
74157468
dependencies:
74167469
agent-base "^7.0.2"
74177470
debug "4"
@@ -10206,7 +10259,7 @@ [email protected]:
1020610259
dependencies:
1020710260
p-reduce "^2.0.0"
1020810261

10209-
pac-proxy-agent@^7.0.1:
10262+
pac-proxy-agent@^7.0.0:
1021010263
version "7.0.1"
1021110264
resolved "https://registry.yarnpkg.com/pac-proxy-agent/-/pac-proxy-agent-7.0.1.tgz#6b9ddc002ec3ff0ba5fdf4a8a21d363bcc612d75"
1021210265
integrity sha512-ASV8yU4LLKBAjqIPMbrgtaKIvxQri/yh2OpI+S6hVa9JRkUI3Y3NPFbfngDtY7oFtSMD3w31Xns89mDa3Feo5A==
@@ -10630,19 +10683,19 @@ proxy-addr@^2.0.7:
1063010683
forwarded "0.2.0"
1063110684
ipaddr.js "1.9.1"
1063210685

10633-
proxy-agent@6.4.0:
10634-
version "6.4.0"
10635-
resolved "https://registry.yarnpkg.com/proxy-agent/-/proxy-agent-6.4.0.tgz#b4e2dd51dee2b377748aef8d45604c2d7608652d"
10636-
integrity sha512-u0piLU+nCOHMgGjRbimiXmA9kM/L9EHh3zL81xCdp7m+Y2pHIsnmbdDoEDoAz5geaonNR6q6+yOPQs6n4T6sBQ==
10686+
proxy-agent@6.3.0:
10687+
version "6.3.0"
10688+
resolved "https://registry.yarnpkg.com/proxy-agent/-/proxy-agent-6.3.0.tgz#72f7bb20eb06049db79f7f86c49342c34f9ba08d"
10689+
integrity sha512-0LdR757eTj/JfuU7TL2YCuAZnxWXu3tkJbg4Oq3geW/qFNT/32T0sp2HnZ9O0lMR4q3vwAt0+xCA8SR0WAD0og==
1063710690
dependencies:
1063810691
agent-base "^7.0.2"
1063910692
debug "^4.3.4"
10640-
http-proxy-agent "^7.0.1"
10641-
https-proxy-agent "^7.0.3"
10693+
http-proxy-agent "^7.0.0"
10694+
https-proxy-agent "^7.0.0"
1064210695
lru-cache "^7.14.1"
10643-
pac-proxy-agent "^7.0.1"
10696+
pac-proxy-agent "^7.0.0"
1064410697
proxy-from-env "^1.1.0"
10645-
socks-proxy-agent "^8.0.2"
10698+
socks-proxy-agent "^8.0.1"
1064610699

1064710700
proxy-from-env@^1.1.0:
1064810701
version "1.1.0"
@@ -11304,13 +11357,6 @@ [email protected]:
1130411357
dependencies:
1130511358
lru-cache "^6.0.0"
1130611359

11307-
[email protected], semver@^7.6.0:
11308-
version "7.6.0"
11309-
resolved "https://registry.yarnpkg.com/semver/-/semver-7.6.0.tgz#1a46a4db4bffcccd97b743b5005c8325f23d4e2d"
11310-
integrity sha512-EnwXhrlwXMk9gKu5/flx5sv/an57AkRplG3hTK68W7FRDN+k+OWBj65M7719OkA82XLBxrcX0KSHj+X5COhOVg==
11311-
dependencies:
11312-
lru-cache "^6.0.0"
11313-
1131411360
semver@^6.1.0, semver@^6.2.0, semver@^6.3.1:
1131511361
version "6.3.1"
1131611362
resolved "https://registry.yarnpkg.com/semver/-/semver-6.3.1.tgz#556d2ef8689146e46dcea4bfdd095f3434dffcb4"
@@ -11323,6 +11369,13 @@ semver@^7.0.0, semver@^7.1.1, semver@^7.3.2, semver@^7.3.4, semver@^7.3.5, semve
1132311369
dependencies:
1132411370
lru-cache "^6.0.0"
1132511371

11372+
semver@^7.6.0:
11373+
version "7.6.0"
11374+
resolved "https://registry.yarnpkg.com/semver/-/semver-7.6.0.tgz#1a46a4db4bffcccd97b743b5005c8325f23d4e2d"
11375+
integrity sha512-EnwXhrlwXMk9gKu5/flx5sv/an57AkRplG3hTK68W7FRDN+k+OWBj65M7719OkA82XLBxrcX0KSHj+X5COhOVg==
11376+
dependencies:
11377+
lru-cache "^6.0.0"
11378+
1132611379
serialize-error@^11.0.1:
1132711380
version "11.0.3"
1132811381
resolved "https://registry.yarnpkg.com/serialize-error/-/serialize-error-11.0.3.tgz#b54f439e15da5b4961340fbbd376b6b04aa52e92"
@@ -11531,6 +11584,15 @@ socks-proxy-agent@^7.0.0:
1153111584
debug "^4.3.3"
1153211585
socks "^2.6.2"
1153311586

11587+
socks-proxy-agent@^8.0.1:
11588+
version "8.0.3"
11589+
resolved "https://registry.yarnpkg.com/socks-proxy-agent/-/socks-proxy-agent-8.0.3.tgz#6b2da3d77364fde6292e810b496cb70440b9b89d"
11590+
integrity sha512-VNegTZKhuGq5vSD6XNKlbqWhyt/40CgoEw8XxD6dhnm8Jq9IEa3nIa4HwnM8XOqU0CdB0BwWVXusqiFXfHB3+A==
11591+
dependencies:
11592+
agent-base "^7.1.1"
11593+
debug "^4.3.4"
11594+
socks "^2.7.1"
11595+
1153411596
socks-proxy-agent@^8.0.2:
1153511597
version "8.0.2"
1153611598
resolved "https://registry.yarnpkg.com/socks-proxy-agent/-/socks-proxy-agent-8.0.2.tgz#5acbd7be7baf18c46a3f293a840109a430a640ad"
@@ -12027,7 +12089,16 @@ tapable@^2.2.0:
1202712089
resolved "https://registry.yarnpkg.com/tapable/-/tapable-2.2.1.tgz#1967a73ef4060a82f12ab96af86d52fdb76eeca0"
1202812090
integrity sha512-GNzQvQTOIP6RyTfE2Qxb8ZVlNmw0n88vp1szwWRimP02mnTsx3Wtn5qRdqY9w2XduFNUgvOwhNnQsjwCp+kqaQ==
1202912091

12030-
[email protected], tar-fs@^3.0.5:
12092+
[email protected], tar-fs@^3.0.4:
12093+
version "3.0.4"
12094+
resolved "https://registry.yarnpkg.com/tar-fs/-/tar-fs-3.0.4.tgz#a21dc60a2d5d9f55e0089ccd78124f1d3771dbbf"
12095+
integrity sha512-5AFQU8b9qLfZCX9zp2duONhPmZv0hGYiBPJsyUdqMjzq/mqVpy/rEUSeHk1+YitmxugaptgBh5oDGU3VsAJq4w==
12096+
dependencies:
12097+
mkdirp-classic "^0.5.2"
12098+
pump "^3.0.0"
12099+
tar-stream "^3.1.5"
12100+
12101+
tar-fs@^3.0.5:
1203112102
version "3.0.5"
1203212103
resolved "https://registry.yarnpkg.com/tar-fs/-/tar-fs-3.0.5.tgz#f954d77767e4e6edf973384e1eb95f8f81d64ed9"
1203312104
integrity sha512-JOgGAmZyMgbqpLwct7ZV8VzkEB6pxXFBVErLtb+XCOqzc6w1xiWKI9GVd6bwk68EX7eJ4DWmfXVmq8K2ziZTGg==
@@ -12038,15 +12109,6 @@ [email protected], tar-fs@^3.0.5:
1203812109
bare-fs "^2.1.1"
1203912110
bare-path "^2.1.0"
1204012111

12041-
tar-fs@^3.0.4:
12042-
version "3.0.4"
12043-
resolved "https://registry.yarnpkg.com/tar-fs/-/tar-fs-3.0.4.tgz#a21dc60a2d5d9f55e0089ccd78124f1d3771dbbf"
12044-
integrity sha512-5AFQU8b9qLfZCX9zp2duONhPmZv0hGYiBPJsyUdqMjzq/mqVpy/rEUSeHk1+YitmxugaptgBh5oDGU3VsAJq4w==
12045-
dependencies:
12046-
mkdirp-classic "^0.5.2"
12047-
pump "^3.0.0"
12048-
tar-stream "^3.1.5"
12049-
1205012112
tar-fs@~2.0.1:
1205112113
version "2.0.1"
1205212114
resolved "https://registry.yarnpkg.com/tar-fs/-/tar-fs-2.0.1.tgz#e44086c1c60d31a4f0cf893b1c4e155dabfae9e2"
@@ -13627,7 +13689,20 @@ [email protected], yargs@^16.2.0:
1362713689
y18n "^5.0.5"
1362813690
yargs-parser "^20.2.2"
1362913691

13630-
[email protected], yargs@^17.1.1, yargs@^17.5.1, yargs@^17.6.2, yargs@^17.7.1:
13692+
13693+
version "17.7.1"
13694+
resolved "https://registry.yarnpkg.com/yargs/-/yargs-17.7.1.tgz#34a77645201d1a8fc5213ace787c220eabbd0967"
13695+
integrity sha512-cwiTb08Xuv5fqF4AovYacTFNxk62th7LKJ6BL9IGUpTJrWoU7/7WdQGTP2SjKf1dUNBGzDd28p/Yfs/GI6JrLw==
13696+
dependencies:
13697+
cliui "^8.0.1"
13698+
escalade "^3.1.1"
13699+
get-caller-file "^2.0.5"
13700+
require-directory "^2.1.1"
13701+
string-width "^4.2.3"
13702+
y18n "^5.0.5"
13703+
yargs-parser "^21.1.1"
13704+
13705+
yargs@^17.1.1, yargs@^17.5.1, yargs@^17.6.2, yargs@^17.7.1:
1363113706
version "17.7.2"
1363213707
resolved "https://registry.yarnpkg.com/yargs/-/yargs-17.7.2.tgz#991df39aca675a192b816e1e0363f9d75d2aa269"
1363313708
integrity sha512-7dSzzRQ++CKnNI/krKnYRV7JKKPUXMEh61soaHKg9mrWEhzFWhFnxPxGl+69cD1Ou63C13NUPCnmIcrvqCuM6w==

0 commit comments

Comments
 (0)