Skip to content

Commit b9120d9

Browse files
committed
chore: add quic port to scripts
1 parent 81707c6 commit b9120d9

File tree

8 files changed

+55
-12
lines changed

8 files changed

+55
-12
lines changed

Makefile

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -193,11 +193,13 @@ libbacktrace:
193193
#
194194
# REST tests:
195195
# - --base-port (REST_TEST_BASE_PORT + 0)
196-
# - --base-rest-port (REST_TEST_BASE_PORT + 1)
197-
# - --base-metrics-port (REST_TEST_BASE_PORT + 2)
196+
# - debug-quic-port (REST_TEST_BASE_PORT + 1)
197+
# - --base-rest-port (REST_TEST_BASE_PORT + 2)
198+
# - --base-metrics-port (REST_TEST_BASE_PORT + 3)
198199
#
199200
# Local testnets (entire continuous range):
200201
# - --base-port + [0, --nodes + --light-clients)
202+
# - debug-quic-port uses (--base-port + 1) + [0, --nodes + --light-clients)
201203
# - --base-rest-port + [0, --nodes)
202204
# - --base-metrics-port + [0, --nodes)
203205
# - --base-vc-keymanager-port + [0, --nodes)
@@ -218,9 +220,9 @@ MAINNET_TESTNET_BASE_PORT := 26501
218220
restapi-test:
219221
./tests/simulation/restapi.sh \
220222
--data-dir resttest0_data \
221-
--base-port $$(( $(REST_TEST_BASE_PORT) + EXECUTOR_NUMBER * 3 + 0 )) \
222-
--base-rest-port $$(( $(REST_TEST_BASE_PORT) + EXECUTOR_NUMBER * 3 + 1 )) \
223-
--base-metrics-port $$(( $(REST_TEST_BASE_PORT) + EXECUTOR_NUMBER * 3 + 2 )) \
223+
--base-port $$(( $(REST_TEST_BASE_PORT) + EXECUTOR_NUMBER * 4 + 0 )) \
224+
--base-rest-port $$(( $(REST_TEST_BASE_PORT) + EXECUTOR_NUMBER * 4 + 2 )) \
225+
--base-metrics-port $$(( $(REST_TEST_BASE_PORT) + EXECUTOR_NUMBER * 4 + 3 )) \
224226
--resttest-delay 30 \
225227
--kill-old-processes
226228

@@ -500,6 +502,8 @@ nimbus_beacon_node: force_build_alone_tools
500502

501503
GOERLI_TESTNETS_PARAMS := \
502504
--tcp-port=$$(( $(BASE_PORT) + $(NODE_ID) )) \
505+
--debug-quic=true \
506+
--debug-quic-port=$$(( $(BASE_PORT) + $(NODE_ID) + 1 )) \
503507
--udp-port=$$(( $(BASE_PORT) + $(NODE_ID) )) \
504508
--metrics \
505509
--metrics-port=$$(( $(BASE_METRICS_PORT) + $(NODE_ID) )) \

beacon_chain/networking/eth2_network.nim

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1968,7 +1968,7 @@ proc startListening*(node: Eth2Node) {.async.} =
19681968
try:
19691969
await node.switch.start()
19701970
except CatchableError as exc:
1971-
fatal "Failed to start LibP2P transport. TCP port may be already in use",
1971+
fatal "Failed to start LibP2P transport. TCP/QUIC port may be already in use",
19721972
exc = exc.msg
19731973
quit 1
19741974

docker/dist/README.md.tpl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ To connect to mainnet with default options:
4242
The script will forward all supplied options to the beacon node executable:
4343

4444
```bash
45-
./run-mainnet-beacon-node.sh --log-level=DEBUG --tcp-port=9050
45+
./run-mainnet-beacon-node.sh --log-level=DEBUG --tcp-port=9050 --debug-quic=true --debug-quic-port=9051
4646
```
4747

4848
To monitor the Eth1 validator deposit contract, you'll need to pair

docker/dist/binaries/docker-compose-example1.yml

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,11 +15,12 @@ services:
1515
ports:
1616
- 9000:9000/tcp
1717
- 9000:9000/udp
18+
- 9001:9001/udp
1819
- 127.0.0.1:5052:5052/tcp
1920
- 127.0.0.1:8008:8008/tcp
2021
volumes:
2122
- ./data:/home/user/nimbus-eth2/build/data
22-
# you need to make sure that port 9000 is accesible from outside; no automagic port forwarding here
23+
# you need to make sure that ports 9000/9001 are accesible from outside; no automagic port forwarding here
2324
command: >-
2425
--network=hoodi
2526
--data-dir=/home/user/nimbus-eth2/build/data/shared_hoodi_0
@@ -28,6 +29,8 @@ services:
2829
--log-level=info
2930
--tcp-port=9000
3031
--udp-port=9000
32+
--debug-quic=true
33+
--debug-quic-port=9001
3134
--rest
3235
--rest-address=0.0.0.0
3336
--rest-port=5052

scripts/launch_local_testnet.sh

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -439,6 +439,16 @@ kill_by_port() {
439439
exit 1
440440
fi
441441
done
442+
for PID in $(lsof -n -i udp:${PORT} -t); do
443+
echo -n "Found old process using UDP port ${PORT}, with PID ${PID}. "
444+
if [[ "${KILL_OLD_PROCESSES}" == "1" ]]; then
445+
echo "Killing it."
446+
kill -SIGKILL "${PID}" || true
447+
else
448+
echo "Aborting."
449+
exit 1
450+
fi
451+
done
442452
done
443453
}
444454

@@ -515,7 +525,7 @@ if [[ "${OS}" != "windows" ]]; then
515525

516526
# Stop Nimbus CL nodes
517527
for NUM_NODE in $(seq 1 $NUM_NODES); do
518-
for PORT in $(( BASE_PORT + NUM_NODE - 1 )) $(( BASE_METRICS_PORT + NUM_NODE - 1)) $(( BASE_REST_PORT + NUM_NODE - 1)); do
528+
for PORT in $(( BASE_PORT + NUM_NODE - 1 )) $(( BASE_PORT + 2000 + NUM_NODE - 1 )) $(( BASE_METRICS_PORT + NUM_NODE - 1)) $(( BASE_REST_PORT + NUM_NODE - 1)); do
519529
PORTS_TO_KILL+=("${PORT}")
520530
done
521531
done
@@ -1136,6 +1146,8 @@ for NUM_NODE in $(seq 1 "${NUM_NODES}"); do
11361146
--config-file="${CLI_CONF_FILE}" \
11371147
--tcp-port=$(( BASE_PORT + NUM_NODE - 1 )) \
11381148
--udp-port=$(( BASE_PORT + NUM_NODE - 1 )) \
1149+
--debug-quic=true \
1150+
--debug-quic-port=$(( BASE_PORT + 2000 + NUM_NODE - 1 )) \
11391151
--max-peers=$(( NUM_NODES + LC_NODES - 1 )) \
11401152
--data-dir="${CONTAINER_NODE_DATA_DIR}" \
11411153
${BOOTSTRAP_ARG} \
@@ -1254,6 +1266,9 @@ if [ "$LC_NODES" -ge "1" ]; then
12541266
WEB3_ARG+=("--web3-url=http://127.0.0.1:${GETH_AUTH_RPC_PORTS[$(( NUM_NODES + NUM_LC - 1 ))]}")
12551267
fi
12561268

1269+
TCP_PORT=$(( BASE_PORT + NUM_NODES + NUM_LC - 1 ))
1270+
QUIC_PORT=$(( TCP_PORT + 1000 ))
1271+
12571272
./build/nimbus_light_client \
12581273
--log-level="${LOG_LEVEL}" \
12591274
--log-format="json" \
@@ -1262,6 +1277,8 @@ if [ "$LC_NODES" -ge "1" ]; then
12621277
--bootstrap-node="${LC_BOOTSTRAP_NODE}" \
12631278
--tcp-port=$(( BASE_PORT + NUM_NODES + NUM_LC - 1 )) \
12641279
--udp-port=$(( BASE_PORT + NUM_NODES + NUM_LC - 1 )) \
1280+
--debug-quic=true \
1281+
--debug-quic-port=$(( BASE_PORT + 2000 + NUM_NODES + NUM_LC - 1 )) \
12651282
--max-peers=$(( NUM_NODES + LC_NODES - 1 )) \
12661283
--nat="extip:127.0.0.1" \
12671284
--trusted-block-root="${LC_TRUSTED_BLOCK_ROOT}" \

scripts/run-beacon-node.sh

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -60,12 +60,17 @@ if [[ "$WEB3_URL" != "" ]]; then
6060
WEB3_URL_ARG="--web3-url=${WEB3_URL}"
6161
fi
6262

63+
TCP_PORT=$(( BASE_P2P_PORT + NODE_ID ))
64+
QUIC_PORT=$(( TCP_PORT + 1 ))
65+
6366
# Allow the binary to receive signals directly.
6467
exec ${WINPTY} build/${NBC_BINARY} \
6568
--network=${NETWORK} \
6669
--data-dir="${DATA_DIR}" \
67-
--tcp-port=$(( ${BASE_P2P_PORT} + ${NODE_ID} )) \
68-
--udp-port=$(( ${BASE_P2P_PORT} + ${NODE_ID} )) \
70+
--tcp-port=${TCP_PORT} \
71+
--udp-port=${TCP_PORT} \
72+
--debug-quic=true \
73+
--debug-quic-port=${QUIC_PORT} \
6974
--rest \
7075
--rest-port=$(( ${BASE_REST_PORT} + ${NODE_ID} )) \
7176
--metrics \

tests/simulation/restapi.sh

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -145,7 +145,7 @@ fi
145145

146146
# kill lingering processes from a previous run
147147
if [[ "${HAVE_LSOF}" == "1" ]]; then
148-
for PORT in ${BASE_PORT} ${BASE_METRICS_PORT} ${BASE_REST_PORT}; do
148+
for PORT in ${BASE_PORT} ${BASE_PORT + 2000} ${BASE_METRICS_PORT} ${BASE_REST_PORT}; do
149149
for PID in $(lsof -n -i tcp:${PORT} -sTCP:LISTEN -t); do
150150
echo -n "Found old process listening on port ${PORT}, with PID ${PID}. "
151151
if [[ "${KILL_OLD_PROCESSES}" == "1" ]]; then
@@ -156,6 +156,16 @@ if [[ "${HAVE_LSOF}" == "1" ]]; then
156156
exit 1
157157
fi
158158
done
159+
for PID in $(lsof -n -i udp:${PORT} -t); do
160+
echo -n "Found old process using UDP port ${PORT}, with PID ${PID}. "
161+
if [[ "${KILL_OLD_PROCESSES}" == "1" ]]; then
162+
echo "Killing it."
163+
kill -9 ${PID} || true
164+
else
165+
echo "Aborting."
166+
exit 1
167+
fi
168+
done
159169
done
160170
fi
161171

@@ -239,6 +249,8 @@ rm -rf "${TEST_DIR}/db" "${TEST_DIR}/validators/slashing_protection.sqlite3"
239249
${NIMBUS_BEACON_NODE_BIN} \
240250
--tcp-port=${BASE_PORT} \
241251
--udp-port=${BASE_PORT} \
252+
--debug-quic=true \
253+
--debug-quic-port=${BASE_PORT + 2000} \
242254
--log-level=${LOG_LEVEL:-DEBUG} \
243255
--network="${TEST_DIR}" \
244256
--data-dir="${TEST_DIR}" \

tests/test_keymanager_api.nim

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -349,6 +349,8 @@ proc initBeaconNode(basePort: int): Future[BeaconNode] {.async: (raises: []).} =
349349
@[
350350
"--tcp-port=" & $(basePort + PortKind.PeerToPeer.ord),
351351
"--udp-port=" & $(basePort + PortKind.PeerToPeer.ord),
352+
"--debug-quic=true",
353+
"--debug-quic-port=" & $(basePort + PortKind.PeerToPeer.ord + 2000),
352354
"--discv5=off",
353355
"--network=" & dataDir,
354356
"--data-dir=" & nodeDataDir,

0 commit comments

Comments
 (0)