Commit Graph

200 Commits

Author SHA1 Message Date
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
merge-script
7d27af98c7 Merge bitcoin/bitcoin#33461: ci: add Valgrind fuzz
e4b04630bc ci: add Valgrind fuzz (fanquake)

Pull request description:

  Valgrind fuzz runtime?

ACKs for top commit:
  dergoegge:
    ACK e4b04630bc

Tree-SHA512: 0d62da6baf10fb59e3a32df8af72bd0f371e72a725fdea8dfd08f0242634b3c8bcdbf86ff8777ccada0570d13f20ebf8e21a2f935570f3463097b9d411e7b3ce
2025-10-22 12:50:02 +02:00
fanquake
e4b04630bc ci: add Valgrind fuzz 2025-10-22 10:13:14 +02:00
MarcoFalke
fabe0e07de ci: Only write docker build images to Cirrus cache
Other cache providers offer too little space for this to be useful.
2025-10-21 15:43:01 +02: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
6c4fe401e9 Merge bitcoin/bitcoin#33508: ci: fix buildx gha cache authentication on forks
bc706955d7 ci: expose all ACTIONS_* vars (willcl-ark)

Pull request description:

  When using `docker buildx build` in conjunction with the `gha` backend cache type (as we do in our CI) it's important to specify the URL and TOKEN needed to authenticate.

  On Cirrus runners this is working with only `ACTIONS_CACHE_URL` and `ACTIONS_RUNTIME_TOKEN`, but this is not enough for the GitHub backend.

  Fix this by exporting all `ACTIONS_*` variables.

  This fixes docker build layer cache restore/save on forks or where GH-hosted runners are being used, and addresses https://github.com/bitcoin/bitcoin/issues/31965#issuecomment-3324707093

ACKs for top commit:
  m3dwards:
    ACK bc706955d7
  maflcko:
    lgtm ACK bc706955d7

Tree-SHA512: 13e973bb1c1ca5448dd6c3c176fb5ce39c725886ba2012d3253158205309a7038a1430135b37400e1f2f69408a9d0f4e2b3c5f0515154a593ec382ab7db10266
2025-10-14 09:53:06 +01:00
kevkevinpal
f6567527d8 doc: bump the template macOS version
It makes more sense to have a higher OS version than one that is not
supported
2025-10-10 14:34:32 -04:00
merge-script
90b2884ce4 Merge bitcoin/bitcoin#33581: ci: Properly include $FILE_ENV in DEPENDS_HASH
ceeb53adcd ci: Properly include $FILE_ENV in DEPENDS_HASH (Ava Chow)

Pull request description:

  $FILE_ENV has a full relative path already, prepending with ci/test/ results in a non-existent path which means that DEPENDS_HASH was not actually committing to the test's environment file.

ACKs for top commit:
  maflcko:
    lgtm ACK ceeb53adcd

Tree-SHA512: 80a7a23676ff8bf2f48a7d3c5897217f11d7d4d4f8a54897d2b7c42689585d2d63e45fad2b8f4c442111f128a87eeb6edeac2b25c79862e6bc035eeb1ebc7f4e
2025-10-09 16:42:14 +01:00
Coder
b35341b9ba Update ci.yml 2025-10-09 12:33:01 +02:00
Ava Chow
ceeb53adcd ci: Properly include $FILE_ENV in DEPENDS_HASH
$FILE_ENV has a full relative path already, prepending with ci/test/
results in a non-existent path which means that DEPENDS_HASH was not
actually committing to the test's environment file.
2025-10-08 14:47:00 -07:00
MarcoFalke
fad5a7101c ci: Add macOS cross task for arm64 2025-10-08 13:02:50 +02:00
MarcoFalke
fa8c750a0a ci: Refactor get_previous_releases step in win-test-cross task
This refactor does not change behavior, but allows the step to be
re-used in other tasks, such as a mac-test-cross task
2025-10-08 13:02:42 +02:00
Hennadii Stepanov
ec5841888d Merge bitcoin/bitcoin#32513: ci: remove 3rd party js from windows dll gha job
156927903d ci: Check windows manifests for all executables (Max Edwards)
e1a1b14c93 ci: use a more generic way of finding mt.exe (Max Edwards)
7ae0497eef ci: remove 3rd party js from windows dll gha job (Max Edwards)

Pull request description:

  The windows job uses the external dependency `ilammy/msvc-dev-cmd` which runs javascript. We use this to put various tools on the path such as `MSBuild.exe` and `mt.exe`. We can remove this dependency and use `vswhere.exe` directly to find these tools and create a "[Developer command prompt](https://github.com/microsoft/vswhere/wiki/Start-Developer-Command-Prompt#using-powershell)" as someone would on their dev machine.

  While in this area of the code, this PR also runs some additional manifest checks on the windows binaries.

  Fixes: #32508

ACKs for top commit:
  davidgumberg:
    crACK 156927903d
  hebasto:
    ACK 156927903d.

Tree-SHA512: df640dff27579a1c95daddc5a5ba8fd655bbd0a6f2aff74d0f63439c7185c0b18a90abfee3f1f032fe833cd19b822ef71812f44b24c4c044222e46d01c271864
2025-10-08 00:44:05 +01:00
Max Edwards
156927903d ci: Check windows manifests for all executables
The other executables have manifests and these should be checked in
addition to bitcoind. Skipping fuzz.exe, bench_bitcoin.exe and
test_bitcoin-qt.exe as they do not have manifests.
2025-10-02 15:13:29 +01:00
Max Edwards
e1a1b14c93 ci: use a more generic way of finding mt.exe
This sets up a vs developer command prompt and should hopefully should
be more resilient to upstream changes

Co-authored-by: David Gumberg <davidzgumberg@gmail.com>
2025-10-02 15:13:26 +01:00
MarcoFalke
fadad7a494 Drop support for EOL macOS 13 2025-10-01 08:09:30 +02:00
willcl-ark
bc706955d7 ci: expose all ACTIONS_* vars
When using `docker buildx build` in conjunction with the `gha` backend
cache type, it's important to specify the URL and TOKEN needed to
authenticate.

On Cirrus runners this is working with only `ACTIONS_CACHE_URL` and
`ACTIONS_RUNTIME_TOKEN`, but this is not enough for the GitHub backend.

Fix this by exporting all `ACTIONS_*` variables.

This fixes cache restore/save on forks or where GH-hosted runners are
being used.
2025-09-30 11:26:01 +01:00
MarcoFalke
444409ff2b ci: Reduce Alpine musl task to md runner size
Per https://github.com/bitcoin/bitcoin/pull/33480#discussion_r2387381492
2025-09-29 12:14:45 +02:00
Max Edwards
7ae0497eef ci: remove 3rd party js from windows dll gha job
We can use vswhere.exe directly to create a vs developer
prompt and so can remove this third party dependency.

Co-authored-by: David Gumberg <davidzgumberg@gmail.com>
2025-09-25 18:12:02 +01:00
MarcoFalke
fa6b2e9efe ci: Turn centos config into alpine musl config 2025-09-25 14:10:20 +02:00
will
00c253d494 ci: disable cirrus cache in 32bit arm job
Co-authored-by: Max Edwards <youwontforgetthis@gmail.com>
Add an optional matrix field allowing opt-out of configuring cirrus
GHA cache when not using cirrus runners.

This is not needed for the cirruslabs/[save|restore]-cache actions, as
they automatically fallback based on runner type.
2025-09-10 21:34:09 +01:00
will
ff18b6bbaf ci: refactor docker action to return provider str
Avoid relying on future truthy evaluations of string 'false'.
2025-09-10 21:34:07 +01:00
merge-script
13809b867a Merge bitcoin/bitcoin#33303: ci: Checkout latest merged pulls
fa8f081af3 ci: Checkout latest merged pulls (MarcoFalke)

Pull request description:

  Currently, the `actions/checkout@v5` checks out pull requests merged against master, which is what we want.

  However, it checks out ancient/stale merge commits on a re-run. This is documented (https://docs.github.com/en/actions/how-tos/manage-workflow-runs/re-run-workflows-and-jobs):

  >  Re-run workflows [...] will also use the same GITHUB_SHA (commit SHA) and GITHUB_REF (git ref) of the original event that triggered the workflow run.

  For example:

  * https://github.com/bitcoin/bitcoin/actions/runs/17458152407/job/49579638898?pr=29641#step:9:914 compiles with IPC=ON, even though latest master is at ed2ff3c63d
  * https://github.com/bitcoin/bitcoin/pull/32989#issuecomment-3133536724 (example explained in comment)

  This is problematic, because:

  * Unrelated CI failures and intermittent issues, which are fixed or worked around in latest master can not be cleaned by re-running the task. The author has to actively go out and (force-)push the branch, invalidating review.
  * It is odd to have a recent CI run, but it uses code and config from the past.
  * Detecting silent merge conflicts by re-running the CI task is impossible.

  Fix all issues by checking out the latest merged state of the pull request. The behavior is unchanged for non-pull-request actions. This patch changes the "re-run" default behaviour. Forcing it to use the new state instead of running the old state again.

ACKs for top commit:
  janb84:
    re ACK fa8f081af3
  hebasto:
    ACK fa8f081af3.

Tree-SHA512: c22c6f837402f61ec46be46817473e1946424b5312e36ed0e246cadb1ca89c04163bb471f71c309765a3d327f198a83cd83679d231f03828a99a97562a622fdd
2025-09-09 10:16:00 +01:00
merge-script
e749205f83 Merge bitcoin/bitcoin#33319: ci: reduce runner sizes on various jobs
5eeb2facbb ci: reduce runner sizes on various jobs (will)

Pull request description:

  These jobs can likely use reduced runner sizes to avoid wasting our CPU quota, as much of the long-running part of the job is single-threaded.

  This will also give us more (job) parallelisem from the same number of CPU that we are using.

  Suggested in: https://github.com/bitcoin/bitcoin/pull/32989#discussion_r2321775620

ACKs for top commit:
  kevkevinpal:
    ACK [5eeb2fa](5eeb2facbb)
  m3dwards:
    ACK 5eeb2facbb
  janb84:
    ACK 5eeb2facbb

Tree-SHA512: 6fb0352bc40623dd63b9bd6169d753d1ec9667c272445fda7a2db8bbedfa35350a51d08c1adf3fa5e070e84855c3f491668726d3c7ded07a39f2f9c63edacefc
2025-09-09 10:12:28 +01:00
MarcoFalke
fa8f081af3 ci: Checkout latest merged pulls 2025-09-07 11:33:42 +02:00
Pieter Wuille
6aee573bfc ci: enable IPC tests in CI 2025-09-05 09:24:17 -04:00
Ryan Ofsky
3cceb60a71 test: Provide path to bitcoin binary
Set new `BitcoinTestFramework.binary_paths.bitcoin_bin` property with path to
the `bitcoin` wrapper binary. This allows new tests for `bitcoin-mine` in
#30437 and `bitcoin-cli` in #32297 to find the `bitcoin` binary and call
`bitcoin -m` to start nodes with IPC support. This way the new tests can run
whenever the ENABLE_IPC build option is enabled, instead of only running when
the `BITCOIN_CMD` environment variable is set to `bitcoin -m`
2025-09-05 07:15:29 -04:00
will
5eeb2facbb ci: reduce runner sizes on various jobs
These jobs can use reduced runner size to avoid wasting CPU, as much of
the long-running part of the job is single-threaded.

Suggested in: https://github.com/bitcoin/bitcoin/pull/32989#discussion_r2321775620

Co-authored-by: MarcoFalke <*~=`'#}+{/-|&$^_@721217.xyz>
2025-09-04 19:58:42 +01:00
MarcoFalke
fae610d858 ci: Remove redundant RUN_UNIT_TESTS_SEQUENTIAL 2025-09-04 12:08:39 +02:00
will
3f339e99e0 ci: dynamically match makejobs with cores
Previously jobs were running on a large multi-core server where 10 jobs
as default made sense (or may even have been on the low side).

Using hosted runners with fixed (and lower) numbers of vCPUs we should
adapt compilation to match the number of cpus we have dynamically.

This is cross-platform compatible with macos and linux only.
2025-09-01 16:22:31 +01:00
will
bc41848d00 ci: port lint
Co-authored-by: Max Edwards <youwontforgetthis@gmail.com>
2025-09-01 16:22:29 +01:00
will
d290a8e6ea ci: port msan-depends
Co-authored-by: Max Edwards <youwontforgetthis@gmail.com>
2025-09-01 16:22:28 +01:00
will
9bbae61e3b ci: port tsan-depends
Co-authored-by: Max Edwards <youwontforgetthis@gmail.com>
2025-09-01 16:22:27 +01:00
will
bf7d536452 ci: port tidy
Co-authored-by: Max Edwards <youwontforgetthis@gmail.com>
2025-09-01 16:22:26 +01:00
will
549074bc64 ci: port centos-depends-gui
Co-authored-by: Max Edwards <youwontforgetthis@gmail.com>
2025-09-01 16:22:25 +01:00
will
58e38c3a04 ci: port previous-releases-depends-debug
Co-authored-by: Max Edwards <youwontforgetthis@gmail.com>
2025-09-01 16:22:24 +01:00
will
341196d75c ci: port fuzzer-address-undefined-integer-nodepends
Co-authored-by: Max Edwards <youwontforgetthis@gmail.com>
2025-09-01 16:22:23 +01:00
will
f2068f26c1 ci: port no-IPC-i686-DEBUG
Co-authored-by: Max Edwards <youwontforgetthis@gmail.com>
2025-09-01 16:22:22 +01:00
will
2a00b12d73 ci: port nowallet-libbitcoinkernel
Co-authored-by: Max Edwards <youwontforgetthis@gmail.com>
2025-09-01 16:22:21 +01:00
will
9c2514de53 ci: port mac-cross-gui-notests
Co-authored-by: Max Edwards <youwontforgetthis@gmail.com>
2025-09-01 16:22:20 +01:00
will
884251441b ci: update asan-lsan-ubsan
Co-authored-by: Max Edwards <youwontforgetthis@gmail.com>
2025-09-01 16:22:18 +01:00
will
f253031cb8 ci: port arm 32-bit job
Co-authored-by: Max Edwards <youwontforgetthis@gmail.com>
2025-09-01 16:22:17 +01:00
will
04e7bfbceb ci: update windows-cross job
Co-authored-by: Max Edwards <youwontforgetthis@gmail.com>
2025-09-01 10:32:06 +01:00
will
cc1735d777 ci: add job to determine runner type
To remove multiple occurances of the respository name, against which we
compare `${{ github.repository }}` to check if we should use Cirrus
Runners, introduce a helper job which can check a single environment
variable and output this as an input to subsequent jobs.

Forks can maintain a trivial patch of their repo name against the
`REPO_USE_CIRRUS_RUNNERS` variable in ci.yml if they have Cirrus Runners
of their own, which will then enable cache actions and docker build
cache to use Cirrus Cache.

It's not possible to use `${{ env.USE_CIRRUS_RUNNERS }}` in the
`runs-on:` directive as the context is not supported by GitHub.

If it was, this job would no longer be necessary.
2025-09-01 10:32:05 +01:00
will
020069e6b7 ci: add Cirrus cache host
Whilst the action cirruslabs/actions/cache will automatically set this
host, the docker `gha` build cache backend will not be aware of it.

Set the value here, which will later be used in the docker build args to
enable docker build cache on the cirrus cache.
2025-09-01 10:32:04 +01:00
will
fdf64e5532 ci: add configure-docker action
Another action to reduce boilerplate in the main ci.yml file.

This action will set up a docker builder compatible with caching build
layers to a container registry using the `gha` build driver.

It will then configure the docker build cache args.
2025-09-01 10:32:00 +01:00
will
33ba073df7 ci: add REPO_USE_CIRRUS_RUNNERS
If set, Cirrus runners will be used on pushes to, and pull requests
against, this repository.

Forks can set this if they have their own cirrus runners.
2025-09-01 10:31:59 +01:00
will
b232b0fa5e ci: add caching actions
Add "Restore" and "Save" caching actions.

These actions reduce boilerplate in the main ci.yml configuration file.

These actions are implemented so that caches will be saved on `push`
only.

When a pull request is opened it will cache hit on the caches from the
lastest push, or in the case of depends will hit on any matching depends
hash, falling back to partial matches.

Depends caches are hashed using
`$(git ls-tree HEAD depends "ci/test/$FILE_ENV" | sha256sum | cut -d' ' -f1)`
and this hash is passed in as an input to the actions. This means we
direct cache hit in cases where depends would not be re-built, otherwise
falling back to a partial match.

Previous releases cache is hashed similarly to depends, but using the
test/get_previous_releases.py file.

The cirruslabs cache action will fallback transparently to GitHub's
cache in the case that the job is not being run on a Cirrus Runner,
making these compatible with running on forks (on free GH hardware).
2025-09-01 10:31:58 +01:00
will
b8fcc9fcbc ci: add configure environment action 2025-09-01 10:31:58 +01:00