Skip to content

Commit

Permalink
Add Yamux experimental support (#5080)
Browse files Browse the repository at this point in the history
  • Loading branch information
Menduist authored Jun 23, 2023
1 parent 8a853fc commit 11d18ac
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 2 deletions.
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

0 comments on commit 11d18ac

Please sign in to comment.