Skip to content

Commit

Permalink
Address review comments
Browse files Browse the repository at this point in the history
* 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"
  • Loading branch information
zah committed Apr 28, 2020
1 parent 667bdf0 commit fada11e
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 5 deletions.
4 changes: 2 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -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*}
Expand Down
12 changes: 9 additions & 3 deletions scripts/connect_to_testnet.nims
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand All @@ -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

Expand Down

0 comments on commit fada11e

Please sign in to comment.