Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Yamux experimental support #5080

Merged
merged 3 commits into from
Jun 23, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions beacon_chain/conf.nim
Original file line number Diff line number Diff line change
Expand Up @@ -305,6 +305,12 @@ type
defaultValue: false
name: "enr-auto-update" .}: bool

enableYamux* {.
hidden
desc: "Enable the Yamux multiplexer"
defaultValue: false
name: "enable-yamux" .}: bool

weakSubjectivityCheckpoint* {.
desc: "Weak subjectivity checkpoint in the format block_root:epoch_number"
name: "weak-subjectivity-checkpoint" .}: Option[Checkpoint]
Expand Down
6 changes: 6 additions & 0 deletions beacon_chain/conf_light_client.nim
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,12 @@ type LightClientConf* = object
defaultValue: false
name: "enr-auto-update" .}: bool

enableYamux* {.
hidden
desc: "Enable the Yamux multiplexer"
defaultValue: false
name: "enable-yamux" .}: bool

agentString* {.
defaultValue: "nimbus",
desc: "Node agent string which is used as identifier in network"
Expand Down
10 changes: 8 additions & 2 deletions beacon_chain/networking/eth2_network.nim
Original file line number Diff line number Diff line change
Expand Up @@ -2271,8 +2271,14 @@ func gossipId(
proc newBeaconSwitch(config: BeaconNodeConf | LightClientConf,
seckey: PrivateKey, address: MultiAddress,
rng: ref HmacDrbgContext): Switch {.raises: [Defect, CatchableError].} =
SwitchBuilder
.new()
var sb =
if config.enableYamux:
SwitchBuilder.new().withYamux()
else:
SwitchBuilder.new()
# Order of multiplexers matters, the first will be default

sb
.withPrivateKey(seckey)
.withAddress(address)
.withRng(rng)
Expand Down