Commit Graph

1022 Commits

Author SHA1 Message Date
MarcoFalke
faf2759c8c test: [refactor] Use reference over ptr to chainman
It does not make sense to use a pointer, when a reference is more
appropriate, especially given that nullptr has been ruled out.

This is also allows to remove the CI workaround to avoid warnings:

```
C++ compiler .......................... GNU 13.0.0, /bin/x86_64-w64-mingw32-g++-posix
...
/ci_container_base/src/test/blockmanager_tests.cpp: In member function ‘void blockmanager_tests::blockmanager_scan_unlink_already_pruned_files::test_method()’:
/ci_container_base/src/test/blockmanager_tests.cpp:63:17: error: possibly dangling reference to a temporary [-Werror=dangling-reference]
   63 |     const auto& chainman = Assert(m_node.chainman);
      |                 ^~~~~~~~
In file included from /ci_container_base/src/streams.h:13,
                 from /ci_container_base/src/dbwrapper.h:11,
                 from /ci_container_base/src/node/blockstorage.h:10,
                 from /ci_container_base/src/test/blockmanager_tests.cpp:8:
/ci_container_base/src/util/check.h:116:49: note: the temporary was destroyed at the end of the full expression ‘inline_assertion_check<true, std::unique_ptr<ChainstateManager>&>(((blockmanager_tests::blockmanager_scan_unlink_already_pruned_files*)this)->blockmanager_tests::blockmanager_scan_unlink_already_pruned_files::<anonymous>.TestChain100Setup::<anonymous>.TestingSetup::<anonymous>.ChainTestingSetup::<anonymous>.BasicTestingSetup::m_node.node::NodeContext::chainman, std::source_location{(& *.Lsrc_loc27)}, std::basic_string_view<char>(((const char*)"m_node.chainman")))’
  116 | #define Assert(val) inline_assertion_check<true>(val, std::source_location::current(), #val)
      |                     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/ci_container_base/src/test/blockmanager_tests.cpp:63:28: note: in expansion of macro ‘Assert’
   63 |     const auto& chainman = Assert(m_node.chainman);
      |                            ^~~~~~
cc1plus: all warnings being treated as errors
gmake[2]: Leaving directory '/ci_container_base/ci/scratch/build-x86_64-w64-mingw32'
gmake[2]: *** [src/test/CMakeFiles/test_bitcoin.dir/build.make:382: src/test/CMakeFiles/test_bitcoin.dir/blockmanager_tests.cpp.obj] Error 1
gmake[1]: *** [CMakeFiles/Makefile2:1810: src/test/CMakeFiles/test_bitcoin.dir/all] Error 2
gmake[1]: Leaving directory '/ci_container_base/ci/scratch/build-x86_64-w64-mingw32'
gmake: *** [Makefile:146: all] Error 2
```

This false-positive warning is also fixed in later GCC versions.

See also https://godbolt.org/z/fjc6be65M
2025-11-10 13:07:42 +01:00
merge-script
490cb056f6 Merge bitcoin/bitcoin#33785: util: Allow Assert (et al.) in contexts without __func__
fad6efd3be refactor: Use STR_INTERNAL_BUG macro where possible (MarcoFalke)
fada379589 doc: Remove unused bugprone-lambda-function-name suppression (MarcoFalke)
fae1d99651 refactor: Use const reference to std::source_location (MarcoFalke)
fa5fbcd615 util: Allow Assert() in contexts without __func__ (MarcoFalke)

Pull request description:

  Without this, compile warnings could be hit about `__func__` being only valid inside functions.

  ```
  warning: predefined identifier is only valid inside function [-Wpredefined-identifier-outside-function] note: expanded from macro Assert
    115 | #define Assert(val) inline_assertion_check<true>(val, __FILE__, __LINE__, __func__, #val)
        |                                                                           ^
  ```

  Ref https://github.com/bitcoin/bitcoin/pull/32740#discussion_r2486258473

  This also introduces a slight behaviour change, because `std::source_location::function_name` usually includes the entire function signature instead of just the name.

ACKs for top commit:
  l0rinc:
    Code review ACK fad6efd3be
  stickies-v:
    ACK fad6efd3be
  hodlinator:
    re-ACK fad6efd3be

Tree-SHA512: e78a2d812d5ae22e45c93db1661dafbcd22ef209b3d8d8d5f2ac514e92fd19a17c3f0a5db2ef5e7748aa2083b10c0465326eb36812e6a80e238972facd2c7e98
2025-11-10 11:56:09 +00:00
Hennadii Stepanov
5d0a40d607 ci: Extend tidy job to cover kernel code 2025-11-07 14:24:48 +00:00
MarcoFalke
fae1d99651 refactor: Use const reference to std::source_location
Performance likely does not matter here, but from a perspective of
code-readablilty, a const reference should be preferred for read-only
access.

So use it here.

This requires to set -Wno-error=dangling-reference for GCC 13.1
compilations, but this false-positive is fixed in later GCC versions.

See also https://godbolt.org/z/fjc6be65M
2025-11-05 08:42:29 +01:00
merge-script
4da01123df Merge bitcoin/bitcoin#30595: kernel: Introduce C header API
6c7a34f3b0 kernel: Add Purpose section to header documentation (TheCharlatan)
7e9f00bcc1 kernel: Allowing reducing exports (TheCharlatan)
7990463b10 kernel: Add pure kernel bitcoin-chainstate (TheCharlatan)
36ec9a3ea2 Kernel: Add functions for working with outpoints (TheCharlatan)
5eec7fa96a kernel: Add block hash type and block tree utility functions to C header (TheCharlatan)
f5d5d1213c kernel: Add function to read block undo data from disk to C header (TheCharlatan)
09d0f62638 kernel: Add functions to read block from disk to C header (TheCharlatan)
a263a4caf2 kernel: Add function for copying block data to C header (TheCharlatan)
b30e15f432 kernel: Add functions for the block validation state to C header (TheCharlatan)
aa262da7bc kernel: Add validation interface to C header (TheCharlatan)
d27e27758d kernel: Add interrupt function to C header (TheCharlatan)
1976b13be9 kernel: Add import blocks function to C header (TheCharlatan)
a747ca1f51 kernel: Add chainstate load options for in-memory dbs in C header (TheCharlatan)
070e77732c kernel: Add options for reindexing in C header (TheCharlatan)
ad80abc73d kernel: Add block validation to C header (TheCharlatan)
cb1590b05e kernel: Add chainstate loading when instantiating a ChainstateManager (TheCharlatan)
e2c1bd3d71 kernel: Add chainstate manager option for setting worker threads (TheCharlatan)
65571c36a2 kernel: Add chainstate manager object to C header (TheCharlatan)
c62f657ba3 kernel: Add notifications context option to C header (TheCharlatan)
9e1bac4585 kernel: Add chain params context option to C header (TheCharlatan)
337ea860df kernel: Add kernel library context object (TheCharlatan)
28d679bad9 kernel: Add logging to kernel library C header (TheCharlatan)
2cf136dec4 kernel: Introduce initial kernel C header API (TheCharlatan)

Pull request description:

  This is a first attempt at introducing a C header for the libbitcoinkernel library that may be used by external applications for interfacing with Bitcoin Core's validation logic. It currently is limited to operations on blocks. This is a conscious choice, since it already offers a lot of powerful functionality, but sits just on the cusp of still being reviewable scope-wise while giving some pointers on how the rest of the API could look like.

  The current design was informed by the development of some tools using the C header:

  * A re-implementation (part of this pull request) of [bitcoin-chainstate](https://github.com/bitcoin/bitcoin/blob/master/src/bitcoin-chainstate.cpp).
  * A re-implementation of the python [block linearize](https://github.com/bitcoin/bitcoin/tree/master/contrib/linearize) scripts: https://github.com/TheCharlatan/bitcoin/tree/kernelLinearize
  * A silent payment scanner: https://github.com/josibake/silent-payments-scanner
  * An electrs index builder: https://github.com/josibake/electrs/commits/electrs-kernel-integration
  * A rust bitcoin node: https://github.com/TheCharlatan/kernel-node
  * A reindexer: https://github.com/TheCharlatan/bitcoin/tree/kernelApi_Reindexer

  The library has also been used by other developers already:

  * A historical block analysis tool: https://github.com/ismaelsadeeq/mining-analysis
  * A swiftsync hints generator: https://github.com/theStack/swiftsync-hints-gen
  * Fast script validation in floresta: https://github.com/vinteumorg/Floresta/pull/456
  * A swiftsync node implementation: https://github.com/2140-dev/swiftsync/tree/master/node

  Next to the C++ header also made available in this pull request, bindings for other languages are available here:

  * Rust: https://github.com/TheCharlatan/rust-bitcoinkernel
  * Python: https://github.com/stickies-v/py-bitcoinkernel
  * Go: https://github.com/stringintech/go-bitcoinkernel
  * Java: https://github.com/yuvicc/java-bitcoinkernel

  The rust bindings include unit and fuzz tests for the API.

  The header currently exposes logic for enabling the following functionality:
  * Feature-parity with the now deprecated libbitcoin-consensus
  * Optimized sha256 implementations that were not available to previous users of libbitcoin-consensus thanks to a static kernel context
  * Full support for logging as well as control over categories and severity
  * Feature parity with the existing experimental bitcoin-chainstate
  * Traversing the block index as well as using block index entries for reading block and undo data.
  * Running the chainstate in memory
  * Reindexing (both full and chainstate-only)
  * Interrupting long-running functions

  The pull request introduces a new kernel-only test binary that purely relies on the kernel C header and the C++ standard library. This is intentionally done to show its capabilities without relying on other code inside the project. This may be relaxed to include some of the existing utilities, or even be merged into the existing test suite.

  The complete docs for the API as well as some usage examples are hosted on [thecharlatan.ch/kernel-docs](https://thecharlatan.ch/kernel-docs/index.html). The docs are generated from the following repository (which also holds the examples): [github.com/TheCharlatan/kernel-docs](https://github.com/TheCharlatan/kernel-docs).

  #### How can I review this PR?

  Scrutinize the commit messages, run the tests, write your own little applications using the library, let your favorite code sanitizer loose on it, hook it up to your fuzzing infrastructure, profile the difference between the existing bitcoin-chainstate and the bitcoin-chainstate introduced here, be nitty on the documentation, police the C interface, opine on your own API design philosophy.

  To get a feeling for the API, read through the tests, or one of the examples.

  To configure this PR for making the shared library and the bitcoin-chainstate and test_kernel utilities available:
  ```
  cmake -B build -DBUILD_KERNEL_LIB=ON -DBUILD_UTIL_CHAINSTATE=ON
  ```

  Once compiled the library is part of the build artifacts that can be installed with:
  ```
  cmake --install build
  ```

  #### Why a C header (and not a C++ header)

  * Shipping a shared library with a C++ header is hard, because of name mangling and an unstable ABI.
  * Mature and well-supported tooling for integrating C exists for nearly every popular language.
  * C offers a reasonably stable ABI

  Also see https://github.com/bitcoin/bitcoin/pull/30595#issuecomment-2285719575.

  #### What about versioning?

  The header and library are still experimental and I would expect this to remain so for some time, so best not to worry about versioning yet.

  #### Potential future additions

  In future, the C header could be expanded to support (some of these have been roughly implemented):

  * Handling transactions, block headers, coins cache, utxo set, meta data, and the mempool
  * Adapters for an abstract coins store
  * Adapters for an abstract block store
  * Adapters for an abstract block tree store
  * Allocators and buffers for more efficient memory usage
  * An "[io-less](https://sans-io.readthedocs.io/how-to-sans-io.html)" interface
  * Hooks for an external mempool, or external policy rules

  #### Current drawbacks

  * For external applications to read the block index of an existing Bitcoin Core node, Bitcoin Core needs to shut down first, since leveldb does not support reading across multiple processes. Other than migrating away from leveldb, there does not seem to be a solution for this problem. Such a migration is implemented in #32427.
  * The fatal error handling through the notifications is awkward. This is partly improved through #29642.
  * Handling shared pointers in the interfaces is unfortunate. They make ownership and freeing of the resources fuzzy and poison the interfaces with additional types and complexity. However, they seem to be an artifact of the current code that interfaces with the validation engine. The validation engine itself does not seem to make extensive use of these shared pointers.
  * If multiple instances of the same type of objects are used, there is no mechanism for distinguishing the log messages produced by each of them. A potential solution is #30342.
  * The background leveldb compaction thread may not finish in time leading to a non-clean exit. There seems to be nothing we can do about this, outside of patching leveldb.

ACKs for top commit:
  alexanderwiederin:
    re-ACK 6c7a34f3b0
  stringintech:
    re-ACK 6c7a34f
  laanwj:
    Code review ACK 6c7a34f3b0
  ismaelsadeeq:
    reACK 6c7a34f3b0 👾
  fanquake:
    ACK 6c7a34f3b0 - soon we'll be running bitcoin (kernel)

Tree-SHA512: ffe7d4581facb7017d06da8b685b81f4b5e4840576e878bb6845595021730eab808d8f9780ed0eb0d2b57f2647c85dcb36b6325180caaac469eaf339f7258030
2025-11-04 15:38:42 +00:00
merge-script
5ffa63d681 Merge bitcoin/bitcoin#33626: ci: run native fuzz with MSAN job
1e6e32fa8a ci: run native fuzz with MSAN job (fanquake)
3784d15bcd ci: use LLVM libcxx 21.1.5 (fanquake)

Pull request description:

  I think this job should exist in this repo (not just qa-assets), if the alternative is double-handling changes to the interpreter. #32998 made changes which were then re-changed in #33600, to work around a false positive.

  The unchached runtime of this job with `-lg` is `~32m`, with `-md` it's `~43m`.

  Timeout is set to 150m, as the slow GHA runners were close to hitting a 120m limit.

ACKs for top commit:
  maflcko:
    lgtm ACK 1e6e32fa8a
  dergoegge:
    utACK 1e6e32fa8a

Tree-SHA512: afd4cb0039f4f49ddc23f5553a5bf6d5ceffbc12d91acd6890d5cc40c30b7421b23d04f305983d94c862daa6fc07535b1331d7fa2a8ebfe9f19c20d83d95c692
2025-11-04 13:58:23 +00:00
merge-script
1cd8d9fe5c Merge bitcoin/bitcoin#33445: ci: Update Clang in "tidy" job
5d784bebaf clang-tidy: Disable `ArrayBound` check in src/ipc and src/test (Hennadii Stepanov)
5efdb0ef30 ci: Update Clang in "tidy" job (Hennadii Stepanov)

Pull request description:

  This PR:

  1. Updates to [IWYU 0.25](https://github.com/include-what-you-use/include-what-you-use/releases/tag/0.25), which is compatible with Clang 21.

  2. Fixes new "modernize-use-default-member-init" warnings. The warning in `interpreter.cpp` is a [false positive](https://github.com/llvm/llvm-project/issues/160394), so it has been suppressed.

ACKs for top commit:
  maflcko:
    review ACK 5d784bebaf 🎒
  ryanofsky:
    Code review ACK 5d784bebaf, just adding clang version comment since last review.

Tree-SHA512: a1d853675ec064170ee0f1cd16be6a900676588d4a1e7b5def8733933b140ba1a9520ec6f6a42bf7638b2ff7cf2fe4d5866d407f68b677b49d2bd68ff345f735
2025-11-04 10:16:06 +00:00
fanquake
3784d15bcd ci: use LLVM libcxx 21.1.5 2025-11-04 09:27:12 +00:00
TheCharlatan
2cf136dec4 kernel: Introduce initial kernel C header API
As a first step, implement the equivalent of what was implemented in the
now deprecated libbitcoinconsensus header. Also add a test binary to
exercise the header and library.

Unlike the deprecated libbitcoinconsensus the kernel library can now use
the hardware-accelerated sha256 implementations thanks for its
statically-initialzed context. The functions kept around for
backwards-compatibility in the libbitcoinconsensus header are not ported
over. As a new header, it should not be burdened by previous
implementations. Also add a new error code for handling invalid flag
combinations, which would otherwise cause a crash.

The macros used in the new C header were adapted from the libsecp256k1
header.

To make use of the C header from C++ code, a C++ header is also
introduced for wrapping the C header. This makes it safer and easier to
use from C++ code.

Co-authored-by: stickies-v <stickies-v@protonmail.com>
2025-11-04 08:31:51 +01:00
MarcoFalke
facf8b771a ci: Add missing python3-dev package for riscv64 2025-10-30 17:28:34 +01:00
merge-script
72511fd02e Merge bitcoin/bitcoin#33555: build: Bump clang minimum supported version to 17
fa0fa0f700 refactor: Revert "disable self-assign warning for tests" (MarcoFalke)
faed118fb3 build: Bump clang minimum supported version to 17 (MarcoFalke)

Pull request description:

  Most supported operating systems ship with clang-17 (or later), so bump the minimum to that and allow new code to drop workarounds for previous clang bugs.

  (Apart from dropping the small workaround, this bump allows the `ci_native_nowallet_libbitcoinkernel` CI to run on riscv64 without running into an ICE with clang-16.)

  This patch will only be released in version 31.x, next year (2026).

  For reference:

  * https://packages.debian.org/bookworm/clang-19
  * https://packages.ubuntu.com/noble/clang (clang-18)
  * CentOS-like 8/9/10 ship clang-17 (and later) via Stream
  * FreeBSD 12/13 ship clang-17 (and later) via packages
  * OpenSuse Tumbleweed ships with https://software.opensuse.org/package/clang (clang21); No idea about OpenSuse Leap

  On operating systems where the clang version is not shipped by default, the user would have to use GCC, or install clang in a different way. For example:

  * https://packages.debian.org/bookworm/g++ (g++-12)
  * https://packages.ubuntu.com/jammy/g++ (g++-11)
  * https://apt.llvm.org/, or nix, or guix, or compile clang from source, ...

  *Ubuntu 22.04 LTS does not ship with clang-16 (the previous minimum required), nor with clang-17, so one of the above workarounds is needed there.*

  macOS 14 is unaffected, and the previous minimum requirement of Xcode15.0 remains, see also 919e6d01e9/depends/hosts/darwin.mk (L3-L4). (Modulo compiling the fuzz tests, which requires 919e6d01e9/.github/workflows/ci.yml (L149))

ACKs for top commit:
  janb84:
    Concept ACK fa0fa0f700
  l0rinc:
    Code review ACK fa0fa0f700
  hebasto:
    ACK fa0fa0f700.

Tree-SHA512: 5973cec39982f80b8b43e493cde012d9d1ab75a0362300b007d155db9f871c6341e7e209e5e63f0c3ca490136b684683de270136d62cb56f6b00b0ac0331dc36
2025-10-29 16:53:42 +00:00
merge-script
292ea0eb89 Merge bitcoin/bitcoin#33677: ci: Retry image building once on failure
5555bce994 ci: Document why IN_GETOPT_BIN env var is needed on macOS (MarcoFalke)
fabe516440 ci: Export the container id in python script (MarcoFalke)
fa6aa9f42f ci: Retry image building once on failure (MarcoFalke)
fa4dbe04d7 ci: Allow overwriting check option in run() helper (MarcoFalke)
fa8e4de5c3 ci: Use os.environ[key] access when value must be set (MarcoFalke)

Pull request description:

  This should fix https://github.com/bitcoin/bitcoin/issues/33640.

  It also contains a few refactor cleanups, which are explained in the corresponding commits.

ACKs for top commit:
  l0rinc:
    Code review reACK 5555bce994
  kevkevinpal:
    ACK [5555bce](5555bce994)
  davidgumberg:
    crACK 5555bce994

Tree-SHA512: f1ea95b0650e57d6a9f97c575a11ee461832c0715c3d1a24dbfe12ccc5366f295639d4c4827f1d01da460ddf00917ecaa627e7dbd12e405770db6c53c3778a9c
2025-10-29 10:09:52 +00:00
merge-script
dd82c6c5d0 Merge bitcoin/bitcoin#33693: ci: use pycapnp 2.2.1
53b34c80c6 ci: use pycapnp 2.2.1 in mac native job (fanquake)
865432869c ci: remove Python version comment from mac config (fanquake)

Pull request description:

  Switch to using v2.2.1 in the mac native job. Remove the git clone & install step.

ACKs for top commit:
  maflcko:
    lgtm ACK 53b34c80c6
  l0rinc:
    crACK 53b34c80c6
  hebasto:
    ACK 53b34c80c6.

Tree-SHA512: e756694c14431aacb3e48104331da88285c7500b4c4599c698f50d721d428ffe61258be075ef526b93c15aa3331f38535ca95249a2ef3ebfc804f61479095d9b
2025-10-29 10:00:57 +00:00
Hennadii Stepanov
5efdb0ef30 ci: Update Clang in "tidy" job
This change updates to IWYU 0.25, which is compatible with Clang 21.
Fixes new "modernize-use-default-member-init" warnings.
The warning in `interpreter.cpp` is a false positive, so it has been
suppressed.
2025-10-28 15:33:57 +00:00
Hennadii Stepanov
24434c1284 Merge bitcoin/bitcoin#31308: ci, iwyu: Treat warnings as errors for specific directories
02d2b5a11c ci, iwyu: Treat warnings as errors for specific directories (Hennadii Stepanov)
57a3eac387 refactor: Fix includes in `index` directory (Hennadii Stepanov)
bdb8eadcdc refactor: Fix includes in `crypto` directory (Hennadii Stepanov)
56f2a689a2 ci: Do not patch `leveldb` to workaround UB in "tidy" CI job (Hennadii Stepanov)

Pull request description:

  This PR is the first step towards treating IWYU warnings as errors. At this stage, it applies only to the `crypto` and `index` directories.

ACKs for top commit:
  maflcko:
    re-ACK 02d2b5a11c 💮
  ryanofsky:
    Code review ACK 02d2b5a11c. Just rebased and update tidy patch comment again since last review
  willcl-ark:
    ACK 02d2b5a11c

Tree-SHA512: 1c966e01c47bf3e7d225faa3b819367f757430e2d71e9582fa82d67307aabe3f0d76f69346ee180192e7f5ab194ecc58d2b8ecf178eab26ba3309a6b55bff4b6
2025-10-28 11:52:27 +00:00
merge-script
27cd7f5049 Merge bitcoin/bitcoin#33185: guix: update time-machine to 5cb84f2013c5b1e48a7d0e617032266f1e6059e2
59c4898994 guix: remove python-pydantic-core input from LIEF (fanquake)
9f2a6927d3 guix: use Clang & LLVM 19 for macOS build (fanquake)
9570ddbec9 guix: update time-machine to 5cb84f2013c5b1e48a7d0e617032266f1e6059e2 (fanquake)
7b5cc276aa guix: patch around riscv issue with newer (2.40+) binutils (fanquake)
91b5cbaabb ci: use Debian Trixie for macOS cross job (fanquake)

Pull request description:

  5cb84f2013 isn't super recent, but it's enough to get access to some newer packages, such as LLVM 19, and avoids having to add any further work arounds for things that we know are fixed later (i.e nsis). Once things upstream have stabilized a bit more (the `core-updates` branch was fairly recently merged), we could look at bumping to something newer.

  Package updates:
  (base) glibc 2.35 -> 2.39
  binutils 2.38 -> 2.41
  diffutils 3.8 -> 3.10
  gawk 5.2.1 -> 5.3.0
  git-minimal 2.45.2 -> 2.46.0
  grep 3.8 -> 3.11
  gzip 1.12 -> 1.13
  linux-headers 6.1.106 -> 6.1.119
  make 4.3 -> 4.4.1
  xz 5.2.8 -> 5.4.5

  CMake 3.30 becomes available.
  Clang/LLVM 19 becomes available.

  Could be used for #32764.

ACKs for top commit:
  hebasto:
    re-ACK 59c4898994.
  willcl-ark:
    ACK 59c4898994

Tree-SHA512: c44965d5a315e4c862f5e40d8e98c645713405fec72a61055f95b6c68b7d2dcc69a61a084e397a4556d4c1df18f1cfa7a905234643fe4a7df9c58d486e26c097
2025-10-28 10:59:53 +00:00
fanquake
53b34c80c6 ci: use pycapnp 2.2.1 in mac native job
Drop using the git clone & install.
2025-10-27 12:22:53 +01:00
fanquake
865432869c ci: remove Python version comment from mac config 2025-10-27 12:21:17 +01:00
MarcoFalke
5555bce994 ci: Document why IN_GETOPT_BIN env var is needed on macOS
This was added in commit b705bade44, but I
keep forgetting the background that this is needed for the retry Bash
script. So document it.
2025-10-24 13:11:25 +02:00
MarcoFalke
fabe516440 ci: Export the container id in python script
This refactor does not change behavior, but it has a few benefits:

* The shellcheck SC2086 warning is disabled for the whole command, but
  is only needed for the CI_CONTAINER_CAP env var. So in Python, only
  pass this one env var to shlex.split() for proper word splitting.
* Future logic improvements can be implemented in Python.

The comments are moved, which can be checked via the git options:
--color-moved=dimmed-zebra --color-moved-ws=ignore-all-space
2025-10-24 13:11:17 +02:00
merge-script
f6ba97cea1 Merge bitcoin/bitcoin#33666: ci: Drop libFuzzer from msan fuzz task
fa70e23de7 ci: Drop libFuzzer from msan fuzz task (MarcoFalke)

Pull request description:

  libFuzzer is mostly unmaintained (https://llvm.org/docs/LibFuzzer.html#status), and it isn't really needed by the CI tasks. While it provides some additional stats like rss or the max input byte size, they are not essential. Dropping libFuzzer here would also drop the "60 seconds sanity check" for empty folders, but I think this is an acceptable price to pay to silence false-positives that were hit for years.

  Also, there seems to be a history of intermittent false-positive msan warnings (https://github.com/bitcoin/bitcoin/pull/33600#issuecomment-3391921802).

  It is unclear what exactly is causing the false-positives, so just disable libFuzzer in this task for now, to work around them.

ACKs for top commit:
  kevkevinpal:
    ACK [fa70e23](fa70e23de7)
  dergoegge:
    ACK fa70e23de7

Tree-SHA512: c3e5958b8378ba30f51d923f97a84dec2ee60af8b9c2a4f13bc8de486a490031468371120e421384aa198ffec591db554e636935ab3c6d4de5e870238f5079f2
2025-10-24 10:05:35 +02:00
merge-script
11684c9ce2 Merge bitcoin/bitcoin#33674: ci: Doc ASLR workaround for sanitizer tasks
fa0e36156c ci: Doc ASLR workaround for sanitizer tasks (MarcoFalke)

Pull request description:

  Fixes https://github.com/bitcoin/bitcoin/issues/30674

ACKs for top commit:
  fanquake:
    ACK fa0e36156c

Tree-SHA512: 9811a35526c707a6b2438e4f15d1ea765c9ecf1786cb37cd23e3bc5d65a25623f276a74b4a70c24492126a87514845111741290fc3095206decf17ee2c52dd2a
2025-10-23 09:18:51 +02:00
MarcoFalke
fa6aa9f42f ci: Retry image building once on failure
The build scripts inside the image retry after a failure. However, there
may be some rare network failures inside the container engine. For
example, when pulling the underlying base image, or when pulling the
docker cache.

Thus, retry after a failure once, which should hopefully fix
https://github.com/bitcoin/bitcoin/issues/33640.
2025-10-22 14:12:25 +02:00
MarcoFalke
fa4dbe04d7 ci: Allow overwriting check option in run() helper
The bool is forced to check=True, but some commands may want to
explicitly use kwargs to disable it.

This refactor is needed for the next commit.
2025-10-22 14:12:20 +02:00
MarcoFalke
fa8e4de5c3 ci: Use os.environ[key] access when value must be set
The other code in this file is using this pattern to throw when a key is
unset, instead of silently returning a None when using os.getenv(key)
with no default value specified.

So use the pattern here as well. As the env vars are always set, this
should be a refactor that does not change the behavior.
2025-10-22 14:12:18 +02:00
merge-script
1569bcc387 Merge bitcoin/bitcoin#33639: ci: Only write docker build images to Cirrus cache
fabe0e07de ci: Only write docker build images to Cirrus cache (MarcoFalke)
fab64a5d6f ci: Move buildx command to python script (MarcoFalke)
fa72a2bd5c ci: Remove unused MAYBE_CPUSET (MarcoFalke)

Pull request description:

  The `DOCKER_BUILD_CACHE_ARG` env var holds the options on how to use cache providers. Storing the image layers is useful for the Cirrus cache provider, because it offers 10GB per runner (https://cirrus-runners.app/setup/#speeding-up-the-cache). The cached image layers can help to avoid issues when the upstream package manager infra (apt native, apt llvm, pip, apk, git clone, ...) has outages or network issues.

  However, on the GitHub Actions cache provider, a *total* cache of 10GB is offered for the whole repo. This cache must be shared with the depends cache, and the ccache, as well as the previous releases cache. So it is already full and trying to put the docker build layers into it will lead to an overflow.

  Fix it by only writing to the docker cache on Cirrus.

  Also, `DOCKER_BUILD_CACHE_ARG` requires a `shellcheck disable=SC2086` on the full build command. Fix that as well by using `shlex.split` from Python on just this variable.

ACKs for top commit:
  m3dwards:
    ACK fabe0e07de
  cedwies:
    reACK fabe0e0
  l0rinc:
    Code review ACK fabe0e07de
  willcl-ark:
    ACK fabe0e07de

Tree-SHA512: 4f471f080007fdd0c3bc97b0cfe0e9c0457e5029a7ccde1d784d30eb4752e5eb309cd4b122b182bce31f1b986c8a9f3e9a49da1768bedbb2b1f64f70183680ba
2025-10-22 12:49:05 +02:00
MarcoFalke
fa0e36156c ci: Doc ASLR workaround for sanitizer tasks 2025-10-22 09:14:40 +02:00
merge-script
c862936d16 Merge bitcoin/bitcoin#33370: ci: use Mold linker for asan-lsan-ubsan-integer-no-depends-usdt workflow
f031536f2d ci: use Mold linker for asan-lsan-ubsan-integer-no-depends-usdt workflow (Brandon Odiwuor)

Pull request description:

  Follow up to https://github.com/bitcoin/bitcoin/pull/32888#pullrequestreview-2993523631 and https://github.com/bitcoin/bitcoin/pull/32888#issuecomment-3044773485

  >>Can we use `mold` as a linker in other Linux based system workflows ? dependencies [we have](https://github.com/bitcoin/bitcoin/blob/master/doc/dependencies.md#compiler) seem to satisfy the deps here https://github.com/rui314/mold?tab=readme-ov-file#how-to-build
  >
  > Sure, happy to review a follow-up. Only place to avoid it would probably the ci tasks that mirror the guix build (win-cross, mac-cross)

  Updated the `ASan + LSan + UBSan + integer, no depends, USDT` workflow to use `mold` linker

ACKs for top commit:
  maflcko:
    lgtm ACK f031536f2d

Tree-SHA512: 35a4cb3eec732bee3f18a3ea70e49b1c99b8e88624a0bb28eca8f3d72ed0835af8773307a27c750b89fc6d969ff20dd87b840d755b7fd14d3cb6ab68d9f587b9
2025-10-21 16:37:01 +02:00
MarcoFalke
fab64a5d6f ci: Move buildx command to python script
This has a few benefits:

* The shellcheck SC2086 warning is disabled for the whole command, but
  is only needed for the DOCKER_BUILD_CACHE_ARG env var.  So in Python,
  only pass this one env var to shlex.split() for proper word splitting.
* Future logic improvements can be implemented in Python.

The comments are moved, which can be checked via the git options:
--color-moved=dimmed-zebra --color-moved-ws=ignore-all-space
2025-10-21 15:42:50 +02:00
MarcoFalke
fa72a2bd5c ci: Remove unused MAYBE_CPUSET
The option is currently unused. If it is used again in the future, it
could trivially be added back.

Also, the logic is just a single undocumented python command one-liner.

So remove it for now.
2025-10-21 15:22:52 +02:00
MarcoFalke
fa70e23de7 ci: Drop libFuzzer from msan fuzz task 2025-10-21 11:33:12 +02:00
fanquake
91b5cbaabb ci: use Debian Trixie for macOS cross job
This will use Clang & LLVM 19.
2025-10-15 13:46:06 +01:00
merge-script
40e7d4cd0d Merge bitcoin/bitcoin#33549: ci: Add macOS cross task for arm64-apple-darwin
fad5a7101c ci: Add macOS cross task for arm64 (MarcoFalke)
fa8c750a0a ci: Refactor get_previous_releases step in win-test-cross task (MarcoFalke)

Pull request description:

  Cross compiling to Intel macOS seems fine, but it would be good to cross compile to arm64-apple-darwin as well.

  Further reading:

  * https://en.wikipedia.org/wiki/Mac_transition_to_Apple_silicon#Timeline.
  * It is harder to find native Intel macOS hardware (E.g. GitHub is in the process of dropping it: https://github.blog/changelog/2025-07-11-upcoming-changes-to-macos-hosted-runners-macos-latest-migration-and-xcode-support-policy-updates/#macos-13-is-closing-down)

ACKs for top commit:
  Sjors:
    utACK fad5a7101c
  hodlinator:
    crACK fad5a7101c

Tree-SHA512: ce96ac9f68f594584dc910555bd34590084e3e45ca02a22d4949e88bb569de3bf87ebf6b5c6718ae82d7750a98212b72f6dab80bddfc9652a57180fbdda97f42
2025-10-15 11:20:27 +01:00
merge-script
ea17618c11 Merge bitcoin/bitcoin#33480: ci: Turn CentOS config into Alpine musl config
444409ff2b ci: Reduce Alpine musl task to md runner size (MarcoFalke)
fa6b2e9efe ci: Turn centos config into alpine musl config (MarcoFalke)

Pull request description:

  Fixes https://github.com/bitcoin/bitcoin/issues/33437

  Historically, the centos task was added to add CI coverage for old packages and 32-bit depends builds, but both are now covered by different tasks.

  The CentOS task aligns with Ubuntu/Debian CI tasks in terms of libc usage, but (slightly) differs in package naming and update philosophy. I am not aware of the task ever discovering a centos-related issue, so it seems fine to recycle it into an Alpine Linux task.

  The main difference would be that musl libc is now used. Also, busybox is used in Alpine, so in theory the busybox install could be removed from the arm CI task in the future.

  Packaging considerations: All packages should roughly be the same (gcc remains at version 14, python remains at version 3.12, etc). Also, all packages are from the Alpine main track, coming with 2 years of support. The only exception is the py3-pip package (https://pkgs.alpinelinux.org/packages?name=py3-pip&branch=v3.22&repo=&arch=riscv64) from the community track, however, I don't expect any issues arising from that.

ACKs for top commit:
  janb84:
    reACK 444409ff2b
  willcl-ark:
    ACK 444409ff2b

Tree-SHA512: fd1a1da0fd766591e44a57dbdb84f9b3b47ca92113a429bba139ee5fef54714b8fe509c321e7b3a470c29b4af7d9eab9786e1660b9effb862ecea52824f458aa
2025-10-15 10:56:45 +01:00
merge-script
2f7a50f67c Merge bitcoin/bitcoin#33462: ci: add libcpp hardening flags to macOS fuzz job
e4c04f7759 ci: add libcpp hardening flags to macOS fuzz job (fanquake)

Pull request description:

  Follows up to https://github.com/bitcoin/bitcoin/pull/33425#issuecomment-3323149107.

ACKs for top commit:
  maflcko:
    lgtm ACK e4c04f7759. The qa-assets repo has a libc++ debug run, so this isn't required, but it seems fast enough to not hurt.

Tree-SHA512: 6c0dc90528ca867df49027eebf2d1c417a7395f9f94779076ace48e3e4b21771e7d99e8b3ed75ca56da87153418a446075429aa6b9ec5cd4b6b8cb5b0c25c1d7
2025-10-15 09:39:58 +01:00
MarcoFalke
faed118fb3 build: Bump clang minimum supported version to 17 2025-10-09 20:39:39 +02:00
MarcoFalke
fad5a7101c ci: Add macOS cross task for arm64 2025-10-08 13:02:50 +02:00
fanquake
e4c04f7759 ci: add libcpp hardening flags to macOS fuzz job
Follows up to
https://github.com/bitcoin/bitcoin/pull/33425#issuecomment-3323149107.
2025-10-08 10:42:25 +01:00
MarcoFalke
fa6fd16f36 ci: Use native platform for win-cross task 2025-10-07 12:22:37 +02:00
Brandon Odiwuor
50194029e7 ci: Remove bash -c from cmake invocation using eval 2025-10-01 08:58:17 +03:00
fanquake
d4f47f9771 ci: use latest versions of lint deps
Some of the versions used here are > 2 years old. i.e mypy. Use the
latest avilable versions, except for LIEF, which is generally changed
with Guix.
2025-09-29 14:47:41 -04:00
MarcoFalke
fa6b2e9efe ci: Turn centos config into alpine musl config 2025-09-25 14:10:20 +02:00
fanquake
b77137a564 ci: link against -lstdc++ in native fuzz with msan job 2025-09-23 09:53:58 -04:00
Brandon Odiwuor
f031536f2d ci: use Mold linker for asan-lsan-ubsan-integer-no-depends-usdt workflow 2025-09-13 14:13:52 +03:00
merge-script
853f0d8811 Merge bitcoin/bitcoin#33364: ci: always use tag for LLVM checkout
b736052e39 ci: always use tag for LLVM checkout (fanquake)

Pull request description:

  Rather than trying to match the apt installed clang version, which is prone to intermittent issues. i.e #33345.

ACKs for top commit:
  davidgumberg:
    ACK b736052e39
  willcl-ark:
    ACK b736052e39

Tree-SHA512: 8e3fcc8219f573cec65941576c7995f21cae3330bcdbf615f799e8c5facd1146d3239a7284e9af7b013c37170ddf7435d7df6d2966f63fe7b4a8e4937311ff36
2025-09-12 09:46:25 +01:00
Ava Chow
b81445333a Merge bitcoin/bitcoin#33243: test: Fix CLI_MAX_ARG_SIZE issues
fa96a4afea ci: Enable CI_LIMIT_STACK_SIZE=1 in i686_no_ipc task (MarcoFalke)
facfde2cdc test: Fix CLI_MAX_ARG_SIZE issues (MarcoFalke)

Pull request description:

  `CLI_MAX_ARG_SIZE` has many edge case issues:

  * It seems to be lower on some systems, but it is unknown how to reproduce locally: https://github.com/bitcoin/bitcoin/pull/33079#issuecomment-3139957274
  * `MAX_ARG_STRLEN` is a limit per arg, but we probably want "The maximum length of [all of] the arguments": See https://www.man7.org/linux/man-pages/man3/sysconf.3.html, section `ARG_MAX - _SC_ARG_MAX`.
  * It doesn't account for the additional args added by the `bitcoin` command later on: 73220fc0f9/src/bitcoin.cpp (L85-L92)
  * It doesn't account for unicode encoding a string to bytes before taking its length.

  The issues are mostly harmless edge cases, but it would be good to fix them. So do that here, by:

  * Replacing `max()` by `sum()`, to correctly take into account all args, not just the largest one.
  * Reduce `CLI_MAX_ARG_SIZE`, to account for the `bitcoin` command additional args.

  Also, there is a test. The test can be called with `ulimit` to hopefully limit the max args size to the hard-coded value in the test framework. For reference:

  ```
  $ ( ulimit -s 512 && python3 -c 'import os; print(os.sysconf("SC_ARG_MAX") )' )
  131072
  ```

  On top of this pull it should pass, ...

  ```
  bash -c 'ulimit -s 512 && BITCOIN_CMD="bitcoin -M" ./bld-cmake/test/functional/rpc_misc.py --usecli -l DEBUG'
  ```

  ... and with the test_framework changes reverted, it should fail:

  ```
  OSError: [Errno 7] Argument list too long: 'bitcoin'
  ```

  Also, there is a commit to enable `CI_LIMIT_STACK_SIZE=1` in the i686 task, because it should now be possible and no longer hit the hard-to-reproduce issue mentioned above.

ACKs for top commit:
  cedwies:
    ACK fa96a4a
  achow101:
    ACK fa96a4afea
  enirox001:
    ACK fa96a4a — thanks for addressing the nits and clarifying the test; LGTM.
  mzumsande:
    Code Review ACK fa96a4afea

Tree-SHA512: d12211bd097d692d560c3615970ec0e911707d8c6cbbb145591abc548beed55f487a80b08f0a8c89d4eef4d76a9fbd6a33edc0b42b5860a93dd7b954355bc887
2025-09-11 15:37:48 -07:00
fanquake
b736052e39 ci: always use tag for LLVM checkout
Rather than trying to match the apt installed clang version, which is
prone to intermittent issues. i.e #33345.
2025-09-11 10:40:11 +01:00
Hennadii Stepanov
02d2b5a11c ci, iwyu: Treat warnings as errors for specific directories
Currently, this applies only to the `crypto` and `index` directories.
2025-09-09 12:34:31 +01:00
Hennadii Stepanov
56f2a689a2 ci: Do not patch leveldb to workaround UB in "tidy" CI job 2025-09-09 11:25:49 +01:00
Sjors Provoost
a341e11ac9 ci: test IPC on additional hosts
Install pycapnp on all (active) CI hosts which have IPC enabled and
run the functional tests.

Except for previous_releases, which uses an older version of pip
that doesn't support --break-system-packages.
2025-09-05 09:31:54 -04:00