Skip to content

backport: add CMake build system alongside Autotools - #7481

Open
PastaPastaPasta wants to merge 14 commits into
dashpay:developfrom
PastaPastaPasta:build/cmake-alongside-autotools
Open

backport: add CMake build system alongside Autotools#7481
PastaPastaPasta wants to merge 14 commits into
dashpay:developfrom
PastaPastaPasta:build/cmake-alongside-autotools

Conversation

@PastaPastaPasta

@PastaPastaPasta PastaPastaPasta commented Jul 25, 2026

Copy link
Copy Markdown
Member

Issue being fixed or feature implemented

Dash Core only has an Autotools build. Bitcoin Core replaced Autotools with CMake
in v29, and every backport from that point on carries build-system changes we
cannot apply. This adds the CMake build system alongside Autotools so both
work, which lets us backport upstream build changes incrementally and gives
Windows/MSVC users a supported path.

The first commit is the upstream CMake tree adapted to Dash. The remaining
commits fix the divergences from our Autotools build that the adaptation missed —
several of which silently disabled Dash-specific functionality rather than
failing loudly.

What was done?

build: add cmake build system alongside autotools ports Bitcoin Core's CMake
build (top-level CMakeLists.txt, cmake/ modules, per-directory
CMakeLists.txt under src/, depends/toolchain.cmake.in, vcpkg.json,
CMakePresets.json) and keeps configure.ac/Makefile.am fully functional.

Follow-up commits:

  • build: fix CMake build failures

    • bitcoin_common compiles common/url.cpp, which includes
      <event2/http.h>, but did not link libevent. This only builds where
      libevent headers happen to sit in a default include path — it fails with
      Homebrew and with depends.
    • test_bitcoin-qt did not link LevelDB, so dbwrapper.h (reachable from the
      Dash-specific headers those tests pull in) failed to compile.
    • qt/test/trafficgraphdatatests.cpp was missing from the Qt test target
      while test_main.cpp still instantiates TrafficGraphDataTests, so the
      binary could not link even once it compiled.
    • bitcoin_zmq linked neither LevelDB nor dashbls, so a -DWITH_ZMQ=ON
      build failed outright: zmqpublishnotifier.cpp reaches dbwrapper.h
      through node/blockstorage.h and bls.h through chainlock/chainlock.h.
    • dashbls/relic headers are included with -isystem under Autotools but not
      under CMake, producing ~13k -Wdocumentation warnings and breaking any
      WERROR build. They are now marked as system includes for consumers.
  • build: restore Dash-specific feature detection under CMake — the CMake
    config header was missing a set of macros that Dash's sources check. Each of
    these built and linked fine while quietly changing behaviour:

    • ENABLE_MINER — every mining RPC (generatetoaddress,
      generatetodescriptor, generateblock) fell through to the
      "This call is not available because RPC miner isn't compiled" stub, which
      breaks essentially every functional test.
    • ENABLE_SSSE3, ENABLE_X86_AESNI, ENABLE_ARM_AES, ENABLE_ARM_NEON
      detection and the corresponding crypto/x11/{ssse3,x86_aesni,arm_crypto,arm_neon}
      sources were absent, so X11 hashing silently fell back to the generic
      implementations on every platform.
    • HAVE_SYS_GETRANDOM — CMake probed for the libc getrandom() wrapper and
      defined HAVE_GETRANDOM, which random.cpp does not read; it checks
      HAVE_SYS_GETRANDOM and issues the syscall directly.
    • ENABLE_STACKTRACES / ENABLE_CRASH_HOOKS / CRASH_HOOKS_WRAPPED_CXX_ABI
      no option existed at all. Added with libbacktrace detection mirroring
      configure.ac, including -Wl,-export-dynamic/-rdynamic, -gdwarf-4,
      -fno-standalone-debug, and the -Wl,-wrap exception hooks.
    • GSL_NO_IOSTREAMS, and the NOWARN_CXXFLAGS suppressions
      (-Wno-array-bounds and friends) without which a GCC WERROR build fails
      on immer.
  • build: match the Autotools warning and optimisation settings

    • -Wno-error=deprecated-literal-operator (Clang 20 + hana) was missing from
      the warning block.
    • -Wundef is not in Dash's Autotools warning set, and
      crypto/x11/sph_types.h tests SPH_* macros that are deliberately left
      undefined, so any -DWERROR=ON build failed. Downgraded to
      -Wno-error=undef rather than dropped, since it is exactly the check that
      catches the #if ENABLE_MINER class of bug fixed above.
    • The sphlib sources are built as their own library with -O3 under
      Autotools (SPHLIB_FLAGS) because they sit on the X11 proof-of-work path.
      Under CMake they were folded into bitcoin_crypto at the default -O2.
    • Autotools' AM_CFLAGS carries neither WARN_CXXFLAGS nor
      ERROR_CXXFLAGS, so the vendored sphlib C sources are never built with
      -Werror there. CMake's core_interface options apply to every language,
      so -DWERROR=ON failed on groestl.c; the C sources now opt out.
  • build: report the git description in CMake builds — upstream's
    GenerateBuildInfo.cmake emits BUILD_GIT_TAG/BUILD_GIT_COMMIT, but Dash's
    clientversion.cpp only understands BUILD_GIT_DESCRIPTION, so every
    non-release CMake build reported itself as v23.1.5-unk. It now emits the
    same git describe --abbrev=12 --dirty string as share/genbuild.sh.

  • build: drop the unusable libbitcoinkernel CMake target
    src/kernel/CMakeLists.txt referenced eleven files that do not exist in Dash
    (kernel/bitcoinkernel.cpp, kernel/chainparams.cpp, policy/truc_policy.cpp,
    …) and was gated behind an EXISTS check so it could never build. Removed
    along with BUILD_KERNEL_LIB; bitcoin-chainstate is unaffected.

  • test: fix CMake test wiringtest/coinjoin_dstxmanager_tests.cpp,
    test/coinjoin_inouts_tests.cpp and test/coinjoin_queue_tests.cpp were not
    in the unit-test target; PROVIDE_FUZZ_MAIN_FUNCTION was never defined even
    though the probe for it was; and config.ini substituted
    ENABLE_FUZZ_BINARY_TRUE while the template uses ENABLE_FUZZ_TRUE, leaving
    ENABLE_FUZZ=true unconditionally set for test/fuzz/test_runner.py.

  • ci: keep the Autotools invocations working00_setup_env_s390x.sh had
    been switched to BITCOIN_CONFIG="-DREDUCE_EXPORTS=ON", which
    ci/dash/build_src.sh passes to ./configure; wrap-wine.sh had dropped the
    secp256k1/minisketch test binaries; and test_runner.py had been switched to
    read the functional tests out of the build directory, which only CMake
    populates. All three are reverted until CMake is the only build system.

  • doc: adapt the MSVC build guide to Dash — the new
    doc/build-windows-msvc.md told readers to clone bitcoin/bitcoin, and
    src/qt/README.md had been repointed away from our cross-compile guide.

  • ci: add a linux64_cmake job that builds the full stack with CMake — a
    native Linux target that reuses the depends prefix built for the linux64
    Autotools job. Same HOST and DEP_OPTS, so the depends cache is shared
    rather than duplicated, and the make -C depends step that restores the
    prefix is also what writes depends/$HOST/toolchain.cmake, which the build
    then consumes. Feature set therefore comes from what depends actually built
    (GUI, wallet with BDB and SQLite, ZMQ), WERROR is on as it is everywhere
    else, and the job runs the full unit-test suite through ctest plus a
    three-test functional smoke list.

    The smoke list is not redundant with the Autotools functional jobs:
    mining_basic.py is what catches a missing ENABLE_MINER, and no unit test
    would. Artifact bundling and the full functional suite deliberately stay with
    the Autotools jobs. The job is gated on SKIP_LINUX64_CMAKE like its
    siblings.

  • build: restore the Dash build outputs the CMake port dropped — findings
    from the automated review on this PR, all verified against src/Makefile.am
    and configure.ac before acting on them:

    • The Windows resource targets referenced bitcoind-res.rc,
      bitcoin-cli-res.rc, bitcoin-tx-res.rc and bitcoin-wallet-res.rc; this
      tree carries the dash*-named files, so no Windows build could be
      generated at all
      .
    • bitcoin-node and bitcoin-gui were installed under their upstream names,
      while rpc/node.cpp spawns dash-node and init/bitcoin-gui.cpp declares
      EXE_NAME "dash-gui". bitcoin-chainstate was built but never installed.
    • GenerateSetupNsi.cmake substituted upstream executable names and the
      bitcoin URI class into share/setup.nsi.in, and emitted no OutFile
      directive, so the deploy target could not produce an installer.
    • masternodemodel.cpp was grouped with masternodelist.cpp under
      if(ENABLE_WALLET), but it lives in BITCOIN_QT_BASE_CPP upstream — and
      rpcconsole.cpp, clientfeeds.cpp and proposalinfo.cpp are all non-wallet
      sources that use MasternodeModel.
    • libdashconsensus was missing entirely. Dash still provides the public
      consensus API that upstream removed in Remove libbitcoinconsensus bitcoin/bitcoin#29648, and Guix passes no
      --with-libs, so releases ship it. It is now built as a shared library with
      its own compilation of the consensus and crypto sources
      (BUILD_BITCOIN_INTERNAL, DISABLE_OPTIMIZED_SHA256), with the header and
      pkg-config file installed and HAVE_CONSENSUS_LIB defined so script_tests
      exercises the public API again.
  • build: drop the multiprocess IPC test block Dash cannot build — it
    referenced ipc_test.cpp, ipc_test.capnp and ipc_tests.cpp, which came
    from multiprocess: Add basic type conversion hooks bitcoin/bitcoin#28921 and were never backported, so -DWITH_MULTIPROCESS=ON
    failed during generation.

How Has This Been Tested?

On macOS/arm64 with Homebrew dependencies:

  • cmake -B build && cmake --build build — clean build of dashd, dash-cli,
    dash-tx, dash-util, dash-wallet and test_dash.
  • cmake -B build -DWERROR=ON && cmake --build build — clean, 0 errors.
  • ./src/test/test_dash — 696 test cases, no errors, on both the default and
    the WERROR build (includes the three CoinJoin suites restored here).
  • cmake -B build -DBUILD_GUI=ON -DBUILD_GUI_TESTS=ON && cmake --build build
    builds dash-qt and test_dash-qt.
  • Verified against the Autotools build: generated bitcoin-config.h macro set,
    per-target source lists (Makefile*.am/*.include vs every CMakeLists.txt),
    JSON/raw test-data lists, and the generated obj/build.h.
  • test/lint/lint-python.py, lint-shell.py, lint-whitespace.py pass.
  • libdashconsensus: exports the public dashconsensus_* symbols,
    script_tests runs the five API cases that HAVE_CONSENSUS_LIB guards, and
    cmake --install lays down lib/, include/script/ and lib/pkgconfig/ to
    match the Autotools layout.
  • -DBUILD_GUI=ON -DENABLE_WALLET=OFF links, which is the configuration the
    masternodemodel fix restores.

The path the new CI job takes was also run locally end to end, on a native
macOS depends prefix — which is how the bitcoin_zmq link failure above was
found, since it only appears once ZMQ is actually enabled:

  • make -C depends, then
    cmake --toolchain depends/<host>/toolchain.cmake -DWERROR=ON -DBUILD_BENCH=ON
    configure picks up wallet/BDB/SQLite/ZMQ from depends, builds clean.
  • mining_basic.py, rpc_blockchain.py and wallet_basic.py run from the
    CMake build directory and pass (6 variants total across v1/v2 transport and
    descriptor/legacy wallets). mining_basic.py is a direct regression test for
    the ENABLE_MINER fix.

Not exercised here, and worth reviewer attention:

  • The cross-compile depends targets (Windows/MinGW, macOS SDK, aarch64) and the
    Guix path — the new CI job covers native Linux only.
  • The MSVC/vcpkg path. vcpkg.json has no gmp dependency; dashbls will fall
    back to relic's easy arithmetic backend there.
  • WITH_MULTIPROCESS (libmultiprocess/capnp) — it now configures, but Dash has
    no IPC test sources, so that block is left out with a comment.
  • depends/packages/qt.mk now runs a full make install for qtbase/qttools and
    keeps lib/cmake/, which is what find_package(Qt5) needs. This invalidates
    the depends cache and grows the Qt staging output for both build systems.

The linux64_cmake job added here covers the native Linux path end to end.
The cross-compile targets, Guix and MSVC remain Autotools-only for now.

Breaking Changes

None. Autotools remains the build system used by CI, depends and Guix; CMake
is additive.

Checklist:

  • I have performed a self-review of my own code
  • I have commented my code, particularly in hard-to-understand areas
  • I have added or updated relevant unit/integration/functional/e2e tests
  • I have made corresponding changes to the documentation
  • I have assigned this pull request to a milestone

@thepastaclaw

thepastaclaw commented Jul 25, 2026

Copy link
Copy Markdown

⛔ Blockers found — Sonnet deferred (commit ca2750c)
Canonical validated blockers: 3

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: e732253572

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread cmake/module/GenerateSetupNsi.cmake Outdated
Comment on lines +9 to +13
set(PACKAGE_TARNAME "bitcoin")
set(BITCOIN_GUI_NAME "bitcoin-qt")
set(BITCOIN_DAEMON_NAME "bitcoind")
set(BITCOIN_CLI_NAME "bitcoin-cli")
set(BITCOIN_TX_NAME "bitcoin-tx")

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Adapt NSIS substitutions to Dash artifact names

When the MinGW deploy target is built, Maintenance.cmake stages files using $<TARGET_FILE_NAME:...>, which yields dash-qt.exe, dashd.exe, and the other Dash OUTPUT_NAME values, but share/setup.nsi.in is configured here to load bitcoin-qt.exe, bitcoind.exe, and similar names. Consequently the generated NSIS script references files that were never staged and cannot produce the installer; PACKAGE_TARNAME also registers the wrong URI class. Set these substitutions to the Dash names already defined by the Autotools build.

Useful? React with 👍 / 👎.

Comment thread src/test/CMakeLists.txt Outdated

if(WITH_MULTIPROCESS)
add_library(bitcoin_ipc_test STATIC EXCLUDE_FROM_ALL
ipc_test.cpp

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Supply the missing multiprocess test sources

With WITH_MULTIPROCESS=ON and the default BUILD_TESTS=ON, CMake adds ipc_test.cpp, ipc_test.capnp, and ipc_tests.cpp, but a repo-wide search confirms none of those files exists in this Dash tree. Configuration therefore fails before any multiprocess build can start; either backport the test sources or omit this upstream-only test block.

Useful? React with 👍 / 👎.

Comment thread src/CMakeLists.txt
list(APPEND installable_targets bitcoind)
endif()
if(WITH_MULTIPROCESS)
add_executable(bitcoin-node

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Preserve Dash names for multiprocess executables

When multiprocess support is enabled with tests disabled to bypass the missing test files, CMake installs bitcoin-node here and bitcoin-gui in src/qt/CMakeLists.txt, whereas configure.ac, the multiprocess documentation, and the executables' own EXE_NAME constants identify them as dash-node and dash-gui. Add the corresponding OUTPUT_NAME properties so CMake installations expose the documented binaries and IPC code resolves the expected sibling executable names.

Useful? React with 👍 / 👎.

Comment thread src/CMakeLists.txt Outdated
unset(dashbls_include_dirs)

# Stable, backwards-compatible consensus functionality.
add_library(bitcoin_consensus STATIC EXCLUDE_FROM_ALL

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Install the documented dashconsensus shared library

For users switching to the new CMake build, this creates only an internal static archive and no install rule includes it, its public header, or its pkg-config metadata. That leaves the documented libdashconsensus API in doc/shared-libraries.md unavailable from cmake --install, unlike the existing Autotools build, which produces libdashconsensus.la; provide an installable shared-library target rather than using only this internal archive.

Useful? React with 👍 / 👎.

@coderabbitai

coderabbitai Bot commented Jul 25, 2026

Copy link
Copy Markdown

Review Change Stack

Note

Reviews paused

It looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the reviews.auto_review.auto_pause_after_reviewed_commits setting.

Use the following commands to manage reviews:

  • @coderabbitai resume to resume automatic reviews.
  • @coderabbitai review to trigger a single review.

Use the checkboxes below for quick actions:

  • ▶️ Resume reviews
  • 🔍 Trigger review

Walkthrough

This PR replaces the dummy CMake project with a complete Dash Core build system. It adds configuration and platform detection, dependency and toolchain integration, core libraries and executables, wallet/GUI/ZMQ/IPC support, tests, benchmarks, fuzzing, coverage, deployment scripts, vcpkg metadata, CI workflows, and Windows build documentation. Testing instructions are updated for CMake and CTest.

Estimated code review effort: 5 (Critical) | ~150 minutes

Suggested reviewers: thepastaclaw

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
Title check ✅ Passed The title accurately summarizes the main change: adding a CMake build system alongside Autotools.
Description check ✅ Passed The description is clearly related to the changeset and explains the CMake port, fixes, and CI/docs updates.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 9

🧹 Nitpick comments (9)
CMakePresets.json (1)

6-21: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win

Declare an out-of-source binaryDir for both presets.

Without it, the output location depends on the caller’s working directory. Set a deterministic ignored build path, e.g. ${sourceDir}/build/${presetName}, so cmake --preset cannot populate the checkout. CMake 3.21 permits omitted binaryDir and falls back to regular CMake behavior. (cmake.org)

Proposed fix
       "generator": "Visual Studio 17 2022",
       "architecture": "x64",
+      "binaryDir": "${sourceDir}/build/${presetName}",
       "toolchainFile": "$env{VCPKG_ROOT}\\scripts\\buildsystems\\vcpkg.cmake",

Also applies to: 24-39

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@CMakePresets.json` around lines 6 - 21, Add a deterministic out-of-source
binaryDir to both presets, using the preset name under the source directory (for
example, ${sourceDir}/build/${presetName}). Keep the existing preset
configuration unchanged so each cmake --preset invocation writes only to its own
ignored build directory.
CMakeLists.txt (4)

764-782: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win

Dash-specific options are missing from the configure summary.

ENABLE_MINER, ENABLE_STACKTRACES, and ENABLE_CRASH_HOOKS are the Dash-only switches restored in this PR (and stacktraces can be silently flipped off by the detection block at lines 625-638), so they're exactly the values a user needs echoed back.

♻️ Proposed addition
 message("  USDT tracing ........................ ${WITH_USDT}")
+message("  in-wallet miner ..................... ${ENABLE_MINER}")
+message("  stack traces ........................ ${ENABLE_STACKTRACES}")
+message("  crash hooks ......................... ${ENABLE_CRASH_HOOKS}")
 message("  QR code (GUI) ....................... ${WITH_QRENCODE}")
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@CMakeLists.txt` around lines 764 - 782, Add the Dash-specific configuration
switches ENABLE_MINER, ENABLE_STACKTRACES, and ENABLE_CRASH_HOOKS to the
configure summary near the existing optional-feature messages. Echo each
variable’s final value, including any value changes made by the stacktrace
detection logic, so the summary reflects the effective configuration.

674-693: 📐 Maintainability & Code Quality | 🔵 Trivial | 💤 Low value

Dead wrap_exceptions_flags accumulation.

The VAR wrap_exceptions_flags result is never consumed (the literal -Wl,-wrap,... options are added explicitly below) and is then unset. Since only RESULT_VAR matters here, dropping VAR makes the probe intent clearer.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@CMakeLists.txt` around lines 674 - 693, Remove the unused VAR
wrap_exceptions_flags argument from the try_append_linker_flag call while
preserving RESULT_VAR CRASH_HOOKS_WRAPPED_CXX_ABI and the existing
target_link_options behavior. Also remove the now-unnecessary
unset(wrap_exceptions_flags) statement.

382-394: 📐 Maintainability & Code Quality | 🔵 Trivial | 💤 Low value

SANITIZERS is consumed but never declared as a cache variable.

It works via -DSANITIZERS=... (untyped cache entry), but it won't show up in the configure summary tooling / ccmake / cmake-gui and has no help text, unlike the neighboring APPEND_* cache strings.

♻️ Proposed change
+set(SANITIZERS "" CACHE STRING "Comma-separated list of sanitizers to enable, e.g. \"address,undefined\".")
+
 add_library(sanitize_interface INTERFACE)
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@CMakeLists.txt` around lines 382 - 394, Declare SANITIZERS as a typed cache
string with descriptive help text near the neighboring APPEND_* cache variables,
preserving its existing use in the sanitizer flag check and allowing it to
appear in configure summaries, ccmake, and cmake-gui.

117-126: 📐 Maintainability & Code Quality | 🔵 Trivial | 💤 Low value

WARN_INCOMPATIBLE_BDB=OFF no longer suppresses the incompatible-BDB warning.

The version warning is emitted unconditionally and only the follow-up hint respects WARN_INCOMPATIBLE_BDB, so the option's help text ("Warn when using a Berkeley DB version other than 4.8.") doesn't match behavior.

🛠️ Proposed fix
   if(NOT BerkeleyDB_VERSION VERSION_EQUAL 4.8)
-    message(WARNING "Found Berkeley DB (BDB) other than 4.8.\n"
-                    "BDB (legacy) wallets opened by this build will not be portable!"
-    )
     if(WARN_INCOMPATIBLE_BDB)
-      message(WARNING "If this is intended, pass \"-DWARN_INCOMPATIBLE_BDB=OFF\".\n"
+      message(WARNING "Found Berkeley DB (BDB) other than 4.8.\n"
+                      "BDB (legacy) wallets opened by this build will not be portable!\n"
+                      "If this is intended, pass \"-DWARN_INCOMPATIBLE_BDB=OFF\".\n"
                       "Passing \"-DWITH_BDB=OFF\" will suppress this warning."
       )
     endif()
   endif()
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@CMakeLists.txt` around lines 117 - 126, Update the incompatible Berkeley DB
warning conditional around BerkeleyDB_VERSION so the entire warning, including
its follow-up hint, is emitted only when WARN_INCOMPATIBLE_BDB is enabled.
Preserve the existing version check and warning messages when the option remains
enabled.
cmake/ccache.cmake (1)

26-33: 📐 Maintainability & Code Quality | 🔵 Trivial | 💤 Low value

Add the missing include(TryAppendCXXFlags).

This module calls try_append_cxx_flags() but relies on the root CMakeLists.txt having included the defining module first. The include guard makes an explicit include free and keeps the module self-contained.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@cmake/ccache.cmake` around lines 26 - 33, Make cmake/ccache.cmake
self-contained by explicitly including the module that defines
try_append_cxx_flags before the WITH_CCACHE block. Add
include(TryAppendCXXFlags) near the top, relying on its include guard and
leaving the existing flag configuration unchanged.
cmake/module/ProcessConfigurations.cmake (2)

92-107: 📐 Maintainability & Code Quality | 🔵 Trivial | 💤 Low value

flag is interpolated as an unanchored regex.

remove_cxx_flag_from_all_configs(-DNDEBUG) would also strip any flag containing that substring (e.g. -DNDEBUG_SOMETHING), and a caller passing a flag with regex metacharacters would misbehave. Anchoring the pattern makes the intent exact.

♻️ Proposed change
-    list(FILTER flags EXCLUDE REGEX "${flag}")
+    list(FILTER flags EXCLUDE REGEX "^${flag}$")
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@cmake/module/ProcessConfigurations.cmake` around lines 92 - 107, Update
remove_cxx_flag_from_all_configs so list(FILTER ... EXCLUDE REGEX ...) matches
the entire flag rather than an unanchored substring. Anchor the interpolated
flag pattern and escape any regex metacharacters in flag before filtering,
preserving removal of only the exact requested compiler flag.

120-129: 📐 Maintainability & Code Quality | 🔵 Trivial | 💤 Low value

Module has an implicit dependency on core_interface_debug existing.

include(ProcessConfigurations) silently requires the caller to have already created core_interface_debug (root CMakeLists.txt line 250). A short comment or an if(NOT TARGET ...) fatal error would make the contract explicit for future includes.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@cmake/module/ProcessConfigurations.cmake` around lines 120 - 129, Add an
explicit prerequisite check before the target_compile_definitions call for
core_interface_debug: detect when the target does not exist and fail with a
clear fatal error explaining that callers must create it before including
ProcessConfigurations. Keep the existing configuration definitions unchanged.
cmake/script/GenerateHeaderFromJson.cmake (1)

12-21: 🚀 Performance & Scalability | 🔵 Trivial | ⚡ Quick win

Shared root cause: duplicated, per-byte file(APPEND) hex-dump loop in both header generators. Both scripts issue one file(APPEND) call per input byte, which is both a DRY violation and slow for larger fixture files at configure time.

  • cmake/script/GenerateHeaderFromJson.cmake#L12-L21: accumulate the formatted bytes into a single string and write it with one file(APPEND)/file(WRITE) call instead of one call per byte; consider extracting the shared loop into a common CMake macro/module reused by both generators.
  • cmake/script/GenerateHeaderFromRaw.cmake#L11-L20: apply the same batching fix and share the extracted macro from the JSON variant.
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@cmake/script/GenerateHeaderFromJson.cmake` around lines 12 - 21, The
duplicated byte-formatting loops in GenerateHeaderFromJson.cmake and
GenerateHeaderFromRaw.cmake perform one file append per byte. Extract the shared
loop into a reusable CMake macro/module, have both generators accumulate
formatted bytes into one string, and write the complete output with a single
file(APPEND) or file(WRITE) call; update both listed sites accordingly.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@cmake/ccache.cmake`:
- Around line 8-14: Replace the readlink-based resolution in the ccache
masquerade check with CMake 3.22’s portable file(REAL_PATH) command. Resolve
both CMAKE_CXX_COMPILER and CCACHE_EXECUTABLE before comparing them in the
existing CCACHE_EXECUTABLE/NOT WITH_CCACHE condition, preserving the warning
behavior when either path reaches the same ccache executable through symlinks.

In `@cmake/module/FindLibevent.cmake`:
- Around line 43-80: Guard the post-discovery setup in both VCPKG and pkg-config
branches with if(Libevent_FOUND): only call check_evhttp_connection_get_peer,
create the libevent aliases, and apply the related mark_as_advanced entries when
discovery succeeded. Keep the existing package discovery and required-variable
handling unchanged.

In `@cmake/module/GenerateSetupNsi.cmake`:
- Around line 5-17: Update generate_setup_nsi to use Dash executable names for
the existing BITCOIN_*_NAME variables, replacing the bitcoin-* values with their
dash-* equivalents, and emit dash-win64-setup.nsi instead of
bitcoin-win64-setup.nsi while preserving the template variable names.

In `@CMakeLists.txt`:
- Around line 222-230: Apply APPEND_CFLAGS to the C compilation rule by
appending it to CMAKE_C_COMPILE_OBJECT, alongside the existing CXX rule updates.
Also append APPEND_CXXFLAGS to CMAKE_OBJCXX_COMPILE_OBJECT so Objective-C++
compilation receives the configured C++ flags, preserving the existing ordering
at the end of each command line.
- Around line 617-623: Update the warn_interface INTERFACE_COMPILE_OPTIONS setup
to transform each entry in warn_interface_flags into its own compile-language
generator expression, preserving each expression as a single list element. Do
not wrap the entire semicolon-separated flag list in one genex; keep the
existing CXX/OBJCXX language scope and cleanup behavior.

In `@doc/build-windows-msvc.md`:
- Line 49: Correct the typo “istructions” to “instructions” in the documentation
sentence describing the Debug and Release configurations.
- Line 27: Update every PowerShell code fence in doc/build-windows-msvc.md to
use the powershell language label, including the fences near the referenced
sections, so each opening fence follows the ```powershell format required by
MD040.
- Around line 11-18: Add a setup and validation step in the Windows build guide
before the first cmake --list-presets or build command to define VCPKG_ROOT for
the installed vcpkg directory and verify that it is set to a valid location.
Ensure the existing vs2022 and vs2022-static preset commands run only after this
variable is available.

In `@src/qt/CMakeLists.txt`:
- Around line 56-93: Move masternodemodel.cpp and masternodemodel.h from the
ENABLE_WALLET-gated source block into the unconditional bitcoinqt source list,
while keeping masternodelist.cpp wallet-gated. Ensure the CMake target includes
MasternodeModel when ENABLE_WALLET=OFF, matching the unconditional
BITCOIN_QT_BASE_CPP and BITCOIN_QT_H lists.

---

Nitpick comments:
In `@cmake/ccache.cmake`:
- Around line 26-33: Make cmake/ccache.cmake self-contained by explicitly
including the module that defines try_append_cxx_flags before the WITH_CCACHE
block. Add include(TryAppendCXXFlags) near the top, relying on its include guard
and leaving the existing flag configuration unchanged.

In `@cmake/module/ProcessConfigurations.cmake`:
- Around line 92-107: Update remove_cxx_flag_from_all_configs so list(FILTER ...
EXCLUDE REGEX ...) matches the entire flag rather than an unanchored substring.
Anchor the interpolated flag pattern and escape any regex metacharacters in flag
before filtering, preserving removal of only the exact requested compiler flag.
- Around line 120-129: Add an explicit prerequisite check before the
target_compile_definitions call for core_interface_debug: detect when the target
does not exist and fail with a clear fatal error explaining that callers must
create it before including ProcessConfigurations. Keep the existing
configuration definitions unchanged.

In `@cmake/script/GenerateHeaderFromJson.cmake`:
- Around line 12-21: The duplicated byte-formatting loops in
GenerateHeaderFromJson.cmake and GenerateHeaderFromRaw.cmake perform one file
append per byte. Extract the shared loop into a reusable CMake macro/module,
have both generators accumulate formatted bytes into one string, and write the
complete output with a single file(APPEND) or file(WRITE) call; update both
listed sites accordingly.

In `@CMakeLists.txt`:
- Around line 764-782: Add the Dash-specific configuration switches
ENABLE_MINER, ENABLE_STACKTRACES, and ENABLE_CRASH_HOOKS to the configure
summary near the existing optional-feature messages. Echo each variable’s final
value, including any value changes made by the stacktrace detection logic, so
the summary reflects the effective configuration.
- Around line 674-693: Remove the unused VAR wrap_exceptions_flags argument from
the try_append_linker_flag call while preserving RESULT_VAR
CRASH_HOOKS_WRAPPED_CXX_ABI and the existing target_link_options behavior. Also
remove the now-unnecessary unset(wrap_exceptions_flags) statement.
- Around line 382-394: Declare SANITIZERS as a typed cache string with
descriptive help text near the neighboring APPEND_* cache variables, preserving
its existing use in the sanitizer flag check and allowing it to appear in
configure summaries, ccmake, and cmake-gui.
- Around line 117-126: Update the incompatible Berkeley DB warning conditional
around BerkeleyDB_VERSION so the entire warning, including its follow-up hint,
is emitted only when WARN_INCOMPATIBLE_BDB is enabled. Preserve the existing
version check and warning messages when the option remains enabled.

In `@CMakePresets.json`:
- Around line 6-21: Add a deterministic out-of-source binaryDir to both presets,
using the preset name under the source directory (for example,
${sourceDir}/build/${presetName}). Keep the existing preset configuration
unchanged so each cmake --preset invocation writes only to its own ignored build
directory.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro Plus

Run ID: 4ac2e910-9426-48d3-be53-31596dc5cb13

📥 Commits

Reviewing files that changed from the base of the PR and between 6d04c60 and e732253.

📒 Files selected for processing (72)
  • .gitignore
  • CMakeLists.txt
  • CMakePresets.json
  • README.md
  • cmake/bitcoin-config.h.in
  • cmake/ccache.cmake
  • cmake/cov_tool_wrapper.sh.in
  • cmake/crc32c.cmake
  • cmake/introspection.cmake
  • cmake/leveldb.cmake
  • cmake/minisketch.cmake
  • cmake/module/AddBoostIfNeeded.cmake
  • cmake/module/AddWindowsResources.cmake
  • cmake/module/CheckSourceCompilesAndLinks.cmake
  • cmake/module/FindBerkeleyDB.cmake
  • cmake/module/FindLibevent.cmake
  • cmake/module/FindMiniUPnPc.cmake
  • cmake/module/FindNATPMP.cmake
  • cmake/module/FindQt5.cmake
  • cmake/module/FindUSDT.cmake
  • cmake/module/FlagsSummary.cmake
  • cmake/module/GenerateHeaders.cmake
  • cmake/module/GenerateSetupNsi.cmake
  • cmake/module/GetTargetInterface.cmake
  • cmake/module/Maintenance.cmake
  • cmake/module/ProcessConfigurations.cmake
  • cmake/module/TestAppendRequiredLibraries.cmake
  • cmake/module/TryAppendCXXFlags.cmake
  • cmake/module/TryAppendLinkerFlag.cmake
  • cmake/module/WarnAboutGlobalProperties.cmake
  • cmake/script/Coverage.cmake
  • cmake/script/CoverageFuzz.cmake
  • cmake/script/CoverageInclude.cmake.in
  • cmake/script/GenerateBuildInfo.cmake
  • cmake/script/GenerateHeaderFromJson.cmake
  • cmake/script/GenerateHeaderFromRaw.cmake
  • cmake/script/macos_zip.sh
  • cmake/tests.cmake
  • contrib/guix/README.md
  • depends/Makefile
  • depends/funcs.mk
  • depends/hosts/default.mk
  • depends/packages/qt.mk
  • depends/patches/qt/qt.pro
  • depends/toolchain.cmake.in
  • doc/CMakeLists.txt
  • doc/Doxyfile.in
  • doc/build-windows-msvc.md
  • src/CMakeLists.txt
  • src/Makefile.qt.include
  • src/bench/CMakeLists.txt
  • src/crypto/CMakeLists.txt
  • src/dashbls/CMakeLists.txt
  • src/dashbls/depends/relic/CMakeLists.txt
  • src/dashbls/depends/relic/include/relic_conf.h.cmake.in
  • src/dashbls/src/CMakeLists.txt
  • src/ipc/CMakeLists.txt
  • src/qt/CMakeLists.txt
  • src/qt/test/CMakeLists.txt
  • src/test/CMakeLists.txt
  • src/test/fuzz/CMakeLists.txt
  • src/test/fuzz/util/CMakeLists.txt
  • src/test/util/CMakeLists.txt
  • src/univalue/CMakeLists.txt
  • src/util/CMakeLists.txt
  • src/wallet/CMakeLists.txt
  • src/wallet/test/CMakeLists.txt
  • src/wallet/test/fuzz/CMakeLists.txt
  • src/zmq/CMakeLists.txt
  • test/CMakeLists.txt
  • test/functional/test_runner.py
  • vcpkg.json
💤 Files with no reviewable changes (1)
  • depends/patches/qt/qt.pro

Comment thread cmake/ccache.cmake
Comment thread cmake/module/FindLibevent.cmake
Comment thread cmake/module/GenerateSetupNsi.cmake Outdated
Comment thread CMakeLists.txt
Comment thread CMakeLists.txt
Comment thread doc/build-windows-msvc.md
Comment on lines +11 to +18
This guide relies on using CMake and vcpkg package manager provided with the Visual Studio installation.
Here are requirements for the Visual Studio installation:
1. Minimum required version: Visual Studio 2022 version 17.6.
2. Installed components:
- The "Desktop development with C++" workload.

The commands in this guide should be executed in "Developer PowerShell for VS 2022" or "Developer Command Prompt for VS 2022".
The former is assumed hereinafter.

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🎯 Functional Correctness | 🟠 Major | ⚡ Quick win

🧩 Analysis chain

🏁 Script executed:

#!/usr/bin/env bash
set -euo pipefail

test -n "${VCPKG_ROOT:-}" || {
  echo "VCPKG_ROOT is unset"
  exit 1
}
test -f "$VCPKG_ROOT/scripts/buildsystems/vcpkg.cmake"

Repository: dashpay/dash

Length of output: 170


🏁 Script executed:

#!/usr/bin/env bash
set -euo pipefail

echo "== locate build-windows-msvc.md =="
fd -a 'build-windows-msvc\.md$' . || true

echo "== inspect relevant doc section =="
cat -n doc/build-windows-msvc.md | sed -n '1,80p'

echo "== search cmake presets/toolchain references =="
rg -n '"vs2022"|cmake-tools\.json|vcpkg\.cmake|\$env\{VCPKG_ROOT\}|\$env:VCPKG_ROOT|VCPKG_ROOT' . -g '*.json' -g '*.md' -g '*.cmake' -g '*.cmake.in' || true

echo "== locate cmake preset/toolchain files =="
git ls-files | rg '(^|/)(CMakePresets|cmake-tools|vcpkg|presets|\.cmake)$' | sort

Repository: dashpay/dash

Length of output: 4303


🏁 Script executed:

#!/usr/bin/env bash
set -euo pipefail

echo "== CMakePresets.json =="
cat -n CMakePresets.json | sed -n '1,80p'

echo "== vscode vcpkg settings references =="
rg -n '"CMAKE_TOOLCHAIN_FILE"|"CMAKE_TOOLCHAIN_FILE":|VCPKG_ROOT|vcpkg\.cmake' . -g '.*settings.json$' -g 'CMakePresets.json' -g 'cmake-tools.json' || true

echo "== files mentioning VCPKG_ROOT in repo =="
rg -n 'VCPKG_ROOT|vcpkg root|VcpkgRoot|/include/vcpkg|scripts/buildsystems/vcpkg.cmake' . -g '*.md' -g '*.json' -g '*.cmake' -g '*.ini' -g '*.txt' -g '*.ps1' -g '*.bat' -g '*.cmd' || true

Repository: dashpay/dash

Length of output: 2232


Add a VCPKG_ROOT setup step before using the presets.

CMakePresets.json uses $env{VCPKG_ROOT}\scripts\buildsystems\vcpkg.cmake for both vs2022 and vs2022-static, but this guide never sets or checks that variable. Add setup/validation before the first cmake --list-presets / build command so the presets do not fail to resolve the toolchain.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@doc/build-windows-msvc.md` around lines 11 - 18, Add a setup and validation
step in the Windows build guide before the first cmake --list-presets or build
command to define VCPKG_ROOT for the installed vcpkg directory and verify that
it is set to a valid location. Ensure the existing vs2022 and vs2022-static
preset commands run only after this variable is available.

Comment thread doc/build-windows-msvc.md
Comment thread doc/build-windows-msvc.md Outdated
Comment thread src/qt/CMakeLists.txt
PastaPastaPasta and others added 7 commits July 25, 2026 13:13
bitcoin_common compiles common/url.cpp, which includes <event2/http.h>, but did not link libevent. That only builds where the libevent headers happen to sit in a default include path; it fails with Homebrew and with depends.

test_bitcoin-qt did not link LevelDB, so dbwrapper.h (reachable from the Dash-specific headers those tests pull in) failed to compile, and qt/test/trafficgraphdatatests.cpp was missing from the target even though test_main.cpp instantiates TrafficGraphDataTests. Name the binary test_dash-qt, like every other Dash target.

The dashbls and relic headers are pulled in with -isystem under Autotools but not under CMake, which produced ~13k -Wdocumentation warnings and would break any WERROR build. Mark them as system includes for consumers.

Also fix a copy-paste typo in try_append_linker_flag(), where the IF_CHECK_FAILED path referenced a TACXXF_ prefixed variable that is never set.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
The generated bitcoin-config.h was missing a set of macros that Dash sources check. Each of these built and linked cleanly while quietly changing behaviour:

ENABLE_MINER: every mining RPC fell through to the "This call is not available because RPC miner isn't compiled" stub, which breaks essentially every functional test. HAVE_SYS_GETRANDOM: CMake probed for the libc getrandom() wrapper and defined HAVE_GETRANDOM, which random.cpp does not read; it checks HAVE_SYS_GETRANDOM and issues the syscall directly.

ENABLE_SSSE3, ENABLE_X86_AESNI, ENABLE_ARM_AES and ENABLE_ARM_NEON were missing along with the crypto/x11 SIMD sources they guard, so X11 hashing silently fell back to the generic implementations everywhere. Add the introspection checks and the per-backend libraries, mirroring the sha256 ones.

ENABLE_STACKTRACES and ENABLE_CRASH_HOOKS had no option at all. Add them with libbacktrace detection mirroring configure.ac, including -Wl,-export-dynamic/-rdynamic, -gdwarf-4, -fno-standalone-debug and the -Wl,-wrap exception hooks behind CRASH_HOOKS_WRAPPED_CXX_ABI.

ENABLE_ZMQ, USE_UPNP and USE_NATPMP are deliberately not added here: unlike Autotools, which defines them in config.h, CMake attaches them as INTERFACE definitions on the bitcoin_zmq, MiniUPnPc::MiniUPnPc and NATPMP::NATPMP targets, and every consumer links those.

Also define GSL_NO_IOSTREAMS and the NOWARN_CXXFLAGS suppressions, without which a GCC WERROR build fails on immer, and drop BUILD_KERNEL_LIB: src/kernel/CMakeLists.txt referenced eleven files that do not exist in Dash and was gated behind an EXISTS check so it could never build.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Upstream's GenerateBuildInfo.cmake emits BUILD_GIT_TAG/BUILD_GIT_COMMIT, but Dash's clientversion.cpp only understands BUILD_GIT_DESCRIPTION, so every non-release CMake build reported itself as vX.Y.Z-unk. Emit the same git describe --abbrev=12 --dirty string that share/genbuild.sh produces.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
test/coinjoin_dstxmanager_tests.cpp, test/coinjoin_inouts_tests.cpp and test/coinjoin_queue_tests.cpp were not in the unit-test target, so three CoinJoin suites were silently not run.

PROVIDE_FUZZ_MAIN_FUNCTION was never defined even though the probe for it (FUZZ_BINARY_LINKS_WITHOUT_MAIN_FUNCTION) was performed, so a fuzz binary built without a fuzzing engine that supplies main() fails to link.

config.ini.in expects ENABLE_FUZZ_TRUE, but create_test_config() substituted ENABLE_FUZZ_BINARY_TRUE. The unmatched placeholder expanded to nothing, leaving ENABLE_FUZZ=true set unconditionally for test/fuzz/test_runner.py.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
ci/dash/build_src.sh passes BITCOIN_CONFIG straight to ./configure, so the s390x job's -DREDUCE_EXPORTS=ON would fail as an unrecognised option; wrap-wine.sh had dropped the secp256k1 and minisketch test binaries that the Autotools build still produces; and test_runner.py had been switched to read the functional tests out of the build directory, which only the CMake build populates.

Revert all three until CMake is the only build system.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
The guide told readers to clone bitcoin/bitcoin and referred to the Bitcoin Core project throughout, and src/qt/README.md had been repointed from our cross-compile guide to the MSVC one.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
configure.ac adds -Wno-error=deprecated-literal-operator for Clang 20 (hana triggers it) whenever --enable-werror is used; the CMake warning block was missing it.

Also spell out why config.ini's ENABLE_FUZZ is driven by BUILD_FUZZ_BINARY rather than BUILD_FOR_FUZZING.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>

@thepastaclaw thepastaclaw left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Preliminary review — Codex only

The default native CMake path may build, but five confirmed blockers leave supported optional and deployment paths unusable: the MinGW installer is malformed, multiprocess configuration and installed binaries are broken, and CMake drops Dash's public consensus library. Two commit-history cleanups are also warranted for durable backport provenance and logical WERROR commit grouping.

Validated blockers were found in the Codex precheck. Sonnet is deferred until a fresh Codex revalidation clears the blocker gate.

Review provenance

  • Codex reviewers: gpt-5.6-sol — general (completed), gpt-5.6-sol — dash-core-commit-history (completed), gpt-5.6-sol — backport-reviewer (completed)
  • Verifier: gpt-5.6-sol — verifier
  • Sonnet: not run (deferred by blocker gate)

🔴 5 blocking | 🟡 2 suggestion(s)

2 additional finding(s) omitted (not in diff).

🤖 Prompt for all review comments with AI agents
These findings are from an automated code review. Verify each finding against the current code and only fix it if needed.

In `cmake/module/GenerateSetupNsi.cmake`:
- [BLOCKING] cmake/module/GenerateSetupNsi.cmake:9-15: NSIS script references unstaged Bitcoin executable names
  The deploy command stages each target using `$<TARGET_FILE_NAME:...>`, and the targets have Dash output names such as `dash-qt.exe`, `dashd.exe`, and `dash-cli.exe`. This generator instead substitutes `bitcoin-qt.exe`, `bitcoind.exe`, `bitcoin-cli.exe`, and the other upstream names into `share/setup.nsi.in`. NSIS therefore cannot find the staged files and cannot build the installer. `PACKAGE_TARNAME` also registers the upstream `bitcoin` URI class instead of preserving Dash's Autotools package name, `dashcore`.

In `cmake/module/Maintenance.cmake`:
- [BLOCKING] cmake/module/Maintenance.cmake:75-84: Windows deploy script never specifies an installer output file
  `share/setup.nsi.in` contains no `OutFile` directive, and this command invokes `makensis` without injecting one. The existing Autotools recipe explicitly appends `OutFile "$@"` before invoking NSIS. Without an equivalent directive, NSIS has no output path and cannot produce the custom command's declared `bitcoin-win64-setup.exe`, so the `deploy` target cannot complete.

In `src/test/CMakeLists.txt`:
- [BLOCKING] src/test/CMakeLists.txt:191-210: Missing prerequisite: bitcoin#28921
  The imported `WITH_MULTIPROCESS` block references `ipc_test.cpp`, `ipc_test.capnp`, and `ipc_tests.cpp`, but none exists in the PR head. Upstream bitcoin#30454 added this CMake block after bitcoin#28921 had already introduced those files, so copying the block without its prerequisite makes `-DWITH_MULTIPROCESS=ON` fail during CMake generation with the default `BUILD_TESTS=ON`. Backport and adapt the IPC test sources, or omit this test block until that prerequisite is present.

In `src/CMakeLists.txt`:
- [BLOCKING] src/CMakeLists.txt:400-410: Multiprocess node is installed under a name its IPC code cannot spawn
  Unlike the other Dash executables, `bitcoin-node` has no `OUTPUT_NAME`, so CMake installs it as `bitcoin-node`. The IPC implementation constructs a sibling path using the literal name passed to `spawnProcess`, and `rpc/node.cpp` passes `dash-node`; an installed CMake build therefore tries to launch a file that does not exist. The corresponding `bitcoin-gui` target in `src/qt/CMakeLists.txt` also lacks the `dash-gui` output name required by `init/bitcoin-gui.cpp` and the documented Autotools behavior.
- [BLOCKING] src/CMakeLists.txt:93-119: Missing prerequisite: bitcoin#29648
  bitcoin#30454 was developed after bitcoin#29648 removed Bitcoin Core's public consensus library, but Dash still provides and documents that API. The imported CMake code creates only an internal `STATIC EXCLUDE_FROM_ALL` archive and provides no shared `libdashconsensus`, installed `script/bitcoinconsensus.h`, generated and installed `libdashconsensus.pc`, or `HAVE_CONSENSUS_LIB` definition. This is not equivalent to Dash's default Autotools build and silently skips the public API checks guarded by `HAVE_CONSENSUS_LIB` in `script_tests.cpp`. Preserve Dash's public shared-library target, export definitions, header and pkg-config installation, and API tests in the CMake build.

In `<commit:86f540b>`:
- [SUGGESTION] <commit:86f540b>:1: Record the upstream provenance of the CMake import
  The initial commit imports and adapts the CMake system from Bitcoin Core but its permanent commit message contains no upstream PR, source commit, or cherry-pick provenance. Record bitcoin/bitcoin#30454 and the exact merge or source hash used so future maintainers can compare Dash's adaptation with its upstream origin directly from `git log`.

In `<commit:c5915df>`:
- [SUGGESTION] <commit:c5915df>:1: Combine the adjacent WERROR parity commits
  Commits `c5915df` and `e732253` are adjacent parts of the same logical change: making CMake's warning, WERROR, and optimization behavior match Autotools. The first commit also contains an unrelated explanatory change in `test/CMakeLists.txt`. Squash the WERROR changes into one commit and move the test-config comment into `fdfafe8`, where that wiring was fixed.

Comment thread cmake/module/GenerateSetupNsi.cmake Outdated
Comment on lines +9 to +15
set(PACKAGE_TARNAME "bitcoin")
set(BITCOIN_GUI_NAME "bitcoin-qt")
set(BITCOIN_DAEMON_NAME "bitcoind")
set(BITCOIN_CLI_NAME "bitcoin-cli")
set(BITCOIN_TX_NAME "bitcoin-tx")
set(BITCOIN_WALLET_TOOL_NAME "bitcoin-wallet")
set(BITCOIN_TEST_NAME "test_bitcoin")

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🔴 Blocking: NSIS script references unstaged Bitcoin executable names

The deploy command stages each target using $<TARGET_FILE_NAME:...>, and the targets have Dash output names such as dash-qt.exe, dashd.exe, and dash-cli.exe. This generator instead substitutes bitcoin-qt.exe, bitcoind.exe, bitcoin-cli.exe, and the other upstream names into share/setup.nsi.in. NSIS therefore cannot find the staged files and cannot build the installer. PACKAGE_TARNAME also registers the upstream bitcoin URI class instead of preserving Dash's Autotools package name, dashcore.

Suggested change
set(PACKAGE_TARNAME "bitcoin")
set(BITCOIN_GUI_NAME "bitcoin-qt")
set(BITCOIN_DAEMON_NAME "bitcoind")
set(BITCOIN_CLI_NAME "bitcoin-cli")
set(BITCOIN_TX_NAME "bitcoin-tx")
set(BITCOIN_WALLET_TOOL_NAME "bitcoin-wallet")
set(BITCOIN_TEST_NAME "test_bitcoin")
set(PACKAGE_TARNAME "dashcore")
set(BITCOIN_GUI_NAME "dash-qt")
set(BITCOIN_DAEMON_NAME "dashd")
set(BITCOIN_CLI_NAME "dash-cli")
set(BITCOIN_TX_NAME "dash-tx")
set(BITCOIN_WALLET_TOOL_NAME "dash-wallet")
set(BITCOIN_TEST_NAME "test_dash")

source: ['codex']

Comment thread cmake/module/Maintenance.cmake Outdated
Comment on lines +75 to +84
OUTPUT ${PROJECT_BINARY_DIR}/bitcoin-win64-setup.exe
COMMAND ${CMAKE_COMMAND} -E make_directory ${PROJECT_BINARY_DIR}/release
COMMAND ${CMAKE_STRIP} $<TARGET_FILE:bitcoin-qt> -o ${PROJECT_BINARY_DIR}/release/$<TARGET_FILE_NAME:bitcoin-qt>
COMMAND ${CMAKE_STRIP} $<TARGET_FILE:bitcoind> -o ${PROJECT_BINARY_DIR}/release/$<TARGET_FILE_NAME:bitcoind>
COMMAND ${CMAKE_STRIP} $<TARGET_FILE:bitcoin-cli> -o ${PROJECT_BINARY_DIR}/release/$<TARGET_FILE_NAME:bitcoin-cli>
COMMAND ${CMAKE_STRIP} $<TARGET_FILE:bitcoin-tx> -o ${PROJECT_BINARY_DIR}/release/$<TARGET_FILE_NAME:bitcoin-tx>
COMMAND ${CMAKE_STRIP} $<TARGET_FILE:bitcoin-wallet> -o ${PROJECT_BINARY_DIR}/release/$<TARGET_FILE_NAME:bitcoin-wallet>
COMMAND ${CMAKE_STRIP} $<TARGET_FILE:bitcoin-util> -o ${PROJECT_BINARY_DIR}/release/$<TARGET_FILE_NAME:bitcoin-util>
COMMAND ${CMAKE_STRIP} $<TARGET_FILE:test_bitcoin> -o ${PROJECT_BINARY_DIR}/release/$<TARGET_FILE_NAME:test_bitcoin>
COMMAND makensis -V2 ${PROJECT_BINARY_DIR}/bitcoin-win64-setup.nsi

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🔴 Blocking: Windows deploy script never specifies an installer output file

share/setup.nsi.in contains no OutFile directive, and this command invokes makensis without injecting one. The existing Autotools recipe explicitly appends OutFile "$@" before invoking NSIS. Without an equivalent directive, NSIS has no output path and cannot produce the custom command's declared bitcoin-win64-setup.exe, so the deploy target cannot complete.

source: ['codex']

Comment thread src/test/CMakeLists.txt Outdated
Comment on lines +191 to +210
if(WITH_MULTIPROCESS)
add_library(bitcoin_ipc_test STATIC EXCLUDE_FROM_ALL
ipc_test.cpp
)

target_capnp_sources(bitcoin_ipc_test ${PROJECT_SOURCE_DIR}
ipc_test.capnp
)

target_link_libraries(bitcoin_ipc_test
PRIVATE
core_interface
univalue
)

target_sources(test_bitcoin
PRIVATE
ipc_tests.cpp
)
target_link_libraries(test_bitcoin bitcoin_ipc_test)

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🔴 Blocking: Missing prerequisite: bitcoin#28921

The imported WITH_MULTIPROCESS block references ipc_test.cpp, ipc_test.capnp, and ipc_tests.cpp, but none exists in the PR head. Upstream bitcoin#30454 added this CMake block after bitcoin#28921 had already introduced those files, so copying the block without its prerequisite makes -DWITH_MULTIPROCESS=ON fail during CMake generation with the default BUILD_TESTS=ON. Backport and adapt the IPC test sources, or omit this test block until that prerequisite is present.

source: ['codex']

Comment thread src/CMakeLists.txt
Comment on lines +400 to +410
add_executable(bitcoin-node
bitcoind.cpp
init/bitcoin-node.cpp
)
target_link_libraries(bitcoin-node
core_interface
bitcoin_node
bitcoin_ipc
$<TARGET_NAME_IF_EXISTS:bitcoin_wallet>
)
list(APPEND installable_targets bitcoin-node)

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🔴 Blocking: Multiprocess node is installed under a name its IPC code cannot spawn

Unlike the other Dash executables, bitcoin-node has no OUTPUT_NAME, so CMake installs it as bitcoin-node. The IPC implementation constructs a sibling path using the literal name passed to spawnProcess, and rpc/node.cpp passes dash-node; an installed CMake build therefore tries to launch a file that does not exist. The corresponding bitcoin-gui target in src/qt/CMakeLists.txt also lacks the dash-gui output name required by init/bitcoin-gui.cpp and the documented Autotools behavior.

source: ['codex']

Comment thread src/CMakeLists.txt
Comment on lines +93 to +119
# Stable, backwards-compatible consensus functionality.
add_library(bitcoin_consensus STATIC EXCLUDE_FROM_ALL
arith_uint256.cpp
bls/bls.cpp
consensus/merkle.cpp
consensus/tx_check.cpp
hash.cpp
primitives/block.cpp
primitives/transaction.cpp
pubkey.cpp
script/bitcoinconsensus.cpp
script/interpreter.cpp
script/script.cpp
script/script_error.cpp
uint256.cpp
util/strencodings.cpp
util/string.cpp
)
set_target_properties(bitcoin_consensus PROPERTIES OUTPUT_NAME dashconsensus)
target_link_libraries(bitcoin_consensus
PRIVATE
core_interface
bitcoin_crypto
Boost::headers
dashbls
secp256k1
)

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🔴 Blocking: Missing prerequisite: bitcoin#29648

bitcoin#30454 was developed after bitcoin#29648 removed Bitcoin Core's public consensus library, but Dash still provides and documents that API. The imported CMake code creates only an internal STATIC EXCLUDE_FROM_ALL archive and provides no shared libdashconsensus, installed script/bitcoinconsensus.h, generated and installed libdashconsensus.pc, or HAVE_CONSENSUS_LIB definition. This is not equivalent to Dash's default Autotools build and silently skips the public API checks guarded by HAVE_CONSENSUS_LIB in script_tests.cpp. Preserve Dash's public shared-library target, export definitions, header and pkg-config installation, and API tests in the CMake build.

source: ['codex']

@PastaPastaPasta
PastaPastaPasta force-pushed the build/cmake-alongside-autotools branch from e732253 to 1feb706 Compare July 25, 2026 19:20

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 1feb706873

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread src/CMakeLists.txt Outdated
bitcoind.cpp
init/bitcoind.cpp
)
add_windows_resources(bitcoind bitcoind-res.rc)

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Badge Use the Dash resource filenames for Windows targets

When WIN32 is true, add_windows_resources passes this path directly to target_sources, but the repository contains src/dashd-res.rc, not src/bitcoind-res.rc, so CMake cannot generate a default Windows build. The wallet, CLI, and transaction targets have the same mismatch (dash-wallet-res.rc, dash-cli-res.rc, and dash-tx-res.rc are present instead of the referenced Bitcoin-named files), so adapt all four resource arguments to the existing Dash files.

Useful? React with 👍 / 👎.

Comment thread src/CMakeLists.txt
Comment on lines +498 to +499
set_target_properties(bitcoin-chainstate PROPERTIES OUTPUT_NAME dash-chainstate)
endif()

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Install the optional dash-chainstate executable

When configured with BUILD_UTIL_CHAINSTATE=ON, this target is created but never appended to installable_targets, so cmake --install silently omits dash-chainstate. The equivalent Autotools option adds it to bin_PROGRAMS; append this target as the other command-line executables do.

Useful? React with 👍 / 👎.

Comment thread README.md Outdated
Developers are strongly encouraged to write [unit tests](src/test/README.md) for new code, and to
submit new unit tests for old code. Unit tests can be compiled and run
(assuming they weren't disabled in configure) with: `make check`. Further details on running
(assuming they weren't disabled during the generation of the build system) with: `ctest`. Further details on running

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Point ctest at the out-of-source build directory

CMake explicitly forbids in-source builds, so running the documented ctest command from the repository root finds no tests; Autotools builds still require make check as well. Document both build-system commands, or use ctest --test-dir <build-dir>, so following the README actually executes the unit tests.

Useful? React with 👍 / 👎.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 5

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In @.github/workflows/build-src-cmake.yml:
- Line 42: Update the workflow’s container-image input handling so the image
producer resolves inputs.container-path to an immutable `@sha256` digest before
invoking reusable jobs, including the job using the container image. Reject or
fail when the resolved reference is not digest-pinned, and pass the validated
digest reference rather than forwarding needs.container.outputs.path unchanged.
- Line 68: Stop re-parsing CI inputs as shell source: in
.github/workflows/build-src-cmake.yml at lines 68, 86, 106, and 113, pass
depends-dep-opts through env and invoke make with a validated argument array,
while reading build-target from the environment rather than interpolating it
into shell text. In ci/dash/build_src_cmake.sh lines 36-42, remove bash -c and
invoke CMake and cmake --build using quoted paths and argument arrays.
- Around line 45-49: Update the workflow trigger and checkout configuration
around the checkout step and build execution so untrusted pull-request head code
is not executed in the privileged workflow. Prefer running this build on
pull_request rather than pull_request_target; if checkout remains necessary
under pull_request_target, isolate it as read-only and set persist-credentials
to false before running ci/dash/build_src_cmake.sh and tests.

In `@doc/build-windows-msvc.md`:
- Around line 24-29: Update the “Clone Dash Repository” instructions after the
git clone command to explicitly change into the cloned dash directory before any
subsequent build or CMake commands are run.
- Line 82: Update the build-performance guidance in doc/build-windows-msvc.md to
remove the recommendation for excluding the entire Dash repository from
Microsoft Defender. If exclusion advice is retained, scope it to a temporary
build directory only, make the security trade-off explicit, and require
compliance with local security policy.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro Plus

Run ID: e5c9da9c-14c7-46fa-83ce-00af43e7ed6c

📥 Commits

Reviewing files that changed from the base of the PR and between e732253 and 1feb706.

📒 Files selected for processing (21)
  • .github/workflows/build-src-cmake.yml
  • .github/workflows/build.yml
  • CMakeLists.txt
  • ci/dash/build_src_cmake.sh
  • ci/dash/matrix.sh
  • ci/dash/test_integrationtests_cmake.sh
  • ci/dash/test_unittests_cmake.sh
  • ci/test/00_setup_env_native_cmake.sh
  • cmake/bitcoin-config.h.in
  • cmake/introspection.cmake
  • cmake/module/TryAppendLinkerFlag.cmake
  • cmake/script/GenerateBuildInfo.cmake
  • doc/build-windows-msvc.md
  • src/CMakeLists.txt
  • src/crypto/CMakeLists.txt
  • src/qt/test/CMakeLists.txt
  • src/test/CMakeLists.txt
  • src/test/fuzz/CMakeLists.txt
  • src/zmq/CMakeLists.txt
  • test/CMakeLists.txt
  • test/functional/test_runner.py
🚧 Files skipped from review as they are similar to previous changes (12)
  • src/zmq/CMakeLists.txt
  • test/functional/test_runner.py
  • src/qt/test/CMakeLists.txt
  • src/test/fuzz/CMakeLists.txt
  • test/CMakeLists.txt
  • src/crypto/CMakeLists.txt
  • cmake/script/GenerateBuildInfo.cmake
  • cmake/module/TryAppendLinkerFlag.cmake
  • cmake/introspection.cmake
  • src/test/CMakeLists.txt
  • CMakeLists.txt
  • src/CMakeLists.txt

Comment thread .github/workflows/build-src-cmake.yml
Comment on lines +45 to +49
- name: Checkout code
uses: actions/checkout@v6
with:
ref: ${{ github.event.pull_request.head.sha }}
fetch-depth: 50

@coderabbitai coderabbitai Bot Jul 25, 2026

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🔒 Security & Privacy | 🟠 Major | ⚡ Quick win

🧩 Analysis chain

🏁 Script executed:

#!/bin/bash
set -euo pipefail

echo "== workflow files =="
git ls-files .github/workflows || true

echo "== target workflow excerpt =="
if [ -f .github/workflows/build-src-cmake.yml ]; then
  cat -n .github/workflows/build-src-cmake.yml
fi

echo "== all pull_request_target occurrences =="
rg -n "pull_request_target|pull_request\b|permissions:|GITHUB_TOKEN|checkout|permissions =" .github || true

echo "== changed workflow status =="
git diff -- .github/workflows/build-src-cmake.yml || true

Repository: dashpay/dash

Length of output: 11666


🏁 Script executed:

#!/bin/bash
set -euo pipefail

echo "== build.yml relevant excerpt =="
cat -n .github/workflows/build.yml | sed -n '1,120p'

echo "== build-src-cmake workflow_call references =="
rg -n "build-src-cmake|build_src_cmake|matrix\.sh|workflow_call|event_name|head\.sha|permissions:" .github/workflows/build.yml .github/workflows/build-src-cmake.yml

Repository: dashpay/dash

Length of output: 7034


🌐 Web query:

actions/checkout persist-credentials default true .git/config local credential helper

💡 Result:

The persist-credentials input for the actions/checkout GitHub Action determines whether the authentication token or SSH key used to fetch the repository is configured within the local Git configuration of the checked-out repository [1][2][3]. When set to its default value of true, the action enables your workflow scripts to run authenticated Git commands (such as git push or git pull) without needing to manually configure additional credentials [1][2][4]. The token or key is removed during the action's post-job cleanup [1][2][3]. Important changes regarding how this data is persisted have been introduced in recent versions: 1. Evolution of Storage Method: Historically, actions/checkout directly injected credentials into the repository's .git/config file [1][2][5]. Starting with version v6.0.0, the action was updated to store these credentials in a separate file located within the $RUNNER_TEMP directory [5][6]. It then uses Git's includeIf mechanism to conditionally include these credentials only when accessing the relevant Git directory, improving security and isolation [7][5]. 2. Security Context: Because the default is true, subsequent steps in your workflow have access to these credentials [8]. To minimize risk—especially if your workflow includes untrusted code—you can opt out of this behavior by setting persist-credentials: false in your workflow definition [1][2][4][8]. There have been community discussions and proposals to change this default to false to reduce the risk of accidental token exposure, though as of July 2026, the default remains true [9][8]. If you use persist-credentials: true, ensure your workflow adheres to the principle of least privilege by configuring appropriate repository permissions for the GITHUB_TOKEN [10][8].

Citations:


🏁 Script executed:

#!/bin/bash
set -euo pipefail

echo "== build.yml build-src-cmatrix inputs =="
cat -n .github/workflows/build.yml | sed -n '210,245p'

echo "== build-container uses workflow_call and checkout refs =="
cat -n .github/workflows/build-container.yml | sed -n '1,80p'

echo "== build-depends workflow_call and checkout refs =="
cat -n .github/workflows/build-depends.yml | sed -n '1,130p'

echo "== cache-depends-sources workflow_call and checkout refs =="
cat -n .github/workflows/cache-depends-sources.yml | sed -n '1,80p'

Repository: dashpay/dash

Length of output: 12296


🌐 Web query:

GitHub Pull_request_target workflows run with contents permission default read pull_request head commit security

💡 Result:

The pull_request_target event is a powerful trigger in GitHub Actions that runs workflows in the context of the base repository's default branch, granting them elevated trust, including access to organization/repository secrets and a write-capable GITHUB_TOKEN [1][2][3]. This trigger was designed to allow automation (like labeling or triage) on pull requests from forks, where standard pull_request events would be restricted [1][4]. Security Risks and Mechanics The primary security risk, often called a "pwn request," occurs when a workflow uses pull_request_target and then checks out the untrusted head commit of a pull request from a fork [5][2]. If that workflow subsequently executes any code from that checkout (e.g., running tests, build scripts, or Makefiles), an attacker can execute arbitrary commands with the base repository's secrets and elevated permissions [2][6]. Mitigation and Recent Changes 1. Automatic Protection: As of June 2026, actions/checkout v7 automatically refuses to fetch fork pull request code in pull_request_target workflows to prevent these vulnerabilities [5]. 2. Opt-Out: If a workflow genuinely requires checking out fork code with elevated trust, authors must explicitly add allow-unsafe-pr-checkout: true to the actions/checkout step [1][5]. This is an intentional hurdle meant to highlight the security risk during code review [5]. 3. Permissions: Setting permissions: contents: read at the job level is a recommended best practice to apply the principle of least privilege [7][8]. However, security researchers warn that this is a partial mitigation [9]. Permissions flags restrict the GITHUB_TOKEN but do not isolate the runner environment [9]. Features such as actions/cache and in-memory OIDC tokens can potentially be exploited by malicious code running on the same runner, regardless of the job's defined permissions [9]. 4. Context Execution: Because pull_request_target workflows run from the default branch, the workflow file itself is trusted [1][6]. The vulnerability only arises if the workflow fetches and executes external, unreviewed code [6]. Recommendation To secure these workflows: - Avoid executing code from a pull request head commit [2]. - If you only need to inspect changes (e.g., labeling), use the GitHub API to read PR data rather than checking out the source code [2]. - If you must use pull_request_target, explicitly define least-privilege permissions [1][7]. - Treat the entire runner environment as a trust boundary, not just the permissions on the GITHUB_TOKEN [9].

Citations:


Do not execute the PR head from this build workflow.

When triggered by pull_request_target, this workflow will checkout github.event.pull_request.head.sha and then run ./ci/dash/build_src_cmake.sh and tests from that ref. Keep PR builds on pull_request, or otherwise isolate execution as read-only and set persist-credentials: false if checkout is needed.

🧰 Tools
🪛 zizmor (1.26.1)

[warning] 45-49: credential persistence through GitHub Actions artifacts (artipacked): does not set persist-credentials: false

(artipacked)

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In @.github/workflows/build-src-cmake.yml around lines 45 - 49, Update the
workflow trigger and checkout configuration around the checkout step and build
execution so untrusted pull-request head code is not executed in the privileged
workflow. Prefer running this build on pull_request rather than
pull_request_target; if checkout remains necessary under pull_request_target,
isolate it as read-only and set persist-credentials to false before running
ci/dash/build_src_cmake.sh and tests.

Source: Linters/SAST tools

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The current checkout-v6.1 default prevents the fork-head checkout before PR code executes, so this is not a presently reachable pwn-request path. It is still a blocker because fork coverage is broken; match Dash commit ba143fe163a by adding both allow-unsafe-pr-checkout: true and persist-credentials: false.

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🧩 Analysis chain

🏁 Script executed:

#!/bin/bash
set -euo pipefail

echo "== Current CMake workflow checkout step =="
sed -n '40,58p' .github/workflows/build-src-cmake.yml

echo "== Referenced precedent commit, relevant workflow changes =="
git show --format=fuller --no-ext-diff --unified=12 ba143fe163a -- .github/workflows 2>/dev/null || \
  echo "Referenced commit is unavailable in this checkout."

Length of output: 1109


@thepastaclaw, agreed. The current workflow lacks both settings, and the original finding overstated the currently reachable pwn-request path: checkout blocks fork-head checkout before PR code runs. The real blocker is restoring fork coverage intentionally while ensuring checkout credentials are not exposed to the executed PR code.

  • Add the explicit unsafe fork-PR checkout opt-in required by actions/checkout v6.1.
  • Disable persisted checkout credentials as defense in depth for the subsequently executed PR-controlled build and test commands.
  • Keep the workflow trigger and existing ref unchanged.

✏️ Learnings added
Learnt from: thepastaclaw
Repo: dashpay/dash PR: 7481
File: .github/workflows/build-src-cmake.yml:45-49
Timestamp: 2026-07-25T22:39:07.618Z
Learning: For `.github/workflows/build-src-cmake.yml`, Dash intentionally executes fork pull-request head code under its `pull_request_target`-based CI flow to retain fork coverage. With `actions/checkout` v6.1 or later, the checkout step must explicitly set `allow-unsafe-pr-checkout: true`; it must also set `persist-credentials: false` so the subsequent PR-controlled build and test commands do not receive persisted checkout credentials.

Note: Learnings are effective only in the context of similar code segments. To apply general coding guidelines, please configure review instructions. You can manage existing learnings in the app.


  • 📌 Commit the changes to this branch

Comment thread .github/workflows/build-src-cmake.yml
Comment thread doc/build-windows-msvc.md
Comment thread doc/build-windows-msvc.md

### 7. Antivirus Software

To improve the build process performance, one might add the Dash repository directory to the Microsoft Defender Antivirus exclusions.

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🔒 Security & Privacy | 🟡 Minor | ⚡ Quick win

Avoid recommending a repository-wide antivirus exclusion.

Excluding the entire repository from Microsoft Defender can allow malicious source files, dependencies, or build artifacts to evade scanning. If retained, make the trade-off explicit and limit the advice to a narrowly scoped, temporary build-directory exclusion subject to local security policy.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@doc/build-windows-msvc.md` at line 82, Update the build-performance guidance
in doc/build-windows-msvc.md to remove the recommendation for excluding the
entire Dash repository from Microsoft Defender. If exclusion advice is retained,
scope it to a temporary build directory only, make the security trade-off
explicit, and require compliance with local security policy.

PastaPastaPasta and others added 2 commits July 25, 2026 16:38
Dash CI always configures with --enable-werror, but -DWERROR=ON never built. Three reasons, all divergences from what Autotools does:

-Wundef is not part of Dash's Autotools warning set, and crypto/x11/sph_types.h tests SPH_* macros that are deliberately left undefined. Keep the diagnostic but downgrade it to -Wno-error=undef; it is exactly the check that catches the '#if ENABLE_MINER' class of bug.

AM_CXXFLAGS carries the warning and -Werror flags but AM_CFLAGS does not, so the vendored sphlib C sources under crypto/x11 are never held to them. CMake applies target options to every language, so groestl.c failed on -Wunused-but-set-variable. Restrict warn_interface to C++/Objective-C++.

Autotools also builds the sphlib sources as their own library with -O3 (SPHLIB_FLAGS), because they sit on the X11 proof-of-work path. Turn bitcoin_crypto_sph from an INTERFACE target that only carried two defines into a real static library that mirrors that.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Without a job that exercises it, the CMake build bitrots. This adds one native Linux target that reuses the depends prefix built for the linux64 Autotools job: the same HOST and DEP_OPTS mean the depends cache is shared, and the 'make -C depends' step that restores the prefix is also what writes depends/$HOST/toolchain.cmake, which the build then consumes.

The job configures with that toolchain file, so the feature set (GUI, wallet with BDB and SQLite, ZMQ) comes from what depends actually built, and WERROR is on as it is for every other job. It then runs the full unit-test suite through ctest and a three-test functional smoke list.

The smoke tests are not redundant with the Autotools functional jobs: mining_basic.py is what catches a missing ENABLE_MINER, which no unit test would notice. Artifact bundling and the full functional suite deliberately stay with the Autotools jobs.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
@PastaPastaPasta
PastaPastaPasta force-pushed the build/cmake-alongside-autotools branch from 1feb706 to 47e47e8 Compare July 25, 2026 21:40

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In @.github/workflows/build-src-cmake.yml:
- Around line 32-36: Update the workflow header documentation to accurately
reflect that the CMake job runs the integration smoke test via
test_integrationtests_cmake.sh, while only the full functional test suite
remains in the Autotools jobs; preserve the existing workflow steps.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro Plus

Run ID: ae657ff6-af94-47fd-955d-430c509ae5e6

📥 Commits

Reviewing files that changed from the base of the PR and between 1feb706 and 47e47e8.

📒 Files selected for processing (9)
  • .github/workflows/build-src-cmake.yml
  • .github/workflows/build.yml
  • CMakeLists.txt
  • ci/dash/build_src_cmake.sh
  • ci/dash/matrix.sh
  • ci/dash/test_integrationtests_cmake.sh
  • ci/dash/test_unittests_cmake.sh
  • ci/test/00_setup_env_native_cmake.sh
  • src/crypto/CMakeLists.txt
🚧 Files skipped from review as they are similar to previous changes (3)
  • .github/workflows/build.yml
  • ci/test/00_setup_env_native_cmake.sh
  • CMakeLists.txt

Comment thread .github/workflows/build-src-cmake.yml Outdated
PastaPastaPasta and others added 3 commits July 25, 2026 17:40
The Windows resource targets referenced bitcoind-res.rc, bitcoin-cli-res.rc, bitcoin-tx-res.rc and bitcoin-wallet-res.rc; this tree carries dashd-res.rc, dash-cli-res.rc, dash-tx-res.rc and dash-wallet-res.rc, so no Windows build could be generated at all.

bitcoin-node and bitcoin-gui were installed under their upstream names even though rpc/node.cpp spawns 'dash-node' and init/bitcoin-gui.cpp declares EXE_NAME 'dash-gui', and bitcoin-chainstate was built but never added to installable_targets.

GenerateSetupNsi.cmake substituted the upstream executable names and the bitcoin URI class into share/setup.nsi.in, so the generated NSIS script referenced files the deploy target never stages. It also never emitted an OutFile directive, which the Autotools recipe pipes in ahead of the script, leaving makensis with no output path.

masternodemodel.cpp is part of BITCOIN_QT_BASE_CPP under Autotools but was grouped with masternodelist.cpp inside if(ENABLE_WALLET). rpcconsole.cpp, clientfeeds.cpp and proposalinfo.cpp are all non-wallet sources that use MasternodeModel, so a GUI build without wallet support lost its definition.

Finally, Dash still provides the public libdashconsensus API that upstream removed in bitcoin#29648, so build it as a shared library with its own compilation of the consensus and crypto sources (BUILD_BITCOIN_INTERNAL, DISABLE_OPTIMIZED_SHA256), install the header and pkg-config file, and define HAVE_CONSENSUS_LIB so script_tests exercises the public API. The internal static library goes back to its own name to avoid colliding with it.

Found by CodeRabbit, Codex and thepastaclaw review on PR dashpay#7481.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
The block referenced ipc_test.cpp, ipc_test.capnp and ipc_tests.cpp, none of which exist in this tree; upstream added them in bitcoin#28921, which Dash has not backported. Configuring with -DWITH_MULTIPROCESS=ON therefore failed during generation, since BUILD_TESTS defaults to ON.

Found by Codex and thepastaclaw review on PR dashpay#7481.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
README told readers to run ctest from the repository root, where in-source builds are refused and no tests exist; the MSVC guide never set VCPKG_ROOT that its own presets reference, never entered the cloned directory, and carried an upstream typo. The linux64_cmake workflow header also still claimed functional tests were left entirely to Autotools, which stopped being true when the smoke list was added.

Found by CodeRabbit and Codex review on PR dashpay#7481.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
doc/build-windows-msvc.md (1)

63-74: 🎯 Functional Correctness | 🟠 Major | ⚡ Quick win

Use separate build directories for the two vcpkg triplets.

vs2022 and vs2022-static set different VCPKG_TARGET_TRIPLET values for the same build directory. Configure the second workflow with a different directory, e.g. build-vs2022 and build-vs2022-static, or delete build before switching.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@doc/build-windows-msvc.md` around lines 63 - 74, Update the Windows build
instructions for the vs2022 and vs2022-static presets to use separate build
directories, such as build-vs2022 and build-vs2022-static, consistently across
configure, build, test, and install commands. Alternatively, explicitly instruct
users to delete the existing build directory before switching presets.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@doc/build-windows-msvc.md`:
- Around line 35-39: Update the VCPKG_ROOT example in the build instructions to
avoid hardcoding the Visual Studio Community edition. Use an edition-independent
placeholder for the Visual Studio install directory or instruct users to
determine their own bundled vcpkg path before configuring.

---

Outside diff comments:
In `@doc/build-windows-msvc.md`:
- Around line 63-74: Update the Windows build instructions for the vs2022 and
vs2022-static presets to use separate build directories, such as build-vs2022
and build-vs2022-static, consistently across configure, build, test, and install
commands. Alternatively, explicitly instruct users to delete the existing build
directory before switching presets.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro Plus

Run ID: e9cf604b-af1c-4baa-8c3b-ec419ff1384f

📥 Commits

Reviewing files that changed from the base of the PR and between 47e47e8 and bd328dd.

📒 Files selected for processing (12)
  • .github/workflows/build-src-cmake.yml
  • CMakeLists.txt
  • README.md
  • cmake/bitcoin-config.h.in
  • cmake/introspection.cmake
  • cmake/module/GenerateSetupNsi.cmake
  • cmake/module/Maintenance.cmake
  • doc/build-windows-msvc.md
  • src/CMakeLists.txt
  • src/crypto/CMakeLists.txt
  • src/qt/CMakeLists.txt
  • src/test/CMakeLists.txt
🚧 Files skipped from review as they are similar to previous changes (7)
  • README.md
  • .github/workflows/build-src-cmake.yml
  • src/qt/CMakeLists.txt
  • cmake/module/Maintenance.cmake
  • src/crypto/CMakeLists.txt
  • cmake/bitcoin-config.h.in
  • CMakeLists.txt

Comment thread doc/build-windows-msvc.md
Comment on lines +35 to +39
The presets below reference `$env{VCPKG_ROOT}`. Set it to the vcpkg instance
shipped with Visual Studio, or to your own clone, before configuring:
```
$env:VCPKG_ROOT = "C:\Program Files\Microsoft Visual Studio\2022\Community\VC\vcpkg"
```

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🎯 Functional Correctness | 🟠 Major | ⚡ Quick win

🧩 Analysis chain

🏁 Script executed:

#!/bin/bash
set -euo pipefail

echo "== file excerpt =="
sed -n '1,70p' doc/build-windows-msvc.md

echo
echo "== search for VCPKG_ROOT mentions =="
rg -n "VCPKG_ROOT|vcpkg\.cmake|Visual Studio|VSINSTALLDIR|VCInstallDir" .

echo
echo "== git diff/stat for doc/build-windows-msvc.md (if available) =="
git diff --stat -- doc/build-windows-msvc.md || true
git diff -- doc/build-windows-msvc.md | sed -n '1,220p' || true

Repository: dashpay/dash

Length of output: 7095


🌐 Web query:

Visual Studio 2022 vcpkg install location Community Professional Enterprise programs files VC vcpkg

💡 Result:

In Visual Studio 2022 (version 17.6 and later), the vcpkg package manager is included as an optional component that you can select during installation via the Visual Studio Installer [1][2]. When installed as a component of Visual Studio 2022, vcpkg is located within the Visual Studio installation directory, typically under: C:\Program Files\Microsoft Visual Studio\2022[Edition]\VC\vcpkg In this path, [Edition] corresponds to your specific version (e.g., Community, Professional, or Enterprise) [3][1]. Key details regarding this included version of vcpkg: - Functionality: The version bundled with Visual Studio supports manifest mode but does not support classic mode, as the installation directory is protected and requires Visual Studio installer permissions [1][4]. - Updates: You update this version of vcpkg by updating your Visual Studio installation through the Visual Studio Installer [5]. - Environment Variable Conflicts: When using the bundled vcpkg, Visual Studio may automatically configure the environment (specifically the VCPKG_ROOT variable) to point to this internal location [3]. If you intend to use a separate, standalone instance of vcpkg, you may need to manually override or configure your environment variables (like VCPKG_ROOT) and project settings to point to your desired directory [6][7][2]. - Manual Setup: For developers who require classic mode or specific versions of vcpkg, it remains common practice to download and manage a standalone installation of vcpkg independently of the Visual Studio-bundled component [1][4].

Citations:


🌐 Web query:

"VSInstallRoot" "'Program Files' 'Microsoft Visual Studio' 2022 'VC' 'vcpkg.cmake"

💡 Result:

When you install the vcpkg component in Visual Studio 2022, the vcpkg files are located in a subdirectory of your Visual Studio installation [1][2][3]. The base path, often represented by the MSBuild property $(VsInstallRoot), is typically C:\Program Files\Microsoft Visual Studio\2022[Edition] [4]. The vcpkg toolchain file (vcpkg.cmake) used by CMake is found at: $(VsInstallRoot)\VC\vcpkg\scripts\buildsystems\vcpkg.cmake [1][2][5] To utilize this, you generally point your CMake configuration to this file via the CMAKE_TOOLCHAIN_FILE variable [6][7]. If you have installed the vcpkg component via the Visual Studio Installer, the integrated IDE experience often handles this automatically [3]. Otherwise, you can set it manually, for example: -DCMAKE_TOOLCHAIN_FILE="C:\Program Files\Microsoft Visual Studio\2022[Edition]\VC\vcpkg\scripts\buildsystems\vcpkg.cmake" [7] Note that [Edition] refers to your specific Visual Studio installation type (e.g., Community, Professional, or Enterprise) [4]. You can verify your specific installation path by using the vswhere utility [1][2].

Citations:


🌐 Web query:

Microsoft Visual Studio 2022 vcpkg "VC\vcpkg" Professional Enterprise path

💡 Result:

In Visual Studio 2022 (version 17.6 and later), the vcpkg package manager is available as an optional, built-in component [1]. When installed, this component resides within the Visual Studio installation directory at the following path structure [2][3]: C:\Program Files\Microsoft Visual Studio\2022<Edition>\VC\vcpkg In this path, corresponds to your specific installation, such as Professional or Enterprise [3][4]. Key characteristics and common behaviors include: Automatic Environment Setting: When you use the Visual Studio Developer Command Prompt, it automatically sets the VCPKG_ROOT environment variable to this internal path [2]. This ensures that the IDE can immediately locate and utilize the built-in vcpkg instance [1]. Overriding Behavior: Because the built-in vcpkg is automatically integrated, it may override or conflict with custom, standalone vcpkg installations if you attempt to use them simultaneously [4][5]. If you intend to use a separate, external vcpkg repository, you may experience mismatched VCPKG_ROOT warnings or path conflicts [6][7]. To use an external installation exclusively, some users choose to uninstall the built-in vcpkg component via the Visual Studio Installer [4][5]. Integration: Once installed, you can integrate this vcpkg instance with your projects by running vcpkg integrate install (which requires administrative privileges) [1]. This enables MSBuild and CMake integration, allowing Visual Studio to automatically handle dependencies via manifest files (vcpkg.json) [8][1].

Citations:


Use an edition-independent vcpkg root in the example.

Visual Studio installs the bundled vcpkg under <InstallDir>\VC\vcpkg, where <InstallDir> includes the edition (Community, Professional, Enterprise). Editing line 38 to show only the required validation/test path would avoid pointing Professional/Enterprise or custom installs at a nonexistent Community directory; alternatively, direct users to inspect their own VCPKG_ROOT.

🧰 Tools
🪛 markdownlint-cli2 (0.23.0)

[warning] 37-37: Fenced code blocks should have a language specified

(MD040, fenced-code-language)

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@doc/build-windows-msvc.md` around lines 35 - 39, Update the VCPKG_ROOT
example in the build instructions to avoid hardcoding the Visual Studio
Community edition. Use an edition-independent placeholder for the Visual Studio
install directory or instruct users to determine their own bundled vcpkg path
before configuring.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: bd328dd146

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread src/CMakeLists.txt
Comment on lines +152 to +154
install(FILES script/bitcoinconsensus.h
DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/script
)

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Preserve the public header's existing install path

When consumers switch from an Autotools installation to cmake --install, this places the header under ${includedir}/script, while src/Makefile.am uses include_HEADERS, which installs its basename directly as ${includedir}/bitcoinconsensus.h; the generated pkg-config file also exposes only -I${includedir}. Existing consumers using #include <bitcoinconsensus.h> therefore stop compiling, so install the header directly into ${CMAKE_INSTALL_INCLUDEDIR} to preserve the public API layout.

Useful? React with 👍 / 👎.

Comment thread src/CMakeLists.txt
# without the optimised SHA-256 backends; see libdashconsensus_la in
# src/Makefile.am.
if(BUILD_CONSENSUS_LIB)
add_library(dashconsensus SHARED

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Retain the consensus library's ABI soname

On ELF platforms, creating this shared target without SOVERSION gives it an unversioned libdashconsensus.so soname, whereas the existing libtool target defaults to ABI version 0 and supplies libdashconsensus.so.0. Replacing an Autotools-built package with the CMake installation can consequently leave existing applications unable to load the library; set SOVERSION 0 (and an appropriate VERSION) to preserve runtime compatibility.

Useful? React with 👍 / 👎.

The NSIS generator and the Windows deploy target both need it, and they live in different function scopes, so the name was spelled out by hand in both places. Set it once next to PACKAGE_NAME instead.

Also note that the dashconsensus block depends on add_subdirectory(crypto) having already run, since that is what populates the source-list variables it consumes.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants