From d17ddacf39d7a82f90e2fdb0ed52907ae68a8a75 Mon Sep 17 00:00:00 2001 From: web3-developer <51288821+web3-developer@users.noreply.github.com> Date: Fri, 13 Sep 2024 20:40:48 +0800 Subject: [PATCH] More improvements to the Fluffy local testnet script (#2624) * More improvements to the Fluffy local testnet script. --- fluffy/scripts/launch_local_testnet.sh | 18 +++++++++++++----- .../portal_bridge/portal_bridge_state.nim | 4 ++-- 2 files changed, 15 insertions(+), 7 deletions(-) diff --git a/fluffy/scripts/launch_local_testnet.sh b/fluffy/scripts/launch_local_testnet.sh index 62b28dc6a..2a65ea61e 100755 --- a/fluffy/scripts/launch_local_testnet.sh +++ b/fluffy/scripts/launch_local_testnet.sh @@ -34,10 +34,14 @@ if [ ${PIPESTATUS[0]} != 4 ]; then fi OPTS="h:n:d" -LONGOPTS="help,nodes:,data-dir:,run-tests,log-level:,base-port:,base-rpc-port:,trusted-block-root:,portal-bridge,base-metrics-port:,reuse-existing-data-dir,timeout:,kill-old-processes,skip-build,portal-subnetworks:,disable-state-root-validation" +LONGOPTS="help,nodes:,data-dir:,run-tests,log-level:,base-port:,base-rpc-port:,trusted-block-root:,portal-bridge,base-metrics-port:,reuse-existing-data-dir,timeout:,kill-old-processes,skip-build,portal-subnetworks:,disable-state-root-validation,radius:" # default values -NUM_NODES="3" + +NUM_NODES="8" # With the default radius of 254 which should result in ~1/4th +# of the data set stored on each node at least 8 nodes are recommended to +# provide complete coverage of the data set with approx replication factor of 2. +RADIUS="static:254" DATA_DIR="local_testnet_data" RUN_TESTS="0" LOG_LEVEL="INFO" @@ -78,6 +82,7 @@ E.g.: $(basename "$0") --nodes ${NUM_NODES} --data-dir "${DATA_DIR}" # defaults --skip-build skip building the binaries (default: disabled) --portal-subnetworks comma separated list of subnetworks to enable (default: ${PORTAL_SUBNETWORKS}) --disable-state-root-validation disable state root validation for the state subnetwork (default: disabled) + --radius set the radius to be used by the nodes (default: ${RADIUS}) EOF } @@ -155,6 +160,10 @@ while true; do DISABLE_STATE_ROOT_VALIDATION="1" shift ;; + --radius) + RADIUS="$2" + shift 2 + ;; --) shift break @@ -297,11 +306,10 @@ for NUM_NODE in $(seq 0 $(( NUM_NODES - 1 ))); do NODE_DATA_DIR="${DATA_DIR}/node${NUM_NODE}" + RADIUS_ARG="--radius=${RADIUS}" + if [[ ${NUM_NODE} != ${BOOTSTRAP_NODE} ]]; then BOOTSTRAP_ARG="--bootstrap-file=${BOOTSTRAP_ENR_FILE}" - # All nodes but bootstrap node run with log. radius of 254 which should - # result in ~1/4th of the data set stored. - RADIUS_ARG="--radius=static:254" # Wait for the bootstrap node to write out its enr file START_TIMESTAMP=$(date +%s) diff --git a/fluffy/tools/portal_bridge/portal_bridge_state.nim b/fluffy/tools/portal_bridge/portal_bridge_state.nim index e375f93a1..23e75a12d 100644 --- a/fluffy/tools/portal_bridge/portal_bridge_state.nim +++ b/fluffy/tools/portal_bridge/portal_bridge_state.nim @@ -314,7 +314,7 @@ proc runBackfillGossipBlockOffersLoop( continue if verifyGossip: - #await sleepAsync(100.milliseconds) # wait for the peers to be updated + await sleepAsync(100.milliseconds) # wait for the peers to be updated for k, _ in offersMap: try: let contentInfo = @@ -324,7 +324,7 @@ proc runBackfillGossipBlockOffersLoop( retryGossip = true break except CatchableError as e: - error "Failed to find content with key: ", + warn "Failed to find content with key: ", contentKey = k, error = e.msg, workerId retryGossip = true break