2021-02-02 22:31:01 +00:00
|
|
|
# Copyright (c) 2019-2021 Status Research & Development GmbH. Licensed under
|
2019-03-28 15:18:59 +00:00
|
|
|
# either of:
|
|
|
|
# - Apache License, version 2.0
|
|
|
|
# - MIT license
|
|
|
|
# at your option. This file may not be copied, modified, or distributed except
|
|
|
|
# according to those terms.
|
|
|
|
|
2019-09-10 00:50:09 +00:00
|
|
|
SHELL := bash # the shell used internally by "make"
|
|
|
|
|
2019-08-21 12:45:24 +00:00
|
|
|
# used inside the included makefiles
|
|
|
|
BUILD_SYSTEM_DIR := vendor/nimbus-build-system
|
2019-03-28 15:18:59 +00:00
|
|
|
|
2020-08-27 11:29:23 +00:00
|
|
|
# we set its default value before LOG_LEVEL is used in "variables.mk"
|
2021-02-19 15:37:00 +00:00
|
|
|
LOG_LEVEL := DEBUG
|
|
|
|
|
|
|
|
# used by Make targets that launch a beacon node
|
|
|
|
RUNTIME_LOG_LEVEL := INFO
|
2020-08-27 11:29:23 +00:00
|
|
|
|
2020-11-13 15:00:45 +00:00
|
|
|
LINK_PCRE := 0
|
|
|
|
|
2020-04-18 23:25:21 +00:00
|
|
|
# we don't want an error here, so we can handle things later, in the ".DEFAULT" target
|
2019-08-21 12:45:24 +00:00
|
|
|
-include $(BUILD_SYSTEM_DIR)/makefiles/variables.mk
|
2019-03-28 15:18:59 +00:00
|
|
|
|
2020-07-09 22:41:51 +00:00
|
|
|
NODE_ID := 0
|
|
|
|
BASE_PORT := 9000
|
|
|
|
BASE_RPC_PORT := 9190
|
|
|
|
BASE_METRICS_PORT := 8008
|
2020-12-01 21:20:28 +00:00
|
|
|
WEB3_URL := "wss://goerli.infura.io/ws/v3/809a18497dd74102b5f37d25aae3c85a"
|
2020-07-10 15:18:14 +00:00
|
|
|
VALIDATORS := 1
|
2020-08-21 21:05:37 +00:00
|
|
|
CPU_LIMIT := 0
|
2021-09-09 12:14:19 +00:00
|
|
|
BUILD_END_MSG := "\\x1B[92mBuild completed successfully:\\x1B[39m"
|
2020-08-21 21:05:37 +00:00
|
|
|
|
|
|
|
ifeq ($(CPU_LIMIT), 0)
|
|
|
|
CPU_LIMIT_CMD :=
|
|
|
|
else
|
|
|
|
CPU_LIMIT_CMD := cpulimit --limit=$(CPU_LIMIT) --foreground --
|
|
|
|
endif
|
2020-07-09 22:41:51 +00:00
|
|
|
|
2019-12-04 14:40:36 +00:00
|
|
|
# unconditionally built by the default Make target
|
2020-07-29 21:19:36 +00:00
|
|
|
# TODO re-enable ncli_query if/when it works again
|
2019-12-04 14:40:36 +00:00
|
|
|
TOOLS := \
|
2020-11-07 18:00:31 +00:00
|
|
|
nimbus_beacon_node \
|
2020-06-11 16:41:43 +00:00
|
|
|
deposit_contract \
|
2021-04-27 20:46:24 +00:00
|
|
|
resttest \
|
2020-03-11 00:39:58 +00:00
|
|
|
logtrace \
|
2020-07-29 21:19:36 +00:00
|
|
|
ncli \
|
2020-06-11 16:41:43 +00:00
|
|
|
ncli_db \
|
2020-05-04 05:38:14 +00:00
|
|
|
stack_sizes \
|
2020-11-07 18:00:31 +00:00
|
|
|
nimbus_validator_client \
|
2021-11-30 01:20:21 +00:00
|
|
|
nimbus_signing_node
|
2021-02-14 20:04:54 +00:00
|
|
|
.PHONY: $(TOOLS)
|
2020-06-23 22:41:38 +00:00
|
|
|
|
|
|
|
# bench_bls_sig_agggregation TODO reenable after bls v0.10.1 changes
|
2020-06-11 16:41:43 +00:00
|
|
|
|
2019-12-04 14:40:36 +00:00
|
|
|
TOOLS_DIRS := \
|
|
|
|
beacon_chain \
|
2021-03-03 06:23:05 +00:00
|
|
|
beacon_chain/eth1 \
|
2019-12-04 14:40:36 +00:00
|
|
|
benchmarks \
|
|
|
|
ncli \
|
|
|
|
research \
|
2020-06-10 15:21:32 +00:00
|
|
|
tools
|
2019-04-12 22:15:38 +00:00
|
|
|
TOOLS_CSV := $(subst $(SPACE),$(COMMA),$(TOOLS))
|
2019-03-28 15:18:59 +00:00
|
|
|
|
2019-12-04 14:40:36 +00:00
|
|
|
.PHONY: \
|
|
|
|
all \
|
|
|
|
deps \
|
|
|
|
update \
|
|
|
|
test \
|
2020-06-16 19:45:52 +00:00
|
|
|
clean_eth2_network_simulation_all \
|
2019-12-04 14:40:36 +00:00
|
|
|
eth2_network_simulation \
|
|
|
|
clean-testnet0 \
|
|
|
|
testnet0 \
|
|
|
|
clean-testnet1 \
|
|
|
|
testnet1 \
|
2020-02-13 12:19:12 +00:00
|
|
|
clean \
|
2020-05-02 14:30:34 +00:00
|
|
|
libbacktrace \
|
|
|
|
book \
|
2020-10-15 12:19:41 +00:00
|
|
|
publish-book \
|
2021-01-07 09:19:29 +00:00
|
|
|
dist-amd64 \
|
|
|
|
dist-arm64 \
|
|
|
|
dist-arm \
|
2021-02-02 22:31:01 +00:00
|
|
|
dist-win64 \
|
2021-05-19 06:38:13 +00:00
|
|
|
dist-macos \
|
|
|
|
dist-macos-arm64 \
|
2020-12-11 11:12:43 +00:00
|
|
|
dist \
|
|
|
|
benchmarks
|
2019-08-21 12:45:24 +00:00
|
|
|
|
2019-12-03 18:52:54 +00:00
|
|
|
ifeq ($(NIM_PARAMS),)
|
2020-04-18 23:25:21 +00:00
|
|
|
# "variables.mk" was not included, so we update the submodules.
|
2020-09-16 15:46:05 +00:00
|
|
|
#
|
|
|
|
# The `git reset ...` will try to fix a `make update` that was interrupted
|
|
|
|
# with Ctrl+C after deleting the working copy and before getting a chance to
|
|
|
|
# restore it in $(BUILD_SYSTEM_DIR).
|
2020-04-18 23:25:21 +00:00
|
|
|
GIT_SUBMODULE_UPDATE := git submodule update --init --recursive
|
|
|
|
.DEFAULT:
|
|
|
|
+@ echo -e "Git submodules not found. Running '$(GIT_SUBMODULE_UPDATE)'.\n"; \
|
2020-04-19 11:36:11 +00:00
|
|
|
$(GIT_SUBMODULE_UPDATE) && \
|
2020-09-16 15:46:05 +00:00
|
|
|
git submodule foreach --quiet 'git reset --quiet --hard' && \
|
2020-04-18 23:25:21 +00:00
|
|
|
echo
|
|
|
|
# Now that the included *.mk files appeared, and are newer than this file, Make will restart itself:
|
|
|
|
# https://www.gnu.org/software/make/manual/make.html#Remaking-Makefiles
|
|
|
|
#
|
|
|
|
# After restarting, it will execute its original goal, so we don't have to start a child Make here
|
|
|
|
# with "$(MAKE) $(MAKECMDGOALS)". Isn't hidden control flow great?
|
|
|
|
|
|
|
|
else # "variables.mk" was included. Business as usual until the end of this file.
|
|
|
|
|
|
|
|
# default target, because it's the first one that doesn't start with '.'
|
|
|
|
all: | $(TOOLS) libnfuzz.so libnfuzz.a
|
2019-08-21 12:45:24 +00:00
|
|
|
|
|
|
|
# must be included after the default target
|
|
|
|
-include $(BUILD_SYSTEM_DIR)/makefiles/targets.mk
|
|
|
|
|
2020-06-14 02:25:19 +00:00
|
|
|
ifeq ($(OS), Windows_NT)
|
2021-01-07 09:19:29 +00:00
|
|
|
# libbacktrace/libunwind is disabled on Windows.
|
2020-10-12 13:04:21 +00:00
|
|
|
USE_LIBBACKTRACE := 0
|
2020-06-14 02:25:19 +00:00
|
|
|
endif
|
|
|
|
|
2020-07-28 20:37:12 +00:00
|
|
|
DEPOSITS_DELAY := 0
|
2020-07-09 22:41:51 +00:00
|
|
|
|
2020-11-27 01:29:06 +00:00
|
|
|
#- "--define:release" cannot be added to "config.nims"
|
|
|
|
#- disable Nim's default parallelisation because it starts too many processes for too little gain
|
2021-10-01 14:15:08 +00:00
|
|
|
#- https://github.com/status-im/nim-libp2p#use-identify-metrics
|
|
|
|
NIM_PARAMS += -d:release --parallelBuild:1 -d:libp2p_agents_metrics -d:KnownLibP2PAgents=nimbus,lighthouse,prysm,teku
|
2020-11-27 01:29:06 +00:00
|
|
|
|
2020-02-20 16:41:10 +00:00
|
|
|
ifeq ($(USE_LIBBACKTRACE), 0)
|
2020-09-21 06:40:01 +00:00
|
|
|
# Blame Jacek for the lack of line numbers in your stack traces ;-)
|
2021-02-14 20:04:54 +00:00
|
|
|
NIM_PARAMS += --stacktrace:on --excessiveStackTrace:on --linetrace:off -d:disable_libbacktrace
|
2020-02-20 16:41:10 +00:00
|
|
|
endif
|
2020-02-13 12:19:12 +00:00
|
|
|
|
2021-02-14 20:04:54 +00:00
|
|
|
deps: | deps-common nat-libs build/generate_makefile
|
2020-02-20 16:41:10 +00:00
|
|
|
ifneq ($(USE_LIBBACKTRACE), 0)
|
|
|
|
deps: | libbacktrace
|
|
|
|
endif
|
2019-08-21 12:45:24 +00:00
|
|
|
|
2020-11-27 01:29:06 +00:00
|
|
|
#- deletes binaries that might need to be rebuilt after a Git pull
|
2019-08-21 12:45:24 +00:00
|
|
|
update: | update-common
|
2020-11-27 01:29:06 +00:00
|
|
|
rm -f build/generate_makefile
|
2021-03-17 17:29:34 +00:00
|
|
|
rm -fr nimcache/
|
2019-08-21 12:45:24 +00:00
|
|
|
|
2020-02-13 12:19:12 +00:00
|
|
|
# nim-libbacktrace
|
|
|
|
libbacktrace:
|
2020-09-04 06:33:37 +00:00
|
|
|
+ "$(MAKE)" -C vendor/nim-libbacktrace --no-print-directory BUILD_CXX_LIB=0
|
2020-02-13 12:19:12 +00:00
|
|
|
|
2021-04-28 16:41:02 +00:00
|
|
|
# test binaries that can output an XML report
|
|
|
|
XML_TEST_BINARIES := \
|
2021-10-12 11:36:52 +00:00
|
|
|
consensus_spec_tests_mainnet \
|
|
|
|
consensus_spec_tests_minimal \
|
|
|
|
all_tests
|
2021-04-28 16:41:02 +00:00
|
|
|
|
|
|
|
# test suite
|
|
|
|
TEST_BINARIES := \
|
2021-02-14 20:04:54 +00:00
|
|
|
state_sim \
|
|
|
|
block_sim
|
2021-04-28 16:41:02 +00:00
|
|
|
.PHONY: $(TEST_BINARIES) $(XML_TEST_BINARIES)
|
2021-02-14 20:04:54 +00:00
|
|
|
|
2021-10-12 11:36:52 +00:00
|
|
|
# Preset-dependent tests
|
|
|
|
consensus_spec_tests_mainnet: | build deps
|
2021-02-14 20:04:54 +00:00
|
|
|
+ echo -e $(BUILD_MSG) "build/$@" && \
|
2021-02-15 17:08:18 +00:00
|
|
|
MAKE="$(MAKE)" V="$(V)" $(ENV_SCRIPT) scripts/compile_nim_program.sh \
|
2021-02-14 20:04:54 +00:00
|
|
|
$@ \
|
2021-10-12 11:36:52 +00:00
|
|
|
"tests/consensus_spec/consensus_spec_tests_preset.nim" \
|
2021-02-15 17:08:18 +00:00
|
|
|
$(NIM_PARAMS) -d:chronicles_log_level=TRACE -d:const_preset=mainnet -d:chronicles_sinks="json[file]" && \
|
2021-02-14 20:04:54 +00:00
|
|
|
echo -e $(BUILD_END_MSG) "build/$@"
|
|
|
|
|
2021-10-12 11:36:52 +00:00
|
|
|
consensus_spec_tests_minimal: | build deps
|
2021-07-13 06:38:35 +00:00
|
|
|
+ echo -e $(BUILD_MSG) "build/$@" && \
|
|
|
|
MAKE="$(MAKE)" V="$(V)" $(ENV_SCRIPT) scripts/compile_nim_program.sh \
|
|
|
|
$@ \
|
2021-10-12 11:36:52 +00:00
|
|
|
"tests/consensus_spec/consensus_spec_tests_preset.nim" \
|
2021-07-13 06:38:35 +00:00
|
|
|
$(NIM_PARAMS) -d:chronicles_log_level=TRACE -d:const_preset=minimal -d:chronicles_sinks="json[file]" && \
|
|
|
|
echo -e $(BUILD_END_MSG) "build/$@"
|
|
|
|
|
2021-10-12 11:36:52 +00:00
|
|
|
# Tests we only run for the default preset
|
2021-02-14 20:04:54 +00:00
|
|
|
proto_array: | build deps
|
|
|
|
+ echo -e $(BUILD_MSG) "build/$@" && \
|
2021-02-15 17:08:18 +00:00
|
|
|
MAKE="$(MAKE)" V="$(V)" $(ENV_SCRIPT) scripts/compile_nim_program.sh \
|
2021-02-14 20:04:54 +00:00
|
|
|
$@ \
|
|
|
|
"beacon_chain/fork_choice/$@.nim" \
|
2021-10-12 11:36:52 +00:00
|
|
|
$(NIM_PARAMS) -d:chronicles_sinks="json[file]" && \
|
2021-02-14 20:04:54 +00:00
|
|
|
echo -e $(BUILD_END_MSG) "build/$@"
|
|
|
|
|
|
|
|
fork_choice: | build deps
|
|
|
|
+ echo -e $(BUILD_MSG) "build/$@" && \
|
2021-02-15 17:08:18 +00:00
|
|
|
MAKE="$(MAKE)" V="$(V)" $(ENV_SCRIPT) scripts/compile_nim_program.sh \
|
2021-02-14 20:04:54 +00:00
|
|
|
$@ \
|
|
|
|
"beacon_chain/fork_choice/$@.nim" \
|
2021-10-12 11:36:52 +00:00
|
|
|
$(NIM_PARAMS) -d:chronicles_sinks="json[file]" && \
|
2021-02-14 20:04:54 +00:00
|
|
|
echo -e $(BUILD_END_MSG) "build/$@"
|
|
|
|
|
|
|
|
all_tests: | build deps
|
|
|
|
+ echo -e $(BUILD_MSG) "build/$@" && \
|
2021-02-15 17:08:18 +00:00
|
|
|
MAKE="$(MAKE)" V="$(V)" $(ENV_SCRIPT) scripts/compile_nim_program.sh \
|
2021-02-14 20:04:54 +00:00
|
|
|
$@ \
|
|
|
|
"tests/$@.nim" \
|
2021-10-12 11:36:52 +00:00
|
|
|
$(NIM_PARAMS) -d:chronicles_log_level=TRACE -d:chronicles_sinks="json[file]" && \
|
2021-02-14 20:04:54 +00:00
|
|
|
echo -e $(BUILD_END_MSG) "build/$@"
|
|
|
|
|
|
|
|
# State and block sims; getting to 4th epoch triggers consensus checks
|
|
|
|
state_sim: | build deps
|
|
|
|
+ echo -e $(BUILD_MSG) "build/$@" && \
|
2021-02-15 17:08:18 +00:00
|
|
|
MAKE="$(MAKE)" V="$(V)" $(ENV_SCRIPT) scripts/compile_nim_program.sh \
|
2021-02-14 20:04:54 +00:00
|
|
|
$@ \
|
|
|
|
"research/$@.nim" \
|
2021-10-12 11:36:52 +00:00
|
|
|
$(NIM_PARAMS) && \
|
2021-02-14 20:04:54 +00:00
|
|
|
echo -e $(BUILD_END_MSG) "build/$@"
|
|
|
|
|
|
|
|
block_sim: | build deps
|
|
|
|
+ echo -e $(BUILD_MSG) "build/$@" && \
|
2021-02-15 17:08:18 +00:00
|
|
|
MAKE="$(MAKE)" V="$(V)" $(ENV_SCRIPT) scripts/compile_nim_program.sh \
|
2021-02-14 20:04:54 +00:00
|
|
|
$@ \
|
|
|
|
"research/$@.nim" \
|
2021-10-12 11:36:52 +00:00
|
|
|
$(NIM_PARAMS) && \
|
2021-02-14 20:04:54 +00:00
|
|
|
echo -e $(BUILD_END_MSG) "build/$@"
|
|
|
|
|
2019-11-22 13:21:16 +00:00
|
|
|
DISABLE_TEST_FIXTURES_SCRIPT := 0
|
2021-02-14 20:04:54 +00:00
|
|
|
# This parameter passing scheme is ugly, but short.
|
2021-04-28 16:41:02 +00:00
|
|
|
test: | $(XML_TEST_BINARIES) $(TEST_BINARIES)
|
2019-11-22 13:21:16 +00:00
|
|
|
ifeq ($(DISABLE_TEST_FIXTURES_SCRIPT), 0)
|
2021-10-12 11:36:52 +00:00
|
|
|
V=$(V) scripts/setup_scenarios.sh
|
2019-08-14 21:53:48 +00:00
|
|
|
endif
|
2021-04-28 16:41:02 +00:00
|
|
|
for TEST_BINARY in $(XML_TEST_BINARIES); do \
|
|
|
|
PARAMS="--xml:build/$${TEST_BINARY}.xml --console"; \
|
|
|
|
echo -e "\nRunning $${TEST_BINARY} $${PARAMS}\n"; \
|
|
|
|
build/$${TEST_BINARY} $${PARAMS} || { echo -e "\n$${TEST_BINARY} $${PARAMS} failed; Aborting."; exit 1; }; \
|
|
|
|
done; \
|
|
|
|
rm -rf 0000-*.json t_slashprot_migration.* *.log block_sim_db
|
2021-02-14 20:04:54 +00:00
|
|
|
for TEST_BINARY in $(TEST_BINARIES); do \
|
|
|
|
PARAMS=""; \
|
2021-06-23 14:43:18 +00:00
|
|
|
if [[ "$${TEST_BINARY}" == "state_sim" ]]; then PARAMS="--validators=8000 --slots=160"; \
|
|
|
|
elif [[ "$${TEST_BINARY}" == "block_sim" ]]; then PARAMS="--validators=8000 --slots=160"; \
|
2021-02-14 20:04:54 +00:00
|
|
|
fi; \
|
|
|
|
echo -e "\nRunning $${TEST_BINARY} $${PARAMS}\n"; \
|
|
|
|
build/$${TEST_BINARY} $${PARAMS} || { echo -e "\n$${TEST_BINARY} $${PARAMS} failed; Aborting."; exit 1; }; \
|
|
|
|
done; \
|
|
|
|
rm -rf 0000-*.json t_slashprot_migration.* *.log block_sim_db
|
2019-03-28 15:18:59 +00:00
|
|
|
|
2020-11-27 01:29:06 +00:00
|
|
|
# It's OK to only build this once. `make update` deletes the binary, forcing a rebuild.
|
|
|
|
ifneq ($(USE_LIBBACKTRACE), 0)
|
|
|
|
build/generate_makefile: | libbacktrace
|
|
|
|
endif
|
|
|
|
build/generate_makefile: tools/generate_makefile.nim | deps-common
|
2021-06-01 13:22:21 +00:00
|
|
|
+ echo -e $(BUILD_MSG) "$@" && \
|
2021-02-23 19:39:10 +00:00
|
|
|
$(ENV_SCRIPT) nim c -o:$@ $(NIM_PARAMS) tools/generate_makefile.nim && \
|
|
|
|
echo -e $(BUILD_END_MSG) "$@"
|
2020-11-27 01:29:06 +00:00
|
|
|
|
|
|
|
# GCC's LTO parallelisation is able to detect a GNU Make jobserver and get its
|
|
|
|
# maximum number of processes from there, but only if we use the "+" prefix.
|
|
|
|
# Without it, it will default to the number of CPU cores, which can be a
|
|
|
|
# problem on low-memory systems.
|
|
|
|
# It also requires Make to pass open file descriptors to the GCC process,
|
|
|
|
# which is not possible if we let Nim handle this, so we generate and use a
|
|
|
|
# makefile instead.
|
2019-09-05 08:50:38 +00:00
|
|
|
$(TOOLS): | build deps
|
2020-11-24 19:26:37 +00:00
|
|
|
+ for D in $(TOOLS_DIRS); do [ -e "$${D}/$@.nim" ] && TOOL_DIR="$${D}" && break; done && \
|
2019-03-29 17:21:14 +00:00
|
|
|
echo -e $(BUILD_MSG) "build/$@" && \
|
2021-02-15 17:08:18 +00:00
|
|
|
MAKE="$(MAKE)" V="$(V)" $(ENV_SCRIPT) scripts/compile_nim_program.sh $@ "$${TOOL_DIR}/$@.nim" $(NIM_PARAMS) && \
|
2020-11-26 02:15:37 +00:00
|
|
|
echo -e $(BUILD_END_MSG) "build/$@"
|
2019-03-28 15:18:59 +00:00
|
|
|
|
2020-06-16 19:45:52 +00:00
|
|
|
clean_eth2_network_simulation_data:
|
2020-06-19 17:42:28 +00:00
|
|
|
rm -rf tests/simulation/data
|
2020-06-16 19:45:52 +00:00
|
|
|
|
|
|
|
clean_eth2_network_simulation_all:
|
2019-04-17 15:54:28 +00:00
|
|
|
rm -rf tests/simulation/{data,validators}
|
2019-03-28 15:18:59 +00:00
|
|
|
|
2020-07-09 22:41:51 +00:00
|
|
|
GOERLI_TESTNETS_PARAMS := \
|
2020-12-01 21:20:28 +00:00
|
|
|
--web3-url=$(WEB3_URL) \
|
2020-07-09 22:41:51 +00:00
|
|
|
--tcp-port=$$(( $(BASE_PORT) + $(NODE_ID) )) \
|
|
|
|
--udp-port=$$(( $(BASE_PORT) + $(NODE_ID) )) \
|
|
|
|
--metrics \
|
|
|
|
--metrics-port=$$(( $(BASE_METRICS_PORT) + $(NODE_ID) )) \
|
|
|
|
--rpc \
|
|
|
|
--rpc-port=$$(( $(BASE_RPC_PORT) +$(NODE_ID) ))
|
|
|
|
|
2020-07-23 15:58:54 +00:00
|
|
|
eth2_network_simulation: | build deps clean_eth2_network_simulation_all
|
2020-06-16 18:38:51 +00:00
|
|
|
+ GIT_ROOT="$$PWD" NIMFLAGS="$(NIMFLAGS)" LOG_LEVEL="$(LOG_LEVEL)" tests/simulation/start-in-tmux.sh
|
2020-07-23 15:58:54 +00:00
|
|
|
killall prometheus &>/dev/null
|
2019-03-28 15:18:59 +00:00
|
|
|
|
2019-03-28 22:19:12 +00:00
|
|
|
clean-testnet0:
|
2020-06-11 16:42:58 +00:00
|
|
|
rm -rf build/data/testnet0*
|
2019-03-28 22:19:12 +00:00
|
|
|
|
|
|
|
clean-testnet1:
|
2020-06-11 16:42:58 +00:00
|
|
|
rm -rf build/data/testnet1*
|
2019-03-28 22:19:12 +00:00
|
|
|
|
2021-12-10 10:56:51 +00:00
|
|
|
testnet0 testnet1: | nimbus_beacon_node
|
2020-11-07 18:00:31 +00:00
|
|
|
build/nimbus_beacon_node \
|
2020-07-10 14:31:24 +00:00
|
|
|
--network=$@ \
|
2021-02-19 15:37:00 +00:00
|
|
|
--log-level="$(RUNTIME_LOG_LEVEL)" \
|
2020-07-10 14:31:24 +00:00
|
|
|
--data-dir=build/data/$@_$(NODE_ID) \
|
|
|
|
$(GOERLI_TESTNETS_PARAMS) $(NODE_PARAMS)
|
2020-05-28 04:28:10 +00:00
|
|
|
|
2020-10-06 15:18:02 +00:00
|
|
|
#- https://www.gnu.org/software/make/manual/html_node/Multi_002dLine.html
|
|
|
|
#- macOS doesn't support "=" at the end of "define FOO": https://stackoverflow.com/questions/13260396/gnu-make-3-81-eval-function-not-working
|
|
|
|
define CONNECT_TO_NETWORK
|
2020-10-12 13:10:23 +00:00
|
|
|
scripts/makedir.sh build/data/shared_$(1)_$(NODE_ID)
|
2020-08-06 12:21:07 +00:00
|
|
|
|
2020-08-05 12:51:55 +00:00
|
|
|
scripts/make_prometheus_config.sh \
|
|
|
|
--nodes 1 \
|
|
|
|
--base-metrics-port $$(($(BASE_METRICS_PORT) + $(NODE_ID))) \
|
2020-09-21 14:19:34 +00:00
|
|
|
--config-file "build/data/shared_$(1)_$(NODE_ID)/prometheus.yml"
|
2020-08-05 12:51:55 +00:00
|
|
|
|
2021-07-13 14:27:10 +00:00
|
|
|
[ "$(3)" == "FastSync" ] && { export CHECKPOINT_PARAMS="--finalized-checkpoint-state=vendor/eth2-networks/shared/$(1)/recent-finalized-state.ssz \
|
|
|
|
--finalized-checkpoint-block=vendor/eth2-network/shared/$(1)/recent-finalized-block.ssz" ; }; \
|
2020-10-16 18:48:27 +00:00
|
|
|
$(CPU_LIMIT_CMD) build/$(2) \
|
2020-09-21 14:19:34 +00:00
|
|
|
--network=$(1) \
|
2021-02-19 15:37:00 +00:00
|
|
|
--log-level="$(RUNTIME_LOG_LEVEL)" \
|
2020-09-21 14:19:34 +00:00
|
|
|
--log-file=build/data/shared_$(1)_$(NODE_ID)/nbc_bn_$$(date +"%Y%m%d%H%M%S").log \
|
|
|
|
--data-dir=build/data/shared_$(1)_$(NODE_ID) \
|
2020-09-22 20:42:42 +00:00
|
|
|
$$CHECKPOINT_PARAMS $(GOERLI_TESTNETS_PARAMS) $(NODE_PARAMS)
|
2020-09-21 14:19:34 +00:00
|
|
|
endef
|
2020-04-27 19:03:03 +00:00
|
|
|
|
2020-10-06 15:18:02 +00:00
|
|
|
define CONNECT_TO_NETWORK_IN_DEV_MODE
|
2020-10-12 13:04:21 +00:00
|
|
|
scripts/makedir.sh build/data/shared_$(1)_$(NODE_ID)
|
2020-09-21 14:19:34 +00:00
|
|
|
|
|
|
|
scripts/make_prometheus_config.sh \
|
|
|
|
--nodes 1 \
|
|
|
|
--base-metrics-port $$(($(BASE_METRICS_PORT) + $(NODE_ID))) \
|
|
|
|
--config-file "build/data/shared_$(1)_$(NODE_ID)/prometheus.yml"
|
|
|
|
|
2020-10-16 18:48:27 +00:00
|
|
|
$(CPU_LIMIT_CMD) build/$(2) \
|
2020-09-21 14:19:34 +00:00
|
|
|
--network=$(1) \
|
|
|
|
--log-level="DEBUG; TRACE:discv5,networking; REQUIRED:none; DISABLED:none" \
|
|
|
|
--data-dir=build/data/shared_$(1)_$(NODE_ID) \
|
|
|
|
$(GOERLI_TESTNETS_PARAMS) --dump $(NODE_PARAMS)
|
|
|
|
endef
|
|
|
|
|
2020-09-28 17:13:36 +00:00
|
|
|
define CONNECT_TO_NETWORK_WITH_VALIDATOR_CLIENT
|
2020-07-28 15:14:13 +00:00
|
|
|
# if launching a VC as well - send the BN looking nowhere for validators/secrets
|
2020-10-12 13:04:21 +00:00
|
|
|
scripts/makedir.sh build/data/shared_$(1)_$(NODE_ID)
|
|
|
|
scripts/makedir.sh build/data/shared_$(1)_$(NODE_ID)/empty_dummy_folder
|
2020-08-05 12:51:55 +00:00
|
|
|
|
|
|
|
scripts/make_prometheus_config.sh \
|
|
|
|
--nodes 1 \
|
|
|
|
--base-metrics-port $$(($(BASE_METRICS_PORT) + $(NODE_ID))) \
|
2020-09-21 14:19:34 +00:00
|
|
|
--config-file "build/data/shared_$(1)_$(NODE_ID)/prometheus.yml"
|
2020-08-05 12:51:55 +00:00
|
|
|
|
2020-10-16 18:48:27 +00:00
|
|
|
$(CPU_LIMIT_CMD) build/$(2) \
|
2020-09-21 14:19:34 +00:00
|
|
|
--network=$(1) \
|
2021-02-19 15:37:00 +00:00
|
|
|
--log-level="$(RUNTIME_LOG_LEVEL)" \
|
2020-09-21 14:19:34 +00:00
|
|
|
--log-file=build/data/shared_$(1)_$(NODE_ID)/nbc_bn_$$(date +"%Y%m%d%H%M%S").log \
|
|
|
|
--data-dir=build/data/shared_$(1)_$(NODE_ID) \
|
|
|
|
--validators-dir=build/data/shared_$(1)_$(NODE_ID)/empty_dummy_folder \
|
|
|
|
--secrets-dir=build/data/shared_$(1)_$(NODE_ID)/empty_dummy_folder \
|
2020-07-28 15:14:13 +00:00
|
|
|
$(GOERLI_TESTNETS_PARAMS) $(NODE_PARAMS) &
|
2020-08-05 12:51:55 +00:00
|
|
|
|
2020-07-28 15:14:13 +00:00
|
|
|
sleep 4
|
2020-08-05 12:51:55 +00:00
|
|
|
|
2020-11-07 18:00:31 +00:00
|
|
|
build/nimbus_validator_client \
|
2021-02-19 15:37:00 +00:00
|
|
|
--log-level="$(RUNTIME_LOG_LEVEL)" \
|
2020-09-21 14:19:34 +00:00
|
|
|
--log-file=build/data/shared_$(1)_$(NODE_ID)/nbc_vc_$$(date +"%Y%m%d%H%M%S").log \
|
|
|
|
--data-dir=build/data/shared_$(1)_$(NODE_ID) \
|
2020-07-28 15:14:13 +00:00
|
|
|
--rpc-port=$$(( $(BASE_RPC_PORT) +$(NODE_ID) ))
|
2020-09-21 14:19:34 +00:00
|
|
|
endef
|
2020-07-28 15:14:13 +00:00
|
|
|
|
2020-09-28 17:13:36 +00:00
|
|
|
define MAKE_DEPOSIT_DATA
|
2021-04-08 11:35:58 +00:00
|
|
|
build/nimbus_beacon_node deposits createTestnetDeposits \
|
2020-09-21 14:19:34 +00:00
|
|
|
--network=$(1) \
|
|
|
|
--new-wallet-file=build/data/shared_$(1)_$(NODE_ID)/wallet.json \
|
|
|
|
--out-validators-dir=build/data/shared_$(1)_$(NODE_ID)/validators \
|
|
|
|
--out-secrets-dir=build/data/shared_$(1)_$(NODE_ID)/secrets \
|
|
|
|
--out-deposits-file=$(1)-deposits_data-$$(date +"%Y%m%d%H%M%S").json \
|
2020-07-17 20:59:50 +00:00
|
|
|
--count=$(VALIDATORS)
|
2020-09-21 14:19:34 +00:00
|
|
|
endef
|
2020-07-17 20:59:50 +00:00
|
|
|
|
2020-09-28 17:13:36 +00:00
|
|
|
define MAKE_DEPOSIT
|
2021-04-08 11:35:58 +00:00
|
|
|
build/nimbus_beacon_node deposits createTestnetDeposits \
|
2020-09-21 14:19:34 +00:00
|
|
|
--network=$(1) \
|
|
|
|
--out-deposits-file=nbc-$(1)-deposits.json \
|
|
|
|
--new-wallet-file=build/data/shared_$(1)_$(NODE_ID)/wallet.json \
|
|
|
|
--out-validators-dir=build/data/shared_$(1)_$(NODE_ID)/validators \
|
|
|
|
--out-secrets-dir=build/data/shared_$(1)_$(NODE_ID)/secrets \
|
2020-07-28 20:37:12 +00:00
|
|
|
--count=$(VALIDATORS)
|
|
|
|
|
|
|
|
build/deposit_contract sendDeposits \
|
2020-12-01 21:20:28 +00:00
|
|
|
--web3-url=$(WEB3_URL) \
|
2021-07-13 14:27:10 +00:00
|
|
|
--deposit-contract=$$(cat vendor/eth2-network/shared/$(1)/deposit_contract.txt) \
|
2020-09-21 14:19:34 +00:00
|
|
|
--deposits-file=nbc-$(1)-deposits.json \
|
2020-07-28 20:37:12 +00:00
|
|
|
--min-delay=$(DEPOSITS_DELAY) \
|
|
|
|
--ask-for-key
|
2020-09-21 14:19:34 +00:00
|
|
|
endef
|
|
|
|
|
2020-09-28 17:13:36 +00:00
|
|
|
define CLEAN_NETWORK
|
2020-09-21 14:19:34 +00:00
|
|
|
rm -rf build/data/shared_$(1)*/db
|
|
|
|
rm -rf build/data/shared_$(1)*/dump
|
|
|
|
rm -rf build/data/shared_$(1)*/*.log
|
|
|
|
endef
|
|
|
|
|
2020-11-12 19:50:49 +00:00
|
|
|
###
|
2021-03-15 19:49:53 +00:00
|
|
|
### Pyrmont
|
2020-11-12 19:50:49 +00:00
|
|
|
###
|
2021-11-30 01:20:21 +00:00
|
|
|
pyrmont-build: | nimbus_beacon_node nimbus_signing_node
|
2020-11-12 19:50:49 +00:00
|
|
|
|
|
|
|
# https://www.gnu.org/software/make/manual/html_node/Call-Function.html#Call-Function
|
|
|
|
pyrmont: | pyrmont-build
|
|
|
|
$(call CONNECT_TO_NETWORK,pyrmont,nimbus_beacon_node)
|
|
|
|
|
|
|
|
pyrmont-vc: | pyrmont-build nimbus_validator_client
|
|
|
|
$(call CONNECT_TO_NETWORK_WITH_VALIDATOR_CLIENT,pyrmont,nimbus_beacon_node)
|
|
|
|
|
|
|
|
ifneq ($(LOG_LEVEL), TRACE)
|
|
|
|
pyrmont-dev:
|
2021-02-19 15:37:00 +00:00
|
|
|
+ "$(MAKE)" LOG_LEVEL=TRACE $@
|
2020-11-12 19:50:49 +00:00
|
|
|
else
|
|
|
|
pyrmont-dev: | pyrmont-build
|
|
|
|
$(call CONNECT_TO_NETWORK_IN_DEV_MODE,pyrmont,nimbus_beacon_node)
|
|
|
|
endif
|
|
|
|
|
2020-11-14 21:46:34 +00:00
|
|
|
pyrmont-dev-deposit: | pyrmont-build deposit_contract
|
|
|
|
$(call MAKE_DEPOSIT,pyrmont)
|
|
|
|
|
2020-11-12 19:50:49 +00:00
|
|
|
clean-pyrmont:
|
|
|
|
$(call CLEAN_NETWORK,pyrmont)
|
|
|
|
|
2021-03-15 19:49:53 +00:00
|
|
|
|
|
|
|
###
|
|
|
|
### Prater
|
|
|
|
###
|
2021-11-30 01:20:21 +00:00
|
|
|
prater-build: | nimbus_beacon_node nimbus_signing_node
|
2021-03-15 19:49:53 +00:00
|
|
|
|
|
|
|
# https://www.gnu.org/software/make/manual/html_node/Call-Function.html#Call-Function
|
|
|
|
prater: | prater-build
|
|
|
|
$(call CONNECT_TO_NETWORK,prater,nimbus_beacon_node)
|
|
|
|
|
|
|
|
prater-vc: | prater-build nimbus_validator_client
|
|
|
|
$(call CONNECT_TO_NETWORK_WITH_VALIDATOR_CLIENT,prater,nimbus_beacon_node)
|
|
|
|
|
|
|
|
ifneq ($(LOG_LEVEL), TRACE)
|
|
|
|
prater-dev:
|
|
|
|
+ "$(MAKE)" LOG_LEVEL=TRACE $@
|
|
|
|
else
|
|
|
|
prater-dev: | prater-build
|
|
|
|
$(call CONNECT_TO_NETWORK_IN_DEV_MODE,prater,nimbus_beacon_node)
|
|
|
|
endif
|
|
|
|
|
|
|
|
prater-dev-deposit: | prater-build deposit_contract
|
|
|
|
$(call MAKE_DEPOSIT,prater)
|
|
|
|
|
|
|
|
clean-prater:
|
|
|
|
$(call CLEAN_NETWORK,prater)
|
|
|
|
|
|
|
|
###
|
|
|
|
### Other
|
|
|
|
###
|
|
|
|
|
2020-06-11 16:41:43 +00:00
|
|
|
ctail: | build deps
|
|
|
|
mkdir -p vendor/.nimble/bin/
|
2020-11-24 19:26:37 +00:00
|
|
|
+ $(ENV_SCRIPT) nim -d:danger -o:vendor/.nimble/bin/ctail c vendor/nim-chronicles-tail/ctail.nim
|
2020-06-11 16:41:43 +00:00
|
|
|
|
|
|
|
ntu: | build deps
|
|
|
|
mkdir -p vendor/.nimble/bin/
|
2020-11-24 19:26:37 +00:00
|
|
|
+ $(ENV_SCRIPT) nim -d:danger -o:vendor/.nimble/bin/ntu c vendor/nim-testutils/ntu.nim
|
2020-06-11 16:41:43 +00:00
|
|
|
|
2019-08-21 12:45:24 +00:00
|
|
|
clean: | clean-common
|
2020-11-27 01:29:06 +00:00
|
|
|
rm -rf build/{$(TOOLS_CSV),all_tests,test_*,proto_array,fork_choice,*.a,*.so,*_node,*ssz*,nimbus_*,beacon_node*,block_sim,state_sim,transition*,generate_makefile}
|
2020-02-20 16:41:10 +00:00
|
|
|
ifneq ($(USE_LIBBACKTRACE), 0)
|
2020-09-04 06:33:37 +00:00
|
|
|
+ "$(MAKE)" -C vendor/nim-libbacktrace clean $(HANDLE_OUTPUT)
|
2020-02-20 16:41:10 +00:00
|
|
|
endif
|
2019-11-27 20:43:02 +00:00
|
|
|
|
2020-03-05 17:56:07 +00:00
|
|
|
libnfuzz.so: | build deps
|
2020-11-24 19:26:37 +00:00
|
|
|
+ echo -e $(BUILD_MSG) "build/$@" && \
|
2020-02-14 12:35:23 +00:00
|
|
|
$(ENV_SCRIPT) nim c -d:release --app:lib --noMain --nimcache:nimcache/libnfuzz -o:build/$@.0 $(NIM_PARAMS) nfuzz/libnfuzz.nim && \
|
2020-11-26 02:15:37 +00:00
|
|
|
echo -e $(BUILD_END_MSG) "build/$@" && \
|
2019-11-27 20:43:02 +00:00
|
|
|
rm -f build/$@ && \
|
|
|
|
ln -s $@.0 build/$@
|
|
|
|
|
2020-03-05 17:56:07 +00:00
|
|
|
libnfuzz.a: | build deps
|
2020-11-24 19:26:37 +00:00
|
|
|
+ echo -e $(BUILD_MSG) "build/$@" && \
|
2019-11-27 20:43:02 +00:00
|
|
|
rm -f build/$@ && \
|
2020-02-14 12:35:23 +00:00
|
|
|
$(ENV_SCRIPT) nim c -d:release --app:staticlib --noMain --nimcache:nimcache/libnfuzz_static -o:build/$@ $(NIM_PARAMS) nfuzz/libnfuzz.nim && \
|
2020-11-26 02:15:37 +00:00
|
|
|
echo -e $(BUILD_END_MSG) "build/$@" && \
|
2020-11-24 16:27:21 +00:00
|
|
|
[[ -e "$@" ]] && mv "$@" build/ || true # workaround for https://github.com/nim-lang/Nim/issues/12745
|
2020-04-18 23:25:21 +00:00
|
|
|
|
2020-05-02 14:30:34 +00:00
|
|
|
book:
|
2021-02-15 07:33:49 +00:00
|
|
|
which mdbook &>/dev/null || { echo "'mdbook' not found in PATH. See 'docs/README.md'. Aborting."; exit 1; }
|
|
|
|
which mdbook-toc &>/dev/null || { echo "'mdbook-toc' not found in PATH. See 'docs/README.md'. Aborting."; exit 1; }
|
2021-03-22 15:40:26 +00:00
|
|
|
which mdbook-open-on-gh &>/dev/null || { echo "'mdbook-open-on-gh' not found in PATH. See 'docs/README.md'. Aborting."; exit 1; }
|
2020-07-01 08:37:04 +00:00
|
|
|
cd docs/the_nimbus_book && \
|
2020-05-02 14:30:34 +00:00
|
|
|
mdbook build
|
|
|
|
|
2020-07-07 08:44:21 +00:00
|
|
|
auditors-book:
|
|
|
|
cd docs/the_auditors_handbook && \
|
|
|
|
mdbook build
|
|
|
|
|
2020-07-13 10:46:42 +00:00
|
|
|
publish-book: | book auditors-book
|
2021-02-15 07:33:49 +00:00
|
|
|
CURRENT_BRANCH="$$(git rev-parse --abbrev-ref HEAD)"; \
|
|
|
|
if [[ "$${CURRENT_BRANCH}" != "stable" && "$${CURRENT_BRANCH}" != "unstable" ]]; then \
|
|
|
|
echo -e "\nWarning: you're publishing the books from a branch that is neither 'stable' nor 'unstable'!\n"; \
|
|
|
|
fi
|
2020-07-13 10:46:42 +00:00
|
|
|
git branch -D gh-pages && \
|
|
|
|
git branch --track gh-pages origin/gh-pages && \
|
2020-07-07 08:44:21 +00:00
|
|
|
git worktree add tmp-book gh-pages && \
|
2020-07-13 10:46:42 +00:00
|
|
|
rm -rf tmp-book/* && \
|
2020-07-07 08:44:21 +00:00
|
|
|
mkdir -p tmp-book/auditors-book && \
|
2021-01-22 16:57:55 +00:00
|
|
|
cp -a docs/the_nimbus_book/CNAME tmp-book/ && \
|
2020-07-13 10:46:42 +00:00
|
|
|
cp -a docs/the_nimbus_book/book/* tmp-book/ && \
|
2020-07-07 08:44:21 +00:00
|
|
|
cp -a docs/the_auditors_handbook/book/* tmp-book/auditors-book/ && \
|
|
|
|
cd tmp-book && \
|
|
|
|
git add . && { \
|
2020-07-13 10:46:42 +00:00
|
|
|
git commit -m "make publish-book" && \
|
2020-07-07 08:44:21 +00:00
|
|
|
git push origin gh-pages || true; } && \
|
|
|
|
cd .. && \
|
|
|
|
git worktree remove -f tmp-book && \
|
|
|
|
rm -rf tmp-book
|
|
|
|
|
2021-01-07 09:19:29 +00:00
|
|
|
dist-amd64:
|
2021-03-10 02:59:19 +00:00
|
|
|
+ MAKE="$(MAKE)" \
|
2021-01-07 09:19:29 +00:00
|
|
|
scripts/make_dist.sh amd64
|
|
|
|
|
|
|
|
dist-arm64:
|
2021-03-10 02:59:19 +00:00
|
|
|
+ MAKE="$(MAKE)" \
|
2021-01-07 09:19:29 +00:00
|
|
|
scripts/make_dist.sh arm64
|
|
|
|
|
|
|
|
dist-arm:
|
2021-03-10 02:59:19 +00:00
|
|
|
+ MAKE="$(MAKE)" \
|
2021-01-07 09:19:29 +00:00
|
|
|
scripts/make_dist.sh arm
|
|
|
|
|
2021-02-02 22:31:01 +00:00
|
|
|
dist-win64:
|
2021-03-10 02:59:19 +00:00
|
|
|
+ MAKE="$(MAKE)" \
|
2021-02-02 22:31:01 +00:00
|
|
|
scripts/make_dist.sh win64
|
|
|
|
|
2021-05-19 06:38:13 +00:00
|
|
|
dist-macos:
|
|
|
|
+ MAKE="$(MAKE)" \
|
|
|
|
scripts/make_dist.sh macos
|
|
|
|
|
|
|
|
dist-macos-arm64:
|
|
|
|
+ MAKE="$(MAKE)" \
|
|
|
|
scripts/make_dist.sh macos-arm64
|
|
|
|
|
2020-10-15 12:19:41 +00:00
|
|
|
dist:
|
2021-03-10 02:59:19 +00:00
|
|
|
+ $(MAKE) dist-amd64
|
|
|
|
+ $(MAKE) dist-arm64
|
|
|
|
+ $(MAKE) dist-arm
|
|
|
|
+ $(MAKE) dist-win64
|
2021-05-19 06:38:13 +00:00
|
|
|
+ $(MAKE) dist-macos
|
|
|
|
+ $(MAKE) dist-macos-arm64
|
2020-10-15 12:19:41 +00:00
|
|
|
|
2020-12-11 11:12:43 +00:00
|
|
|
#- Build and run benchmarks using an external repo (which can be used easily on
|
|
|
|
# older commits, before this Make target was added).
|
|
|
|
#- It's up to the user to create a benchmarking environment that minimises the
|
|
|
|
# results spread. We're showing a 95% CI bar to help visualise that.
|
|
|
|
benchmarks:
|
|
|
|
+ vendor/nimbus-benchmarking/run_nbc_benchmarks.sh --output-type d3
|
|
|
|
|
2020-04-18 23:25:21 +00:00
|
|
|
endif # "variables.mk" was not included
|