Skip to content
Open
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
13 changes: 8 additions & 5 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -191,8 +191,8 @@ libbacktrace:
#
# REST tests:
# - --base-port (REST_TEST_BASE_PORT + 0)
# - --base-rest-port (REST_TEST_BASE_PORT + 1)
# - --base-metrics-port (REST_TEST_BASE_PORT + 2)
# - --base-rest-port (REST_TEST_BASE_PORT + 2)
# - --base-metrics-port (REST_TEST_BASE_PORT + 3)
#
# Local testnets (entire continuous range):
# - --base-port + [0, --nodes + --light-clients)
Expand All @@ -216,9 +216,9 @@ MAINNET_TESTNET_BASE_PORT := 26501
restapi-test:
./tests/simulation/restapi.sh \
--data-dir resttest0_data \
--base-port $$(( $(REST_TEST_BASE_PORT) + EXECUTOR_NUMBER * 3 + 0 )) \
--base-rest-port $$(( $(REST_TEST_BASE_PORT) + EXECUTOR_NUMBER * 3 + 1 )) \
--base-metrics-port $$(( $(REST_TEST_BASE_PORT) + EXECUTOR_NUMBER * 3 + 2 )) \
--base-port $$(( $(REST_TEST_BASE_PORT) + EXECUTOR_NUMBER * 4 + 0 )) \
--base-rest-port $$(( $(REST_TEST_BASE_PORT) + EXECUTOR_NUMBER * 4 + 2 )) \
--base-metrics-port $$(( $(REST_TEST_BASE_PORT) + EXECUTOR_NUMBER * 4 + 3 )) \
--resttest-delay 30 \
--kill-old-processes

Expand Down Expand Up @@ -496,6 +496,9 @@ nimbus_beacon_node: force_build_alone_tools

GOERLI_TESTNETS_PARAMS := \
--tcp-port=$$(( $(BASE_PORT) + $(NODE_ID) )) \
--tcp=true \
--debug-quic=true \
--debug-quic-port=$$(( $(BASE_PORT) + $(NODE_ID) + 2000 )) \
--udp-port=$$(( $(BASE_PORT) + $(NODE_ID) )) \
--metrics \
--metrics-port=$$(( $(BASE_METRICS_PORT) + $(NODE_ID) )) \
Expand Down
40 changes: 39 additions & 1 deletion beacon_chain/conf.nim
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ from consensus_object_pools/block_pools_types_light_client

export
uri, nat, enr,
defaultEth2TcpPort, enabledLogLevel,
defaultEth2TcpPort, defaultEth2QuicPort, enabledLogLevel,
defs, parseCmdArg, completeCmdArg, network_metadata,
el_conf, network,
confTomlDefs, confTomlNet, confTomlUri, jsnet,
Expand Down Expand Up @@ -302,12 +302,31 @@ type
defaultValueDesc: "*"
name: "listen-address" .}: Option[IpAddress]

tcpEnabled* {.
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is presumably the existing mplex support?

hidden
desc: "Enable TCP transport"
defaultValue: true
name: "tcp" .}: bool

tcpPort* {.
desc: "Listening TCP port for Ethereum LibP2P traffic"
defaultValue: defaultEth2TcpPort
defaultValueDesc: $defaultEth2TcpPortDesc
name: "tcp-port" .}: Port

quicEnabled* {.
hidden
desc: "Enable QUIC transport"
defaultValue: false
name: "debug-quic" .}: bool

quicPort* {.
hidden
desc: "Listening UDP port for Ethereum LibP2P traffic over QUIC"
defaultValue: defaultEth2QuicPort
defaultValueDesc: $defaultEth2QuicPortDesc
name: "debug-quic-port" .}: Port

udpPort* {.
desc: "Listening UDP port for node discovery"
defaultValue: defaultEth2TcpPort
Expand Down Expand Up @@ -804,14 +823,33 @@ type
desc: "External IP address"
name: "ip" .}: IpAddress

tcpExtEnabled* {.
hidden
desc: "Enable TCP transport"
defaultValue: true
name: "tcp" .}: bool

tcpPortExt* {.
desc: "External TCP port"
defaultValue: defaultEth2TcpPort
name: "tcp-port" .}: Port

udpPortExt* {.
desc: "External UDP port"
name: "udp-port" .}: Port

quicExtEnabled* {.
hidden
desc: "Enable QUIC transport"
defaultValue: false
name: "debug-quic" .}: bool

quicPortExt* {.
hidden
desc: "External QUIC port"
defaultValue: defaultEth2QuicPort
name: "debug-quic-port" .}: Port

seqNumber* {.
desc: "Record sequence number"
defaultValue: 1,
Expand Down
19 changes: 19 additions & 0 deletions beacon_chain/conf_light_client.nim
Original file line number Diff line number Diff line change
Expand Up @@ -57,12 +57,31 @@ type LightClientConf* = object
desc: "Listening address for the Ethereum LibP2P and Discovery v5 traffic"
name: "listen-address" .}: Option[IpAddress]

tcpEnabled* {.
hidden
desc: "Enable TCP transport"
defaultValue: true
name: "tcp" .}: bool

tcpPort* {.
desc: "Listening TCP port for Ethereum LibP2P traffic"
defaultValue: defaultEth2TcpPort
defaultValueDesc: $defaultEth2TcpPortDesc
name: "tcp-port" .}: Port

quicEnabled* {.
hidden
desc: "Enable QUIC transport"
defaultValue: false
name: "debug-quic" .}: bool

quicPort* {.
hidden
desc: "Listening UDP port for Ethereum LibP2P traffic over QUIC"
defaultValue: defaultEth2QuicPort
defaultValueDesc: $defaultEth2QuicPortDesc
name: "debug-quic-port" .}: Port

udpPort* {.
desc: "Listening UDP port for node discovery"
defaultValue: defaultEth2TcpPort
Expand Down
7 changes: 4 additions & 3 deletions beacon_chain/networking/eth2_discovery.nim
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ import
chronos, chronicles,
eth/p2p/discoveryv5/[protocol, node, random2],
../spec/datatypes/[altair, fulu],
../spec/network,
../spec/eth2_ssz_serialization,
".."/[conf, conf_light_client]

Expand Down Expand Up @@ -78,7 +79,7 @@ proc loadBootstrapFile*(bootstrapFile: string,

proc new*(T: type Eth2DiscoveryProtocol,
config: BeaconNodeConf | LightClientConf,
enrIp: Opt[IpAddress], enrTcpPort, enrUdpPort: Opt[Port],
enrIp: Opt[IpAddress], enrTcpPort, enrQuicPort, enrUdpPort: Opt[Port],
pk: PrivateKey,
enrFields: openArray[(string, seq[byte])], rng: ref HmacDrbgContext):
T =
Expand All @@ -102,8 +103,8 @@ proc new*(T: type Eth2DiscoveryProtocol,
else:
Opt.none(IpAddress)

newProtocol(pk, enrIp, enrTcpPort, enrUdpPort, enrFields, bootstrapEnrs,
bindPort = config.udpPort, bindIp = listenAddress,
newProtocol(pk, enrIp, enrTcpPort, enrUdpPort, enrQuicPort, enrFields,
bootstrapEnrs, bindPort = config.udpPort, bindIp = listenAddress,
enrAutoUpdate = config.enrAutoUpdate, rng = rng)

func isCompatibleForkId*(discoveryForkId: ENRForkID, peerForkId: ENRForkID): bool =
Expand Down
Loading
Loading