2019-03-28 15:18:59 +00:00
|
|
|
mode = ScriptMode.Verbose
|
|
|
|
|
2019-03-05 22:54:08 +00:00
|
|
|
import
|
2019-03-12 12:56:33 +00:00
|
|
|
beacon_chain/version as ver
|
2019-03-05 22:54:08 +00:00
|
|
|
|
2018-07-20 13:46:03 +00:00
|
|
|
packageName = "beacon_chain"
|
2019-03-05 22:54:08 +00:00
|
|
|
version = versionAsStr
|
2018-07-20 13:46:03 +00:00
|
|
|
author = "Status Research & Development GmbH"
|
2018-09-26 16:26:39 +00:00
|
|
|
description = "Eth2.0 research implementation of the beacon chain"
|
2018-07-20 13:46:03 +00:00
|
|
|
license = "MIT or Apache License 2.0"
|
2018-12-21 22:37:46 +00:00
|
|
|
installDirs = @["beacon_chain", "research"]
|
2019-11-28 22:01:12 +00:00
|
|
|
skipDirs = @["nfuzz"]
|
2018-12-21 22:37:46 +00:00
|
|
|
bin = @[
|
2020-11-07 18:00:31 +00:00
|
|
|
"beacon_chain/nimbus_beacon_node",
|
2018-12-27 20:14:37 +00:00
|
|
|
"research/serialized_sizes",
|
2020-02-27 11:14:24 +00:00
|
|
|
"nbench/nbench",
|
2018-12-27 20:14:37 +00:00
|
|
|
]
|
2018-07-20 13:46:03 +00:00
|
|
|
|
|
|
|
### Dependencies
|
2019-02-07 11:02:40 +00:00
|
|
|
requires "nim >= 0.19.0",
|
2019-02-21 04:42:17 +00:00
|
|
|
"blscurve",
|
2018-11-23 23:58:49 +00:00
|
|
|
"chronicles",
|
2019-09-07 17:48:05 +00:00
|
|
|
"chronos",
|
2018-11-23 23:58:49 +00:00
|
|
|
"confutils",
|
2019-09-07 17:48:05 +00:00
|
|
|
"eth",
|
2019-02-06 17:56:04 +00:00
|
|
|
"json_rpc",
|
2019-09-07 17:48:05 +00:00
|
|
|
"json_serialization",
|
2020-02-13 12:19:12 +00:00
|
|
|
"libbacktrace",
|
2019-07-31 08:32:35 +00:00
|
|
|
"libp2p",
|
2019-09-07 17:48:05 +00:00
|
|
|
"metrics",
|
|
|
|
"nimcrypto",
|
2020-10-02 14:48:27 +00:00
|
|
|
"normalize",
|
2019-09-07 17:48:05 +00:00
|
|
|
"serialization",
|
|
|
|
"stew",
|
2020-03-24 11:13:07 +00:00
|
|
|
"testutils",
|
2019-10-02 12:38:14 +00:00
|
|
|
"prompt",
|
2020-10-02 14:48:27 +00:00
|
|
|
"unicodedb",
|
2019-09-07 17:48:05 +00:00
|
|
|
"web3",
|
2020-10-06 18:55:04 +00:00
|
|
|
"yaml",
|
|
|
|
"zxcvbn"
|
2018-07-20 13:46:03 +00:00
|
|
|
|
|
|
|
### Helper functions
|
2020-06-14 02:25:19 +00:00
|
|
|
proc buildAndRunBinary(name: string, srcDir = "./", params = "", cmdParams = "", lang = "c") =
|
2018-07-20 13:46:03 +00:00
|
|
|
if not dirExists "build":
|
|
|
|
mkDir "build"
|
2019-03-28 15:18:59 +00:00
|
|
|
# allow something like "nim test --verbosity:0 --hints:off beacon_chain.nims"
|
|
|
|
var extra_params = params
|
|
|
|
for i in 2..<paramCount():
|
|
|
|
extra_params &= " " & paramStr(i)
|
2020-02-20 16:41:10 +00:00
|
|
|
exec "nim " & lang & " --out:./build/" & name & " -r " & extra_params & " " & srcDir & name & ".nim" & " " & cmdParams
|
2018-07-20 13:46:03 +00:00
|
|
|
|
2020-03-24 11:13:07 +00:00
|
|
|
task moduleTests, "Run all module tests":
|
2020-11-07 18:00:31 +00:00
|
|
|
buildAndRunBinary "nimbus_beacon_node", "beacon_chain/",
|
|
|
|
"-d:chronicles_log_level=TRACE " &
|
2020-11-20 13:49:49 +00:00
|
|
|
"-d:const_preset=minimal " &
|
2020-11-07 18:00:31 +00:00
|
|
|
"-d:testutils_test_build"
|
2020-03-24 11:13:07 +00:00
|
|
|
|
2018-07-20 13:46:03 +00:00
|
|
|
### tasks
|
|
|
|
task test, "Run all tests":
|
2020-02-13 12:19:12 +00:00
|
|
|
# We're enabling the TRACE log level so we're sure that those rarely used
|
|
|
|
# pieces of code get tested regularly. Increased test output verbosity is the
|
|
|
|
# price we pay for that.
|
|
|
|
|
2020-11-20 13:49:49 +00:00
|
|
|
buildAndRunBinary "test_fixture_const_sanity_check", "tests/official/", """-d:const_preset=minimal -d:chronicles_sinks="json[file]""""
|
|
|
|
buildAndRunBinary "test_fixture_const_sanity_check", "tests/official/", """-d:const_preset=mainnet -d:chronicles_sinks="json[file]""""
|
2020-06-20 07:12:45 +00:00
|
|
|
|
2020-09-16 11:30:03 +00:00
|
|
|
# Generic SSZ test, doesn't use consensus objects minimal/mainnet presets
|
2020-11-20 13:49:49 +00:00
|
|
|
buildAndRunBinary "test_fixture_ssz_generic_types", "tests/official/", """-d:chronicles_log_level=TRACE -d:chronicles_sinks="json[file]""""
|
2020-09-21 15:58:35 +00:00
|
|
|
|
2020-10-13 17:21:25 +00:00
|
|
|
# Consensus object SSZ tests
|
2020-11-20 13:49:49 +00:00
|
|
|
buildAndRunBinary "test_fixture_ssz_consensus_objects", "tests/official/", """-d:chronicles_log_level=TRACE -d:const_preset=mainnet -d:chronicles_sinks="json[file]""""
|
2020-10-13 17:21:25 +00:00
|
|
|
|
2020-09-16 11:30:03 +00:00
|
|
|
# EF tests
|
2020-11-20 13:49:49 +00:00
|
|
|
buildAndRunBinary "all_fixtures_require_ssz", "tests/official/", """-d:chronicles_log_level=TRACE -d:const_preset=mainnet -d:chronicles_sinks="json[file]""""
|
2020-09-16 11:30:03 +00:00
|
|
|
|
2021-02-09 15:23:06 +00:00
|
|
|
# EIP-3076 - Slashing interchange
|
|
|
|
buildAndRunBinary "test_official_interchange_vectors", "tests/slashing_protection/", """-d:chronicles_log_level=TRACE -d:const_preset=mainnet -d:chronicles_sinks="json[file]""""
|
|
|
|
|
2020-06-17 17:41:59 +00:00
|
|
|
# Mainnet config
|
2020-11-20 13:49:49 +00:00
|
|
|
buildAndRunBinary "proto_array", "beacon_chain/fork_choice/", """-d:const_preset=mainnet -d:chronicles_sinks="json[file]""""
|
|
|
|
buildAndRunBinary "fork_choice", "beacon_chain/fork_choice/", """-d:const_preset=mainnet -d:chronicles_sinks="json[file]""""
|
|
|
|
buildAndRunBinary "all_tests", "tests/", """-d:chronicles_log_level=TRACE -d:const_preset=mainnet -d:chronicles_sinks="json[file]""""
|
2020-10-30 14:30:19 +00:00
|
|
|
# TODO `test_keystore` is extracted from the rest of the tests because it uses conflicting BLST headers
|
2020-11-20 13:49:49 +00:00
|
|
|
buildAndRunBinary "test_keystore", "tests/", """-d:chronicles_log_level=TRACE -d:const_preset=mainnet -d:chronicles_sinks="json[file]""""
|
2020-08-15 17:33:58 +00:00
|
|
|
|
2020-12-10 09:18:07 +00:00
|
|
|
# As BLST has a pure C fallback as of Dec 2020 undergoing audit and formal verification
|
|
|
|
# we skip Miracl checks as they are costly in CI time.
|
|
|
|
# # Check Miracl/Milagro fallback on select tests
|
|
|
|
# buildAndRunBinary "test_interop", "tests/", """-d:chronicles_log_level=TRACE -d:const_preset=mainnet -d:BLS_FORCE_BACKEND=miracl -d:chronicles_sinks="json[file]""""
|
|
|
|
# buildAndRunBinary "test_process_attestation", "tests/spec_block_processing/", """-d:chronicles_log_level=TRACE -d:const_preset=mainnet -d:BLS_FORCE_BACKEND=miracl -d:chronicles_sinks="json[file]""""
|
|
|
|
# buildAndRunBinary "test_process_deposits", "tests/spec_block_processing/", """-d:chronicles_log_level=TRACE -d:const_preset=mainnet -d:BLS_FORCE_BACKEND=miracl -d:chronicles_sinks="json[file]""""
|
|
|
|
# buildAndRunBinary "all_fixtures_require_ssz", "tests/official/", """-d:chronicles_log_level=TRACE -d:const_preset=mainnet -d:BLS_FORCE_BACKEND=miracl -d:chronicles_sinks="json[file]""""
|
|
|
|
# buildAndRunBinary "test_attestation_pool", "tests/", """-d:chronicles_log_level=TRACE -d:const_preset=mainnet -d:BLS_FORCE_BACKEND=miracl -d:chronicles_sinks="json[file]""""
|
|
|
|
# buildAndRunBinary "test_block_pool", "tests/", """-d:chronicles_log_level=TRACE -d:const_preset=mainnet -d:BLS_FORCE_BACKEND=miracl -d:chronicles_sinks="json[file]""""
|
2019-08-07 03:09:26 +00:00
|
|
|
|
2020-06-29 18:08:58 +00:00
|
|
|
# State and block sims; getting to 4th epoch triggers consensus checks
|
2020-11-20 13:49:49 +00:00
|
|
|
buildAndRunBinary "state_sim", "research/", "-d:const_preset=mainnet -d:chronicles_log_level=INFO", "--validators=3000 --slots=128"
|
|
|
|
# buildAndRunBinary "state_sim", "research/", "-d:const_preset=mainnet -d:BLS_FORCE_BACKEND=miracl -d:chronicles_log_level=INFO", "--validators=3000 --slots=128"
|
|
|
|
buildAndRunBinary "block_sim", "research/", "-d:const_preset=mainnet", "--validators=3000 --slots=128"
|
|
|
|
# buildAndRunBinary "block_sim", "research/", "-d:const_preset=mainnet -d:BLS_FORCE_BACKEND=miracl", "--validators=3000 --slots=128"
|