From fada11e1e94ad346d44846fc817b8c444b54a204 Mon Sep 17 00:00:00 2001 From: Zahary Karadjov Date: Tue, 28 Apr 2020 13:43:40 +0300 Subject: [PATCH] Address review comments * Create a json log named "nbc.log" only when the --dev-build option is specified to the connect_to_testnet script. This option is specified for the targets "testnet0", "testnet1" and "schlesi-dev" --- Makefile | 4 ++-- scripts/connect_to_testnet.nims | 12 +++++++++--- 2 files changed, 11 insertions(+), 5 deletions(-) diff --git a/Makefile b/Makefile index 8e0204b53..380063e59 100644 --- a/Makefile +++ b/Makefile @@ -124,14 +124,14 @@ clean-testnet1: # - try SCRIPT_PARAMS="--skipGoerliKey" testnet0 testnet1: | build deps source scripts/$@.env; \ - NIM_PARAMS="$(NIM_PARAMS)" LOG_LEVEL="$(LOG_LEVEL)" $(ENV_SCRIPT) nim $(NIM_PARAMS) scripts/connect_to_testnet.nims $(SCRIPT_PARAMS) --const-preset=$$CONST_PRESET $@ + NIM_PARAMS="$(NIM_PARAMS)" LOG_LEVEL="$(LOG_LEVEL)" $(ENV_SCRIPT) nim $(NIM_PARAMS) scripts/connect_to_testnet.nims $(SCRIPT_PARAMS) --const-preset=$$CONST_PRESET --dev-build $@ schlesi: | build deps LOG_LEVEL="DEBUG" $(ENV_SCRIPT) nim $(NIM_PARAMS) scripts/connect_to_testnet.nims $(SCRIPT_PARAMS) shared/schlesi schlesi-dev: | build deps LOG_LEVEL="DEBUG; TRACE:discv5,networking; REQUIRED:none; DISABLED:none" \ - $(ENV_SCRIPT) nim $(NIM_PARAMS) scripts/connect_to_testnet.nims $(SCRIPT_PARAMS) shared/schlesi + $(ENV_SCRIPT) nim $(NIM_PARAMS) scripts/connect_to_testnet.nims $(SCRIPT_PARAMS) --dev-build shared/schlesi clean: | clean-common rm -rf build/{$(TOOLS_CSV),all_tests,*_node,*ssz*,beacon_node_testnet*,state_sim,transition*} diff --git a/scripts/connect_to_testnet.nims b/scripts/connect_to_testnet.nims index 1f051d369..807714fce 100644 --- a/scripts/connect_to_testnet.nims +++ b/scripts/connect_to_testnet.nims @@ -27,9 +27,12 @@ cli do (skipGoerliKey {. desc: "Don't prompt for an Eth1 Goerli key to become a validator" .}: bool, constPreset {. - defaultValue: "" desc: "The Ethereum 2.0 const preset of the network (optional)" - name: "const-preset" .}: string, + name: "const-preset" .} = "", + + devBuild {. + desc: "Enables more extensive logging and debugging support" + name: "dev-build" .} = false, testnetName {.argument .}: string): let @@ -89,6 +92,9 @@ cli do (skipGoerliKey {. var nimFlags = "-d:chronicles_log_level=TRACE " & getEnv("NIM_PARAMS") + if devBuild: + nimFlags.add """ -d:"chronicles_sinks=textlines,json[file(nbc.log)]" """ + let depositContractFile = testnetDir / depositContractFileName if system.fileExists(depositContractFile): depositContractOpt = "--deposit-contract=" & readFile(depositContractFile).strip @@ -107,7 +113,7 @@ cli do (skipGoerliKey {. rmDir dataDir cd rootDir - exec &"""nim c {nimFlags} -d:"const_preset={preset}" -d:"chronicles_sinks=textlines,json[file(json-log.txt)],textblocks[file(text-log.txt)]" -o:"{beaconNodeBinary}" beacon_chain/beacon_node.nim""" + exec &"""nim c {nimFlags} -d:"const_preset={preset}" -o:"{beaconNodeBinary}" beacon_chain/beacon_node.nim""" mkDir dumpDir