2023-01-16 10:34:40 +00:00
# Copyright (c) 2019-2023 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
- i n c l u d e $( BUILD_SYSTEM_DIR ) / m a k e f i l e s / v a r i a b l e s . m k
2019-03-28 15:18:59 +00:00
2020-07-09 22:41:51 +00:00
NODE_ID := 0
BASE_PORT := 9000
2022-02-12 11:27:43 +00:00
BASE_REST_PORT := 5052
2020-07-09 22:41:51 +00:00
BASE_METRICS_PORT := 8008
2022-07-26 09:38:38 +00:00
# WARNING: Use lazy assignment to allow CI to override.
EXECUTOR_NUMBER ?= 0
2022-02-25 08:22:44 +00:00
2022-06-16 14:11:26 +00:00
SEPOLIA_WEB3_URL := "--web3-url=https://rpc.sepolia.dev --web3-url=https://www.sepoliarpc.space"
2022-02-25 08:22:44 +00:00
GOERLI_WEB3_URL := "--web3-url=wss://goerli.infura.io/ws/v3/809a18497dd74102b5f37d25aae3c85a"
2022-11-30 10:48:08 +00:00
GNOSIS_WEB3_URLS := "--web3-url=https://rpc.gnosischain.com/"
2022-02-25 08:22:44 +00:00
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
2022-11-04 01:11:11 +00:00
TEST_MODULES_FLAGS := -d:chronicles_log_level= TRACE -d:chronicles_sinks= json[ file]
2020-08-21 21:05:37 +00:00
i f e q ( $( CPU_LIMIT ) , 0 )
2022-05-31 10:45:37 +00:00
CPU_LIMIT_CMD :=
2020-08-21 21:05:37 +00:00
e l s e
2022-05-31 10:45:37 +00:00
CPU_LIMIT_CMD := cpulimit --limit= $( CPU_LIMIT) --foreground --
2022-02-18 14:30:43 +00:00
e n d i f
# TODO: move this to nimbus-build-system
i f e q ( $( shell uname ) , D a r w i n )
2022-05-31 10:45:37 +00:00
# Scary warnings in large volume: https://github.com/status-im/nimbus-eth2/issues/3076
SILENCE_WARNINGS := 2>& 1 | grep -v "failed to insert symbol" | grep -v "could not find object file symbol for symbol" || true
2022-02-18 14:30:43 +00:00
e l s e
2022-05-31 10:45:37 +00:00
SILENCE_WARNINGS :=
2020-08-21 21:05:37 +00:00
e n d i f
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
2023-07-19 07:48:39 +00:00
TOOLS_CORE_CUSTOMCOMPILE := \
libnimbus_lc.a
2023-01-16 10:34:40 +00:00
TOOLS_CORE := \
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 \
2023-07-19 07:48:39 +00:00
mev_mock \
2020-07-29 21:19:36 +00:00
ncli \
2020-06-11 16:41:43 +00:00
ncli_db \
2022-05-17 13:50:49 +00:00
ncli_split_keystore \
2022-10-18 22:18:36 +00:00
fakeee \
2022-01-22 09:25:30 +00:00
wss_sim \
2020-05-04 05:38:14 +00:00
stack_sizes \
2022-05-31 10:45:37 +00:00
nimbus_light_client \
2020-11-07 18:00:31 +00:00
nimbus_validator_client \
2022-01-17 12:58:33 +00:00
nimbus_signing_node \
2023-02-23 02:10:07 +00:00
validator_db_aggregator \
2023-07-19 07:48:39 +00:00
ncli_testnet \
$( TOOLS_CORE_CUSTOMCOMPILE)
2020-06-23 22:41:38 +00:00
2023-01-16 10:34:40 +00:00
# This TOOLS/TOOLS_CORE decomposition is a workaroud so nimbus_beacon_node can
# build on its own, and if/when that becomes a non-issue, it can be recombined
# to a single TOOLS list.
TOOLS := $( TOOLS_CORE) nimbus_beacon_node
.PHONY : $( TOOLS )
2020-06-11 16:41:43 +00:00
2019-12-04 14:40:36 +00:00
TOOLS_DIRS := \
beacon_chain \
2023-05-15 05:05:12 +00:00
beacon_chain/el \
2019-12-04 14:40:36 +00:00
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 \
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 \
2022-09-18 05:44:20 +00:00
dist \
local-testnet-minimal \
local-testnet-mainnet
2019-08-21 12:45:24 +00:00
2023-01-13 10:17:53 +00:00
# TODO: Add the installer packages here
PLATFORM_SPECIFIC_TARGETS :=
# TODO Fix the gnosis build on Windows
i f n e q ( $( OS ) , W i n d o w s _ N T )
PLATFORM_SPECIFIC_TARGETS += gnosis-build
e n d i f
2019-12-03 18:52:54 +00:00
i f e q ( $( 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?
e l s e # "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 '.'
2023-01-13 10:17:53 +00:00
all : | $( TOOLS ) libnfuzz .so libnfuzz .a $( PLATFORM_SPECIFIC_TARGETS )
2019-08-21 12:45:24 +00:00
# must be included after the default target
- i n c l u d e $( BUILD_SYSTEM_DIR ) / m a k e f i l e s / t a r g e t s . m k
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
2023-02-27 11:30:13 +00:00
NIM_PARAMS := -d:release --parallelBuild:1 -d:libp2p_agents_metrics -d:KnownLibP2PAgents= nimbus,lighthouse,lodestar,prysm,teku $( NIM_PARAMS)
2020-11-27 01:29:06 +00:00
2020-02-20 16:41:10 +00:00
i f e q ( $( USE_LIBBACKTRACE ) , 0 )
2022-03-05 14:40:08 +00:00
NIM_PARAMS += -d:disable_libbacktrace
2020-02-20 16:41:10 +00:00
e n d i f
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
i f n e q ( $( USE_LIBBACKTRACE ) , 0 )
deps : | libbacktrace
e n d i f
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
2022-07-23 14:28:10 +00:00
# Make sure ports don't overlap to support concurrent execution of tests
# Avoid selecting ephemeral ports that may be used by others; safe = 5001-9999
2023-08-07 19:58:24 +00:00
# - Port 8301 is used by Consul
adjust keymanager test port base (#5263)
Port 9952 sometimes seems blocked, maybe by another Status project
being tested on the same host, or by UPS process, or maybe it needs
SO_REUSEPORT as well?
Switch to 9962 for now to see if that improves things.
```
{"lvl":"DBG","ts":"2023-08-06 13:44:56.834+03:00","msg":"Initializing ELManager","topics":"beacnde","tid":231629305,"file":"el_manager.nim:1823","depositContractBlockNumber":1,"depositContractBlockHash":"00000000"}
{"lvl":"ERR","ts":"2023-08-06 13:44:56.834+03:00","msg":"Could not create HTTP server instance","topics":"beacnde","tid":231629305,"file":"server.nim:50","address":{"family":"IPv4","address_v4":[127,0,0,1],"port":9952},"serverIdent":"nim-presto/0.0.3 (arm64/macosx)","serverFlags":["NotifyDisconnect","QueryCommaSeparatedArray"],"socketFlags":["ReuseAddr"],"serverUri":{"scheme":"","username":"","password":"","hostname":"","port":"","path":"","query":"","anchor":"","opaque":false,"isIpv6":false},"maxConnections":-1,"backlogSize":100,"bufferSize":4096,"httpHeadersTimeout":"15250w1d23h47m16s854ms775us807ns","maxHeadersSize":131072,"maxRequestBodySize":16777216,"err":"(48) Address already in use"}
{"lvl":"NOT","ts":"2023-08-06 13:44:56.835+03:00","msg":"Rest server could not be started","topics":"beacnde","tid":231629305,"file":"nimbus_binary_common.nim:370","address":"127.0.0.1:9952","reason":"Could not create HTTP server instance"}
```
2023-08-07 02:58:50 +00:00
# - Port 9952 sometimes reports (48) Address already in use.
2022-07-23 14:28:10 +00:00
#
2023-08-03 20:43:45 +00:00
# EXECUTOR_NUMBER: [0, 2] (depends on max number of concurrent CI jobs)
2022-07-23 14:28:10 +00:00
#
# The following port ranges are allocated (entire continuous range):
2022-11-30 14:29:08 +00:00
#
# Unit tests:
# - NIMBUS_TEST_KEYMANAGER_BASE_PORT + [0, 4)
2023-06-01 09:33:25 +00:00
# - NIMBUS_TEST_SIGNING_NODE_BASE_PORT + [0, 2)
2022-11-30 14:29:08 +00:00
#
# REST tests:
2023-08-03 20:43:45 +00:00
# - --base-port (REST_TEST_BASE_PORT + 0)
# - --base-rest-port (REST_TEST_BASE_PORT + 1)
# - --base-metrics-port (REST_TEST_BASE_PORT + 2)
2022-11-30 14:29:08 +00:00
#
# Local testnets (entire continuous range):
2022-07-23 14:28:10 +00:00
# - --base-port + [0, --nodes + --light-clients)
# - --base-rest-port + [0, --nodes)
# - --base-metrics-port + [0, --nodes)
2023-01-04 17:59:35 +00:00
# - --base-vc-keymanager-port + [0, --nodes)
2022-11-30 10:47:11 +00:00
# - --base-vc-metrics-port + [0, --nodes]
2023-05-25 15:05:38 +00:00
# - --base-remote-signer-port + [0, --signer-nodes)
# - --base-remote-signer-metrics-port + [0, --signer-nodes)
2022-07-23 14:28:10 +00:00
#
2022-11-30 14:29:08 +00:00
# Local testnets with --run-geth or --run-nimbus (only these ports):
2022-07-23 14:28:10 +00:00
# - --base-el-net-port + --el-port-offset * [0, --nodes + --light-clients)
2023-02-23 02:10:07 +00:00
# - --base-el-rpc-port + --el-port-offset * [0, --nodes + --light-clients)
2022-07-23 14:28:10 +00:00
# - --base-el-ws-port + --el-port-offset * [0, --nodes + --light-clients)
# - --base-el-auth-rpc-port + --el-port-offset * [0, --nodes + --light-clients)
adjust keymanager test port base (#5263)
Port 9952 sometimes seems blocked, maybe by another Status project
being tested on the same host, or by UPS process, or maybe it needs
SO_REUSEPORT as well?
Switch to 9962 for now to see if that improves things.
```
{"lvl":"DBG","ts":"2023-08-06 13:44:56.834+03:00","msg":"Initializing ELManager","topics":"beacnde","tid":231629305,"file":"el_manager.nim:1823","depositContractBlockNumber":1,"depositContractBlockHash":"00000000"}
{"lvl":"ERR","ts":"2023-08-06 13:44:56.834+03:00","msg":"Could not create HTTP server instance","topics":"beacnde","tid":231629305,"file":"server.nim:50","address":{"family":"IPv4","address_v4":[127,0,0,1],"port":9952},"serverIdent":"nim-presto/0.0.3 (arm64/macosx)","serverFlags":["NotifyDisconnect","QueryCommaSeparatedArray"],"socketFlags":["ReuseAddr"],"serverUri":{"scheme":"","username":"","password":"","hostname":"","port":"","path":"","query":"","anchor":"","opaque":false,"isIpv6":false},"maxConnections":-1,"backlogSize":100,"bufferSize":4096,"httpHeadersTimeout":"15250w1d23h47m16s854ms775us807ns","maxHeadersSize":131072,"maxRequestBodySize":16777216,"err":"(48) Address already in use"}
{"lvl":"NOT","ts":"2023-08-06 13:44:56.835+03:00","msg":"Rest server could not be started","topics":"beacnde","tid":231629305,"file":"nimbus_binary_common.nim:370","address":"127.0.0.1:9952","reason":"Could not create HTTP server instance"}
```
2023-08-07 02:58:50 +00:00
UNIT_TEST_BASE_PORT := 9960
2023-08-03 20:43:45 +00:00
REST_TEST_BASE_PORT := 9990
2023-08-07 19:58:24 +00:00
MINIMAL_TESTNET_BASE_PORT := 5001
MAINNET_TESTNET_BASE_PORT := 6501
2022-07-23 14:28:10 +00:00
2022-06-19 17:54:12 +00:00
restapi-test :
./tests/simulation/restapi.sh \
--data-dir resttest0_data \
2023-08-03 20:43:45 +00:00
--base-port $$ ( ( $( REST_TEST_BASE_PORT) + EXECUTOR_NUMBER * 3 + 0 ) ) \
--base-rest-port $$ ( ( $( REST_TEST_BASE_PORT) + EXECUTOR_NUMBER * 3 + 1 ) ) \
--base-metrics-port $$ ( ( $( REST_TEST_BASE_PORT) + EXECUTOR_NUMBER * 3 + 2 ) ) \
2022-06-19 17:54:12 +00:00
--resttest-delay 30 \
--kill-old-processes
2023-05-25 15:05:38 +00:00
SIGNER_TYPE := nimbus
2022-07-15 00:19:19 +00:00
local-testnet-minimal :
./scripts/launch_local_testnet.sh \
2022-07-21 22:34:31 +00:00
--data-dir $@ \
2022-07-15 00:19:19 +00:00
--preset minimal \
2023-02-23 02:10:07 +00:00
--nodes 2 \
2023-05-25 15:05:38 +00:00
--signer-nodes 1 \
lower number of `--remote-validators-count` in CI (#5399)
The CI signing node sometimes becomes overloaded, leading to late block.
```
{"lvl":"DBG","ts":"2023-09-05 23:46:34.515+01:00","msg":"REST request body has been sent","remote":"127.0.0.1:5201","request":"/api/v1/eth2/sign/0x82ad1b336ce728978983cbe7c7dd25f757fdc66536f3457cf9f0120c07943f8d464eec55fefcaef9c0d5da6e9f7c1443","size":549,"http_method":"POST"}
```
```
DBG 2023-09-05 23:46:36.098+01:00 Received request peer=127.0.0.1:51194 meth=POST uri=/api/v1/eth2/sign/0x82ad1b336ce728978983cbe7c7dd25f757fdc66536f3457cf9f0120c07943f8d464eec55fefcaef9c0d5da6e9f7c1443
```
Especially on the `minimal` preset with short slot timings, this leads
to attestations and sync duties being made for an old head, ultimately:
```
{"lvl":"FAT","ts":"2023-09-05 23:46:41.915+01:00","msg":"Low sync committee participation","topics":"chaindag","slot":15,"num_active_participants":8}
```
Looking at `nimbus_signing_node.0.jsonl` shows that the signing node is
very busy. Lowering the validator count should reduce the latency a bit.
2023-09-06 09:08:33 +00:00
--remote-validators-count 512 \
2023-05-25 15:05:38 +00:00
--signer-type $( SIGNER_TYPE) \
2023-09-11 09:26:21 +00:00
--capella-fork-epoch 0 \
2023-02-23 02:10:07 +00:00
--deneb-fork-epoch 20 \
2022-09-19 11:10:47 +00:00
--stop-at-epoch 6 \
2022-07-15 00:19:19 +00:00
--disable-htop \
2023-02-23 02:10:07 +00:00
--enable-payload-builder \
2022-07-15 00:19:19 +00:00
--enable-logtrace \
2023-08-07 19:58:24 +00:00
--base-port $$ ( ( $( MINIMAL_TESTNET_BASE_PORT) + EXECUTOR_NUMBER * 400 + 0 ) ) \
--base-rest-port $$ ( ( $( MINIMAL_TESTNET_BASE_PORT) + EXECUTOR_NUMBER * 400 + 30 ) ) \
--base-metrics-port $$ ( ( $( MINIMAL_TESTNET_BASE_PORT) + EXECUTOR_NUMBER * 400 + 60 ) ) \
--base-vc-keymanager-port $$ ( ( $( MINIMAL_TESTNET_BASE_PORT) + EXECUTOR_NUMBER * 400 + 130) ) \
--base-vc-metrics-port $$ ( ( $( MINIMAL_TESTNET_BASE_PORT) + EXECUTOR_NUMBER * 400 + 160) ) \
--base-remote-signer-port $$ ( ( $( MINIMAL_TESTNET_BASE_PORT) + EXECUTOR_NUMBER * 400 + 200) ) \
--base-remote-signer-metrics-port $$ ( ( $( MINIMAL_TESTNET_BASE_PORT) + EXECUTOR_NUMBER * 400 + 250) ) \
--base-el-net-port $$ ( ( $( MINIMAL_TESTNET_BASE_PORT) + EXECUTOR_NUMBER * 400 + 300 ) ) \
--base-el-rpc-port $$ ( ( $( MINIMAL_TESTNET_BASE_PORT) + EXECUTOR_NUMBER * 400 + 301 ) ) \
--base-el-ws-port $$ ( ( $( MINIMAL_TESTNET_BASE_PORT) + EXECUTOR_NUMBER * 400 + 302 ) ) \
--base-el-auth-rpc-port $$ ( ( $( MINIMAL_TESTNET_BASE_PORT) + EXECUTOR_NUMBER * 400 + 303 ) ) \
2022-07-23 14:28:10 +00:00
--el-port-offset 5 \
2022-09-19 11:10:47 +00:00
--timeout 648 \
2022-07-15 00:19:19 +00:00
--kill-old-processes \
2023-02-23 02:10:07 +00:00
--run-geth --dl-geth \
2022-07-15 00:19:19 +00:00
-- \
--verify-finalization \
2023-08-18 11:54:24 +00:00
--discv5:no \
--num-threads:1
2022-07-15 00:19:19 +00:00
local-testnet-mainnet :
./scripts/launch_local_testnet.sh \
2022-07-21 22:34:31 +00:00
--data-dir $@ \
2023-02-23 02:10:07 +00:00
--nodes 2 \
2023-09-11 09:26:21 +00:00
--capella-fork-epoch 0 \
2022-09-19 11:10:47 +00:00
--stop-at-epoch 6 \
2022-07-15 00:19:19 +00:00
--disable-htop \
--enable-logtrace \
2023-08-07 19:58:24 +00:00
--base-port $$ ( ( $( MAINNET_TESTNET_BASE_PORT) + EXECUTOR_NUMBER * 400 + 0 ) ) \
--base-rest-port $$ ( ( $( MAINNET_TESTNET_BASE_PORT) + EXECUTOR_NUMBER * 400 + 30 ) ) \
--base-metrics-port $$ ( ( $( MAINNET_TESTNET_BASE_PORT) + EXECUTOR_NUMBER * 400 + 60 ) ) \
--base-vc-keymanager-port $$ ( ( $( MAINNET_TESTNET_BASE_PORT) + EXECUTOR_NUMBER * 400 + 130 ) ) \
--base-vc-metrics-port $$ ( ( $( MAINNET_TESTNET_BASE_PORT) + EXECUTOR_NUMBER * 400 + 160 ) ) \
--base-remote-signer-port $$ ( ( $( MAINNET_TESTNET_BASE_PORT) + EXECUTOR_NUMBER * 400 + 200 ) ) \
--base-remote-signer-metrics-port $$ ( ( $( MAINNET_TESTNET_BASE_PORT) + EXECUTOR_NUMBER * 400 + 250 ) ) \
--base-el-net-port $$ ( ( $( MAINNET_TESTNET_BASE_PORT) + EXECUTOR_NUMBER * 400 + 300 ) ) \
--base-el-rpc-port $$ ( ( $( MAINNET_TESTNET_BASE_PORT) + EXECUTOR_NUMBER * 400 + 301 ) ) \
--base-el-ws-port $$ ( ( $( MAINNET_TESTNET_BASE_PORT) + EXECUTOR_NUMBER * 400 + 302 ) ) \
--base-el-auth-rpc-port $$ ( ( $( MAINNET_TESTNET_BASE_PORT) + EXECUTOR_NUMBER * 400 + 303 ) ) \
2022-07-23 14:28:10 +00:00
--el-port-offset 5 \
2022-09-19 11:10:47 +00:00
--timeout 2784 \
2022-07-15 00:19:19 +00:00
--kill-old-processes \
2023-02-23 02:10:07 +00:00
--run-geth --dl-geth \
2022-07-15 00:19:19 +00:00
-- \
--verify-finalization \
--discv5:no
2021-04-28 16:41:02 +00:00
# test binaries that can output an XML report
2023-01-16 10:34:40 +00:00
XML_TEST_BINARIES_CORE := \
2023-01-31 12:35:01 +00:00
consensus_spec_tests_minimal \
consensus_spec_tests_mainnet
2023-01-16 10:34:40 +00:00
XML_TEST_BINARIES := \
$( XML_TEST_BINARIES_CORE) \
2021-10-12 11:36:52 +00:00
all_tests
2021-04-28 16:41:02 +00:00
# test suite
TEST_BINARIES := \
2023-07-19 07:48:39 +00:00
block_sim \
test_libnimbus_lc
2023-01-16 10:34:40 +00:00
.PHONY : $( TEST_BINARIES ) $( XML_TEST_BINARIES ) force_build_alone_all_tests
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" \
2022-11-04 01:11:11 +00:00
$( NIM_PARAMS) -d:const_preset= mainnet $( TEST_MODULES_FLAGS) && \
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" \
2022-11-04 01:11:11 +00:00
$( NIM_PARAMS) -d:const_preset= minimal $( TEST_MODULES_FLAGS) && \
2021-07-13 06:38:35 +00:00
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 " \
2022-11-04 01:11:11 +00:00
$( NIM_PARAMS) $( TEST_MODULES_FLAGS) && \
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 " \
2022-11-04 01:11:11 +00:00
$( NIM_PARAMS) $( TEST_MODULES_FLAGS) && \
2021-02-14 20:04:54 +00:00
echo -e $( BUILD_END_MSG) " build/ $@ "
2023-01-16 10:34:40 +00:00
# Windows GitHub Actions CI runners, as of this writing, have around 8GB of RAM
# and compiling all_tests requires around 5.5GB of that. It often fails via OOM
# on the two cores available. Usefully, the part of the process requiring those
# gigabytes of RAM is `nim c --compileOnly`, which intrinsically serializes. As
# a result, only slightly increase build times by using fake dependencies, when
# running `make test`, to ensure the `all_tests` target builds alone when being
# built as part of `test`, while not also spuriously otherwise depending on the
# not-actually-related Makefile goals.
#
# This works because `nim c --compileOnly` is fast but RAM-heavy, while the
# rest of the build process, such as LTO, requires less RAM but is slow and
# still is parallelized.
#
# On net, this saves CI and human time, because it reduces the likelihood of
# CI false negatives in a process lasting hours and requiring a restart, and
# therefore even more wasted time, when it does.
#
2023-08-21 09:10:15 +00:00
# If one asks for, e.g., `make all_tests block_sim`, it intentionally allows
# those in parallel, because the CI system doesn't do that.
2023-01-16 10:34:40 +00:00
#
# https://www.gnu.org/software/make/manual/html_node/Parallel-Disable.html
# describes a special target .WAIT which would enable this more easily but
# remains unusable for this Makefile due to requiring GNU Make 4.4.
i f n e q ( , $( filter test ,$ ( MAKECMDGOALS ) ) )
FORCE_BUILD_ALONE_ALL_TESTS_DEPS := $( XML_TEST_BINARIES_CORE) $( TEST_BINARIES)
e l s e
FORCE_BUILD_ALONE_ALL_TESTS_DEPS :=
e n d i f
force_build_alone_all_tests : | $( FORCE_BUILD_ALONE_ALL_TESTS_DEPS )
2023-04-06 13:16:21 +00:00
all_tests : | build deps nimbus_signing_node force_build_alone_all_tests
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
$@ \
" tests/ $@ .nim " \
2022-11-04 01:11:11 +00:00
$( NIM_PARAMS) $( TEST_MODULES_FLAGS) && \
2021-02-14 20:04:54 +00:00
echo -e $( BUILD_END_MSG) " build/ $@ "
2023-08-21 09:10:15 +00:00
# Block sim; getting to 4th epoch triggers consensus checks
2021-02-14 20:04:54 +00:00
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
i f e q ( $( 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
e n d i f
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 " ; \
2023-08-03 20:43:45 +00:00
NIMBUS_TEST_KEYMANAGER_BASE_PORT = $$ ( ( $( UNIT_TEST_BASE_PORT) + EXECUTOR_NUMBER * 6 + 0 ) ) \
NIMBUS_TEST_SIGNING_NODE_BASE_PORT = $$ ( ( $( UNIT_TEST_BASE_PORT) + EXECUTOR_NUMBER * 6 + 4 ) ) \
2022-11-30 14:29:08 +00:00
build/$$ { TEST_BINARY} $$ { PARAMS} || { \
2023-08-07 16:02:08 +00:00
echo -e " \n $$ {TEST_BINARY} $$ {PARAMS} failed; Last 5000 lines from the log: " ; \
tail -n5000 " $$ {TEST_BINARY}.log " ; exit 1; \
2022-11-30 14:29:08 +00:00
} ; \
2021-04-28 16:41:02 +00:00
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 = "" ; \
2023-07-19 07:48:39 +00:00
REDIRECT = "" ; \
2023-08-21 09:10:15 +00:00
if [ [ " $$ {TEST_BINARY} " = = "block_sim" ] ] ; then PARAMS = "--validators=10000 --slots=192" ; \
2023-07-19 07:48:39 +00:00
elif [ [ " $$ {TEST_BINARY} " = = "test_libnimbus_lc" ] ] ; then REDIRECT = " $$ {TEST_BINARY}.log " ; \
2021-02-14 20:04:54 +00:00
fi ; \
echo -e " \nRunning $$ {TEST_BINARY} $$ {PARAMS}\n " ; \
2023-07-19 07:48:39 +00:00
if [ [ " $$ {REDIRECT} " != "" ] ] ; then \
build/$$ { TEST_BINARY} $$ { PARAMS} > " $$ {REDIRECT} " && echo "OK" || { \
2023-08-07 16:02:08 +00:00
echo -e " \n $$ {TEST_BINARY} $$ {PARAMS} failed; Last 5000 lines from the log: " ; \
tail -n5000 " $$ {TEST_BINARY}.log " ; exit 1; \
2023-07-19 07:48:39 +00:00
} ; \
else \
build/$$ { TEST_BINARY} $$ { PARAMS} || { \
2023-08-07 16:02:08 +00:00
echo -e " \n $$ {TEST_BINARY} $$ {PARAMS} failed; Last 5000 lines from the log: " ; \
tail -n5000 " $$ {TEST_BINARY}.log " ; exit 1; \
2023-07-19 07:48:39 +00:00
} ; \
fi ; \
2021-02-14 20:04:54 +00:00
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.
i f n e q ( $( USE_LIBBACKTRACE ) , 0 )
build/generate_makefile : | libbacktrace
e n d i f
build/generate_makefile : tools /generate_makefile .nim | deps -common
2021-06-01 13:22:21 +00:00
+ echo -e $( BUILD_MSG) " $@ " && \
2022-11-24 20:56:02 +00:00
$( ENV_SCRIPT) $( NIMC) c -o:$@ $( NIM_PARAMS) tools/generate_makefile.nim $( SILENCE_WARNINGS) && \
2021-02-23 19:39:10 +00:00
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.
2023-07-19 07:48:39 +00:00
$(filter-out $(TOOLS_CORE_CUSTOMCOMPILE),$(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
2023-01-16 10:34:40 +00:00
# Windows GitHub Actions CI runners, as of this writing, have around 8GB of RAM
# and compiling nimbus_beacon_node requires more than 5GB. It can fail with OOM
# on the two cores available. Usefully, the part of the process requiring those
# gigabytes of RAM is `nim c --compileOnly`, which intrinsically serializes. As
# a result, only slightly increase build times by using fake dependencies, when
# running `make`, to ensure `nimbus_beacon_node` builds alone, when being built
# as part of `all`, while allowing one to also build `nimbus_beacon_node` alone
# without pulling in the rest of `$(TOOLS)`.
#
# This works because `nim c --compileOnly` is fast but RAM-heavy, while the
# rest of the build process, such as LTO, requires less RAM but is slow and
# still is parallelized.
#
# On net, this saves CI and human time, because it reduces the likelihood of
# CI false negatives in a process lasting hours and requiring a restart, and
# therefore even more wasted time, when it does.
#
# If one asks for, e.g., `make nimbus_beacon_node nimbus_validator_client`, it
2023-01-20 14:14:08 +00:00
# intentionally allows those in parallel, as the CI systems don't do that.
2023-01-16 10:34:40 +00:00
#
# https://www.gnu.org/software/make/manual/html_node/Parallel-Disable.html
# describes a special target .WAIT which would enable this more easily but
# remains unusable for this Makefile due to requiring GNU Make 4.4.
i f n e q ( , $( filter all ,$ ( MAKECMDGOALS ) ) )
FORCE_BUILD_ALONE_TOOLS_DEPS := $( TOOLS_CORE)
2023-01-20 14:14:08 +00:00
# If this isn't an included target (such as Windows), this is a no-op)
gnosis-build : | nimbus_beacon_node
2023-01-16 10:34:40 +00:00
e l s e i f e q ( , $( MAKECMDGOALS ) )
FORCE_BUILD_ALONE_TOOLS_DEPS := $( TOOLS_CORE)
2023-01-20 14:14:08 +00:00
# If this isn't an included target (such as Windows), this is a no-op)
gnosis-build : | nimbus_beacon_node
2023-01-16 10:34:40 +00:00
e l s e
FORCE_BUILD_ALONE_TOOLS_DEPS :=
e n d i f
.PHONY : force_build_alone_tools
force_build_alone_tools : | $( FORCE_BUILD_ALONE_TOOLS_DEPS )
# https://www.gnu.org/software/make/manual/html_node/Multiple-Rules.html#Multiple-Rules
# Already defined as a reult
nimbus_beacon_node : force_build_alone_tools
2020-07-09 22:41:51 +00:00
GOERLI_TESTNETS_PARAMS := \
2022-05-31 10:45:37 +00:00
--tcp-port= $$ ( ( $( BASE_PORT) + $( NODE_ID) ) ) \
--udp-port= $$ ( ( $( BASE_PORT) + $( NODE_ID) ) ) \
--metrics \
--metrics-port= $$ ( ( $( BASE_METRICS_PORT) + $( NODE_ID) ) ) \
--rest \
2022-09-18 05:44:20 +00:00
--rest-port= $$ ( ( $( BASE_REST_PORT) + $( NODE_ID) ) )
2020-07-09 22:41:51 +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
d e f i n e C O N N E C T _ T O _ N E T W O R K
2022-05-31 10:45:37 +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
2020-10-16 18:48:27 +00:00
$( CPU_LIMIT_CMD) build/$( 2) \
2022-02-25 08:22:44 +00:00
--network= $( 1) $( 3) $( GOERLI_TESTNETS_PARAMS) \
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) \
2022-02-25 08:22:44 +00:00
$( NODE_PARAMS)
2020-09-21 14:19:34 +00:00
e n d e f
2020-04-27 19:03:03 +00:00
2020-10-06 15:18:02 +00:00
d e f i n e C O N N E C T _ T O _ N E T W O R K _ I N _ D E V _ M O D E
2022-05-31 10:45:37 +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) \
2022-02-25 08:22:44 +00:00
--network= $( 1) $( 3) $( GOERLI_TESTNETS_PARAMS) \
2020-09-21 14:19:34 +00:00
--log-level= "DEBUG; TRACE:discv5,networking; REQUIRED:none; DISABLED:none" \
--data-dir= build/data/shared_$( 1) _$( NODE_ID) \
2022-02-25 08:22:44 +00:00
--dump $( NODE_PARAMS)
2020-09-21 14:19:34 +00:00
e n d e f
2020-09-28 17:13:36 +00:00
d e f i n e C O N N E C T _ T O _ N E T W O R K _ W I T H _ V A L I D A T O R _ C L I E N T
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) \
2022-02-25 08:22:44 +00:00
--network= $( 1) $( 3) $( GOERLI_TESTNETS_PARAMS) \
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 \
2022-02-25 08:22:44 +00:00
$( 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) \
2022-09-18 05:44:20 +00:00
--rest-port= $$ ( ( $( BASE_REST_PORT) + $( NODE_ID) ) )
2020-09-21 14:19:34 +00:00
e n d e f
2020-07-28 15:14:13 +00:00
2022-05-31 10:45:37 +00:00
d e f i n e C O N N E C T _ T O _ N E T W O R K _ W I T H _ L I G H T _ C L I E N T
scripts/makedir.sh build/data/shared_$( 1) _$( NODE_ID)
$( CPU_LIMIT_CMD) build/nimbus_light_client \
--network= $( 1) \
--log-level= " $( RUNTIME_LOG_LEVEL) " \
--log-file= build/data/shared_$( 1) _$( NODE_ID) /nbc_lc_$$ ( date +"%Y%m%d%H%M%S" ) .log \
2022-07-14 04:07:40 +00:00
--data-dir= build/data/shared_$( 1) _$( NODE_ID) \
2022-05-31 10:45:37 +00:00
--trusted-block-root= " $( LC_TRUSTED_BLOCK_ROOT) "
e n d e f
2020-09-28 17:13:36 +00:00
d e f i n e M A K E _ D E P O S I T _ D A T A
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
e n d e f
2020-07-17 20:59:50 +00:00
2020-09-28 17:13:36 +00:00
d e f i n e M A K E _ D E P O S I T
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 \
2022-02-25 08:22:44 +00:00
$( 2) \
2022-05-10 00:32:12 +00:00
--deposit-contract= $$ ( cat vendor/eth2-networks/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) \
2022-05-10 00:32:12 +00:00
--max-delay= $( DEPOSITS_DELAY) \
2020-07-28 20:37:12 +00:00
--ask-for-key
2020-09-21 14:19:34 +00:00
e n d e f
2020-09-28 17:13:36 +00:00
d e f i n e C L E A N _ N E T W O R K
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
e n d e f
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
2022-02-25 08:22:44 +00:00
$( call CONNECT_TO_NETWORK,prater,nimbus_beacon_node,$( GOERLI_WEB3_URL) )
2021-03-15 19:49:53 +00:00
prater-vc : | prater -build nimbus_validator_client
2022-02-25 08:22:44 +00:00
$( call CONNECT_TO_NETWORK_WITH_VALIDATOR_CLIENT,prater,nimbus_beacon_node,$( GOERLI_WEB3_URL) )
2021-03-15 19:49:53 +00:00
2022-05-31 10:45:37 +00:00
prater-lc : | nimbus_light_client
$( call CONNECT_TO_NETWORK_WITH_LIGHT_CLIENT,prater)
2021-03-15 19:49:53 +00:00
i f n e q ( $( LOG_LEVEL ) , T R A C E )
prater-dev :
+ " $( MAKE) " LOG_LEVEL = TRACE $@
e l s e
prater-dev : | prater -build
2022-02-25 08:22:44 +00:00
$( call CONNECT_TO_NETWORK_IN_DEV_MODE,prater,nimbus_beacon_node,$( GOERLI_WEB3_URL) )
2021-03-15 19:49:53 +00:00
e n d i f
prater-dev-deposit : | prater -build deposit_contract
2022-02-25 08:22:44 +00:00
$( call MAKE_DEPOSIT,prater,$( GOERLI_WEB3_URL) )
2021-03-15 19:49:53 +00:00
clean-prater :
$( call CLEAN_NETWORK,prater)
2022-07-14 20:07:16 +00:00
###
### Goerli
###
goerli-build : | nimbus_beacon_node nimbus_signing_node
# https://www.gnu.org/software/make/manual/html_node/Call-Function.html#Call-Function
goerli : | goerli -build
$( call CONNECT_TO_NETWORK,goerli,nimbus_beacon_node,$( GOERLI_WEB3_URL) )
goerli-vc : | goerli -build nimbus_validator_client
$( call CONNECT_TO_NETWORK_WITH_VALIDATOR_CLIENT,goerli,nimbus_beacon_node,$( GOERLI_WEB3_URL) )
goerli-lc : | nimbus_light_client
$( call CONNECT_TO_NETWORK_WITH_LIGHT_CLIENT,goerli)
i f n e q ( $( LOG_LEVEL ) , T R A C E )
goerli-dev :
+ " $( MAKE) " LOG_LEVEL = TRACE $@
e l s e
goerli-dev : | goerli -build
$( call CONNECT_TO_NETWORK_IN_DEV_MODE,goerli,nimbus_beacon_node,$( GOERLI_WEB3_URL) )
e n d i f
goerli-dev-deposit : | goerli -build deposit_contract
$( call MAKE_DEPOSIT,goerli,$( GOERLI_WEB3_URL) )
clean-goerli :
$( call CLEAN_NETWORK,goerli)
2022-06-16 14:11:26 +00:00
###
### Sepolia
###
sepolia-build : | nimbus_beacon_node nimbus_signing_node
# https://www.gnu.org/software/make/manual/html_node/Call-Function.html#Call-Function
sepolia : | sepolia -build
$( call CONNECT_TO_NETWORK,sepolia,nimbus_beacon_node,$( SEPOLIA_WEB3_URL) )
sepolia-vc : | sepolia -build nimbus_validator_client
$( call CONNECT_TO_NETWORK_WITH_VALIDATOR_CLIENT,sepolia,nimbus_beacon_node,$( SEPOLIA_WEB3_URL) )
sepolia-lc : | nimbus_light_client
$( call CONNECT_TO_NETWORK_WITH_LIGHT_CLIENT,sepolia)
i f n e q ( $( LOG_LEVEL ) , T R A C E )
sepolia-dev :
+ " $( MAKE) " LOG_LEVEL = TRACE $@
e l s e
sepolia-dev : | sepolia -build
$( call CONNECT_TO_NETWORK_IN_DEV_MODE,sepolia,nimbus_beacon_node,$( SEPOLIA_WEB3_URL) )
e n d i f
sepolia-dev-deposit : | sepolia -build deposit_contract
$( call MAKE_DEPOSIT,sepolia,$( SEPOLIA_WEB3_URL) )
clean-sepolia :
$( call CLEAN_NETWORK,sepolia)
2022-02-25 08:22:44 +00:00
###
### Gnosis chain binary
###
2023-01-12 17:58:42 +00:00
# TODO The `-d:gnosisChainBinary` override can be removed if the web3 library
2022-02-25 08:22:44 +00:00
# gains support for multiple "Chain Profiles" that consist of a set of
# consensus object (such as blocks and transactions) that are specific
# to the chain.
2022-04-08 20:11:37 +00:00
gnosis-build gnosis-chain-build : | build deps
2022-03-15 13:56:01 +00:00
+ echo -e $( BUILD_MSG) "build/nimbus_beacon_node_gnosis" && \
MAKE = " $( MAKE) " V = " $( V) " $( ENV_SCRIPT) scripts/compile_nim_program.sh \
nimbus_beacon_node_gnosis \
beacon_chain/nimbus_beacon_node.nim \
$( NIM_PARAMS) \
-d:gnosisChainBinary \
2023-01-12 17:58:42 +00:00
-d:const_preset= gnosis \
2022-03-15 13:56:01 +00:00
&& \
echo -e $( BUILD_END_MSG) "build/nimbus_beacon_node_gnosis"
2022-02-25 08:22:44 +00:00
2022-04-08 20:11:37 +00:00
gnosis : | gnosis -build
$( call CONNECT_TO_NETWORK,gnosis,nimbus_beacon_node_gnosis,$( GNOSIS_WEB3_URLS) )
i f n e q ( $( LOG_LEVEL ) , T R A C E )
gnosis-dev :
+ " $( MAKE) " --no-print-directory LOG_LEVEL = TRACE $@
e l s e
gnosis-dev : | gnosis -build
$( call CONNECT_TO_NETWORK_IN_DEV_MODE,gnosis,nimbus_beacon_node_gnosis,$( GNOSIS_WEB3_URLS) )
e n d i f
gnosis-dev-deposit : | gnosis -build deposit_contract
$( call MAKE_DEPOSIT,gnosis,$( GNOSIS_WEB3_URLS) )
clean-gnosis :
$( call CLEAN_NETWORK,gnosis)
# v22.3 names
gnosis-chain : | gnosis -build
echo ` gnosis-chain` is deprecated, use ` gnosis` after migrating data folder
2022-02-25 08:22:44 +00:00
$( call CONNECT_TO_NETWORK,gnosis-chain,nimbus_beacon_node_gnosis,$( GNOSIS_WEB3_URLS) )
i f n e q ( $( LOG_LEVEL ) , T R A C E )
gnosis-chain-dev :
2022-03-15 13:56:01 +00:00
+ " $( MAKE) " --no-print-directory LOG_LEVEL = TRACE $@
2022-02-25 08:22:44 +00:00
e l s e
2022-04-08 20:11:37 +00:00
gnosis-chain-dev : | gnosis -build
echo ` gnosis-chain-dev` is deprecated, use ` gnosis-dev` instead
2022-02-25 08:22:44 +00:00
$( call CONNECT_TO_NETWORK_IN_DEV_MODE,gnosis-chain,nimbus_beacon_node_gnosis,$( GNOSIS_WEB3_URLS) )
e n d i f
2022-04-08 20:11:37 +00:00
gnosis-chain-dev-deposit : | gnosis -build deposit_contract
echo ` gnosis-chain-dev-deposit` is deprecated, use ` gnosis-chain-dev-deposit` instead
2022-02-25 08:22:44 +00:00
$( call MAKE_DEPOSIT,gnosis-chain,$( GNOSIS_WEB3_URLS) )
clean-gnosis-chain :
$( call CLEAN_NETWORK,gnosis-chain)
2023-07-19 07:48:39 +00:00
###
### libnimbus_lc
###
libnimbus_lc.a : | build deps
+ echo -e $( BUILD_MSG) " build/ $@ " && \
rm -f build/$@ && \
$( ENV_SCRIPT) $( NIMC) c -d:disable_libbacktrace -d:release --app:staticlib --noMain --nimcache:nimcache/libnimbus_lc_static -o:build/$@ $( NIM_PARAMS) beacon_chain/libnimbus_lc/libnimbus_lc.nim $( SILENCE_WARNINGS) && \
echo -e $( BUILD_END_MSG) " build/ $@ "
# `-Wno-maybe-uninitialized` in Linux: https://github.com/nim-lang/Nim/issues/22246
2023-08-07 05:57:56 +00:00
# `-fsanitize=undefined` in Windows: https://github.com/msys2/MINGW-packages/issues/3163
2023-07-19 07:48:39 +00:00
test_libnimbus_lc : libnimbus_lc .a
+ echo -e $( BUILD_MSG) " build/ $@ " && \
2023-08-07 05:57:56 +00:00
EXTRA_FLAGS = ( ) && \
2023-07-19 07:48:39 +00:00
case " $$ (uname) " in \
Darwin) \
2023-08-07 05:57:56 +00:00
if ( ( $$ { WITH_UBSAN:-0} ) ) ; then \
EXTRA_FLAGS += ( '-fsanitize=undefined' ) ; \
fi ; \
clang -D__DIR__= "\"beacon_chain/libnimbus_lc\"" --std= c17 -Weverything -Werror -Wno-declaration-after-statement -Wno-nullability-extension -isysroot /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk -o build/test_libnimbus_lc beacon_chain/libnimbus_lc/test_libnimbus_lc.c build/libnimbus_lc.a -framework Security " $$ {EXTRA_FLAGS[@]} " ; \
2023-07-19 07:48:39 +00:00
; ; \
MINGW64_*) \
2023-08-07 05:57:56 +00:00
if ( ( $$ { WITH_UBSAN:-0} ) ) ; then \
echo "MINGW cannot find -lubsan." && exit 1; \
fi ; \
gcc -D__DIR__= "\"beacon_chain/libnimbus_lc\"" --std= c17 -Wall -Wextra -pedantic -Werror -pedantic-errors -flto -o build/test_libnimbus_lc -D_CRT_SECURE_NO_WARNINGS beacon_chain/libnimbus_lc/test_libnimbus_lc.c build/libnimbus_lc.a " $$ {EXTRA_FLAGS[@]} " ; \
2023-07-19 07:48:39 +00:00
; ; \
*) \
2023-08-07 05:57:56 +00:00
if ( ( $$ { WITH_UBSAN:-0} ) ) ; then \
EXTRA_FLAGS += ( '-fsanitize=undefined' ) ; \
fi ; \
gcc -D__DIR__= "\"beacon_chain/libnimbus_lc\"" --std= c17 -Wall -Wextra -pedantic -Werror -pedantic-errors -Wno-maybe-uninitialized -flto -o build/test_libnimbus_lc beacon_chain/libnimbus_lc/test_libnimbus_lc.c build/libnimbus_lc.a " $$ {EXTRA_FLAGS[@]} " ; \
2023-07-19 07:48:39 +00:00
; ; \
esac && \
echo -e $( BUILD_END_MSG) " build/ $@ "
2021-03-15 19:49:53 +00:00
###
### Other
###
2022-02-27 11:02:57 +00:00
nimbus-msi : | nimbus_beacon_node
" $( WIX) /bin/candle " -ext WixUIExtension -ext WixUtilExtension installer/windows/*.wxs -o installer/windows/obj/
" $( WIX) /bin/light " -ext WixUIExtension -ext WixUtilExtension -cultures:"en-us;en-uk;neutral" installer/windows/obj/*.wixobj -out build/NimbusBeaconNode.msi
2022-02-27 22:08:38 +00:00
nimbus-pkg : | nimbus_beacon_node
xcodebuild -project installer/macos/nimbus-pkg.xcodeproj -scheme nimbus-pkg build
packagesbuild installer/macos/nimbus-pkg.pkgproj
2020-06-11 16:41:43 +00:00
ntu : | build deps
mkdir -p vendor/.nimble/bin/
2022-11-24 20:56:02 +00:00
+ $( ENV_SCRIPT) $( NIMC) -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
2023-08-21 09:10:15 +00:00
rm -rf build/{ $( TOOLS_CSV) ,all_tests,test_*,proto_array,fork_choice,*.a,*.so,*_node,*ssz*,nimbus_*,beacon_node*,block_sim,transition*,generate_makefile,nimbus-wix/obj}
2020-02-20 16:41:10 +00:00
i f n e q ( $( 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
e n d i f
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/ $@ " && \
2022-11-24 20:56:02 +00:00
$( ENV_SCRIPT) $( NIMC) c -d:release --app:lib --noMain --nimcache:nimcache/libnfuzz -o:build/$@ .0 $( NIM_PARAMS) nfuzz/libnfuzz.nim $( SILENCE_WARNINGS) && \
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/$@ && \
2022-11-24 20:56:02 +00:00
$( ENV_SCRIPT) $( NIMC) c -d:release --app:staticlib --noMain --nimcache:nimcache/libnfuzz_static -o:build/$@ $( NIM_PARAMS) nfuzz/libnfuzz.nim $( SILENCE_WARNINGS) && \
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 :
2022-07-22 19:47:24 +00:00
" $( MAKE) " -C docs book
auditors-book :
2023-06-26 16:04:01 +00:00
[ [ " $$ (mdbook --version) " = "mdbook v0.4.28" ] ] || { echo "'mdbook v0.4.28' not found in PATH. See 'docs/README.md'. Aborting." ; exit 1; }
2022-06-20 20:04:46 +00:00
[ [ " $$ (mdbook-toc --version) " = = "mdbook-toc 0.8.0" ] ] || { echo "'mdbook-toc 0.8.0' not found in PATH. See 'docs/README.md'. Aborting." ; exit 1; }
2023-06-26 16:04:01 +00:00
[ [ " $$ (mdbook-open-on-gh --version) " = = "mdbook-open-on-gh 2.3.3" ] ] || { echo "'mdbook-open-on-gh 2.3.3' not found in PATH. See 'docs/README.md'. Aborting." ; exit 1; }
2022-07-21 18:19:47 +00:00
[ [ " $$ (mdbook-admonish --version) " = = "mdbook-admonish 1.7.0" ] ] || { echo "'mdbook-open-on-gh 1.7.0' not found in PATH. See 'docs/README.md'. Aborting." ; exit 1; }
2020-07-07 08:44:21 +00:00
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/ && \
2022-07-22 19:47:24 +00:00
cp -a docs/the_nimbus_book/site/* 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 . && { \
2022-06-20 20:04:46 +00:00
git commit -m " make publish-book $$ (git rev-parse --short HEAD) " && \
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
2023-05-11 10:05:52 +00:00
dist-amd64-opt :
+ MAKE = " $( MAKE) " \
scripts/make_dist.sh amd64-opt
2021-01-07 09:19:29 +00:00
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
2023-05-11 10:05:52 +00:00
+ $( MAKE) dist-amd64-opt
2021-03-10 02:59:19 +00:00
+ $( 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
e n d i f # "variables.mk" was not included