diff --git a/ci/dash/bundle-artifacts.sh b/ci/dash/bundle-artifacts.sh index 7f82fc7f0f3a..30bafa80b968 100755 --- a/ci/dash/bundle-artifacts.sh +++ b/ci/dash/bundle-artifacts.sh @@ -44,6 +44,8 @@ if [ "${VERB}" = "create" ]; then ".libs" # Test binaries that only the unit tests, run before bundling, need "src/bench/bench_dash" + "src/dashbls/runbench" + "src/dashbls/runtest" "src/qt/test/test_dash-qt" "src/test/fuzz/fuzz" "src/test/test_dash" diff --git a/doc/build-freebsd.md b/doc/build-freebsd.md index 133496a14295..971cb79b0a4a 100644 --- a/doc/build-freebsd.md +++ b/doc/build-freebsd.md @@ -10,10 +10,12 @@ This guide describes how to build dashd, command-line utilities, and GUI on Free Run the following as root to install the base dependencies for building. ```bash -pkg install autoconf automake boost-libs git gmake libevent libtool pkgconf libbacktrace zstd +pkg install autoconf automake blst boost-libs git gmake libevent libtool pkgconf libbacktrace zstd ``` +The `blst` package installs its headers into `/usr/local/include/libblst`, so add `BLST_CPPFLAGS="-I/usr/local/include/libblst" LDFLAGS="-L/usr/local/lib"` to the `./configure` commands below. + See [dependencies.md](dependencies.md) for a complete overview. ### 2. Clone Dash Repo diff --git a/doc/build-netbsd.md b/doc/build-netbsd.md index 474a4c3c87c1..f6dffa671554 100644 --- a/doc/build-netbsd.md +++ b/doc/build-netbsd.md @@ -18,6 +18,8 @@ pkgin install autoconf automake libtool pkg-config git gmake boost libevent zstd ``` +blst is not available in pkgsrc; build it as described in [build-unix.md](build-unix.md#blst), using `shasum -a 256 -c` in place of `sha256sum -c`. + NetBSD may ship with an older version of `gcc` than is needed to build C++20 (GCC 11.1+ is required). You should install a newer `gcc` and pass it to the configure script. For example, grab `gcc12`: diff --git a/doc/build-openbsd.md b/doc/build-openbsd.md index 0524df03aaee..87dfd467175c 100644 --- a/doc/build-openbsd.md +++ b/doc/build-openbsd.md @@ -15,6 +15,8 @@ pkg_add bash git gmake libevent libtool boost zstd pkg_add autoconf automake python ``` +blst is not available as an OpenBSD package; build it as described in [build-unix.md](build-unix.md#blst), using `sha256 -c` in place of `sha256sum -c`. + See [dependencies.md](dependencies.md) for a complete overview. ### 2. Clone Dash Core Repo diff --git a/doc/build-osx.md b/doc/build-osx.md index c4eb2d177418..c1b9b07047da 100644 --- a/doc/build-osx.md +++ b/doc/build-osx.md @@ -50,6 +50,8 @@ See [dependencies.md](dependencies.md) for a complete overview. brew install automake libtool boost pkg-config libevent zstd ``` +blst is not available in Homebrew; build it as described in [build-unix.md](build-unix.md#blst), using `shasum -a 256 -c` instead of `sha256sum -c`. + ### 4. Clone Dash repository `git` should already be installed by default on your system. diff --git a/doc/build-unix.md b/doc/build-unix.md index d68b295c1d2f..7b8c1b2c9ae8 100644 --- a/doc/build-unix.md +++ b/doc/build-unix.md @@ -51,6 +51,8 @@ sudo apt-get install libbacktrace-dev libevent-dev libboost-dev Note: libbacktrace-dev is available in Debian 13 (Trixie) and Ubuntu 25.04+. For older releases, use the /depends/README.md which includes all required libraries. +blst is required and not packaged by Debian or Ubuntu; build it as described in [blst](#blst). + SQLite is required for the descriptor wallet: ```sh @@ -132,6 +134,8 @@ sudo dnf install libevent-devel boost-devel Note: Fedora repositories do not include libbacktrace. To build Dash Core without stack trace support, configure with `--disable-stacktraces`. +blst is required and not packaged by Fedora; build it as described in [blst](#blst). + SQLite is required for the descriptor wallet: ```sh @@ -200,6 +204,28 @@ See [dependencies.md](dependencies.md) for a complete overview, and [depends](/depends/README.md) on how to compile them yourself, if you wish to not use the packages of your Linux distribution. +### blst + +[blst](https://github.com/supranational/blst) is required. Some distributions do not package it, so build it yourself: +```bash +curl -fLO https://github.com/supranational/blst/archive/refs/tags/v0.3.17.tar.gz && \ +echo "c3fef37b566b67419703b2bbb648e15176276af9a880c22aa8f5f2e8cecc2e4d v0.3.17.tar.gz" | sha256sum -c && \ +tar -xzf v0.3.17.tar.gz && \ +(cd blst-0.3.17 && ./build.sh -D__BLST_PORTABLE__) +``` +`-D__BLST_PORTABLE__` makes blst pick its ADX code path at run time, as the depends build does. Without it the library uses ADX whenever the build machine has it, and the resulting binaries crash with an illegal instruction on CPUs that lack it. + +and configure from the Dash Core source directory using the following: +```bash +export BLST_DIR="/path/to/blst-0.3.17" + +./configure \ + BLST_CPPFLAGS="-I${BLST_DIR}/bindings" \ + LDFLAGS="-L${BLST_DIR}" +``` + +**Note**: Make sure that `BLST_DIR` is an absolute path. + ### Berkeley DB The legacy wallet uses Berkeley DB. To ensure backwards compatibility it is @@ -257,4 +283,6 @@ make check ./src/dashd ``` +blst is not in the Arch Linux repositories; build it as described in the [blst](#blst) section and pass its paths to `./configure`. + If you intend to work with legacy Berkeley DB wallets, see [Berkeley DB](#berkeley-db) section. diff --git a/doc/release-notes-7678.md b/doc/release-notes-7678.md new file mode 100644 index 000000000000..9ddcaffee7e4 --- /dev/null +++ b/doc/release-notes-7678.md @@ -0,0 +1,4 @@ +Build System +------------ + +- BLS signatures are now computed with [blst](https://github.com/supranational/blst) instead of relic. Unlike relic, blst is not part of the Dash Core source tree, so builds without `depends` need blst 0.3.17 installed. Some distributions do not package it; see the blst section of `doc/build-unix.md` for building it from source. (#7678) diff --git a/src/Makefile.dashbls.include b/src/Makefile.dashbls.include index bb95d7abc8f7..fa1fed96b4c7 100644 --- a/src/Makefile.dashbls.include +++ b/src/Makefile.dashbls.include @@ -93,7 +93,7 @@ dashbls_libmimalloc_secure_la_SOURCES = \ dashbls/depends/mimalloc/src/prim/prim.c dashbls_libmimalloc_secure_la_CPPFLAGS = $(AM_CPPFLAGS) $(MIMALLOC_CPPFLAGS_INT) -dashbls_libmimalloc_secure_la_CFLAGS = $(AM_CFLAGS) $(PIE_FLAGS) -static +dashbls_libmimalloc_secure_la_CFLAGS = $(AM_CFLAGS) $(HARDENED_CXXFLAGS) $(PIE_FLAGS) -static dashbls_libmimalloc_secure_la_LDFLAGS = $(AM_LDFLAGS) -static if ENABLE_TESTS @@ -113,3 +113,17 @@ dashbls_runtest_LDADD = $(LIBDASHBLS) dashbls_runtest_LDFLAGS = $(RELDFLAGS) $(AM_LDFLAGS) $(LIBTOOL_APP_LDFLAGS) $(PTHREAD_FLAGS) -static endif endif + +if ENABLE_BENCH +if !ENABLE_FUZZ +noinst_PROGRAMS += dashbls/runbench + +dashbls_runbench_SOURCES = \ + dashbls/src/test-bench.cpp \ + dashbls/include/dashbls/test-utils.hpp +dashbls_runbench_CPPFLAGS = $(AM_CPPFLAGS) $(DASHBLS_CPPFLAGS_INT) +dashbls_runbench_CXXFLAGS = $(AM_CXXFLAGS) $(PIE_FLAGS) +dashbls_runbench_LDADD = $(LIBDASHBLS) +dashbls_runbench_LDFLAGS = $(RELDFLAGS) $(AM_LDFLAGS) $(LIBTOOL_APP_LDFLAGS) $(PTHREAD_FLAGS) -static +endif +endif diff --git a/test/sanitizer_suppressions/ubsan b/test/sanitizer_suppressions/ubsan index 5e8b81c77c63..6ed40b0d303d 100644 --- a/test/sanitizer_suppressions/ubsan +++ b/test/sanitizer_suppressions/ubsan @@ -2,7 +2,8 @@ # -fsanitize=undefined suppressions # ================================= -nonnull-attribute:dashbls/ +nonnull-attribute:dashbls/include/dashbls/hkdf.hpp +nonnull-attribute:dashbls/include/dashbls/util.hpp # -fsanitize=integer suppressions # =============================== @@ -19,16 +20,19 @@ implicit-integer-sign-change:*/include/boost/ implicit-integer-sign-change:*/include/c++/ implicit-integer-sign-change:*/new_allocator.h implicit-integer-sign-change:crc32c/ -implicit-integer-sign-change:dashbls/ +implicit-integer-sign-change:dashbls/include/dashbls/util.hpp +implicit-integer-sign-change:dashbls/src/extendedprivatekey.cpp +implicit-integer-sign-change:dashbls/src/extendedpublickey.cpp +implicit-integer-sign-change:dashbls/src/test.cpp implicit-integer-sign-change:minisketch/ implicit-integer-sign-change:secp256k1* implicit-signed-integer-truncation:*/include/c++/ -implicit-signed-integer-truncation:dashbls/ +implicit-signed-integer-truncation:dashbls/include/dashbls/test-utils.hpp implicit-signed-integer-truncation:leveldb/ implicit-signed-integer-truncation:secp256k1* implicit-signed-integer-truncation,implicit-integer-sign-change:secp256k1_modinv64_posdivsteps_62_var implicit-unsigned-integer-truncation:*/include/c++/ -implicit-unsigned-integer-truncation:dashbls/ +implicit-unsigned-integer-truncation:dashbls/include/dashbls/util.hpp implicit-unsigned-integer-truncation:leveldb/ implicit-unsigned-integer-truncation:secp256k1* implicit-signed-integer-truncation,implicit-integer-sign-change:secp256k1*