From b3d06c14b686f68a647442a88d6b121a417b5f3f Mon Sep 17 00:00:00 2001 From: Kim De Mey Date: Wed, 5 Jul 2023 16:44:18 +0200 Subject: [PATCH] Build Fluffy tools individually through Makefile (#1626) * Build Fluffy tools individually through Makefile Before the builds were launched sequentually from a nimble task, this would not allow for concurrent builds of the individual tools * Some Makefile / nimble clean-up --- Makefile | 33 ++++++++++++++++++++++++--------- fluffy/nim.cfg | 2 ++ fluffy/tools/bridge/nim.cfg | 2 ++ nimbus.nimble | 12 ++---------- 4 files changed, 30 insertions(+), 19 deletions(-) create mode 100644 fluffy/tools/bridge/nim.cfg diff --git a/Makefile b/Makefile index 73b41e363..46392efa8 100644 --- a/Makefile +++ b/Makefile @@ -63,9 +63,23 @@ TOOLS_DIRS := \ # comma-separated values for the "clean" target TOOLS_CSV := $(subst $(SPACE),$(COMMA),$(TOOLS)) +# Fluffy debugging tools + testing tools +FLUFFY_TOOLS := \ + beacon_chain_bridge \ + eth_data_exporter \ + content_verifier \ + blockwalk \ + portalcli +FLUFFY_TOOLS_DIRS := \ + fluffy/tools/bridge \ + fluffy/tools +# comma-separated values for the "clean" target +FLUFFY_TOOLS_CSV := $(subst $(SPACE),$(COMMA),$(FLUFFY_TOOLS)) + .PHONY: \ all \ $(TOOLS) \ + $(FLUFFY_TOOLS) \ deps \ update \ nimbus \ @@ -208,10 +222,6 @@ fluffy: | build deps echo -e $(BUILD_MSG) "build/$@" && \ $(ENV_SCRIPT) nim fluffy $(NIM_PARAMS) nimbus.nims -lc-bridge: | build deps - echo -e $(BUILD_MSG) "build/$@" && \ - $(ENV_SCRIPT) nim lc_bridge $(NIM_PARAMS) nimbus.nims - # primitive reproducibility test fluffy-test-reproducibility: + [ -e build/fluffy ] || $(MAKE) V=0 fluffy; \ @@ -226,11 +236,16 @@ fluffy-test-reproducibility: fluffy-test: | build deps $(ENV_SCRIPT) nim fluffy_test $(NIM_PARAMS) nimbus.nims -# builds the fluffy tools -fluffy-tools: | build deps - $(ENV_SCRIPT) nim fluffy_tools $(NIM_PARAMS) nimbus.nims +# builds the fluffy tools, wherever they are +$(FLUFFY_TOOLS): | build deps + for D in $(FLUFFY_TOOLS_DIRS); do [ -e "$${D}/$@.nim" ] && TOOL_DIR="$${D}" && break; done && \ + echo -e $(BUILD_MSG) "build/$@" && \ + $(ENV_SCRIPT) nim c $(NIM_PARAMS) -d:chronicles_log_level=TRACE -o:build/$@ "$${TOOL_DIR}/$@.nim" -# builds the fluffy tools +# builds all the fluffy tools +fluffy-tools: | $(FLUFFY_TOOLS) + +# builds the uTP test app utp-test-app: | build deps $(ENV_SCRIPT) nim utp_test_app $(NIM_PARAMS) nimbus.nims @@ -275,7 +290,7 @@ txparse: | build deps # usual cleaning clean: | clean-common - rm -rf build/{nimbus,fluffy,nimbus_verified_proxy,$(TOOLS_CSV),all_tests,test_kvstore_rocksdb,test_rpc,all_fluffy_tests,all_fluffy_portal_spec_tests,test_portal_testnet,portalcli,blockwalk,eth_data_exporter,utp_test_app,utp_test,*.dSYM} + rm -rf build/{nimbus,fluffy,nimbus_verified_proxy,$(TOOLS_CSV),$(FLUFFY_TOOLS_CSV),all_tests,test_kvstore_rocksdb,test_rpc,all_fluffy_tests,all_fluffy_portal_spec_tests,test_portal_testnet,portalcli,blockwalk,eth_data_exporter,utp_test_app,utp_test,*.dSYM} rm -rf tools/t8n/{t8n,t8n_test} rm -rf tools/evmstate/{evmstate,evmstate_test} ifneq ($(USE_LIBBACKTRACE), 0) diff --git a/fluffy/nim.cfg b/fluffy/nim.cfg index 3b4debae9..3ef099b26 100644 --- a/fluffy/nim.cfg +++ b/fluffy/nim.cfg @@ -6,6 +6,8 @@ @end -d:chronosStrictException +-d:PREFER_BLST_SHA256=false + --styleCheck:usages --styleCheck:hint --hint[XDeclaredButNotUsed]:off diff --git a/fluffy/tools/bridge/nim.cfg b/fluffy/tools/bridge/nim.cfg new file mode 100644 index 000000000..e233b3ddc --- /dev/null +++ b/fluffy/tools/bridge/nim.cfg @@ -0,0 +1,2 @@ +# Use only `secp256k1` public key cryptography as an identity in LibP2P. +-d:"libp2p_pki_schemes=secp256k1" diff --git a/nimbus.nimble b/nimbus.nimble index 155bb0280..5dd2574d8 100644 --- a/nimbus.nimble +++ b/nimbus.nimble @@ -31,8 +31,7 @@ when declared(namedBin): namedBin = { "nimbus/nimbus": "nimbus", "fluffy/fluffy": "fluffy", - "lc_proxy/lc_proxy": "lc_proxy", - "fluffy/tools/portalcli": "portalcli", + "nimbus_verified_proxy/nimbus_verified_proxy": "nimbus_verified_proxy", }.toTable() proc buildBinary(name: string, srcDir = "./", params = "", lang = "c") = @@ -72,7 +71,7 @@ task test_evm, "Run EVM tests": ## Fluffy tasks task fluffy, "Build fluffy": - buildBinary "fluffy", "fluffy/", "-d:chronicles_log_level=TRACE -d:chronosStrictException -d:PREFER_BLST_SHA256=false" + buildBinary "fluffy", "fluffy/", "-d:chronicles_log_level=TRACE" task fluffy_test, "Run fluffy tests": # Need the nimbus_db_backend in state network tests as we need a Hexary to @@ -83,13 +82,6 @@ task fluffy_test, "Run fluffy tests": test "fluffy/tests", "all_fluffy_tests", "-d:chronicles_log_level=ERROR -d:chronosStrictException -d:nimbus_db_backend=sqlite -d:PREFER_BLST_SHA256=false -d:mergeBlockNumber:38130" test "fluffy/tests/beacon_light_client_tests", "all_beacon_light_client_tests", "-d:chronicles_log_level=ERROR -d:chronosStrictException -d:nimbus_db_backend=sqlite -d:PREFER_BLST_SHA256=false" -task fluffy_tools, "Build fluffy tools": - buildBinary "beacon_chain_bridge", "fluffy/tools/bridge/", "-d:chronicles_log_level=TRACE -d:chronosStrictException -d:PREFER_BLST_SHA256=false -d:libp2p_pki_schemes=secp256k1" - buildBinary "eth_data_exporter", "fluffy/tools/", "-d:chronicles_log_level=TRACE -d:chronosStrictException -d:PREFER_BLST_SHA256=false" - buildBinary "content_verifier", "fluffy/tools/", "-d:chronicles_log_level=TRACE -d:chronosStrictException -d:PREFER_BLST_SHA256=false" - buildBinary "blockwalk", "fluffy/tools/", "-d:chronicles_log_level=TRACE -d:chronosStrictException" - buildBinary "portalcli", "fluffy/tools/", "-d:chronicles_log_level=TRACE -d:chronosStrictException -d:PREFER_BLST_SHA256=false" - task utp_test_app, "Build uTP test app": buildBinary "utp_test_app", "fluffy/tools/utp_testing/", "-d:chronicles_log_level=TRACE -d:chronosStrictException"