From 2766e20179e321c32477fef70048c0ec4901cafd Mon Sep 17 00:00:00 2001 From: Daniel Sobol Date: Sat, 17 Feb 2024 01:38:58 +0300 Subject: [PATCH] Add flag to explicitly enable state network (#2031) --- fluffy/conf.nim | 8 +++++++- fluffy/fluffy.nim | 12 ++++++++---- fluffy/scripts/launch_local_testnet.sh | 3 ++- 3 files changed, 17 insertions(+), 6 deletions(-) diff --git a/fluffy/conf.nim b/fluffy/conf.nim index 3985aa7cf..8359bdf41 100644 --- a/fluffy/conf.nim +++ b/fluffy/conf.nim @@ -1,5 +1,5 @@ # Fluffy -# Copyright (c) 2021-2023 Status Research & Development GmbH +# Copyright (c) 2021-2024 Status Research & Development GmbH # Licensed and distributed under either of # * MIT license (license terms in the root directory or at https://opensource.org/licenses/MIT). # * Apache v2 license (license terms in the root directory or at https://www.apache.org/licenses/LICENSE-2.0). @@ -246,6 +246,12 @@ type defaultValueDesc: $defaultDisablePoke name: "disable-poke" .}: bool + stateNetworkEnabled* {. + hidden + desc: "Enable State Network" + defaultValue: false + name: "state" .}: bool + case cmd* {. command defaultValue: noCommand .}: PortalCmd diff --git a/fluffy/fluffy.nim b/fluffy/fluffy.nim index 16d6c5b1b..bd751dc59 100644 --- a/fluffy/fluffy.nim +++ b/fluffy/fluffy.nim @@ -166,10 +166,14 @@ proc run(config: PortalConf) {.raises: [CatchableError].} = ) streamManager = StreamManager.new(d) - stateNetwork = Opt.some(StateNetwork.new( - d, db, streamManager, - bootstrapRecords = bootstrapRecords, - portalConfig = portalConfig)) + stateNetwork = + if config.stateNetworkEnabled: + Opt.some(StateNetwork.new( + d, db, streamManager, + bootstrapRecords = bootstrapRecords, + portalConfig = portalConfig)) + else: + Opt.none(StateNetwork) accumulator = # Building an accumulator from header epoch files takes > 2m30s and is diff --git a/fluffy/scripts/launch_local_testnet.sh b/fluffy/scripts/launch_local_testnet.sh index 0ba8ef27a..3783e501f 100755 --- a/fluffy/scripts/launch_local_testnet.sh +++ b/fluffy/scripts/launch_local_testnet.sh @@ -1,6 +1,6 @@ #!/usr/bin/env bash -# Copyright (c) 2021-2023 Status Research & Development GmbH. Licensed under +# Copyright (c) 2021-2024 Status Research & Development GmbH. Licensed under # either of: # - Apache License, version 2.0 # - MIT license @@ -315,6 +315,7 @@ for NUM_NODE in $(seq 0 $(( NUM_NODES - 1 ))); do --table-ip-limit=1024 \ --bucket-ip-limit=24 \ --bits-per-hop=1 \ + --state=1 \ ${TRUSTED_BLOCK_ROOT_ARG} \ ${RADIUS_ARG} \ ${EXTRA_ARGS} \