Skip to content
Draft
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
7 changes: 7 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,13 @@ jobs:
# for miniupnp that runs "wingenminiupnpcstrings.exe" from the current dir
echo "." >> $GITHUB_PATH

- name: Install nasm (Windows)
if: runner.os == 'Windows'
shell: pwsh
run: |
choco install nasm --no-progress -y
"C:\Program Files\NASM" | Out-File -FilePath $Env:GITHUB_PATH -Encoding utf8 -Append

- name: Derive environment variables
run: |
if [[ '${{ matrix.target.cpu }}' == 'amd64' ]]; then
Expand Down
3 changes: 3 additions & 0 deletions .gitmodules
Original file line number Diff line number Diff line change
Expand Up @@ -237,3 +237,6 @@
path = vendor/nim-quic
url = https://github.com/vacp2p/nim-quic
branch = main
[submodule "vendor/nim-lsquic"]
path = vendor/nim-lsquic
url = https://github.com/vacp2p/nim-lsquic.git
20 changes: 14 additions & 6 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,7 @@ TOOLS_CSV := $(subst $(SPACE),$(COMMA),$(TOOLS))
test \
clean \
libbacktrace \
boringssl-win64 \
book \
publish-book \
dist-amd64 \
Expand Down Expand Up @@ -164,7 +165,7 @@ ifeq ($(USE_LIBBACKTRACE), 0)
NIM_PARAMS += -d:disable_libbacktrace
endif

deps: | deps-common nat-libs build/generate_makefile
deps: | deps-common nat-libs build/generate_makefile boringssl-win64
ifneq ($(USE_LIBBACKTRACE), 0)
deps: | libbacktrace
endif
Expand All @@ -178,6 +179,9 @@ update: | update-common
libbacktrace:
+ "$(MAKE)" -C vendor/nim-libbacktrace --no-print-directory BUILD_CXX_LIB=0

boringssl-win64:
+ "$(MAKE)" -C vendor/nim-lsquic

# Make sure ports don't overlap to support concurrent execution of tests
# Avoid selecting ephemeral ports that may be used by others; safe = 5001-9999
# - Port 8301 is used by Consul
Expand All @@ -193,11 +197,13 @@ 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)
# - debug-quic-port (REST_TEST_BASE_PORT + 1)
# - --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)
# - debug-quic-port uses (--base-port + 1) + [0, --nodes + --light-clients)
# - --base-rest-port + [0, --nodes)
# - --base-metrics-port + [0, --nodes)
# - --base-vc-keymanager-port + [0, --nodes)
Expand All @@ -218,9 +224,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 @@ -500,6 +506,8 @@ nimbus_beacon_node: force_build_alone_tools

GOERLI_TESTNETS_PARAMS := \
--tcp-port=$$(( $(BASE_PORT) + $(NODE_ID) )) \
--debug-quic=true \
--debug-quic-port=$$(( $(BASE_PORT) + $(NODE_ID) + 1 )) \
--udp-port=$$(( $(BASE_PORT) + $(NODE_ID) )) \
--metrics \
--metrics-port=$$(( $(BASE_METRICS_PORT) + $(NODE_ID) )) \
Expand Down
20 changes: 19 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 @@ -299,6 +299,19 @@ type
defaultValueDesc: $defaultEth2TcpPortDesc
name: "tcp-port" .}: Port

quicEnabled* {.
hidden
desc: "Enable QUIC transport"
defaultValue: true # TODO: set to false by default
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 @@ -811,6 +824,11 @@ type
desc: "External UDP port"
name: "udp-port" .}: Port

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

seqNumber* {.
desc: "Record sequence number"
defaultValue: 1,
Expand Down
13 changes: 13 additions & 0 deletions beacon_chain/conf_light_client.nim
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,19 @@ type LightClientConf* = object
defaultValueDesc: $defaultEth2TcpPortDesc
name: "tcp-port" .}: Port

quicEnabled* {.
hidden
desc: "Enable QUIC transport"
defaultValue: true # TODO: set to false by default
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