@@ -34,7 +34,7 @@ if [ ${PIPESTATUS[0]} != 4 ]; then
3434fi
3535
3636OPTS=" h:n:d"
37- LONGOPTS=" help,nodes:,data-dir:,enable-htop,log-level:,base-port:,base-rpc-port:,base-metrics-port:,reuse-existing-data-dir,timeout:,kill-old-processes"
37+ LONGOPTS=" help,nodes:,data-dir:,enable-htop,log-level:,base-port:,base-rpc-port:,lc-bridge,trusted-block-root:, base-metrics-port:,reuse-existing-data-dir,timeout:,kill-old-processes"
3838
3939# default values
4040NUM_NODES=" 64"
@@ -48,6 +48,8 @@ REUSE_EXISTING_DATA_DIR="0"
4848TIMEOUT_DURATION=" 0"
4949KILL_OLD_PROCESSES=" 0"
5050SCRIPTS_DIR=" fluffy/scripts/"
51+ LC_BRIDGE=" 0"
52+ TRUSTED_BLOCK_ROOT=" "
5153
5254print_help () {
5355 cat << EOF
@@ -61,6 +63,8 @@ E.g.: $(basename "$0") --nodes ${NUM_NODES} --data-dir "${DATA_DIR}" # defaults
6163 --base-port bootstrap node's discv5 port (default: ${BASE_PORT} )
6264 --base-rpc-port bootstrap node's RPC port (default: ${BASE_RPC_PORT} )
6365 --base-metrics-port bootstrap node's metrics server port (default: ${BASE_METRICS_PORT} )
66+ --lc-bridge run an beacon lc bridge attached to the bootstrap node
67+ --trusted-block-root recent trusted finalized block root to initialize the consensus light client from
6468 --enable-htop use "htop" to see the fluffy processes without doing any tests
6569 --log-level set the log level (default: ${LOG_LEVEL} )
6670 --reuse-existing-data-dir instead of deleting and recreating the data dir, keep it and reuse everything we can from it
@@ -107,6 +111,14 @@ while true; do
107111 BASE_RPC_PORT=" $2 "
108112 shift 2
109113 ;;
114+ --lc-bridge)
115+ LC_BRIDGE=" 1"
116+ shift
117+ ;;
118+ --trusted-block-root)
119+ TRUSTED_BLOCK_ROOT=" $2 "
120+ shift 2
121+ ;;
110122 --base-metrics-port)
111123 BASE_METRICS_PORT=" $2 "
112124 shift 2
183195
184196# Build the binaries
185197BINARIES=" fluffy"
198+ if [[ " ${LC_BRIDGE} " == " 1" ]]; then
199+ BINARIES=" ${BINARIES} beacon_lc_bridge"
200+ fi
186201TEST_BINARIES=" test_portal_testnet"
187202$MAKE -j ${NPROC} LOG_LEVEL=TRACE ${BINARIES}
188203$MAKE -j ${NPROC} LOG_LEVEL=INFO ${TEST_BINARIES}
@@ -191,9 +206,13 @@ $MAKE -j ${NPROC} LOG_LEVEL=INFO ${TEST_BINARIES}
191206# instance as the parent and the target process name as a pattern to the
192207# "pkill" command.
193208cleanup () {
194- pkill -f -P $$ fluffy & > /dev/null || true
209+ for BINARY in ${BINARIES} ; do
210+ pkill -f -P $$ ${BINARY} & > /dev/null || true
211+ done
195212 sleep 2
196- pkill -f -9 -P $$ fluffy & > /dev/null || true
213+ for BINARY in ${BINARIES} ; do
214+ pkill -f -9 -P $$ ${BINARY} & > /dev/null || true
215+ done
197216
198217 # Delete the binaries we just built, because these are with none default logs.
199218 # TODO: When fluffy gets run time log options a la nimbus-eth2 we can keep
@@ -219,7 +238,7 @@ if [[ "${TIMEOUT_DURATION}" != "0" ]]; then
219238fi
220239
221240PIDS=" "
222- NUM_JOBS=${ NUM_NODES}
241+ NUM_JOBS=$(( NUM_NODES + LC_BRIDGE ))
223242
224243dump_logs () {
225244 LOG_LINES=20
@@ -234,6 +253,11 @@ BOOTSTRAP_NODE=0
234253BOOTSTRAP_TIMEOUT=5 # in seconds
235254BOOTSTRAP_ENR_FILE=" ${DATA_DIR} /node${BOOTSTRAP_NODE} /fluffy_node.enr"
236255
256+ TRUSTED_BLOCK_ROOT_ARG=" "
257+ if [[ -z ${TRUSTED_BLOCK_ROOT} ]]; then
258+ TRUSTED_BLOCK_ROOT_ARG=" --trusted-block-root=${TRUSTED_BLOCK_ROOT} "
259+ fi
260+
237261for NUM_NODE in $( seq 0 $(( NUM_NODES - 1 )) ) ; do
238262 NODE_DATA_DIR=" ${DATA_DIR} /node${NUM_NODE} "
239263 rm -rf " ${NODE_DATA_DIR} "
@@ -275,6 +299,7 @@ for NUM_NODE in $(seq 0 $(( NUM_NODES - 1 ))); do
275299 --log-level=" ${LOG_LEVEL} " \
276300 --udp-port=$(( BASE_PORT + NUM_NODE )) \
277301 --data-dir=" ${NODE_DATA_DIR} " \
302+ --network=" none" \
278303 ${BOOTSTRAP_ARG} \
279304 --rpc \
280305 --rpc-address=" 127.0.0.1" \
@@ -285,6 +310,7 @@ for NUM_NODE in $(seq 0 $(( NUM_NODES - 1 ))); do
285310 --table-ip-limit=1024 \
286311 --bucket-ip-limit=24 \
287312 --bits-per-hop=1 \
313+ ${TRUSTED_BLOCK_ROOT_ARG} \
288314 ${RADIUS_ARG} \
289315 ${EXTRA_ARGS} \
290316 > " ${DATA_DIR} /log${NUM_NODE} .txt" 2>&1 &
@@ -296,6 +322,21 @@ for NUM_NODE in $(seq 0 $(( NUM_NODES - 1 ))); do
296322 fi
297323done
298324
325+ if [[ " $LC_BRIDGE " == " 1" ]]; then
326+ echo " Starting bridge node."
327+ LC_BRIDGE_DATA_DIR=" ${DATA_DIR} /lc_bridge"
328+ ./build/beacon_lc_bridge \
329+ --data-dir=" ${LC_BRIDGE_DATA_DIR} " \
330+ --udp-port=$(( BASE_PORT + NUM_NODES )) \
331+ --rpc-address=" 127.0.0.1" \
332+ --rpc-port=" ${BASE_RPC_PORT} " \
333+ --beacon-light-client \
334+ ${TRUSTED_BLOCK_ROOT_ARG} \
335+ > " ${DATA_DIR} /log_lc_bridge.txt" 2>&1 &
336+
337+ PIDS=" ${PIDS} ,$! "
338+ fi
339+
299340# give the regular nodes time to crash
300341sleep 5
301342BG_JOBS=" $( jobs | wc -l | tr -d ' ' ) "
0 commit comments