From b7d0b06e79382d1e7b15f4ed77b562f450455f7e Mon Sep 17 00:00:00 2001 From: Kim De Mey Date: Fri, 20 Oct 2023 14:30:21 +0200 Subject: [PATCH] Change some Fluffy related cli defaults (#1833) --- .github/workflows/fluffy.yml | 2 +- fluffy/conf.nim | 17 ++++++++++++----- .../network/wire/portal_protocol_config.nim | 7 ++++++- fluffy/scripts/launch_local_testnet.sh | 19 +++++++++++-------- 4 files changed, 30 insertions(+), 15 deletions(-) diff --git a/.github/workflows/fluffy.yml b/.github/workflows/fluffy.yml index 7f014bd8e..050a9d712 100644 --- a/.github/workflows/fluffy.yml +++ b/.github/workflows/fluffy.yml @@ -295,4 +295,4 @@ jobs: - name: Run fluffy testnet run: | - ./fluffy/scripts/launch_local_testnet.sh + ./fluffy/scripts/launch_local_testnet.sh --run-tests diff --git a/fluffy/conf.nim b/fluffy/conf.nim index 101aa42b8..4a49ff777 100644 --- a/fluffy/conf.nim +++ b/fluffy/conf.nim @@ -43,8 +43,12 @@ const defaultStorageSize* = uint32(1000 * 1000 * 100) defaultStorageSizeDesc* = $defaultStorageSize - defaultTableIpLimitDesc* = $DefaultTableIpLimit - defaultBucketIpLimitDesc* = $DefaultBucketIpLimit + defaultTableIpLimitDesc* = + $defaultPortalProtocolConfig.tableIpLimits.tableIpLimit + defaultBucketIpLimitDesc* = + $defaultPortalProtocolConfig.tableIpLimits.bucketIpLimit + defaultBitsPerHopDesc* = + $defaultPortalProtocolConfig.bitsPerHop type TrustedDigest* = MDigest[32 * 8] @@ -180,25 +184,28 @@ type name: "proxy-uri" .}: ClientConfig tableIpLimit* {. + hidden desc: "Maximum amount of nodes with the same IP in the routing table. " & "This option is currently required as many nodes are running from " & "the same machines. The option will be removed/adjusted in the future" - defaultValue: DefaultTableIpLimit + defaultValue: defaultPortalProtocolConfig.tableIpLimits.tableIpLimit defaultValueDesc: $defaultTableIpLimitDesc name: "table-ip-limit" .}: uint bucketIpLimit* {. + hidden desc: "Maximum amount of nodes with the same IP in the routing table's buckets. " & "This option is currently required as many nodes are running from " & "the same machines. The option will be removed/adjusted in the future" - defaultValue: DefaultBucketIpLimit + defaultValue: defaultPortalProtocolConfig.tableIpLimits.bucketIpLimit defaultValueDesc: $defaultBucketIpLimitDesc name: "bucket-ip-limit" .}: uint bitsPerHop* {. hidden desc: "Kademlia's b variable, increase for less hops per lookup" - defaultValue: DefaultBitsPerHop + defaultValue: defaultPortalProtocolConfig.bitsPerHop + defaultValueDesc: $defaultBitsPerHopDesc name: "bits-per-hop" .}: int radiusConfig* {. diff --git a/fluffy/network/wire/portal_protocol_config.nim b/fluffy/network/wire/portal_protocol_config.nim index 1118fd2a2..c6887f9ac 100644 --- a/fluffy/network/wire/portal_protocol_config.nim +++ b/fluffy/network/wire/portal_protocol_config.nim @@ -38,7 +38,12 @@ const revalidationTimeout* = chronos.seconds(30) defaultPortalProtocolConfig* = PortalProtocolConfig( - tableIpLimits: DefaultTableIpLimits, + # TODO / IMPORTANT NOTE: + # This must be set back to `DefaultTableIpLimits` as soon as there are + # enough nodes in the Portal network that we don't need to rely on the + # Fluffy fleet. Currently, during development, convenience is taken above + # security, this must not remain. + tableIpLimits: TableIpLimits(tableIpLimit: 32, bucketIpLimit: 16), bitsPerHop: DefaultBitsPerHop, radiusConfig: defaultRadiusConfig ) diff --git a/fluffy/scripts/launch_local_testnet.sh b/fluffy/scripts/launch_local_testnet.sh index a329890e7..4813cdb5d 100755 --- a/fluffy/scripts/launch_local_testnet.sh +++ b/fluffy/scripts/launch_local_testnet.sh @@ -34,12 +34,12 @@ if [ ${PIPESTATUS[0]} != 4 ]; then fi OPTS="h:n:d" -LONGOPTS="help,nodes:,data-dir:,enable-htop,log-level:,base-port:,base-rpc-port:,trusted-block-root:,beacon-chain-bridge,base-metrics-port:,reuse-existing-data-dir,timeout:,kill-old-processes" +LONGOPTS="help,nodes:,data-dir:,run-tests,log-level:,base-port:,base-rpc-port:,trusted-block-root:,beacon-chain-bridge,base-metrics-port:,reuse-existing-data-dir,timeout:,kill-old-processes" # default values NUM_NODES="64" DATA_DIR="local_testnet_data" -USE_HTOP="0" +RUN_TESTS="0" LOG_LEVEL="INFO" BASE_PORT="9000" BASE_METRICS_PORT="8008" @@ -66,7 +66,7 @@ E.g.: $(basename "$0") --nodes ${NUM_NODES} --data-dir "${DATA_DIR}" # defaults --base-metrics-port bootstrap node's metrics server port (default: ${BASE_METRICS_PORT}) --beacon-chain-bridge run a beacon chain bridge attached to the bootstrap node --trusted-block-root recent trusted finalized block root to initialize the consensus light client from - --enable-htop use "htop" to see the fluffy processes without doing any tests + --run-tests when enabled run tests else use "htop" to see the fluffy processes without doing any tests --log-level set the log level (default: ${LOG_LEVEL}) --reuse-existing-data-dir instead of deleting and recreating the data dir, keep it and reuse everything we can from it --timeout timeout in seconds (default: ${TIMEOUT_DURATION} - no timeout) @@ -96,8 +96,8 @@ while true; do DATA_DIR="$2" shift 2 ;; - --enable-htop) - USE_HTOP="1" + --run-tests) + RUN_TESTS="1" shift ;; --log-level) @@ -199,9 +199,12 @@ BINARIES="fluffy" if [[ "${BEACON_CHAIN_BRIDGE}" == "1" ]]; then BINARIES="${BINARIES} beacon_chain_bridge" fi -TEST_BINARIES="test_portal_testnet" $MAKE -j ${NPROC} LOG_LEVEL=TRACE ${BINARIES} -$MAKE -j ${NPROC} LOG_LEVEL=INFO ${TEST_BINARIES} + +if [[ "$RUN_TESTS" == "1" ]]; then + TEST_BINARIES="test_portal_testnet" + $MAKE -j ${NPROC} LOG_LEVEL=INFO ${TEST_BINARIES} +fi # Kill child processes on Ctrl-C/SIGTERM/exit, passing the PID of this shell # instance as the parent and the target process name as a pattern to the @@ -351,7 +354,7 @@ if [[ "$BG_JOBS" != "$NUM_JOBS" ]]; then fi # launch htop and run until `TIMEOUT_DURATION` or check the nodes and quit. -if [[ "$USE_HTOP" == "1" ]]; then +if [[ "$RUN_TESTS" == "0" ]]; then htop -p "$PIDS" cleanup else