Skip to content

Commit ab3a296

Browse files
ryanofskyjanus
authored andcommitted
Squashed 'src/ipc/libmultiprocess/' changes from b4120d34bad2..1b8d4a6f1e54
1b8d4a6f1e54 Merge bitcoin-core/libmultiprocess#194: mpgen: Work around c++20 / capnproto 0.8 incompatibility f1fad396bf5f Merge bitcoin-core/libmultiprocess#195: ci: Add openbsd eed42f210d17 ci: Bump all tasks to actions/checkout@v5 486a510bbeff ci: Remove ancient and problematic -lstdc++fs in mpexample dd40897efe79 Add missing thread include 98414e7d2867 ci: Add openbsd dc3ba2204606 cmake, doc: Add check for CVE-2022-46149 cb170d4913a2 Merge bitcoin-core/libmultiprocess#193: build: require CapnProto 0.7.0 or better 8ceeaa6ae401 ci: Add olddeps job to test old dependencies versions c4cb758eccb5 mpgen: Work around c++20 / capnproto 0.8 incompatibility 30930dff7b06 build: require CapnProto 0.7.0 or better git-subtree-dir: src/ipc/libmultiprocess git-subtree-split: 1b8d4a6f1e54b92708bd2ad627ec6d440a1daf3d
1 parent 4dbdb6f commit ab3a296

File tree

11 files changed

+129
-269
lines changed

11 files changed

+129
-269
lines changed

.github/workflows/ci.yml

Lines changed: 31 additions & 258 deletions
Original file line numberDiff line numberDiff line change
@@ -5,274 +5,47 @@ on:
55
pull_request:
66

77
jobs:
8-
test-each-commit:
9-
name: 'test each commit'
10-
runs-on: ubuntu-24.04
11-
if: github.event_name == 'pull_request' && github.event.pull_request.commits != 1
12-
timeout-minutes: 360 # Use maximum time, see https://docs.github.com/en/actions/writing-workflows/workflow-syntax-for-github-actions#jobsjob_idtimeout-minutes. Assuming a worst case time of 1 hour per commit, this leads to a --max-count=6 below.
13-
env:
14-
MAX_COUNT: 6
8+
build-openbsd:
9+
runs-on: ubuntu-latest
10+
name: build • openbsd
11+
defaults:
12+
run:
13+
shell: openbsd {0}
1514
steps:
16-
- name: Determine fetch depth
17-
run: echo "FETCH_DEPTH=$((${{ github.event.pull_request.commits }} + 2))" >> "$GITHUB_ENV"
1815
- uses: actions/checkout@v5
19-
with:
20-
ref: ${{ github.event.pull_request.head.sha }}
21-
fetch-depth: ${{ env.FETCH_DEPTH }}
22-
- name: Determine commit range
23-
run: |
24-
# Checkout HEAD~ and find the test base commit
25-
# Checkout HEAD~ because it would be wasteful to rerun tests on the PR
26-
# head commit that are already run by other jobs.
27-
git checkout HEAD~
28-
# Figure out test base commit by listing ancestors of HEAD, excluding
29-
# ancestors of the most recent merge commit, limiting the list to the
30-
# newest MAX_COUNT ancestors, ordering it from oldest to newest, and
31-
# taking the first one.
32-
#
33-
# If the branch contains up to MAX_COUNT ancestor commits after the
34-
# most recent merge commit, all of those commits will be tested. If it
35-
# contains more, only the most recent MAX_COUNT commits will be
36-
# tested.
37-
#
38-
# In the command below, the ^@ suffix is used to refer to all parents
39-
# of the merge commit as described in:
40-
# https://git-scm.com/docs/git-rev-parse#_other_rev_parent_shorthand_notations
41-
# and the ^ prefix is used to exclude these parents and all their
42-
# ancestors from the rev-list output as described in:
43-
# https://git-scm.com/docs/git-rev-list
44-
MERGE_BASE=$(git rev-list -n1 --merges HEAD)
45-
EXCLUDE_MERGE_BASE_ANCESTORS=
46-
# MERGE_BASE can be empty due to limited fetch-depth
47-
if test -n "$MERGE_BASE"; then
48-
EXCLUDE_MERGE_BASE_ANCESTORS=^${MERGE_BASE}^@
49-
fi
50-
echo "TEST_BASE=$(git rev-list -n$((${{ env.MAX_COUNT }} + 1)) --reverse HEAD $EXCLUDE_MERGE_BASE_ANCESTORS | head -1)" >> "$GITHUB_ENV"
51-
- run: |
52-
git fetch origin "${GITHUB_BASE_REF}"
53-
git config user.email "[email protected]"
54-
git config user.name "CI"
55-
- run: |
56-
sudo apt-get update
57-
sudo apt-get install clang mold ccache build-essential cmake ninja-build pkgconf python3-zmq libevent-dev libboost-dev libsqlite3-dev systemtap-sdt-dev libzmq3-dev qt6-base-dev qt6-tools-dev qt6-l10n-tools libqrencode-dev capnproto libcapnp-dev -y
58-
- name: Compile and run tests
59-
run: |
60-
# Run tests on commits after the last merge commit and before the PR head commit
61-
git rebase --exec "git merge --no-commit origin/${GITHUB_BASE_REF} && python3 ./.github/ci-test-each-commit-exec.py && git reset --hard" ${{ env.TEST_BASE }}
62-
63-
macos-native-arm64:
64-
name: ${{ matrix.job-name }}
65-
# Use any image to support the xcode-select below, but hardcode version to avoid silent upgrades (and breaks).
66-
# See: https://github.com/actions/runner-images#available-images.
67-
runs-on: macos-14
68-
69-
# When a contributor maintains a fork of the repo, any pull request they make
70-
# to their own fork, or to the main repository, will trigger two CI runs:
71-
# one for the branch push and one for the pull request.
72-
# This can be avoided by setting SKIP_BRANCH_PUSH=true as a custom env variable
73-
# in Github repository settings.
74-
if: ${{ vars.SKIP_BRANCH_PUSH != 'true' || github.event_name == 'pull_request' }}
75-
76-
timeout-minutes: 120
77-
78-
strategy:
79-
fail-fast: false
80-
matrix:
81-
job-type: [standard, fuzz]
82-
include:
83-
- job-type: standard
84-
file-env: './ci/test/00_setup_env_mac_native.sh'
85-
job-name: 'macOS 14 native, arm64, no depends, sqlite only, gui'
86-
- job-type: fuzz
87-
file-env: './ci/test/00_setup_env_mac_native_fuzz.sh'
88-
job-name: 'macOS 14 native, arm64, fuzz'
89-
90-
env:
91-
DANGER_RUN_CI_ON_HOST: 1
92-
BASE_ROOT_DIR: ${{ github.workspace }}
93-
94-
steps:
95-
- name: Checkout
96-
uses: actions/checkout@v5
97-
98-
- name: Clang version
99-
run: |
100-
# Use the earliest Xcode supported by the version of macOS denoted in
101-
# doc/release-notes-empty-template.md and providing at least the
102-
# minimum clang version denoted in doc/dependencies.md.
103-
# See: https://developer.apple.com/documentation/xcode-release-notes/xcode-15-release-notes
104-
sudo xcode-select --switch /Applications/Xcode_15.0.app
105-
clang --version
106-
107-
- name: Install Homebrew packages
108-
env:
109-
HOMEBREW_NO_INSTALLED_DEPENDENTS_CHECK: 1
110-
run: |
111-
# A workaround for "The `brew link` step did not complete successfully" error.
112-
brew install --quiet python@3 || brew link --overwrite python@3
113-
brew install --quiet coreutils ninja pkgconf gnu-getopt ccache boost libevent zeromq qt@6 qrencode capnp
114-
115-
- name: Set Ccache directory
116-
run: echo "CCACHE_DIR=${RUNNER_TEMP}/ccache_dir" >> "$GITHUB_ENV"
11716

118-
- name: Restore Ccache cache
119-
id: ccache-cache
120-
uses: actions/cache/restore@v4
17+
- name: Start OpenBSD VM
18+
uses: vmactions/openbsd-vm@v1
12119
with:
122-
path: ${{ env.CCACHE_DIR }}
123-
key: ${{ github.job }}-${{ matrix.job-type }}-ccache-${{ github.run_id }}
124-
restore-keys: ${{ github.job }}-${{ matrix.job-type }}-ccache-
125-
126-
- name: CI script
127-
run: ./ci/test_run_all.sh
128-
env:
129-
FILE_ENV: ${{ matrix.file-env }}
130-
131-
- name: Save Ccache cache
132-
uses: actions/cache/save@v4
133-
if: github.event_name != 'pull_request' && steps.ccache-cache.outputs.cache-hit != 'true'
134-
with:
135-
path: ${{ env.CCACHE_DIR }}
136-
# https://github.com/actions/cache/blob/main/tips-and-workarounds.md#update-a-cache
137-
key: ${{ github.job }}-${{ matrix.job-type }}-ccache-${{ github.run_id }}
138-
139-
windows-native-dll:
140-
name: ${{ matrix.job-name }}
141-
runs-on: windows-2022
142-
143-
if: ${{ vars.SKIP_BRANCH_PUSH != 'true' || github.event_name == 'pull_request' }}
20+
prepare: |
21+
pkg_add -v cmake ninja git python bash
22+
run: |
23+
git clone --depth=1 https://codeberg.org/OpenBSD/ports.git /usr/ports
24+
sync: 'rsync'
25+
copyback: false
14426

145-
env:
146-
PYTHONUTF8: 1
147-
TEST_RUNNER_TIMEOUT_FACTOR: 40
148-
149-
strategy:
150-
fail-fast: false
151-
matrix:
152-
job-type: [standard, fuzz]
153-
include:
154-
- job-type: standard
155-
generate-options: '-DBUILD_GUI=ON -DWITH_ZMQ=ON -DBUILD_BENCH=ON -DWERROR=ON'
156-
job-name: 'Windows native, VS 2022'
157-
- job-type: fuzz
158-
generate-options: '-DVCPKG_MANIFEST_NO_DEFAULT_FEATURES=ON -DVCPKG_MANIFEST_FEATURES="wallet" -DBUILD_GUI=OFF -DBUILD_FOR_FUZZING=ON -DWERROR=ON'
159-
job-name: 'Windows native, fuzz, VS 2022'
160-
161-
steps:
162-
- name: Checkout
163-
uses: actions/checkout@v5
164-
165-
- name: Configure Developer Command Prompt for Microsoft Visual C++
166-
# Using microsoft/setup-msbuild is not enough.
167-
uses: ilammy/msvc-dev-cmd@v1
168-
with:
169-
arch: x64
170-
171-
- name: Get tool information
172-
shell: pwsh
173-
run: |
174-
cmake -version | Tee-Object -FilePath "cmake_version"
175-
Write-Output "---"
176-
msbuild -version | Tee-Object -FilePath "msbuild_version"
177-
$env:VCToolsVersion | Tee-Object -FilePath "toolset_version"
178-
py -3 --version
179-
Write-Host "PowerShell version $($PSVersionTable.PSVersion.ToString())"
180-
bash --version
181-
182-
- name: Using vcpkg with MSBuild
27+
- name: Install capnproto
18328
run: |
184-
echo "set(VCPKG_BUILD_TYPE release)" >> "${VCPKG_INSTALLATION_ROOT}/triplets/x64-windows.cmake"
185-
# Workaround for libevent, which requires CMake 3.1 but is incompatible with CMake >= 4.0.
186-
sed -i '1s/^/set(ENV{CMAKE_POLICY_VERSION_MINIMUM} 3.5)\n/' "${VCPKG_INSTALLATION_ROOT}/scripts/ports.cmake"
187-
188-
- name: vcpkg tools cache
189-
uses: actions/cache@v4
190-
with:
191-
path: C:/vcpkg/downloads/tools
192-
key: ${{ github.job }}-vcpkg-tools
193-
194-
- name: Restore vcpkg binary cache
195-
uses: actions/cache/restore@v4
196-
id: vcpkg-binary-cache
197-
with:
198-
path: ~/AppData/Local/vcpkg/archives
199-
key: ${{ github.job }}-vcpkg-binary-${{ hashFiles('cmake_version', 'msbuild_version', 'toolset_version', 'vcpkg.json') }}
29+
cd /usr/ports/devel/capnproto/
30+
make install
20031
201-
- name: Generate build system
32+
- name: Run CI script
20233
run: |
203-
cmake -B build -Werror=dev --preset vs2022 -DCMAKE_TOOLCHAIN_FILE="${VCPKG_INSTALLATION_ROOT}/scripts/buildsystems/vcpkg.cmake" ${{ matrix.generate-options }}
34+
cd ${{ github.workspace }}
35+
CI_CONFIG="ci/configs/openbsd.bash" bash ci/scripts/ci.sh
20436
205-
- name: Save vcpkg binary cache
206-
uses: actions/cache/save@v4
207-
if: github.event_name != 'pull_request' && steps.vcpkg-binary-cache.outputs.cache-hit != 'true' && matrix.job-type == 'standard'
208-
with:
209-
path: ~/AppData/Local/vcpkg/archives
210-
key: ${{ github.job }}-vcpkg-binary-${{ hashFiles('cmake_version', 'msbuild_version', 'toolset_version', 'vcpkg.json') }}
211-
212-
- name: Build
213-
working-directory: build
214-
run: |
215-
cmake --build . -j $NUMBER_OF_PROCESSORS --config Release
216-
217-
- name: Get bitcoind manifest
218-
if: matrix.job-type == 'standard'
219-
working-directory: build
220-
run: |
221-
mt.exe -nologo -inputresource:bin/Release/bitcoind.exe -out:bitcoind.manifest
222-
cat bitcoind.manifest
223-
echo
224-
mt.exe -nologo -inputresource:bin/Release/bitcoind.exe -validate_manifest
225-
226-
- name: Run test suite
227-
if: matrix.job-type == 'standard'
228-
working-directory: build
229-
env:
230-
QT_PLUGIN_PATH: '${{ github.workspace }}\build\vcpkg_installed\x64-windows\Qt6\plugins'
231-
run: |
232-
ctest --output-on-failure --stop-on-failure -j $NUMBER_OF_PROCESSORS -C Release
233-
234-
- name: Run functional tests
235-
if: matrix.job-type == 'standard'
236-
working-directory: build
237-
env:
238-
BITCOIND: '${{ github.workspace }}\build\bin\Release\bitcoind.exe'
239-
BITCOINCLI: '${{ github.workspace }}\build\bin\Release\bitcoin-cli.exe'
240-
BITCOINTX: '${{ github.workspace }}\build\bin\Release\bitcoin-tx.exe'
241-
BITCOINUTIL: '${{ github.workspace }}\build\bin\Release\bitcoin-util.exe'
242-
BITCOINWALLET: '${{ github.workspace }}\build\bin\Release\bitcoin-wallet.exe'
243-
TEST_RUNNER_EXTRA: ${{ github.event_name != 'pull_request' && '--extended' || '' }}
244-
run: py -3 test/functional/test_runner.py --jobs $NUMBER_OF_PROCESSORS --ci --quiet --tmpdirprefix="${RUNNER_TEMP}" --combinedlogslen=99999999 --timeout-factor=${TEST_RUNNER_TIMEOUT_FACTOR} ${TEST_RUNNER_EXTRA}
245-
246-
- name: Clone corpora
247-
if: matrix.job-type == 'fuzz'
248-
run: |
249-
git clone --depth=1 https://github.com/bitcoin-core/qa-assets "${RUNNER_TEMP}/qa-assets"
250-
cd "${RUNNER_TEMP}/qa-assets"
251-
echo "Using qa-assets repo from commit ..."
252-
git log -1
253-
254-
- name: Run fuzz tests
255-
if: matrix.job-type == 'fuzz'
256-
working-directory: build
257-
env:
258-
BITCOINFUZZ: '${{ github.workspace }}\build\bin\Release\fuzz.exe'
259-
run: |
260-
py -3 test/fuzz/test_runner.py --par $NUMBER_OF_PROCESSORS --loglevel DEBUG "${RUNNER_TEMP}/qa-assets/fuzz_corpora"
261-
262-
windows-cross:
263-
name: 'Linux->Windows cross, no tests'
37+
build:
26438
runs-on: ubuntu-latest
26539

26640
strategy:
26741
fail-fast: false
26842
matrix:
269-
config: [default, llvm, gnu32, sanitize]
43+
config: [default, llvm, gnu32, sanitize, olddeps]
27044

27145
name: build • ${{ matrix.config }}
27246

27347
steps:
274-
- name: Checkout
275-
uses: actions/checkout@v5
48+
- uses: actions/checkout@v5
27649

27750
- name: Install Nix
27851
uses: cachix/install-nix-action@v31 # 2025-05-27, from https://github.com/cachix/install-nix-action/tags
@@ -325,8 +98,8 @@ jobs:
32598
with:
32699
name: x86_64-w64-mingw32-executables-${{ github.run_id }}
327100

328-
- name: Run bitcoind.exe
329-
run: ./bin/bitcoind.exe -version
101+
- name: Run BGLd.exe
102+
run: ./bin/BGLd.exe -version
330103

331104
- name: Find mt.exe tool
332105
shell: pwsh
@@ -335,25 +108,25 @@ jobs:
335108
$sdk_latest = (Get-ChildItem "$sdk_dir\bin" -Directory | Where-Object { $_.Name -match '^\d+\.\d+\.\d+\.\d+$' } | Sort-Object Name -Descending | Select-Object -First 1).Name
336109
"MT_EXE=${sdk_dir}bin\${sdk_latest}\x64\mt.exe" >> $env:GITHUB_ENV
337110
338-
- name: Get bitcoind manifest
111+
- name: Get BGLd manifest
339112
shell: pwsh
340113
run: |
341-
& $env:MT_EXE -nologo -inputresource:bin\bitcoind.exe -out:bitcoind.manifest
342-
Get-Content bitcoind.manifest
343-
& $env:MT_EXE -nologo -inputresource:bin\bitcoind.exe -validate_manifest
114+
& $env:MT_EXE -nologo -inputresource:bin\BGLd.exe -out:BGLd.manifest
115+
Get-Content BGLd.manifest
116+
& $env:MT_EXE -nologo -inputresource:bin\BGLd.exe -validate_manifest
344117
345118
- name: Run unit tests
346119
# Can't use ctest here like other jobs as we don't have a CMake build tree.
347120
run: |
348-
./bin/test_bitcoin.exe -l test_suite
121+
./bin/test_BGL.exe -l test_suite
349122
./src/secp256k1/bin/exhaustive_tests.exe
350123
./src/secp256k1/bin/noverify_tests.exe
351124
./src/secp256k1/bin/tests.exe
352125
./src/univalue/object.exe
353126
./src/univalue/unitester.exe
354127
355128
- name: Run benchmarks
356-
run: ./bin/bench_bitcoin.exe -sanity-check
129+
run: ./bin/bench_BGL.exe -sanity-check
357130

358131
- name: Adjust paths in test/config.ini
359132
shell: pwsh

CMakeLists.txt

Lines changed: 23 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -60,9 +60,29 @@ option(BUILD_DAEMON "Build BGLd executable." ON)
6060
option(BUILD_GUI "Build BGL-qt executable." OFF)
6161
option(BUILD_CLI "Build BGL-cli executable." ON)
6262

63-
option(BUILD_TESTS "Build test_BGL executable." ON)
64-
option(BUILD_TX "Build BGL-tx executable." ${BUILD_TESTS})
65-
option(BUILD_UTIL "Build BGL-util executable." ${BUILD_TESTS})
63+
find_package(Threads REQUIRED)
64+
find_package(CapnProto 0.7 REQUIRED)
65+
66+
# Check for list-of-pointers memory access bug from Nov 2022
67+
# https://nvd.nist.gov/vuln/detail/CVE-2022-46149
68+
# https://github.com/advisories/GHSA-qqff-4vw4-f6hx
69+
# https://github.com/capnproto/capnproto/security/advisories/GHSA-qqff-4vw4-f6hx
70+
# https://github.com/capnproto/capnproto/blob/master/security-advisories/2022-11-30-0-pointer-list-bounds.md
71+
# https://capnproto.org/news/2022-11-30-CVE-2022-46149-security-advisory.html
72+
# https://dwrensha.github.io/capnproto-rust/2022/11/30/out_of_bounds_memory_access_bug.html
73+
if(CapnProto_VERSION STREQUAL "0.7.0"
74+
OR CapnProto_VERSION STREQUAL "0.8.0"
75+
OR CapnProto_VERSION STREQUAL "0.9.0"
76+
OR CapnProto_VERSION STREQUAL "0.9.1"
77+
OR CapnProto_VERSION STREQUAL "0.10.0"
78+
OR CapnProto_VERSION STREQUAL "0.10.1"
79+
OR CapnProto_VERSION STREQUAL "0.10.2")
80+
message(FATAL_ERROR
81+
"Cap'n Proto ${CapnProto_VERSION} is affected by CVE-2022-46149.\n"
82+
"Please install an updated package.\n"
83+
"Details: https://github.com/advisories/GHSA-qqff-4vw4-f6hx
84+
")
85+
endif()
6686

6787
set(MPGEN_EXECUTABLE "" CACHE FILEPATH "If specified, should be full path to an external mpgen binary to use rather than the one built internally.")
6888

ci/README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ CI_CONFIG=ci/configs/default.bash ci/scripts/run.sh
2020
CI_CONFIG=ci/configs/llvm.bash ci/scripts/run.sh
2121
CI_CONFIG=ci/configs/gnu32.bash ci/scripts/run.sh
2222
CI_CONFIG=ci/configs/sanitize.bash ci/scripts/run.sh
23+
CI_CONFIG=ci/configs/olddeps.bash ci/scripts/run.sh
2324
```
2425

2526
By default CI jobs will reuse their build directories. `CI_CLEAN=1` can be specified to delete them before running instead.

ci/configs/olddeps.bash

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
CI_DESC="CI job using old Cap'n Proto version"
2+
CI_DIR=build-olddeps
3+
export CXXFLAGS="-Werror -Wall -Wextra -Wpedantic -Wno-unused-parameter -Wno-error=array-bounds"
4+
NIX_ARGS=(--argstr capnprotoVersion "0.7.1")
5+
BUILD_ARGS=(-k)

ci/configs/openbsd.bash

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
CI_DESC="CI config for OpenBSD"
2+
CI_DIR=build-openbsd
3+
export CXXFLAGS="-Werror -Wall -Wextra -Wpedantic -Wno-unused-parameter"
4+
CMAKE_ARGS=(-G Ninja)
5+
BUILD_ARGS=(-k 0)

0 commit comments

Comments
 (0)