From 5c259f4ed8259373538a551331e2ad1997ad10c5 Mon Sep 17 00:00:00 2001 From: Konstantin Akimov Date: Wed, 11 Nov 2026 14:01:00 +0700 Subject: [PATCH 1/5] build: build libmimalloc-secure with the hardening flags The secure allocator for BLS secret keys lost its hardening when dashbls moved from its own sub-configure into Dash's build: that configure compiled everything with -fstack-protector-all, -fcf-protection=full and -fstack-clash-protection, while libmimalloc-secure now gets only AM_CFLAGS, which carries none of them. The C++ part of dashbls is unaffected, as AM_CXXFLAGS includes HARDENED_CXXFLAGS. Dash's configure has no HARDENED_CFLAGS because it has no other C code of its own; secp256k1 runs its own configure. Every flag configure puts into HARDENED_CXXFLAGS is accepted by the C compiler of the same toolchain, so they are passed to mimalloc as they are rather than duplicating each check for C. blst, built by depends, stays as it is: depends builds no package with these flags. --- src/Makefile.dashbls.include | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Makefile.dashbls.include b/src/Makefile.dashbls.include index bb95d7abc8f7..e5d795b62728 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 From 393e92da7adce705905aae764b48facb5e3685c4 Mon Sep 17 00:00:00 2001 From: Konstantin Akimov Date: Wed, 11 Nov 2026 14:01:00 +0700 Subject: [PATCH 2/5] ci: do not bundle src/dashbls/runtest The dashbls Catch2 test is part of `make check`, which runs in the build job before the artifacts are bundled. The test jobs never run it, so it is excluded like the other test binaries. --- ci/dash/bundle-artifacts.sh | 1 + 1 file changed, 1 insertion(+) diff --git a/ci/dash/bundle-artifacts.sh b/ci/dash/bundle-artifacts.sh index 7f82fc7f0f3a..da73fbb53d0e 100755 --- a/ci/dash/bundle-artifacts.sh +++ b/ci/dash/bundle-artifacts.sh @@ -44,6 +44,7 @@ if [ "${VERB}" = "create" ]; then ".libs" # Test binaries that only the unit tests, run before bundling, need "src/bench/bench_dash" + "src/dashbls/runtest" "src/qt/test/test_dash-qt" "src/test/fuzz/fuzz" "src/test/test_dash" From 79ae017223aeec540875fb96a1d235f0ad236dc4 Mon Sep 17 00:00:00 2001 From: Konstantin Akimov Date: Wed, 11 Nov 2026 14:01:00 +0700 Subject: [PATCH 3/5] test: narrow the dashbls UBSan suppressions Since dashbls is built by Dash's own makefiles it is compiled with the sanitizer flags, and the suppressions added with that change covered the whole directory, including the code Dash uses for consensus. The -fsanitize=undefined hits reported for dashbls are three memcpy(dst, nullptr, 0) calls in the HKDF/HMAC helpers used for key derivation: HKDF256::Expand copies an empty info, and Util::md_hmac copies an empty key when HKDF256::Extract is called without salt. Only those two functions are suppressed now. The three -fsanitize=integer entries are dropped. Any remaining implicit conversion in dashbls is reported by the asan CI job and gets a suppression scoped to its function. --- test/sanitizer_suppressions/ubsan | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) 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* From 81e0bc5bda9669fc87c8af5978cf55a3aeb3b538 Mon Sep 17 00:00:00 2001 From: Konstantin Akimov Date: Wed, 11 Nov 2026 14:01:49 +0700 Subject: [PATCH 4/5] doc: explain how to get blst without depends blst became a required external library when it replaced relic, which used to be vendored in src/dashbls. Only doc/dependencies.md mentions it: the build guides still list just the packages that were needed before, so a build without depends stops at configure with "blst headers missing". Debian, Ubuntu, Fedora, Arch, Homebrew, pkgsrc and OpenBSD do not package blst. build-unix.md gets a blst section with the commands to fetch the release depends uses, check it against the depends hash, build it and point configure at it; the other guides refer to it. FreeBSD packages blst, with its headers in include/libblst, so its guide installs the package and names the paths for configure. A release note tells packagers about the new dependency. --- doc/build-freebsd.md | 4 +++- doc/build-netbsd.md | 2 ++ doc/build-openbsd.md | 2 ++ doc/build-osx.md | 2 ++ doc/build-unix.md | 28 ++++++++++++++++++++++++++++ doc/release-notes-7678.md | 4 ++++ 6 files changed, 41 insertions(+), 1 deletion(-) create mode 100644 doc/release-notes-7678.md 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) From c6f5dfdf34fd40c39bf09f02783e7c0a67587880 Mon Sep 17 00:00:00 2001 From: Konstantin Akimov Date: Sat, 14 Nov 2026 17:20:13 +0700 Subject: [PATCH 5/5] build: restore the dashbls runbench binary dashbls's own autotools build compiled src/test-bench.cpp into src/dashbls/runbench whenever benchmarks were enabled. Its build files went away with the subtree update to bls-signatures@77c8da5, and the integrated build added in #7678 only brought back runtest. Build it again under ENABLE_BENCH, and keep it out of the CI bundle like the other test and bench binaries. --- ci/dash/bundle-artifacts.sh | 1 + src/Makefile.dashbls.include | 14 ++++++++++++++ 2 files changed, 15 insertions(+) diff --git a/ci/dash/bundle-artifacts.sh b/ci/dash/bundle-artifacts.sh index da73fbb53d0e..30bafa80b968 100755 --- a/ci/dash/bundle-artifacts.sh +++ b/ci/dash/bundle-artifacts.sh @@ -44,6 +44,7 @@ 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" diff --git a/src/Makefile.dashbls.include b/src/Makefile.dashbls.include index e5d795b62728..fa1fed96b4c7 100644 --- a/src/Makefile.dashbls.include +++ b/src/Makefile.dashbls.include @@ -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