Skip to content

Commit 88105c6

Browse files
authored
Adapt to upstream C API changes (#11)
Handle nil slices in raw data constructors using `unsafe.SliceData()` (Go 1.20+) instead of `&slice[0]` for safer CGO interop with null pointers. Remove `Chain.GetTip()` and `Chain.GetGenesis()` methods, aligning with upstream removal of `btck_chain_get_tip` and `btck_chain_get_genesis`.
2 parents 8a3da24 + a8344b7 commit 88105c6

File tree

187 files changed

+2781
-1878
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

187 files changed

+2781
-1878
lines changed

depend/bitcoin/.github/actions/configure-docker/action.yml

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -8,16 +8,11 @@ runs:
88
using: 'composite'
99
steps:
1010
- name: Check inputs
11-
shell: bash
11+
shell: python
1212
run: |
1313
# We expect only gha or cirrus as inputs to cache-provider
14-
case "${{ inputs.cache-provider }}" in
15-
gha|cirrus)
16-
;;
17-
*)
18-
echo "::warning title=Unknown input to configure docker action::Provided value was ${{ inputs.cache-provider }}"
19-
;;
20-
esac
14+
if "${{ inputs.cache-provider }}" not in ("gha", "cirrus"):
15+
print("::warning title=Unknown input to configure docker action::Provided value was ${{ inputs.cache-provider }}")
2116
2217
- name: Set up Docker Buildx
2318
uses: docker/setup-buildx-action@v3
Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
#!/usr/bin/env python3
2+
# Copyright (c) The Bitcoin Core developers
3+
# Distributed under the MIT software license, see the accompanying
4+
# file COPYING or https://opensource.org/license/mit.
5+
6+
import os
7+
import shlex
8+
import subprocess
9+
import sys
10+
import time
11+
12+
13+
def run(cmd, **kwargs):
14+
print("+ " + shlex.join(cmd), flush=True)
15+
kwargs.setdefault("check", True)
16+
try:
17+
return subprocess.run(cmd, **kwargs)
18+
except Exception as e:
19+
sys.exit(e)
20+
21+
22+
def main():
23+
CONTAINER_NAME = os.environ["CONTAINER_NAME"]
24+
25+
build_cmd = [
26+
"docker", "buildx", "build",
27+
f"--tag={CONTAINER_NAME}",
28+
*shlex.split(os.getenv("DOCKER_BUILD_CACHE_ARG", "")),
29+
"--file=./ci/lint_imagefile",
30+
"."
31+
]
32+
33+
if run(build_cmd, check=False).returncode != 0:
34+
print("Retry building image tag after failure")
35+
time.sleep(3)
36+
run(build_cmd)
37+
38+
extra_env = []
39+
if os.environ["GITHUB_EVENT_NAME"] == "pull_request":
40+
extra_env = ["--env", "LINT_CI_IS_PR=1"]
41+
if os.environ["GITHUB_EVENT_NAME"] != "pull_request" and os.environ["GITHUB_REPOSITORY"] == "bitcoin/bitcoin":
42+
extra_env = ["--env", "LINT_CI_SANITY_CHECK_COMMIT_SIG=1"]
43+
44+
run([
45+
"docker",
46+
"run",
47+
"--rm",
48+
*extra_env,
49+
f"--volume={os.getcwd()}:/bitcoin",
50+
CONTAINER_NAME,
51+
])
52+
53+
54+
if __name__ == "__main__":
55+
main()

depend/bitcoin/.github/ci-test-each-commit-exec.py

Lines changed: 7 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -21,11 +21,12 @@ def main():
2121
run(["git", "log", "-1"])
2222

2323
num_procs = int(run(["nproc"], stdout=subprocess.PIPE).stdout)
24+
build_dir = "ci_build"
2425

2526
run([
2627
"cmake",
2728
"-B",
28-
"build",
29+
build_dir,
2930
"-Werror=dev",
3031
# Use clang++, because it is a bit faster and uses less memory than g++
3132
"-DCMAKE_C_COMPILER=clang",
@@ -37,28 +38,23 @@ def main():
3738
"-DAPPEND_CFLAGS='-O3 -g2'",
3839
"-DCMAKE_BUILD_TYPE=Debug",
3940
"-DWERROR=ON",
40-
"-DWITH_ZMQ=ON",
41-
"-DBUILD_GUI=ON",
42-
"-DBUILD_BENCH=ON",
43-
"-DBUILD_FUZZ_BINARY=ON",
44-
"-DWITH_USDT=ON",
45-
"-DBUILD_KERNEL_LIB=ON",
46-
"-DBUILD_KERNEL_TEST=ON",
41+
"--preset=dev-mode",
42+
# Tolerate unused member functions in intermediate commits in a pull request
4743
"-DCMAKE_CXX_FLAGS=-Wno-error=unused-member-function",
4844
])
49-
run(["cmake", "--build", "build", "-j", str(num_procs)])
45+
run(["cmake", "--build", build_dir, "-j", str(num_procs)])
5046
run([
5147
"ctest",
5248
"--output-on-failure",
5349
"--stop-on-failure",
5450
"--test-dir",
55-
"build",
51+
build_dir,
5652
"-j",
5753
str(num_procs),
5854
])
5955
run([
6056
sys.executable,
61-
"./build/test/functional/test_runner.py",
57+
f"./{build_dir}/test/functional/test_runner.py",
6258
"-j",
6359
str(num_procs * 2),
6460
"--combinedlogslen=99999999",

depend/bitcoin/.github/workflows/ci.yml

Lines changed: 43 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -35,10 +35,12 @@ jobs:
3535
outputs:
3636
provider: ${{ steps.runners.outputs.provider }}
3737
steps:
38-
- name: Annotate with pull request number
38+
- &ANNOTATION_PR_NUMBER
39+
name: Annotate with pull request number
3940
# This annotation is machine-readable and can be used to assign a check
40-
# run to its corresponding pull request. Running in one check run is
41-
# sufficient for each check suite.
41+
# run to its corresponding pull request. Running in all check runs is
42+
# required, because check re-runs discard the annotations of other
43+
# tasks in the test suite.
4244
run: |
4345
if [ "${{ github.event_name }}" = "pull_request" ]; then
4446
echo "::notice title=debug_pull_request_number_str::${{ github.event.number }}"
@@ -63,6 +65,7 @@ jobs:
6365
steps:
6466
- name: Determine fetch depth
6567
run: echo "FETCH_DEPTH=$((${{ github.event.pull_request.commits }} + 2))" >> "$GITHUB_ENV"
68+
- *ANNOTATION_PR_NUMBER
6669
- uses: actions/checkout@v5
6770
with:
6871
ref: ${{ github.event.pull_request.head.sha }}
@@ -131,16 +134,18 @@ jobs:
131134
include:
132135
- job-type: standard
133136
file-env: './ci/test/00_setup_env_mac_native.sh'
134-
job-name: 'macOS native, no depends, sqlite only, gui'
137+
job-name: 'macOS native'
135138
- job-type: fuzz
136139
file-env: './ci/test/00_setup_env_mac_native_fuzz.sh'
137140
job-name: 'macOS native, fuzz'
138141

139142
env:
140143
DANGER_RUN_CI_ON_HOST: 1
141-
BASE_ROOT_DIR: ${{ github.workspace }}
144+
BASE_ROOT_DIR: ${{ github.workspace }}/repo_archive
142145

143146
steps:
147+
- *ANNOTATION_PR_NUMBER
148+
144149
- &CHECKOUT
145150
name: Checkout
146151
uses: actions/checkout@v5
@@ -176,14 +181,22 @@ jobs:
176181
key: ${{ github.job }}-${{ matrix.job-type }}-ccache-${{ github.run_id }}
177182
restore-keys: ${{ github.job }}-${{ matrix.job-type }}-ccache-
178183

184+
- name: Create git archive
185+
run: |
186+
git log -1
187+
git archive --format=tar --prefix=repo_archive/ --output=repo.tar HEAD
188+
tar -xf repo.tar
189+
179190
- name: CI script
180-
run: ./ci/test_run_all.sh
191+
run: |
192+
cd repo_archive
193+
./ci/test_run_all.sh
181194
env:
182195
FILE_ENV: ${{ matrix.file-env }}
183196

184197
- name: Save Ccache cache
185198
uses: actions/cache/save@v4
186-
if: github.event_name != 'pull_request' && steps.ccache-cache.outputs.cache-hit != 'true'
199+
if: github.event_name != 'pull_request' && github.ref_name == github.event.repository.default_branch && steps.ccache-cache.outputs.cache-hit != 'true'
187200
with:
188201
path: ${{ env.CCACHE_DIR }}
189202
# https://github.com/actions/cache/blob/main/tips-and-workarounds.md#update-a-cache
@@ -212,6 +225,8 @@ jobs:
212225
job-name: 'Windows native, fuzz, VS 2022'
213226

214227
steps:
228+
- *ANNOTATION_PR_NUMBER
229+
215230
- *CHECKOUT
216231

217232
- &SET_UP_VS
@@ -261,7 +276,7 @@ jobs:
261276
262277
- name: Save vcpkg binary cache
263278
uses: actions/cache/save@v4
264-
if: github.event_name != 'pull_request' && steps.vcpkg-binary-cache.outputs.cache-hit != 'true' && matrix.job-type == 'standard'
279+
if: github.event_name != 'pull_request' && github.ref_name == github.event.repository.default_branch && steps.vcpkg-binary-cache.outputs.cache-hit != 'true' && matrix.job-type == 'standard'
265280
with:
266281
path: ~/AppData/Local/vcpkg/archives
267282
key: ${{ github.job }}-vcpkg-binary-${{ hashFiles('cmake_version', 'msbuild_version', 'toolset_version', 'vcpkg.json') }}
@@ -295,8 +310,6 @@ jobs:
295310
- name: Run test suite
296311
if: matrix.job-type == 'standard'
297312
working-directory: build
298-
env:
299-
QT_PLUGIN_PATH: '${{ github.workspace }}\build\vcpkg_installed\x64-windows\Qt6\plugins'
300313
run: |
301314
ctest --output-on-failure --stop-on-failure -j $NUMBER_OF_PROCESSORS -C Release
302315
@@ -331,7 +344,7 @@ jobs:
331344
py -3 test/fuzz/test_runner.py --par $NUMBER_OF_PROCESSORS --loglevel DEBUG "${RUNNER_TEMP}/qa-assets/fuzz_corpora"
332345
333346
windows-cross:
334-
name: 'Linux->Windows cross, no tests'
347+
name: 'Windows-cross to x86_64'
335348
needs: runners
336349
runs-on: ${{ needs.runners.outputs.provider == 'cirrus' && 'ghcr.io/cirruslabs/ubuntu-runner-amd64:24.04-sm' || 'ubuntu-24.04' }}
337350
if: ${{ vars.SKIP_BRANCH_PUSH != 'true' || github.event_name == 'pull_request' }}
@@ -341,6 +354,8 @@ jobs:
341354
DANGER_CI_ON_HOST_FOLDERS: 1
342355

343356
steps:
357+
- *ANNOTATION_PR_NUMBER
358+
344359
- *CHECKOUT
345360

346361
- name: Configure environment
@@ -366,6 +381,7 @@ jobs:
366381
with:
367382
name: x86_64-w64-mingw32-executables-${{ github.run_id }}
368383
path: |
384+
${{ env.BASE_BUILD_DIR }}/bin/*.dll
369385
${{ env.BASE_BUILD_DIR }}/bin/*.exe
370386
${{ env.BASE_BUILD_DIR }}/src/secp256k1/bin/*.exe
371387
${{ env.BASE_BUILD_DIR }}/src/univalue/*.exe
@@ -381,6 +397,8 @@ jobs:
381397
TEST_RUNNER_TIMEOUT_FACTOR: 40
382398

383399
steps:
400+
- *ANNOTATION_PR_NUMBER
401+
384402
- *CHECKOUT
385403

386404
- name: Download built executables
@@ -461,14 +479,14 @@ jobs:
461479
fail-fast: false
462480
matrix:
463481
include:
464-
- name: '32 bit ARM, unit tests, no functional tests'
482+
- name: '32 bit ARM'
465483
cirrus-runner: 'ubuntu-24.04-arm' # Cirrus' Arm runners are Apple (with virtual Linux aarch64), which doesn't support 32-bit mode
466484
fallback-runner: 'ubuntu-24.04-arm'
467485
timeout-minutes: 120
468486
file-env: './ci/test/00_setup_env_arm.sh'
469487
provider: 'gha'
470488

471-
- name: 'ASan + LSan + UBSan + integer, no depends, USDT'
489+
- name: 'ASan + LSan + UBSan + integer'
472490
cirrus-runner: 'ghcr.io/cirruslabs/ubuntu-runner-amd64:24.04-md' # has to match container in ci/test/00_setup_env_native_asan.sh for tracing tools
473491
fallback-runner: 'ubuntu-24.04'
474492
timeout-minutes: 120
@@ -486,13 +504,13 @@ jobs:
486504
timeout-minutes: 120
487505
file-env: './ci/test/00_setup_env_mac_cross_intel.sh'
488506

489-
- name: 'No wallet, libbitcoinkernel'
507+
- name: 'No wallet'
490508
cirrus-runner: 'ghcr.io/cirruslabs/ubuntu-runner-amd64:24.04-sm'
491509
fallback-runner: 'ubuntu-24.04'
492510
timeout-minutes: 120
493-
file-env: './ci/test/00_setup_env_native_nowallet_libbitcoinkernel.sh'
511+
file-env: './ci/test/00_setup_env_native_nowallet.sh'
494512

495-
- name: 'no IPC, i686, DEBUG'
513+
- name: 'i686, no IPC'
496514
cirrus-runner: 'ghcr.io/cirruslabs/ubuntu-runner-amd64:24.04-md'
497515
fallback-runner: 'ubuntu-24.04'
498516
timeout-minutes: 120
@@ -510,13 +528,13 @@ jobs:
510528
timeout-minutes: 240
511529
file-env: './ci/test/00_setup_env_native_fuzz_with_valgrind.sh'
512530

513-
- name: 'previous releases, depends DEBUG'
531+
- name: 'previous releases'
514532
cirrus-runner: 'ghcr.io/cirruslabs/ubuntu-runner-amd64:24.04-md'
515533
fallback-runner: 'ubuntu-24.04'
516534
timeout-minutes: 120
517535
file-env: './ci/test/00_setup_env_native_previous_releases.sh'
518536

519-
- name: 'Alpine (musl), depends, gui'
537+
- name: 'Alpine (musl)'
520538
cirrus-runner: 'ghcr.io/cirruslabs/ubuntu-runner-amd64:24.04-md'
521539
fallback-runner: 'ubuntu-24.04'
522540
timeout-minutes: 120
@@ -528,7 +546,7 @@ jobs:
528546
timeout-minutes: 120
529547
file-env: './ci/test/00_setup_env_native_tidy.sh'
530548

531-
- name: 'TSan, depends, no gui'
549+
- name: 'TSan'
532550
cirrus-runner: 'ghcr.io/cirruslabs/ubuntu-runner-amd64:24.04-md'
533551
fallback-runner: 'ubuntu-24.04'
534552
timeout-minutes: 120
@@ -540,13 +558,15 @@ jobs:
540558
timeout-minutes: 150
541559
file-env: './ci/test/00_setup_env_native_fuzz_with_msan.sh'
542560

543-
- name: 'MSan, depends'
561+
- name: 'MSan'
544562
cirrus-runner: 'ghcr.io/cirruslabs/ubuntu-runner-amd64:24.04-lg'
545563
fallback-runner: 'ubuntu-24.04'
546564
timeout-minutes: 120
547565
file-env: './ci/test/00_setup_env_native_msan.sh'
548566

549567
steps:
568+
- *ANNOTATION_PR_NUMBER
569+
550570
- *CHECKOUT
551571

552572
- name: Configure environment
@@ -587,6 +607,8 @@ jobs:
587607
env:
588608
CONTAINER_NAME: "bitcoin-linter"
589609
steps:
610+
- *ANNOTATION_PR_NUMBER
611+
590612
- name: Checkout
591613
uses: actions/checkout@v5
592614
with:
@@ -599,11 +621,4 @@ jobs:
599621
cache-provider: ${{ needs.runners.outputs.provider }}
600622

601623
- name: CI script
602-
run: |
603-
set -o xtrace
604-
docker buildx build -t "$CONTAINER_NAME" $DOCKER_BUILD_CACHE_ARG --file "./ci/lint_imagefile" .
605-
CIRRUS_PR_FLAG=""
606-
if [ "${{ github.event_name }}" = "pull_request" ]; then
607-
CIRRUS_PR_FLAG="-e CIRRUS_PR=1"
608-
fi
609-
docker run --rm $CIRRUS_PR_FLAG -v "$(pwd)":/bitcoin "$CONTAINER_NAME"
624+
run: python .github/ci-lint-exec.py

0 commit comments

Comments
 (0)