diff --git a/.github/actions/configure-docker/action.yml b/.github/actions/configure-docker/action.yml index 5c9531d35925..b4abf7c274ab 100644 --- a/.github/actions/configure-docker/action.yml +++ b/.github/actions/configure-docker/action.yml @@ -15,7 +15,7 @@ runs: print("::warning title=Unknown input to configure docker action::Provided value was ${{ inputs.cache-provider }}") - name: Set up Docker Buildx - uses: docker/setup-buildx-action@v3 + uses: docker/setup-buildx-action@v4 with: # Use host network to allow access to cirrus gha cache running on the host driver-opts: | @@ -23,7 +23,7 @@ runs: # This is required to allow buildkit to access the actions cache - name: Expose actions cache variables - uses: actions/github-script@v6 + uses: actions/github-script@v8 with: script: | Object.keys(process.env).forEach(function (key) { diff --git a/.github/actions/restore-caches/action.yml b/.github/actions/restore-caches/action.yml index 8dc35d4902ed..21f2807f4c72 100644 --- a/.github/actions/restore-caches/action.yml +++ b/.github/actions/restore-caches/action.yml @@ -5,7 +5,7 @@ runs: steps: - name: Restore Ccache cache id: ccache-cache - uses: cirruslabs/cache/restore@v4 + uses: cirruslabs/cache/restore@v5 with: path: ${{ env.CCACHE_DIR }} key: ccache-${{ env.CONTAINER_NAME }}-${{ github.run_id }} @@ -14,7 +14,7 @@ runs: - name: Restore depends sources cache id: depends-sources - uses: cirruslabs/cache/restore@v4 + uses: cirruslabs/cache/restore@v5 with: path: ${{ env.SOURCES_PATH }} key: depends-sources-${{ env.CONTAINER_NAME }}-${{ env.DEPENDS_HASH }} @@ -23,7 +23,7 @@ runs: - name: Restore built depends cache id: depends-built - uses: cirruslabs/cache/restore@v4 + uses: cirruslabs/cache/restore@v5 with: path: ${{ env.BASE_CACHE }} key: depends-built-${{ env.CONTAINER_NAME }}-${{ env.DEPENDS_HASH }} @@ -32,7 +32,7 @@ runs: - name: Restore previous releases cache id: previous-releases - uses: cirruslabs/cache/restore@v4 + uses: cirruslabs/cache/restore@v5 with: path: ${{ env.PREVIOUS_RELEASES_DIR }} key: previous-releases-${{ env.CONTAINER_NAME }}-${{ env.PREVIOUS_RELEASES_HASH }} diff --git a/.github/actions/save-caches/action.yml b/.github/actions/save-caches/action.yml index 0e3b31246c61..3072ab3f224a 100644 --- a/.github/actions/save-caches/action.yml +++ b/.github/actions/save-caches/action.yml @@ -11,28 +11,28 @@ runs: echo "previous releases direct cache hit to primary key: ${{ env.previous-releases-cache-hit }}" - name: Save Ccache cache - uses: cirruslabs/cache/save@v4 + uses: cirruslabs/cache/save@v5 if: ${{ (github.event_name == 'push') && (github.ref_name == github.event.repository.default_branch) }} with: path: ${{ env.CCACHE_DIR }} key: ccache-${{ env.CONTAINER_NAME }}-${{ github.run_id }} - name: Save depends sources cache - uses: cirruslabs/cache/save@v4 + uses: cirruslabs/cache/save@v5 if: ${{ (github.event_name == 'push') && (github.ref_name == github.event.repository.default_branch) && (env.depends-sources-cache-hit != 'true') }} with: path: ${{ env.SOURCES_PATH }} key: depends-sources-${{ env.CONTAINER_NAME }}-${{ env.DEPENDS_HASH }} - name: Save built depends cache - uses: cirruslabs/cache/save@v4 + uses: cirruslabs/cache/save@v5 if: ${{ (github.event_name == 'push') && (github.ref_name == github.event.repository.default_branch) && (env.depends-built-cache-hit != 'true' )}} with: path: ${{ env.BASE_CACHE }} key: depends-built-${{ env.CONTAINER_NAME }}-${{ env.DEPENDS_HASH }} - name: Save previous releases cache - uses: cirruslabs/cache/save@v4 + uses: cirruslabs/cache/save@v5 if: ${{ (github.event_name == 'push') && (github.ref_name == github.event.repository.default_branch) && (env.previous-releases-cache-hit != 'true' )}} with: path: ${{ env.PREVIOUS_RELEASES_DIR }} diff --git a/.github/ci-windows-cross.py b/.github/ci-windows-cross.py index af350094cdac..6453cb9eac02 100755 --- a/.github/ci-windows-cross.py +++ b/.github/ci-windows-cross.py @@ -102,9 +102,6 @@ def run_functional_tests(): # feature_unsupported_utxo_db.py fails on Windows because of emojis in the test data directory. "--exclude", "feature_unsupported_utxo_db.py", - # See https://github.com/bitcoin/bitcoin/issues/31409. - "--exclude", - "wallet_multiwallet.py", ] run(test_runner_cmd) diff --git a/.github/ci-windows.py b/.github/ci-windows.py index 236c6301d017..964558a2e209 100755 --- a/.github/ci-windows.py +++ b/.github/ci-windows.py @@ -8,6 +8,7 @@ import shlex import subprocess import sys +import time from pathlib import Path sys.path.append(str(Path(__file__).resolve().parent.parent / "test")) @@ -70,10 +71,20 @@ def generate(ci_type): "-B", "build", "-Werror=dev", - "--preset", - "vs2026", + "--preset=vs2026", + # Using x64-windows-release for both host and target triplets + # to ensure vcpkg builds only release packages, thereby optimizing + # build time. + # See https://github.com/microsoft/vcpkg/issues/50927. + "-DVCPKG_HOST_TRIPLET=x64-windows-release", + "-DVCPKG_TARGET_TRIPLET=x64-windows-release", ] + GENERATE_OPTIONS[ci_type] - run(command) + if run(command, check=False).returncode != 0: + print("=== ⚠️ ===") + print("Generate failure! Network issue? Retry once ...") + time.sleep(12) + print("=== ⚠️ ===") + run(command) def build(_ci_type): diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 70305f261869..f12ceb012ec4 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -186,7 +186,7 @@ jobs: - name: Restore Ccache cache id: ccache-cache - uses: actions/cache/restore@v4 + uses: actions/cache/restore@v5 with: path: ${{ env.CCACHE_DIR }} key: ${{ github.job }}-${{ matrix.job-type }}-ccache-${{ github.run_id }} @@ -206,7 +206,7 @@ jobs: FILE_ENV: ${{ matrix.file-env }} - name: Save Ccache cache - uses: actions/cache/save@v4 + uses: actions/cache/save@v5 if: github.event_name != 'pull_request' && github.ref_name == github.event.repository.default_branch && steps.ccache-cache.outputs.cache-hit != 'true' with: path: ${{ env.CCACHE_DIR }} @@ -253,26 +253,16 @@ jobs: py -3 --version bash --version - - name: Using vcpkg with MSBuild - run: | - echo "set(VCPKG_BUILD_TYPE release)" >> "${VCPKG_INSTALLATION_ROOT}/triplets/x64-windows.cmake" - # Workaround for libevent, which requires CMake 3.1 but is incompatible with CMake >= 4.0. - sed -i '1s/^/set(ENV{CMAKE_POLICY_VERSION_MINIMUM} 3.5)\n/' "${VCPKG_INSTALLATION_ROOT}/scripts/ports.cmake" - - - name: Set VCPKG_ROOT - run: | - echo "VCPKG_ROOT=${VCPKG_INSTALLATION_ROOT}" >> "$GITHUB_ENV" - - name: Restore vcpkg tools cache id: vcpkg-tools-cache uses: actions/cache/restore@v5 with: - path: C:/vcpkg/downloads/tools + path: ~/AppData/Local/vcpkg/downloads/tools key: ${{ github.job }}-vcpkg-tools-${{ github.run_id }} restore-keys: ${{ github.job }}-vcpkg-tools- - name: Restore vcpkg binary cache - uses: actions/cache/restore@v4 + uses: actions/cache/restore@v5 id: vcpkg-binary-cache with: path: ~/AppData/Local/vcpkg/archives @@ -283,7 +273,7 @@ jobs: py -3 .github/ci-windows.py ${{ matrix.job-type }} generate - name: Save vcpkg binary cache - uses: actions/cache/save@v4 + uses: actions/cache/save@v5 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' with: path: ~/AppData/Local/vcpkg/archives @@ -294,7 +284,7 @@ jobs: # Only save cache from one job as they share tools. If the matrix is expanded to jobs with unique tools, this may need amending. if: github.event_name != 'pull_request' && github.ref_name == github.event.repository.default_branch && steps.vcpkg-tools-cache.outputs.cache-hit != 'true' && matrix.job-type == 'standard' with: - path: C:/vcpkg/downloads/tools + path: ~/AppData/Local/vcpkg/downloads/tools key: ${{ github.job }}-vcpkg-tools-${{ github.run_id }} - name: Build @@ -378,7 +368,7 @@ jobs: uses: ./.github/actions/save-caches - name: Upload built executables - uses: actions/upload-artifact@v6 + uses: actions/upload-artifact@v7 with: name: ${{ matrix.artifact-name }}-${{ github.run_id }} path: | @@ -416,7 +406,7 @@ jobs: ref: ${{ needs.record-frozen-commit.outputs.commit }} - name: Download built executables - uses: actions/download-artifact@v7 + uses: actions/download-artifact@v8 with: name: ${{ matrix.artifact-name }}-${{ github.run_id }} @@ -486,6 +476,12 @@ jobs: timeout-minutes: 120 file-env: './ci/test/00_setup_env_mac_cross_intel.sh' + - name: 'FreeBSD Cross' + cirrus-runner: 'ghcr.io/cirruslabs/ubuntu-runner-amd64:24.04-md' + fallback-runner: 'ubuntu-24.04' + timeout-minutes: 120 + file-env: './ci/test/00_setup_env_freebsd_cross.sh' + - name: 'No wallet' cirrus-runner: 'ghcr.io/cirruslabs/ubuntu-runner-amd64:24.04-sm' fallback-runner: 'ubuntu-24.04' diff --git a/CMakeLists.txt b/CMakeLists.txt index db7a19ad93a7..eda934cc8205 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -27,7 +27,7 @@ get_directory_property(precious_variables CACHE_VARIABLES) # Project / Package metadata #============================= set(CLIENT_NAME "Bitcoin Core") -set(CLIENT_VERSION_MAJOR 30) +set(CLIENT_VERSION_MAJOR 31) set(CLIENT_VERSION_MINOR 99) set(CLIENT_VERSION_BUILD 0) set(CLIENT_VERSION_RC 0) @@ -117,8 +117,12 @@ if(ENABLE_WALLET) if(VCPKG_TARGET_TRIPLET) # Use of the `unofficial::` namespace is a vcpkg package manager convention. find_package(unofficial-sqlite3 CONFIG REQUIRED) + add_library(SQLite3::SQLite3 ALIAS unofficial::sqlite3::sqlite3) else() find_package(SQLite3 3.7.17 REQUIRED) + if(NOT TARGET SQLite3::SQLite3) # CMake < 4.3 + add_library(SQLite3::SQLite3 ALIAS SQLite::SQLite3) + endif() endif() endif() cmake_dependent_option(BUILD_WALLET_TOOL "Build bitcoin-wallet tool." ${BUILD_TESTS} "ENABLE_WALLET" OFF) @@ -449,6 +453,7 @@ else() try_append_cxx_flags("-Wall" TARGET warn_interface SKIP_LINK) try_append_cxx_flags("-Wextra" TARGET warn_interface SKIP_LINK) try_append_cxx_flags("-Wgnu" TARGET warn_interface SKIP_LINK) + try_append_cxx_flags("-Wcovered-switch-default" TARGET warn_interface SKIP_LINK) # Some compilers will ignore -Wformat-security without -Wformat, so just combine the two here. try_append_cxx_flags("-Wformat -Wformat-security" TARGET warn_interface SKIP_LINK) try_append_cxx_flags("-Wvla" TARGET warn_interface SKIP_LINK) @@ -690,6 +695,7 @@ if(configure_warnings) message(WARNING "${warning}") endforeach() message(" ******\n") + message(AUTHOR_WARNING "Warnings have been encountered!") endif() # We want all build properties to be encapsulated properly. diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index deb2b40a138b..f0e88514eeec 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -146,7 +146,7 @@ about Git. ### Creating the Pull Request The title of the pull request should be prefixed by the component or area that -the pull request affects. Valid areas as: +the pull request affects. Valid areas are: - `consensus` for changes to consensus critical code - `doc` for changes to the documentation diff --git a/ci/lint/01_install.sh b/ci/lint/01_install.sh index 44563d424e25..573dbca5fe56 100755 --- a/ci/lint/01_install.sh +++ b/ci/lint/01_install.sh @@ -41,20 +41,18 @@ command -v python3 python3 --version ${CI_RETRY_EXE} pip3 install \ - lief==0.16.6 \ - mypy==1.18.2 \ + lief==0.17.5 \ + mypy==1.19.1 \ pyzmq==27.1.0 \ - ruff==0.13.2 \ - vulture==2.14 + ruff==0.15.5 SHELLCHECK_VERSION=v0.11.0 -curl -sL "https://github.com/koalaman/shellcheck/releases/download/${SHELLCHECK_VERSION}/shellcheck-${SHELLCHECK_VERSION}.linux.x86_64.tar.xz" | \ +curl --fail -L "https://github.com/koalaman/shellcheck/releases/download/${SHELLCHECK_VERSION}/shellcheck-${SHELLCHECK_VERSION}.linux.$(uname --machine).tar.xz" | \ tar --xz -xf - --directory /tmp/ mv "/tmp/shellcheck-${SHELLCHECK_VERSION}/shellcheck" /usr/bin/ -MLC_VERSION=v1 -MLC_BIN=mlc-x86_64-linux -curl -sL "https://github.com/becheran/mlc/releases/download/${MLC_VERSION}/${MLC_BIN}" -o "/usr/bin/mlc" +MLC_VERSION=v1.2.0 +curl --fail -L "https://github.com/becheran/mlc/releases/download/${MLC_VERSION}/mlc-$(uname --machine)-linux" -o "/usr/bin/mlc" chmod +x /usr/bin/mlc popd || exit diff --git a/ci/retry/retry b/ci/retry/retry index 37021f009630..7942b6c4f09b 100755 --- a/ci/retry/retry +++ b/ci/retry/retry @@ -4,8 +4,6 @@ __sleep_amount() { if [ -n "$constant_sleep" ]; then sleep_time=$constant_sleep else - #TODO: check for awk - #TODO: check if user would rather use one of the other possible dependencies: python, ruby, bc, dc sleep_time=`awk "BEGIN {t = $min_sleep * $(( (1<<($attempts -1)) )); print (t > $max_sleep ? $max_sleep : t)}"` fi } @@ -43,7 +41,6 @@ retry() P="$1" for param in "${@:2}"; do P="$P '$param'"; done - #TODO: replace single quotes in each arg with '"'"' ? export RETRY_ATTEMPT=$attempts bash -c "$P" return_code=$? diff --git a/ci/test/00_setup_env_freebsd_cross.sh b/ci/test/00_setup_env_freebsd_cross.sh new file mode 100755 index 000000000000..da7304d1d26d --- /dev/null +++ b/ci/test/00_setup_env_freebsd_cross.sh @@ -0,0 +1,23 @@ +#!/usr/bin/env bash +# +# Copyright (c) The Bitcoin Core developers +# Distributed under the MIT software license, see the accompanying +# file COPYING or https://opensource.org/license/mit. + +export LC_ALL=C.UTF-8 + +export CONTAINER_NAME=ci_freebsd_cross +export CI_IMAGE_NAME_TAG="mirror.gcr.io/ubuntu:24.04" +export APT_LLVM_V="22" +export FREEBSD_VERSION=15.0 +export PACKAGES="clang-${APT_LLVM_V} llvm-${APT_LLVM_V} lld" +export HOST=x86_64-unknown-freebsd +export DEP_OPTS="build_CC=clang build_CXX=clang++ AR=llvm-ar-${APT_LLVM_V} STRIP=llvm-strip-${APT_LLVM_V} NM=llvm-nm-${APT_LLVM_V} RANLIB=llvm-ranlib-${APT_LLVM_V}" +export GOAL="install" +export BITCOIN_CONFIG="\ + --preset=dev-mode \ + -DREDUCE_EXPORTS=ON \ + -DWITH_USDT=OFF \ +" +export RUN_UNIT_TESTS=false +export RUN_FUNCTIONAL_TESTS=false diff --git a/ci/test/00_setup_env_native_fuzz_with_valgrind.sh b/ci/test/00_setup_env_native_fuzz_with_valgrind.sh index d8b0f5f1b5bb..ed84ae84cf35 100755 --- a/ci/test/00_setup_env_native_fuzz_with_valgrind.sh +++ b/ci/test/00_setup_env_native_fuzz_with_valgrind.sh @@ -8,7 +8,7 @@ export LC_ALL=C.UTF-8 export CI_IMAGE_NAME_TAG="mirror.gcr.io/debian:trixie" export CONTAINER_NAME=ci_native_fuzz_valgrind -export PACKAGES="libevent-dev libboost-dev libsqlite3-dev valgrind libcapnp-dev capnproto" +export PACKAGES="clang llvm libclang-rt-dev libevent-dev libboost-dev libsqlite3-dev valgrind libcapnp-dev capnproto" export NO_DEPENDS=1 export RUN_UNIT_TESTS=false export RUN_FUNCTIONAL_TESTS=false @@ -17,5 +17,6 @@ export FUZZ_TESTS_CONFIG="--valgrind" export GOAL="all" export BITCOIN_CONFIG="\ -DBUILD_FOR_FUZZING=ON \ - -DCMAKE_CXX_FLAGS='-Wno-error=array-bounds' \ + -DCMAKE_C_COMPILER=clang \ + -DCMAKE_CXX_COMPILER=clang++ \ " diff --git a/ci/test/00_setup_env_native_iwyu.sh b/ci/test/00_setup_env_native_iwyu.sh index 3868510d43a3..27b1e02b6db8 100755 --- a/ci/test/00_setup_env_native_iwyu.sh +++ b/ci/test/00_setup_env_native_iwyu.sh @@ -8,9 +8,9 @@ export LC_ALL=C.UTF-8 export CI_IMAGE_NAME_TAG="mirror.gcr.io/debian:trixie" # To build codegen, CMake must be 3.31 or newer. export CONTAINER_NAME=ci_native_iwyu -export TIDY_LLVM_V="21" -export APT_LLVM_V="${TIDY_LLVM_V}" -export PACKAGES="clang-${TIDY_LLVM_V} clang-format-${TIDY_LLVM_V} libclang-${TIDY_LLVM_V}-dev llvm-${TIDY_LLVM_V}-dev jq libevent-dev libboost-dev libzmq3-dev systemtap-sdt-dev qt6-base-dev qt6-tools-dev qt6-l10n-tools libqrencode-dev libsqlite3-dev libcapnp-dev capnproto" +export IWYU_LLVM_V="22" +export APT_LLVM_V="${IWYU_LLVM_V}" +export PACKAGES="clang-${IWYU_LLVM_V} clang-format-${IWYU_LLVM_V} libclang-${IWYU_LLVM_V}-dev llvm-${IWYU_LLVM_V}-dev jq libevent-dev libboost-dev libzmq3-dev systemtap-sdt-dev qt6-base-dev qt6-tools-dev qt6-l10n-tools libqrencode-dev libsqlite3-dev libcapnp-dev capnproto" export NO_DEPENDS=1 export RUN_UNIT_TESTS=false export RUN_FUNCTIONAL_TESTS=false @@ -20,6 +20,6 @@ export RUN_IWYU=true export GOAL="codegen" export BITCOIN_CONFIG="\ --preset dev-mode -DBUILD_GUI=OFF \ - -DCMAKE_C_COMPILER=clang-${TIDY_LLVM_V} \ - -DCMAKE_CXX_COMPILER=clang++-${TIDY_LLVM_V} \ + -DCMAKE_C_COMPILER=clang-${IWYU_LLVM_V} \ + -DCMAKE_CXX_COMPILER=clang++-${IWYU_LLVM_V} \ " diff --git a/ci/test/00_setup_env_native_valgrind.sh b/ci/test/00_setup_env_native_valgrind.sh index 30c84bf48743..0ca02f77824c 100755 --- a/ci/test/00_setup_env_native_valgrind.sh +++ b/ci/test/00_setup_env_native_valgrind.sh @@ -8,16 +8,18 @@ export LC_ALL=C.UTF-8 export CI_IMAGE_NAME_TAG="mirror.gcr.io/debian:trixie" export CONTAINER_NAME=ci_native_valgrind -export PACKAGES="valgrind python3-zmq libevent-dev libboost-dev libzmq3-dev libsqlite3-dev libcapnp-dev capnproto python3-pip" +export PACKAGES="clang llvm libclang-rt-dev valgrind python3-zmq libevent-dev libboost-dev libzmq3-dev libsqlite3-dev libcapnp-dev capnproto python3-pip" export PIP_PACKAGES="--break-system-packages pycapnp" export USE_VALGRIND=1 export NO_DEPENDS=1 # bind tests excluded for now, see https://github.com/bitcoin/bitcoin/issues/17765#issuecomment-602068547 export TEST_RUNNER_EXTRA="--exclude rpc_bind --exclude feature_bind_extra" export GOAL="install" -# TODO enable GUI +# GUI disabled, because it only passes with a DEBUG=1 depends build export BITCOIN_CONFIG="\ - --preset=dev-mode \ + --preset=dev-mode \ -DBUILD_GUI=OFF \ -DWITH_USDT=OFF \ + -DCMAKE_C_COMPILER=clang \ + -DCMAKE_CXX_COMPILER=clang++ \ " diff --git a/ci/test/01_base_install.sh b/ci/test/01_base_install.sh index f8d337f6c902..5a6e06811fa0 100755 --- a/ci/test/01_base_install.sh +++ b/ci/test/01_base_install.sh @@ -8,6 +8,11 @@ export LC_ALL=C.UTF-8 set -o errexit -o pipefail -o xtrace +if [ "${DANGER_RUN_CI_ON_HOST}" != "1" ]; then + echo "This script will make unsafe local and global modifications, so it can only be run inside a container and requires DANGER_RUN_CI_ON_HOST=1" + exit 1 +fi + CFG_DONE="${BASE_ROOT_DIR}/ci.base-install-done" # Use a global setting to remember whether this script ran to avoid running it twice if [ "$( cat "${CFG_DONE}" || true )" == "done" ]; then @@ -80,9 +85,9 @@ if [[ -n "${USE_INSTRUMENTED_LIBCPP}" ]]; then fi if [[ "${RUN_IWYU}" == true ]]; then - ${CI_RETRY_EXE} git clone --depth=1 https://github.com/include-what-you-use/include-what-you-use -b clang_"${TIDY_LLVM_V}" /include-what-you-use + ${CI_RETRY_EXE} git clone --depth=1 https://github.com/include-what-you-use/include-what-you-use -b clang_"${IWYU_LLVM_V}" /include-what-you-use (cd /include-what-you-use && patch -p1 < /ci_container_base/ci/test/01_iwyu.patch) - cmake -B /iwyu-build/ -G 'Unix Makefiles' -DCMAKE_PREFIX_PATH=/usr/lib/llvm-"${TIDY_LLVM_V}" -S /include-what-you-use + cmake -B /iwyu-build/ -G 'Unix Makefiles' -DCMAKE_PREFIX_PATH=/usr/lib/llvm-"${IWYU_LLVM_V}" -S /include-what-you-use make -C /iwyu-build/ install "$MAKEJOBS" fi @@ -99,4 +104,16 @@ if [ -n "$XCODE_VERSION" ] && [ ! -d "${DEPENDS_DIR}/SDKs/${OSX_SDK_BASENAME}" ] tar -C "${DEPENDS_DIR}/SDKs" -xf "$OSX_SDK_PATH" fi +FREEBSD_SDK_BASENAME="freebsd-${HOST}-${FREEBSD_VERSION}" + +if [ -n "$FREEBSD_VERSION" ] && [ ! -d "${DEPENDS_DIR}/SDKs/${FREEBSD_SDK_BASENAME}" ]; then + FREEBSD_SDK_FILENAME="base-${FREEBSD_VERSION}.txz" + FREEBSD_SDK_PATH="${DEPENDS_DIR}/sdk-sources/${FREEBSD_SDK_FILENAME}" + if [ ! -f "$FREEBSD_SDK_PATH" ]; then + ${CI_RETRY_EXE} curl --location --fail "https://download.freebsd.org/releases/amd64/${FREEBSD_VERSION}-RELEASE/base.txz" -o "$FREEBSD_SDK_PATH" + fi + mkdir -p "${DEPENDS_DIR}/SDKs/${FREEBSD_SDK_BASENAME}" + tar -C "${DEPENDS_DIR}/SDKs/${FREEBSD_SDK_BASENAME}" -xf "$FREEBSD_SDK_PATH" +fi + echo -n "done" > "${CFG_DONE}" diff --git a/ci/test/01_iwyu.patch b/ci/test/01_iwyu.patch index 209e133f0e39..d86a02dc7669 100644 --- a/ci/test/01_iwyu.patch +++ b/ci/test/01_iwyu.patch @@ -3,9 +3,9 @@ See: https://en.cppreference.com/w/cpp/preprocessor/include.html. --- a/iwyu_path_util.cc +++ b/iwyu_path_util.cc -@@ -211,7 +211,7 @@ bool IsQuotedInclude(const string& s) { +@@ -222,7 +222,7 @@ bool IsQuotedInclude(StringRef s) { } - + string AddQuotes(string include_name, bool angled) { - if (angled) { + if (true) { @@ -19,7 +19,7 @@ See: https://github.com/include-what-you-use/include-what-you-use/blob/clang_21/ --- a/iwyu_include_picker.cc +++ b/iwyu_include_picker.cc -@@ -100,20 +100,20 @@ const IncludeMapEntry libc_symbol_map[] = { +@@ -104,20 +104,20 @@ const IncludeMapEntry libc_symbol_map[] = { // equal. The visibility on the symbol-name is ignored; by convention // we always set it to kPrivate. { "_POSIX_VDISABLE", kPrivate, "", kPublic }, @@ -46,7 +46,7 @@ See: https://github.com/include-what-you-use/include-what-you-use/blob/clang_21/ { "error_t", kPrivate, "", kPublic }, { "error_t", kPrivate, "", kPublic }, { "FD_CLR", kPrivate, "", kPublic }, -@@ -122,10 +122,10 @@ const IncludeMapEntry libc_symbol_map[] = { +@@ -126,10 +126,10 @@ const IncludeMapEntry libc_symbol_map[] = { { "fd_set", kPrivate, "", kPublic }, { "FD_SETSIZE", kPrivate, "", kPublic }, { "FD_ZERO", kPrivate, "", kPublic }, @@ -61,7 +61,7 @@ See: https://github.com/include-what-you-use/include-what-you-use/blob/clang_21/ { "fsblkcnt_t", kPrivate, "", kPublic }, { "fsfilcnt_t", kPrivate, "", kPublic }, { "getopt", kPrivate, "", kPublic }, -@@ -135,31 +135,31 @@ const IncludeMapEntry libc_symbol_map[] = { +@@ -139,47 +139,47 @@ const IncludeMapEntry libc_symbol_map[] = { { "in_addr_t", kPrivate, "", kPublic }, { "in_port_t", kPrivate, "", kPublic }, { "id_t", kPrivate, "", kPublic }, @@ -77,20 +77,52 @@ See: https://github.com/include-what-you-use/include-what-you-use/blob/clang_21/ - { "int16_t", kPrivate, "", kPublic }, - { "int32_t", kPrivate, "", kPublic }, - { "int64_t", kPrivate, "", kPublic }, +- { "int_fast8_t", kPrivate, "", kPublic }, +- { "int_fast16_t", kPrivate, "", kPublic }, +- { "int_fast32_t", kPrivate, "", kPublic }, +- { "int_fast64_t", kPrivate, "", kPublic }, +- { "int_least8_t", kPrivate, "", kPublic }, +- { "int_least16_t", kPrivate, "", kPublic }, +- { "int_least32_t", kPrivate, "", kPublic }, +- { "int_least64_t", kPrivate, "", kPublic }, - { "uint8_t", kPrivate, "", kPublic }, - { "uint16_t", kPrivate, "", kPublic }, - { "uint32_t", kPrivate, "", kPublic }, - { "uint64_t", kPrivate, "", kPublic }, +- { "uint_fast8_t", kPrivate, "", kPublic }, +- { "uint_fast16_t", kPrivate, "", kPublic }, +- { "uint_fast32_t", kPrivate, "", kPublic }, +- { "uint_fast64_t", kPrivate, "", kPublic }, +- { "uint_least8_t", kPrivate, "", kPublic }, +- { "uint_least16_t", kPrivate, "", kPublic }, +- { "uint_least32_t", kPrivate, "", kPublic }, +- { "uint_least64_t", kPrivate, "", kPublic }, - { "intptr_t", kPrivate, "", kPublic }, - { "uintptr_t", kPrivate, "", kPublic }, + { "int8_t", kPrivate, "", kPrivate }, + { "int16_t", kPrivate, "", kPrivate }, + { "int32_t", kPrivate, "", kPrivate }, + { "int64_t", kPrivate, "", kPrivate }, ++ { "int_fast8_t", kPrivate, "", kPrivate }, ++ { "int_fast16_t", kPrivate, "", kPrivate }, ++ { "int_fast32_t", kPrivate, "", kPrivate }, ++ { "int_fast64_t", kPrivate, "", kPrivate }, ++ { "int_least8_t", kPrivate, "", kPrivate }, ++ { "int_least16_t", kPrivate, "", kPrivate }, ++ { "int_least32_t", kPrivate, "", kPrivate }, ++ { "int_least64_t", kPrivate, "", kPrivate }, + { "uint8_t", kPrivate, "", kPrivate }, + { "uint16_t", kPrivate, "", kPrivate }, + { "uint32_t", kPrivate, "", kPrivate }, + { "uint64_t", kPrivate, "", kPrivate }, ++ { "uint_fast8_t", kPrivate, "", kPrivate }, ++ { "uint_fast16_t", kPrivate, "", kPrivate }, ++ { "uint_fast32_t", kPrivate, "", kPrivate }, ++ { "uint_fast64_t", kPrivate, "", kPrivate }, ++ { "uint_least8_t", kPrivate, "", kPrivate }, ++ { "uint_least16_t", kPrivate, "", kPrivate }, ++ { "uint_least32_t", kPrivate, "", kPrivate }, ++ { "uint_least64_t", kPrivate, "", kPrivate }, + { "intptr_t", kPrivate, "", kPrivate }, + { "uintptr_t", kPrivate, "", kPrivate }, { "iovec", kPrivate, "", kPublic }, @@ -114,7 +146,7 @@ See: https://github.com/include-what-you-use/include-what-you-use/blob/clang_21/ { "mcontext_t", kPrivate, "", kPublic }, { "mode_t", kPrivate, "", kPublic }, { "nl_item", kPrivate, "", kPublic }, -@@ -175,8 +175,8 @@ const IncludeMapEntry libc_symbol_map[] = { +@@ -195,8 +195,8 @@ const IncludeMapEntry libc_symbol_map[] = { { "optind", kPrivate, "", kPublic }, { "optopt", kPrivate, "", kPublic }, { "pid_t", kPrivate, "", kPublic }, @@ -125,7 +157,7 @@ See: https://github.com/include-what-you-use/include-what-you-use/blob/clang_21/ { "pthread_attr_t", kPrivate, "", kPublic }, { "pthread_cond_t", kPrivate, "", kPublic }, { "pthread_condattr_t", kPrivate, "", kPublic }, -@@ -187,7 +187,7 @@ const IncludeMapEntry libc_symbol_map[] = { +@@ -207,7 +207,7 @@ const IncludeMapEntry libc_symbol_map[] = { { "pthread_rwlock_t", kPrivate, "", kPublic }, { "pthread_rwlockattr_t", kPrivate, "", kPublic }, { "pthread_t", kPrivate, "", kPublic }, @@ -134,7 +166,7 @@ See: https://github.com/include-what-you-use/include-what-you-use/blob/clang_21/ { "regex_t", kPrivate, "", kPublic }, { "regmatch_t", kPrivate, "", kPublic }, { "regoff_t", kPrivate, "", kPublic }, -@@ -218,51 +218,51 @@ const IncludeMapEntry libc_symbol_map[] = { +@@ -238,54 +238,54 @@ const IncludeMapEntry libc_symbol_map[] = { { "SCHED_FIFO", kPrivate, "", kPublic }, { "SCHED_OTHER", kPrivate, "", kPublic }, { "SCHED_RR", kPrivate, "", kPublic }, @@ -167,7 +199,10 @@ See: https://github.com/include-what-you-use/include-what-you-use/blob/clang_21/ { "timer_t", kPrivate, "", kPublic }, - { "timespec", kPrivate, "", kPublic }, + { "timespec", kPrivate, "", kPrivate }, - { "timeval", kPrivate, "", kPublic }, + { "timeval", kPrivate, "", kPublic }, // 'canonical' location for timeval + { "timeval", kPrivate, "", kPublic }, + { "timeval", kPrivate, "", kPublic }, + { "timeval", kPrivate, "", kPublic }, - { "tm", kPrivate, "", kPublic }, + { "tm", kPrivate, "", kPrivate }, { "u_char", kPrivate, "", kPublic }, @@ -212,7 +247,7 @@ See: https://github.com/include-what-you-use/include-what-you-use/blob/clang_21/ { "IBSHIFT", kPrivate, "", kPublic }, { "MAP_POPULATE", kPrivate, "", kPublic }, { "MAP_POPULATE", kPrivate, "", kPublic }, -@@ -270,22 +270,22 @@ const IncludeMapEntry libc_symbol_map[] = { +@@ -293,22 +293,22 @@ const IncludeMapEntry libc_symbol_map[] = { { "MAP_STACK", kPrivate, "", kPublic }, { "MAXHOSTNAMELEN", kPrivate, "", kPublic }, { "MAXHOSTNAMELEN", kPrivate, "", kPublic }, @@ -248,7 +283,7 @@ See: https://github.com/include-what-you-use/include-what-you-use/blob/clang_21/ { "NULL", kPrivate, "", kPublic }, { "NULL", kPrivate, "", kPublic }, { "NULL", kPrivate, "", kPublic }, -@@ -293,13 +293,13 @@ const IncludeMapEntry libc_symbol_map[] = { +@@ -316,13 +316,13 @@ const IncludeMapEntry libc_symbol_map[] = { { "NULL", kPrivate, "", kPublic }, { "NULL", kPrivate, "", kPublic }, { "NULL", kPrivate, "", kPublic }, @@ -266,10 +301,10 @@ See: https://github.com/include-what-you-use/include-what-you-use/blob/clang_21/ + { "NULL", kPrivate, "", kPrivate }, + { "NULL", kPrivate, "", kPrivate }, + { "offsetof", kPrivate, "", kPrivate }, - }; - - // Common kludges for C++ standard libraries -@@ -355,7 +355,7 @@ const IncludeMapEntry libc_include_map[] = { + // Auxiliary vector entry types. + { "AT_BASE", kPrivate, "", kPublic }, + { "AT_BASE_PLATFORM", kPrivate, "", kPublic }, +@@ -409,7 +409,7 @@ const IncludeMapEntry libc_include_map[] = { { "", kPrivate, "", kPublic }, { "", kPrivate, "", kPublic }, { "", kPrivate, "", kPublic }, @@ -278,7 +313,7 @@ See: https://github.com/include-what-you-use/include-what-you-use/blob/clang_21/ { "", kPrivate, "", kPublic }, { "", kPrivate, "", kPublic }, { "", kPrivate, "", kPublic }, -@@ -363,18 +363,18 @@ const IncludeMapEntry libc_include_map[] = { +@@ -417,18 +417,18 @@ const IncludeMapEntry libc_include_map[] = { { "", kPrivate, "", kPublic }, { "", kPrivate, "", kPublic }, { "", kPrivate, "", kPublic }, @@ -304,7 +339,7 @@ See: https://github.com/include-what-you-use/include-what-you-use/blob/clang_21/ { "", kPrivate, "", kPublic }, { "", kPrivate, "", kPublic }, { "", kPrivate, "", kPublic }, -@@ -382,24 +382,24 @@ const IncludeMapEntry libc_include_map[] = { +@@ -436,24 +436,24 @@ const IncludeMapEntry libc_include_map[] = { { "", kPrivate, "", kPublic }, { "", kPrivate, "", kPublic }, { "", kPrivate, "", kPublic }, @@ -337,7 +372,7 @@ See: https://github.com/include-what-you-use/include-what-you-use/blob/clang_21/ { "", kPrivate, "", kPublic }, { "", kPrivate, "", kPublic }, { "", kPrivate, "", kPublic }, -@@ -409,17 +409,17 @@ const IncludeMapEntry libc_include_map[] = { +@@ -463,17 +463,17 @@ const IncludeMapEntry libc_include_map[] = { { "", kPrivate, "", kPublic }, { "", kPrivate, "", kPublic }, { "", kPrivate, "", kPublic }, @@ -365,7 +400,7 @@ See: https://github.com/include-what-you-use/include-what-you-use/blob/clang_21/ { "", kPrivate, "", kPublic }, { "", kPrivate, "", kPublic }, { "", kPrivate, "", kPublic }, -@@ -429,22 +429,22 @@ const IncludeMapEntry libc_include_map[] = { +@@ -483,22 +483,22 @@ const IncludeMapEntry libc_include_map[] = { { "", kPrivate, "", kPublic }, { "", kPrivate, "", kPublic }, { "", kPrivate, "", kPublic }, @@ -400,7 +435,7 @@ See: https://github.com/include-what-you-use/include-what-you-use/blob/clang_21/ { "", kPrivate, "", kPublic }, { "", kPrivate, "", kPublic }, { "", kPrivate, "", kPrivate }, -@@ -459,12 +459,12 @@ const IncludeMapEntry libc_include_map[] = { +@@ -515,12 +515,12 @@ const IncludeMapEntry libc_include_map[] = { { "", kPrivate, "", kPublic }, { "", kPrivate, "", kPublic }, { "", kPrivate, "", kPublic }, @@ -413,9 +448,9 @@ See: https://github.com/include-what-you-use/include-what-you-use/blob/clang_21/ - { "", kPrivate, "", kPublic }, + { "", kPrivate, "", kPrivate }, { "", kPrivate, "", kPublic }, - { "", kPrivate, "", kPublic }, - { "", kPrivate, "", kPublic }, -@@ -474,11 +474,11 @@ const IncludeMapEntry libc_include_map[] = { + { "", kPrivate, "", kPublic }, + { "", kPrivate, "", kPublic }, +@@ -532,11 +532,11 @@ const IncludeMapEntry libc_include_map[] = { { "", kPrivate, "", kPublic }, { "", kPrivate, "", kPublic }, { "", kPrivate, "", kPublic }, @@ -432,7 +467,7 @@ See: https://github.com/include-what-you-use/include-what-you-use/blob/clang_21/ { "", kPrivate, "", kPublic }, // Sometimes libc tells you what mapping to do via an '#error': // # error "Never use directly; include instead." -@@ -488,7 +488,7 @@ const IncludeMapEntry libc_include_map[] = { +@@ -546,7 +546,7 @@ const IncludeMapEntry libc_include_map[] = { { "", kPrivate, "", kPublic }, { "", kPrivate, "", kPublic }, { "", kPrivate, "", kPublic }, @@ -441,7 +476,7 @@ See: https://github.com/include-what-you-use/include-what-you-use/blob/clang_21/ { "", kPrivate, "", kPublic }, { "", kPrivate, "", kPublic }, { "", kPrivate, "", kPublic }, -@@ -498,38 +498,38 @@ const IncludeMapEntry libc_include_map[] = { +@@ -556,38 +556,38 @@ const IncludeMapEntry libc_include_map[] = { { "", kPrivate, "", kPublic }, { "", kPrivate, "", kPublic }, { "", kPrivate, "", kPublic }, @@ -495,7 +530,7 @@ See: https://github.com/include-what-you-use/include-what-you-use/blob/clang_21/ { "", kPrivate, "", kPublic }, { "", kPrivate, "", kPublic }, // Top-level #includes that just forward to another file: -@@ -541,13 +541,13 @@ const IncludeMapEntry libc_include_map[] = { +@@ -599,13 +599,13 @@ const IncludeMapEntry libc_include_map[] = { // on the POSIX.1-2024 list, I just choose the top-level one. { "", kPrivate, "", kPublic }, { "", kPrivate, "", kPublic }, @@ -512,7 +547,7 @@ See: https://github.com/include-what-you-use/include-what-you-use/blob/clang_21/ { "", kPrivate, "", kPublic }, { "", kPrivate, "", kPublic }, { "", kPrivate, "", kPublic }, -@@ -567,21 +567,21 @@ const IncludeMapEntry libc_include_map[] = { +@@ -625,21 +625,21 @@ const IncludeMapEntry libc_include_map[] = { { "", kPrivate, "", kPrivate }, // I don't know what grep would have found these. I found them // via user report. @@ -539,7 +574,7 @@ See: https://github.com/include-what-you-use/include-what-you-use/blob/clang_21/ }; const IncludeMapEntry stdlib_c_include_map[] = { -@@ -600,32 +600,32 @@ const IncludeMapEntry stdlib_c_include_map[] = { +@@ -658,32 +658,32 @@ const IncludeMapEntry stdlib_c_include_map[] = { // https://github.com/cplusplus/draft/blob/c+%2B20/source/lib-intro.tex // // $ curl -s -N https://raw.githubusercontent.com/cplusplus/draft/c%2B%2B20/source/lib-intro.tex | sed -n '/begin{multicolfloattable}.*{headers.cpp.c}/,/end{multicolfloattable}/p' | grep tcode | perl -nle 'm/tcode{}/ && print qq@ { "<$1.h>", kPublic, "", kPublic },@' | sort @@ -548,7 +583,12 @@ See: https://github.com/include-what-you-use/include-what-you-use/blob/clang_21/ - { "", kPublic, "", kPublic }, - { "", kPublic, "", kPublic }, - { "", kPublic, "", kPublic }, -- { "", kPublic, "", kPublic }, ++ { "", kPrivate, "", kPublic }, ++ { "", kPrivate, "", kPublic }, ++ { "", kPrivate, "", kPublic }, ++ { "", kPrivate, "", kPublic }, ++ { "", kPrivate, "", kPublic }, + { "", kPublic, "", kPublic }, - { "", kPublic, "", kPublic }, - { "", kPublic, "", kPublic }, - { "", kPublic, "", kPublic }, @@ -569,12 +609,6 @@ See: https://github.com/include-what-you-use/include-what-you-use/blob/clang_21/ - { "", kPublic, "", kPublic }, - { "", kPublic, "", kPublic }, - { "", kPublic, "", kPublic }, -+ { "", kPrivate, "", kPublic }, -+ { "", kPrivate, "", kPublic }, -+ { "", kPrivate, "", kPublic }, -+ { "", kPrivate, "", kPublic }, -+ { "", kPrivate, "", kPublic }, -+ { "", kPrivate, "", kPublic }, + { "", kPrivate, "", kPublic }, + { "", kPrivate, "", kPublic }, + { "", kPrivate, "", kPublic }, diff --git a/ci/test/02_run_container.py b/ci/test/02_run_container.py index dce3730a65a4..abaa535553db 100755 --- a/ci/test/02_run_container.py +++ b/ci/test/02_run_container.py @@ -158,7 +158,13 @@ def ci_exec(cmd_inner, **kwargs): if os.getenv("DANGER_RUN_CI_ON_HOST"): prefix = [] else: - prefix = ["docker", "exec", container_id] + prefix = [ + "docker", + "exec", + "--env", + "DANGER_RUN_CI_ON_HOST=1", # Safe to set *inside* the container + container_id, + ] return run([*prefix, *cmd_inner], **kwargs) diff --git a/ci/test/03_test_script.sh b/ci/test/03_test_script.sh index eb03c2dd4936..45bc12700fb6 100755 --- a/ci/test/03_test_script.sh +++ b/ci/test/03_test_script.sh @@ -6,7 +6,12 @@ export LC_ALL=C.UTF-8 -set -ex +set -o errexit -o xtrace + +if [ "${DANGER_RUN_CI_ON_HOST}" != "1" ]; then + echo "This script will make unsafe local and global modifications, so it can only be run inside a container and requires DANGER_RUN_CI_ON_HOST=1" + exit 1 +fi cd "${BASE_ROOT_DIR}" @@ -44,6 +49,19 @@ echo "=== BEGIN env ===" env echo "=== END env ===" +# The CI framework should be flexible where it is run from. For example, from +# a git-archive, a git-worktree, or a normal git repo. +# The iwyu task requires a working git repo, which may not always be +# available, so initialize one with force. +if [[ "${RUN_IWYU}" == true ]]; then + mv .git .git_ci_backup || true + git init + git add ./src # the git diff command used later for iwyu only cares about ./src + git config user.email "ci@ci" + git config user.name "CI" + git commit -m "dummy CI ./src init for IWYU" +fi + if [ "$RUN_FUZZ_TESTS" = "true" ]; then export DIR_FUZZ_IN=${DIR_QA_ASSETS}/fuzz_corpora/ if [ ! -d "$DIR_FUZZ_IN" ]; then @@ -137,6 +155,14 @@ if [ "$RUN_CHECK_DEPS" = "true" ]; then "${BASE_ROOT_DIR}/contrib/devtools/check-deps.sh" "${BASE_BUILD_DIR}" fi +if [[ "$CI_OS_NAME" == "macos" && "${GOAL}" = "install deploy" ]]; then + unzip "${BASE_BUILD_DIR}/bitcoin-macos-app.zip" -d "${BASE_BUILD_DIR}/deploy" + if ! ( codesign --verify "${BASE_BUILD_DIR}/deploy/Bitcoin-Qt.app" ); then + echo "Codesigning failed." + false + fi +fi + if [ "$RUN_UNIT_TESTS" = "true" ]; then DIR_UNIT_TEST_DATA="${DIR_UNIT_TEST_DATA}" \ LD_LIBRARY_PATH="${DEPENDS_DIR}/${HOST}/lib" \ @@ -183,7 +209,7 @@ fi if [[ "${RUN_IWYU}" == true ]]; then # TODO: Consider enforcing IWYU across the entire codebase. - FILES_WITH_ENFORCED_IWYU="/src/((crypto|index|kernel|primitives|univalue/(lib|test)|zmq)/.*\\.cpp|node/blockstorage\\.cpp|node/utxo_snapshot\\.cpp|core_io\\.cpp|signet\\.cpp)" + FILES_WITH_ENFORCED_IWYU="/src/(((crypto|index|kernel|primitives|univalue/(lib|test)|util|zmq|compat)/.*|common/license_info|node/blockstorage|node/utxo_snapshot|clientversion|core_io|signet)\\.cpp)" jq --arg patterns "$FILES_WITH_ENFORCED_IWYU" 'map(select(.file | test($patterns)))' "${BASE_BUILD_DIR}/compile_commands.json" > "${BASE_BUILD_DIR}/compile_commands_iwyu_errors.json" jq --arg patterns "$FILES_WITH_ENFORCED_IWYU" 'map(select(.file | test($patterns) | not))' "${BASE_BUILD_DIR}/compile_commands.json" > "${BASE_BUILD_DIR}/compile_commands_iwyu_warnings.json" @@ -198,7 +224,7 @@ if [[ "${RUN_IWYU}" == true ]]; then -Xiwyu --check_also="*/primitives/*.h" \ 2>&1 | tee /tmp/iwyu_ci.out python3 "/include-what-you-use/fix_includes.py" --nosafe_headers < /tmp/iwyu_ci.out - git diff -U1 | ./contrib/devtools/clang-format-diff.py -binary="clang-format-${TIDY_LLVM_V}" -p1 -i -v + git diff -U1 | ./contrib/devtools/clang-format-diff.py -binary="clang-format-${IWYU_LLVM_V}" -p1 -i -v } run_iwyu "compile_commands_iwyu_errors.json" diff --git a/ci/test_imagefile b/ci/test_imagefile index 93494cc1bbe7..908e9a0f5ab4 100644 --- a/ci/test_imagefile +++ b/ci/test_imagefile @@ -21,4 +21,4 @@ COPY ./ci/test/00_setup_env.sh ./${FILE_ENV} ./ci/test/01_base_install.sh ./ci/t # Bash is required, so install it when missing RUN sh -c "bash -c 'true' || ( apk update && apk add --no-cache bash )" -RUN ["bash", "-c", "cd /ci_container_base/ && set -o errexit && source ./ci/test/00_setup_env.sh && ./ci/test/01_base_install.sh"] +RUN ["bash", "-c", "cd /ci_container_base/ && set -o errexit && source ./ci/test/00_setup_env.sh && DANGER_RUN_CI_ON_HOST=1 ./ci/test/01_base_install.sh"] diff --git a/cmake/leveldb.cmake b/cmake/leveldb.cmake index e21190420ec8..cff8c61f96ca 100644 --- a/cmake/leveldb.cmake +++ b/cmake/leveldb.cmake @@ -87,6 +87,9 @@ else() try_append_cxx_flags("-Wconditional-uninitialized" TARGET nowarn_leveldb_interface SKIP_LINK IF_CHECK_PASSED "-Wno-conditional-uninitialized" ) + try_append_cxx_flags("-Wcovered-switch-default" TARGET nowarn_leveldb_interface SKIP_LINK + IF_CHECK_PASSED "-Wno-covered-switch-default" + ) endif() target_link_libraries(leveldb PRIVATE diff --git a/contrib/completions/bash/bitcoin.bash b/contrib/completions/bash/bitcoin.bash new file mode 100644 index 000000000000..a2ecae03e5ec --- /dev/null +++ b/contrib/completions/bash/bitcoin.bash @@ -0,0 +1,100 @@ +# bash programmable completion for bitcoin(1) wrapper +# Copyright (c) 2026-present The Bitcoin Core developers +# Distributed under the MIT software license, see the accompanying +# file COPYING or http://www.opensource.org/licenses/mit-license.php. + +# wrapper to delegate completion to the real function +_bitcoin_wrap() { + local delegate="$1" shift_count="$2" + local func="_${delegate//-/_}" + local words cword dir file + + # load completion script if function not yet defined + if ! declare -F $func >/dev/null; then + dir="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" + file="$(grep -l -E "complete[[:space:]]+-F[[:space:]]+${func}" "$dir"/* 2>/dev/null | head -n1)" + [ -z "$file" ] && file="$(grep -l -E "^[[:space:]]*${func}[[:space:]]*\(\)" "$dir"/* 2>/dev/null | head -n1)" + [ -n "$file" ] && source "$file" || return 0 + fi + + _get_comp_words_by_ref -n = words cword + + COMP_WORDS=( "$delegate" "${words[@]:$shift_count}" ) + COMP_CWORD=$(( cword - (shift_count - 1) )) + COMP_LINE="${COMP_WORDS[@]}" + COMP_POINT=${#COMP_LINE} + $func "$delegate" +} + +_bitcoin() { + local cur prev words cword + local bitcoin subcmd offset + + # save and use original argument to invoke bitcoin for help + # it might not be in $PATH + bitcoin="$1" + + COMPREPLY=() + _get_comp_words_by_ref -n = cur prev words cword + + case "${words[1]}" in + -m|-M|--multiprocess|--monolithic) + subcmd="${words[2]}" + offset=3 + ;; + *) + subcmd="${words[1]}" + offset=2 + ;; + esac + + case "$subcmd" in + gui|node) + _bitcoin_wrap bitcoind "$offset" + return 0 + ;; + rpc) + _bitcoin_wrap bitcoin-cli "$offset" + return 0 + ;; + tx) + _bitcoin_wrap bitcoin-tx "$offset" + return 0 + ;; + esac + + case "$cur" in + -*=*) # prevent nonsense completions + return 0 + ;; + *) + local options commands + + # only parse help if sensible + if [[ -z "$cur" || "$cur" =~ ^- ]]; then + options=$($bitcoin help 2>&1 | awk '{ for(i=1;i<=NF;i++) if ($i~/^--/) { sub(/=.*/, "=",$i); print $i } }' ) + fi + if [[ -z "$cur" || "$cur" =~ ^[a-z] ]]; then + commands=$($bitcoin help 2>/dev/null | awk '$1 ~ /^[a-z]/ { print $1; }') + fi + + COMPREPLY=( $( compgen -W "$options $commands" -- "$cur" ) ) + + # Prevent space if an argument is desired + if [[ $COMPREPLY == *= ]]; then + compopt -o nospace + fi + return 0 + ;; + esac + +} && +complete -F _bitcoin bitcoin + +# Local variables: +# mode: shell-script +# sh-basic-offset: 4 +# sh-indent-comment: t +# indent-tabs-mode: nil +# End: +# ex: ts=4 sw=4 et filetype=sh diff --git a/contrib/devtools/iwyu/bitcoin.core.imp b/contrib/devtools/iwyu/bitcoin.core.imp index 960cb05d85a1..9b471cb82f23 100644 --- a/contrib/devtools/iwyu/bitcoin.core.imp +++ b/contrib/devtools/iwyu/bitcoin.core.imp @@ -2,17 +2,7 @@ # Compiler intrinsics. # See: https://github.com/include-what-you-use/include-what-you-use/issues/1764. { "include": [ "", "private", "", "public" ] }, + { "include": [ "", "private", "", "public" ] }, { "include": [ "", "private", "", "public" ] }, { "include": [ "", "private", "", "public" ] }, - - # libc symbols. - # See: https://github.com/include-what-you-use/include-what-you-use/issues/1809. - { "symbol": ["AT_HWCAP", "private", "", "public"] }, - { "symbol": ["AT_HWCAP2", "private", "", "public"] }, - - # Workarounds for IWYU issues. - # See: https://github.com/include-what-you-use/include-what-you-use/issues/1616. - { "symbol": ["std::pair", "private", "", "public"] }, - # See: https://github.com/include-what-you-use/include-what-you-use/issues/1863. - { "symbol": ["std::vector", "private", "", "public"] }, ] diff --git a/contrib/guix/INSTALL.md b/contrib/guix/INSTALL.md index a157acb4b75c..f6f286c03cbf 100644 --- a/contrib/guix/INSTALL.md +++ b/contrib/guix/INSTALL.md @@ -761,6 +761,21 @@ Please see the following links for more details: - A commit to skip this test is included since Guix 1.4.0: [codeberg/guix@6ba1058](https://codeberg.org/guix/guix/commit/6ba1058df0c4ce5611c2367531ae5c3cdc729ab4) +## zdiff3 + +[Currently](https://issues.guix.gnu.org/72942) `guix` builds may fail if the +global git config has `merge.conflictstyle` set to `zdiff3` as follows: + +``` +Updating channel 'guix' from Git repository at 'https://codeberg.org/guix/guix.git'... +guix time-machine: error: Git error: unknown style 'zdiff3' given for 'merge.conflictstyle' +``` + +This can be fixed by setting `merge.conflictstyle` to `diff3`: + +```bash +git config --global merge.conflictstyle diff3 +``` [install-script]: #options-1-and-2-using-the-official-shell-installer-script-or-binary-tarball [install-bin-tarball]: #options-1-and-2-using-the-official-shell-installer-script-or-binary-tarball @@ -782,7 +797,9 @@ an irreversible way, you may want to completely purge Guix from your system and start over. 1. Uninstall Guix itself according to the way you installed it (e.g. `sudo apt - purge guix` for Ubuntu packaging, `sudo make uninstall` for a build from source). + purge guix` for Ubuntu packaging, `sudo make uninstall` for a build from + source, or running the GUIX [install script][install-script] with the + `--uninstall` [flag](https://guix.gnu.org/manual/devel/en/guix.html#index-uninstalling-Guix)). 2. Remove all build users and groups You may check for relevant users and groups using: diff --git a/contrib/guix/guix-build b/contrib/guix/guix-build index ee285bf322cf..bef1c8412a7b 100755 --- a/contrib/guix/guix-build +++ b/contrib/guix/guix-build @@ -383,6 +383,8 @@ EOF # Running in an isolated container minimizes build-time differences # between machines and improves reproducibility # + # --writable-root make the root filesystem writable + # # --pure unset existing environment variables # # Same rationale as --container @@ -441,6 +443,7 @@ EOF # shellcheck disable=SC2086,SC2031 time-machine shell --manifest="${PWD}/contrib/guix/manifest.scm" \ --container \ + --writable-root \ --pure \ --no-cwd \ --share="$PWD"=/bitcoin \ diff --git a/contrib/guix/guix-clean b/contrib/guix/guix-clean index 9af0a793cff7..32258cd7477e 100755 --- a/contrib/guix/guix-clean +++ b/contrib/guix/guix-clean @@ -9,6 +9,14 @@ set -e -o pipefail # shellcheck source=libexec/prelude.bash source "$(dirname "${BASH_SOURCE[0]}")/libexec/prelude.bash" +# Parse supported args +FORCE=0 +if [[ $* == "--force" ]]; then + FORCE=1 +elif [ $# != 0 ]; then + echo "Script only takes optional --force arg." + exit 1 +fi ################### ## Sanity Checks ## @@ -80,4 +88,14 @@ for precious_dirs_file in "${found_precious_dirs_files[@]}"; do done < "$precious_dirs_file" done +if [[ $FORCE == 0 ]]; then + git clean -nxdff "${exclude_flags[@]}" + + read -p "Proceed? (y/n) " -r + if [[ ! $REPLY =~ ^[Yy]$ ]]; then + echo "Aborted." + exit 1 + fi +fi + git clean -xdff "${exclude_flags[@]}" diff --git a/contrib/guix/guix-codesign b/contrib/guix/guix-codesign index 791b75c540bc..39291dfe9ceb 100755 --- a/contrib/guix/guix-codesign +++ b/contrib/guix/guix-codesign @@ -299,6 +299,8 @@ EOF # Running in an isolated container minimizes build-time differences # between machines and improves reproducibility # + # --writable-root make the root filesystem writable + # # --pure unset existing environment variables # # Same rationale as --container @@ -341,6 +343,7 @@ EOF # shellcheck disable=SC2086,SC2031 time-machine shell --manifest="${PWD}/contrib/guix/manifest.scm" \ --container \ + --writable-root \ --pure \ --no-cwd \ --share="$PWD"=/bitcoin \ diff --git a/contrib/guix/libexec/build.sh b/contrib/guix/libexec/build.sh index 072e5b91ba61..51354273efae 100755 --- a/contrib/guix/libexec/build.sh +++ b/contrib/guix/libexec/build.sh @@ -6,7 +6,7 @@ export LC_ALL=C set -e -o pipefail # Environment variables for determinism -export TAR_OPTIONS="--owner=0 --group=0 --numeric-owner --mtime='@${SOURCE_DATE_EPOCH}' --sort=name" +export TAR_OPTIONS="--no-same-owner --owner=0 --group=0 --numeric-owner --mtime='@${SOURCE_DATE_EPOCH}' --sort=name" export TZ=UTC # Although Guix _does_ set umask when building its own packages (in our case, @@ -272,10 +272,6 @@ mkdir -p "$DISTSRC" # Install built Bitcoin Core to $INSTALLPATH case "$HOST" in *darwin*) - # This workaround can be dropped for CMake >= 3.27. - # See the upstream commit 689616785f76acd844fd448c51c5b2a0711aafa2. - find build -name 'cmake_install.cmake' -exec sed -i 's| -u -r | |g' {} + - cmake --install build --strip --prefix "${INSTALLPATH}" ${V:+--verbose} ;; *) @@ -309,6 +305,7 @@ mkdir -p "$DISTSRC" ;; *linux*) cp "${DISTSRC}/README.md" "${DISTNAME}/" + cp "${DISTSRC}/doc/INSTALL_linux.md" "${DISTNAME}/INSTALL.md" ;; esac diff --git a/contrib/guix/libexec/prelude.bash b/contrib/guix/libexec/prelude.bash index b7c13cc91d8c..166675e8bf09 100644 --- a/contrib/guix/libexec/prelude.bash +++ b/contrib/guix/libexec/prelude.bash @@ -71,7 +71,7 @@ fi time-machine() { # shellcheck disable=SC2086 guix time-machine --url=https://codeberg.org/guix/guix.git \ - --commit=5cb84f2013c5b1e48a7d0e617032266f1e6059e2 \ + --commit=c5eee3336cc1d10a3cc1c97fde2809c3451624d3 \ --cores="$JOBS" \ --keep-failed \ --fallback \ diff --git a/contrib/guix/manifest.scm b/contrib/guix/manifest.scm index 9cadd410537c..4fd901e57a5c 100644 --- a/contrib/guix/manifest.scm +++ b/contrib/guix/manifest.scm @@ -1,12 +1,11 @@ (use-modules (gnu packages) ((gnu packages bash) #:select (bash-minimal)) (gnu packages bison) - ((gnu packages certs) #:select (nss-certs)) - ((gnu packages check) #:select (libfaketime)) ((gnu packages cmake) #:select (cmake-minimal)) (gnu packages commencement) (gnu packages compression) (gnu packages cross-base) + ((gnu packages crypto) #:select (osslsigncode)) (gnu packages gawk) (gnu packages gcc) ((gnu packages installers) #:select (nsis-x86_64)) @@ -17,13 +16,10 @@ (gnu packages pkg-config) ((gnu packages python) #:select (python-minimal)) ((gnu packages python-build) #:select (python-poetry-core)) - ((gnu packages python-crypto) #:select (python-asn1crypto)) - ((gnu packages python-science) #:select (python-scikit-build-core)) - ((gnu packages python-xyz) #:select (python-pydantic-2)) + ((gnu packages python-crypto) #:select (python-asn1crypto python-oscrypto)) + ((gnu packages python-xyz) #:select (python-lief)) ((gnu packages tls) #:select (openssl)) ((gnu packages version-control) #:select (git-minimal)) - (guix build-system cmake) - (guix build-system gnu) (guix build-system python) (guix build-system pyproject) (guix build-system trivial) @@ -32,7 +28,7 @@ (guix git-download) ((guix licenses) #:prefix license:) (guix packages) - ((guix utils) #:select (cc-for-target substitute-keyword-arguments))) + ((guix utils) #:select (substitute-keyword-arguments))) (define-syntax-rule (search-our-patches file-name ...) "Return the list of absolute file names corresponding to each @@ -43,13 +39,36 @@ FILE-NAME found in ./patches relative to the current file." (define building-on (string-append "--build=" (list-ref (string-split (%current-system) #\-) 0) "-guix-linux-gnu")) +(define (base-binutils target) + (package + (inherit (cross-binutils target)) ;; 2.44 + (version "2.46.0") + (source (origin + (method url-fetch) + (uri (string-append "mirror://gnu/binutils/binutils-" + version ".tar.bz2")) + (sha256 + (base32 + "04nd9vl7c1pxjbc9wh3ckddzhz5g82xyjqq9y9kf171a59im4c8g")))) + (arguments + (substitute-keyword-arguments (package-arguments (cross-binutils target)) + ((#:configure-flags flags) + #~(append #$flags + (list "--enable-gprofng=no"))))) + (native-inputs + (modify-inputs + (package-native-inputs (cross-binutils target)) + (delete "bison"))) + ) +) + (define (make-cross-toolchain target base-gcc-for-libc base-kernel-headers base-libc base-gcc) "Create a cross-compilation toolchain package for TARGET" - (let* ((xbinutils (cross-binutils target)) + (let* ((xbinutils (base-binutils target)) ;; 1. Build a cross-compiling gcc without targeting any libc, derived ;; from BASE-GCC-FOR-LIBC (xgcc-sans-libc (cross-gcc target @@ -95,25 +114,17 @@ chain for " target " development.")) (license (package-license xgcc))))) (define base-gcc - (package - (inherit gcc-14) ;; 14.2.0 - (version "14.3.0") - (source (origin - (method url-fetch) - (uri (string-append "mirror://gnu/gcc/gcc-" - version "/gcc-" version ".tar.xz")) - (sha256 - (base32 - "0fna78ly417g69fdm4i5f3ms96g8xzzjza8gwp41lqr5fqlpgp70")))))) + (package-with-extra-patches gcc-14 + (search-our-patches "gcc-remap-guix-store.patch" "gcc-ssa-generation.patch"))) (define base-linux-kernel-headers linux-libre-headers-6.1) (define* (make-bitcoin-cross-toolchain target #:key - (base-gcc-for-libc (gcc-libgcc-patches linux-base-gcc)) + (base-gcc-for-libc linux-base-gcc) (base-kernel-headers base-linux-kernel-headers) (base-libc glibc-2.31) - (base-gcc (gcc-libgcc-patches linux-base-gcc))) + (base-gcc linux-base-gcc)) "Convenience wrapper around MAKE-CROSS-TOOLCHAIN with default values desirable for building Bitcoin Core release binaries." (make-cross-toolchain target @@ -122,10 +133,6 @@ desirable for building Bitcoin Core release binaries." base-libc base-gcc)) -(define (gcc-libgcc-patches gcc) - (package-with-extra-patches gcc - (search-our-patches "gcc-remap-guix-store.patch" "gcc-ssa-generation.patch"))) - (define (binutils-mingw-patches binutils) (package-with-extra-patches binutils (search-our-patches "binutils-unaligned-default.patch"))) @@ -136,13 +143,13 @@ desirable for building Bitcoin Core release binaries." (define (make-mingw-pthreads-cross-toolchain target) "Create a cross-compilation toolchain package for TARGET" - (let* ((xbinutils (binutils-mingw-patches (cross-binutils target))) + (let* ((xbinutils (binutils-mingw-patches (base-binutils target))) (machine (substring target 0 (string-index target #\-))) (pthreads-xlibc (winpthreads-patches (make-mingw-w64 machine - #:xgcc (cross-gcc target #:xgcc (gcc-libgcc-patches base-gcc)) + #:xgcc (cross-gcc target #:xgcc base-gcc) #:with-winpthreads? #t))) (pthreads-xgcc (cross-gcc target - #:xgcc (gcc-libgcc-patches mingw-w64-base-gcc) + #:xgcc mingw-w64-base-gcc #:xbinutils xbinutils #:libc pthreads-xlibc))) ;; Define a meta-package that propagates the resulting XBINUTILS, XLIBC, and @@ -164,80 +171,6 @@ chain for " target " development.")) (home-page (package-home-page pthreads-xgcc)) (license (package-license pthreads-xgcc))))) -;; While LIEF is packaged in Guix, we maintain our own package, -;; to simplify building, and more easily apply updates. -;; Moreover, the Guix's package uses cmake, which caused build -;; failure; see https://github.com/bitcoin/bitcoin/pull/27296. -(define-public python-lief - (package - (name "python-lief") - (version "0.16.6") - (source (origin - (method git-fetch) - (uri (git-reference - (url "https://github.com/lief-project/LIEF") - (commit version))) - (file-name (git-file-name name version)) - (sha256 - (base32 - "1pq9nagrnkl1x943bqnpiyxmkd9vk99znfxiwqp6vf012b50bz2a")) - (patches (search-our-patches "lief-scikit-0-9.patch")))) - (build-system pyproject-build-system) - (native-inputs (list cmake-minimal - ninja - python-scikit-build-core - python-pydantic-2)) - (arguments - (list - #:tests? #f ;needs network - #:phases #~(modify-phases %standard-phases - (add-before 'build 'set-pythonpath - (lambda _ - (setenv "PYTHONPATH" - (string-append (string-append (getcwd) "/api/python/backend") - ":" (or (getenv "PYTHONPATH") ""))))) - (add-after 'set-pythonpath 'change-directory - (lambda _ - (chdir "api/python")))))) - (home-page "https://github.com/lief-project/LIEF") - (synopsis "Library to instrument executable formats") - (description - "@code{python-lief} is a cross platform library which can parse, modify -and abstract ELF, PE and MachO formats.") - (license license:asl2.0))) - -(define osslsigncode - (package - (name "osslsigncode") - (version "2.5") - (source (origin - (method git-fetch) - (uri (git-reference - (url "https://github.com/mtrojnar/osslsigncode") - (commit version))) - (sha256 - (base32 - "1j47vwq4caxfv0xw68kw5yh00qcpbd56d7rq6c483ma3y7s96yyz")))) - (build-system cmake-build-system) - (arguments - (list - #:phases - #~(modify-phases %standard-phases - (replace 'check - (lambda* (#:key tests? #:allow-other-keys) - (if tests? - (invoke "faketime" "-f" "@2025-01-01 00:00:00" ;; Tests fail after 2025. - "ctest" "--output-on-failure" "--no-tests=error") - (format #t "test suite not run~%"))))))) - (inputs (list libfaketime openssl)) - (home-page "https://github.com/mtrojnar/osslsigncode") - (synopsis "Authenticode signing and timestamping tool") - (description "osslsigncode is a small tool that implements part of the -functionality of the Microsoft tool signtool.exe - more exactly the Authenticode -signing and timestamping. But osslsigncode is based on OpenSSL and cURL, and -thus should be able to compile on most platforms where these exist.") - (license license:gpl3+))) ; license is with openssl exception - (define-public python-elfesteem (let ((commit "2eb1e5384ff7a220fd1afacd4a0170acff54fe56")) (package @@ -262,64 +195,6 @@ thus should be able to compile on most platforms where these exist.") (description "elfesteem parses ELF, PE and Mach-O files.") (license license:lgpl2.1)))) -(define-public python-oscrypto - (package - (name "python-oscrypto") - (version "1.3.0") - (source - (origin - (method git-fetch) - (uri (git-reference - (url "https://github.com/wbond/oscrypto") - (commit version))) - (file-name (git-file-name name version)) - (sha256 - (base32 - "1v5wkmzcyiqy39db8j2dvkdrv2nlsc48556h73x4dzjwd6kg4q0a")) - (patches (search-our-patches "oscrypto-hard-code-openssl.patch")))) - (build-system python-build-system) - (native-search-paths - (list (search-path-specification - (variable "SSL_CERT_FILE") - (file-type 'regular) - (separator #f) ;single entry - (files '("etc/ssl/certs/ca-certificates.crt"))))) - - (propagated-inputs - (list python-asn1crypto openssl)) - (arguments - `(#:phases - (modify-phases %standard-phases - (add-after 'unpack 'hard-code-path-to-libscrypt - (lambda* (#:key inputs #:allow-other-keys) - (let ((openssl (assoc-ref inputs "openssl"))) - (substitute* "oscrypto/__init__.py" - (("@GUIX_OSCRYPTO_USE_OPENSSL@") - (string-append openssl "/lib/libcrypto.so" "," openssl "/lib/libssl.so"))) - #t))) - (add-after 'unpack 'disable-broken-tests - (lambda _ - ;; This test is broken as there is no keyboard interrupt. - (substitute* "tests/test_trust_list.py" - (("^(.*)class TrustListTests" line indent) - (string-append indent - "@unittest.skip(\"Disabled by Guix\")\n" - line))) - (substitute* "tests/test_tls.py" - (("^(.*)class TLSTests" line indent) - (string-append indent - "@unittest.skip(\"Disabled by Guix\")\n" - line))) - #t)) - (replace 'check - (lambda _ - (invoke "python" "run.py" "tests") - #t))))) - (home-page "https://github.com/wbond/oscrypto") - (synopsis "Compiler-free Python crypto library backed by the OS") - (description "oscrypto is a compilation-free, always up-to-date encryption library for Python.") - (license license:expat))) - (define-public python-oscryptotests (package (inherit python-oscrypto) (name "python-oscryptotests") @@ -351,7 +226,8 @@ thus should be able to compile on most platforms where these exist.") "1qw2k7xis53179lpqdqyylbcmp76lj7sagp883wmxg5i7chhc96k")))) (build-system python-build-system) (propagated-inputs - (list python-asn1crypto + (list openssl + python-asn1crypto python-oscrypto python-oscryptotests)) ;; certvalidator tests import oscryptotests (arguments @@ -480,7 +356,7 @@ inspecting signatures in Mach-O binaries.") #t)))))))) (define-public glibc-2.31 - (let ((commit "7b27c450c34563a28e634cccb399cd415e71ebfe")) + (let ((commit "28eb5caf895ced5d895cb02757e109004a2d33e5")) (package (inherit glibc) ;; 2.39 (version "2.31") @@ -492,7 +368,7 @@ inspecting signatures in Mach-O binaries.") (file-name (git-file-name "glibc" commit)) (sha256 (base32 - "017qdpr5id7ddb4lpkzj2li1abvw916m3fc6n7nw28z4h5qbv2n0")) + "07arjrc1smqy8wrhg38apr1s9ji7xv1rpzdapk4k2ps2n07irp58")) (patches (search-our-patches "glibc-guix-prefix.patch" "glibc-riscv-jumptarget.patch")))) (arguments @@ -545,7 +421,7 @@ inspecting signatures in Mach-O binaries.") gnu-make ninja ;; Scripting - python-minimal ;; (3.10) + python-minimal ;; (3.11) ;; Git git-minimal ;; Tests @@ -555,7 +431,6 @@ inspecting signatures in Mach-O binaries.") (list zip (make-mingw-pthreads-cross-toolchain "x86_64-w64-mingw32") nsis-x86_64 - nss-certs osslsigncode)) ((string-contains target "-linux-") (list bison diff --git a/contrib/guix/patches/gcc-ssa-generation.patch b/contrib/guix/patches/gcc-ssa-generation.patch index 2e5a600230ec..7054fbf3d0b4 100644 --- a/contrib/guix/patches/gcc-ssa-generation.patch +++ b/contrib/guix/patches/gcc-ssa-generation.patch @@ -1,3 +1,8 @@ +This patch can be removed when using GCC 14.4, 15.3 or 16.x. +14.x: https://github.com/gcc-mirror/gcc/commit/2d7099faa5c59b871e3027268d70a8a46d892824 +15.x: https://github.com/gcc-mirror/gcc/commit/7debee2cb6503b2af0f1d43b0e56b759474396d5 +16.x: https://github.com/gcc-mirror/gcc/commit/c6085ca0ed4cef3bcf4eb382cb71e44219c10f6e + commit b46614ebfc57ccca8a050668ad0e8ba5968c5943 Author: Jakub Jelinek Date: Tue Jan 6 08:36:20 2026 +0100 diff --git a/contrib/guix/patches/lief-scikit-0-9.patch b/contrib/guix/patches/lief-scikit-0-9.patch deleted file mode 100644 index 71e617834f07..000000000000 --- a/contrib/guix/patches/lief-scikit-0-9.patch +++ /dev/null @@ -1,21 +0,0 @@ -Partially revert f23ced2f4ffc170d0a6f40ff4a1bee575e3447cf - -Restore compat with python-scikit-build-core 0.9.x -Can be dropped when using python-scikit-build-core >= 0.10.x - ---- a/api/python/backend/setup.py -+++ b/api/python/backend/setup.py -@@ -101,12 +101,12 @@ def _get_hooked_config(is_editable: bool) -> Optional[dict[str, Union[str, List[ - config_settings = { - "logging.level": "DEBUG", - "build-dir": config.build_dir, -- "build.targets": config.build.targets, - "install.strip": config.strip, - "backport.find-python": "0", - "wheel.py-api": config.build.py_api, - "cmake.source-dir": SRC_DIR.as_posix(), - "cmake.build-type": config.build.build_type, -+ "cmake.targets": config.build.targets, - "cmake.args": [ - *config.cmake_generator, - *config.get_cmake_args(is_editable), diff --git a/contrib/guix/patches/oscrypto-hard-code-openssl.patch b/contrib/guix/patches/oscrypto-hard-code-openssl.patch deleted file mode 100644 index 32027f2d09af..000000000000 --- a/contrib/guix/patches/oscrypto-hard-code-openssl.patch +++ /dev/null @@ -1,13 +0,0 @@ -diff --git a/oscrypto/__init__.py b/oscrypto/__init__.py -index eb27313..371ab24 100644 ---- a/oscrypto/__init__.py -+++ b/oscrypto/__init__.py -@@ -302,3 +302,8 @@ def load_order(): - 'oscrypto._win.tls', - 'oscrypto.tls', - ] -+ -+ -+paths = '@GUIX_OSCRYPTO_USE_OPENSSL@'.split(',') -+assert len(paths) == 2, 'Value for OSCRYPTO_USE_OPENSSL env var must be two paths separated by a comma' -+use_openssl(*paths) diff --git a/contrib/guix/patches/winpthreads-remap-guix-store.patch b/contrib/guix/patches/winpthreads-remap-guix-store.patch index e1f1a6eba531..4530e5f3eea0 100644 --- a/contrib/guix/patches/winpthreads-remap-guix-store.patch +++ b/contrib/guix/patches/winpthreads-remap-guix-store.patch @@ -6,12 +6,12 @@ the package, map all guix store prefixes to something fixed, e.g. /usr. --- a/mingw-w64-libraries/winpthreads/Makefile.in +++ b/mingw-w64-libraries/winpthreads/Makefile.in -@@ -478,7 +478,7 @@ top_build_prefix = @top_build_prefix@ +@@ -465,7 +465,7 @@ top_build_prefix = @top_build_prefix@ top_builddir = @top_builddir@ top_srcdir = @top_srcdir@ SUBDIRS = . tests --AM_CFLAGS = -Wall -DWIN32_LEAN_AND_MEAN $(am__append_1) -+AM_CFLAGS = -Wall -DWIN32_LEAN_AND_MEAN $(am__append_1) $(shell find /gnu/store -maxdepth 1 -mindepth 1 -type d -exec echo -n " -ffile-prefix-map={}=/usr" \;) +-AM_CFLAGS = $(am__append_1) $(am__append_3) ++AM_CFLAGS = $(am__append_1) $(am__append_3) $(shell find /gnu/store -maxdepth 1 -mindepth 1 -type d -exec echo -n " -ffile-prefix-map={}=/usr" \;) ACLOCAL_AMFLAGS = -I m4 lib_LTLIBRARIES = libwinpthread.la - include_HEADERS = include/pthread.h include/sched.h include/semaphore.h include/pthread_unistd.h include/pthread_time.h include/pthread_compat.h include/pthread_signal.h + include_HEADERS = \ diff --git a/contrib/guix/symbol-check.py b/contrib/guix/symbol-check.py index 93002ddce798..86b7965277c9 100755 --- a/contrib/guix/symbol-check.py +++ b/contrib/guix/symbol-check.py @@ -202,7 +202,7 @@ def check_exported_symbols(binary) -> bool: if not symbol.exported: continue name = symbol.name - if binary.header.machine_type == lief.ELF.ARCH.RISCV or name in IGNORE_EXPORTS: + if name in IGNORE_EXPORTS: continue print(f'{filename}: export of symbol {name} not allowed!') ok = False @@ -241,7 +241,7 @@ def check_MACHO_sdk(binary) -> bool: return False def check_MACHO_lld(binary) -> bool: - if binary.build_version.tools[0].version == [19, 1, 4]: + if binary.build_version.tools[0].version == [19, 1, 7]: return True return False diff --git a/contrib/init/bitcoind.openrc b/contrib/init/bitcoind.openrc index 013a1a607027..30e7be36fcf4 100644 --- a/contrib/init/bitcoind.openrc +++ b/contrib/init/bitcoind.openrc @@ -1,6 +1,6 @@ #!/sbin/openrc-run -# backward compatibility for existing gentoo layout +# backward compatibility for existing gentoo layout # if [ -d "/var/lib/bitcoin/.bitcoin" ]; then BITCOIND_DEFAULT_DATADIR="/var/lib/bitcoin/.bitcoin" diff --git a/contrib/macdeploy/macdeployqtplus b/contrib/macdeploy/macdeployqtplus index 476ac133ebf4..c8244af1532f 100755 --- a/contrib/macdeploy/macdeployqtplus +++ b/contrib/macdeploy/macdeployqtplus @@ -42,13 +42,13 @@ class FrameworkInfo(object): self.sourceContentsDirectory = "" self.destinationResourcesDirectory = "" self.destinationVersionContentsDirectory = "" - + def __eq__(self, other): if self.__class__ == other.__class__: return self.__dict__ == other.__dict__ else: return False - + def __str__(self): return f""" Framework name: {self.frameworkName} Framework directory: {self.frameworkDirectory} @@ -62,51 +62,51 @@ class FrameworkInfo(object): Source file Path: {self.sourceFilePath} Deployed Directory (relative to bundle): {self.destinationDirectory} """ - + def isDylib(self): return self.frameworkName.endswith(".dylib") - + def isQtFramework(self): if self.isDylib(): return self.frameworkName.startswith("libQt") else: return self.frameworkName.startswith("Qt") - + reOLine = re.compile(r'^(.+) \(compatibility version [0-9.]+, current version [0-9.]+\)$') bundleFrameworkDirectory = "Contents/Frameworks" bundleBinaryDirectory = "Contents/MacOS" - + @classmethod def fromLibraryLine(cls, line: str) -> Optional['FrameworkInfo']: # Note: line must be trimmed if line == "": return None - + # Don't deploy system libraries if line.startswith("/System/Library/") or line.startswith("@executable_path") or line.startswith("/usr/lib/"): return None - + m = cls.reOLine.match(line) if m is None: raise RuntimeError(f"Line could not be parsed: {line}") - + path = m.group(1) - + info = cls() info.sourceFilePath = path info.installName = path - + if path.endswith(".dylib"): dirname, filename = os.path.split(path) info.frameworkName = filename info.frameworkDirectory = dirname info.frameworkPath = path - + info.binaryDirectory = dirname info.binaryName = filename info.binaryPath = path info.version = "-" - + info.installName = path info.deployedInstallName = f"@executable_path/../Frameworks/{info.binaryName}" info.sourceFilePath = path @@ -121,25 +121,25 @@ class FrameworkInfo(object): i += 1 if i == len(parts): raise RuntimeError(f"Could not find .framework or .dylib in line: {line}") - + info.frameworkName = parts[i] info.frameworkDirectory = "/".join(parts[:i]) info.frameworkPath = os.path.join(info.frameworkDirectory, info.frameworkName) - + info.binaryName = parts[i+3] info.binaryDirectory = "/".join(parts[i+1:i+3]) info.binaryPath = os.path.join(info.binaryDirectory, info.binaryName) info.version = parts[i+2] - + info.deployedInstallName = f"@executable_path/../Frameworks/{os.path.join(info.frameworkName, info.binaryPath)}" info.destinationDirectory = os.path.join(cls.bundleFrameworkDirectory, info.frameworkName, info.binaryDirectory) - + info.sourceResourcesDirectory = os.path.join(info.frameworkPath, "Resources") info.sourceContentsDirectory = os.path.join(info.frameworkPath, "Contents") info.sourceVersionContentsDirectory = os.path.join(info.frameworkPath, "Versions", info.version, "Contents") info.destinationResourcesDirectory = os.path.join(cls.bundleFrameworkDirectory, info.frameworkName, "Resources") info.destinationVersionContentsDirectory = os.path.join(cls.bundleFrameworkDirectory, info.frameworkName, "Versions", info.version, "Contents") - + return info class ApplicationBundleInfo(object): @@ -160,7 +160,7 @@ class DeploymentInfo(object): def detectQtPath(self, frameworkDirectory: str): parentDir = os.path.dirname(frameworkDirectory) - if os.path.exists(os.path.join(parentDir, "share", "qt", "translations")): + if os.path.exists(os.path.join(parentDir, "share", "qt", "plugins")): self.qtPath = parentDir else: self.qtPath = os.getenv("QTDIR", None) @@ -289,45 +289,45 @@ def copyFramework(framework: FrameworkInfo, path: str, verbose: int) -> Optional def deployFrameworks(frameworks: list[FrameworkInfo], bundlePath: str, binaryPath: str, strip: bool, verbose: int, deploymentInfo: Optional[DeploymentInfo] = None) -> DeploymentInfo: if deploymentInfo is None: deploymentInfo = DeploymentInfo() - + while len(frameworks) > 0: framework = frameworks.pop(0) deploymentInfo.deployedFrameworks.append(framework.frameworkName) - + print("Processing", framework.frameworkName, "...") - + # Get the Qt path from one of the Qt frameworks if deploymentInfo.qtPath is None and framework.isQtFramework(): deploymentInfo.detectQtPath(framework.frameworkDirectory) - + if framework.installName.startswith("@executable_path") or framework.installName.startswith(bundlePath): print(framework.frameworkName, "already deployed, skipping.") continue - + # install_name_tool the new id into the binary changeInstallName(framework.installName, framework.deployedInstallName, binaryPath, verbose) - + # Copy framework to app bundle. deployedBinaryPath = copyFramework(framework, bundlePath, verbose) # Skip the rest if already was deployed. if deployedBinaryPath is None: continue - + if strip: runStrip(deployedBinaryPath, verbose) - + # install_name_tool it a new id. changeIdentification(framework.deployedInstallName, deployedBinaryPath, verbose) # Check for framework dependencies dependencies = getFrameworks(deployedBinaryPath, verbose, rpath=framework.frameworkDirectory) - + for dependency in dependencies: changeInstallName(dependency.installName, dependency.deployedInstallName, deployedBinaryPath, verbose) - + # Deploy framework if necessary. if dependency.frameworkName not in deploymentInfo.deployedFrameworks and dependency not in frameworks: frameworks.append(dependency) - + return deploymentInfo def deployFrameworksForAppBundle(applicationBundle: ApplicationBundleInfo, strip: bool, verbose: int) -> DeploymentInfo: @@ -355,29 +355,29 @@ def deployPlugins(appBundleInfo: ApplicationBundleInfo, deploymentInfo: Deployme continue plugins.append((pluginDirectory, pluginName)) - + for pluginDirectory, pluginName in plugins: print("Processing plugin", os.path.join(pluginDirectory, pluginName), "...") - + sourcePath = os.path.join(deploymentInfo.pluginPath, pluginDirectory, pluginName) destinationDirectory = os.path.join(appBundleInfo.pluginPath, pluginDirectory) if not os.path.exists(destinationDirectory): os.makedirs(destinationDirectory) - + destinationPath = os.path.join(destinationDirectory, pluginName) shutil.copy2(sourcePath, destinationPath) if verbose: print("Copied:", sourcePath) print(" to:", destinationPath) - + if strip: runStrip(destinationPath, verbose) - + dependencies = getFrameworks(destinationPath, verbose) - + for dependency in dependencies: changeInstallName(dependency.installName, dependency.deployedInstallName, destinationPath, verbose) - + # Deploy framework if necessary. if dependency.frameworkName not in deploymentInfo.deployedFrameworks: deployFrameworks([dependency], appBundleInfo.path, destinationPath, strip, verbose, deploymentInfo) @@ -446,7 +446,7 @@ except RuntimeError as e: if config.plugins: print("+ Deploying plugins +") - + try: deployPlugins(applicationBundle, deploymentInfo, config.strip, verbose) except RuntimeError as e: @@ -499,7 +499,7 @@ if config.zip is not None: print("+ Removing existing .zip +") os.unlink(name + ".zip") - shutil.make_archive('{}'.format(name), format='zip', root_dir='dist', base_dir='Bitcoin-Qt.app') + subprocess.check_call(["zip", "-ry", os.path.abspath(name + ".zip"), 'Bitcoin-Qt.app'], cwd='dist') # ------------------------------------------------ diff --git a/contrib/qos/tc.sh b/contrib/qos/tc.sh index 2c48fc2a268f..4e4237084e1d 100755 --- a/contrib/qos/tc.sh +++ b/contrib/qos/tc.sh @@ -34,9 +34,9 @@ tc filter add dev ${IF} parent 1: protocol ip prio 1 handle 1 fw classid 1:10 tc filter add dev ${IF} parent 1: protocol ip prio 2 handle 2 fw classid 1:11 if [ -n "${LOCALNET_V6}" ] ; then - # v6 cannot have the same priority value as v4 - tc filter add dev ${IF} parent 1: protocol ipv6 prio 3 handle 1 fw classid 1:10 - tc filter add dev ${IF} parent 1: protocol ipv6 prio 4 handle 2 fw classid 1:11 + # v6 cannot have the same priority value as v4 + tc filter add dev ${IF} parent 1: protocol ipv6 prio 3 handle 1 fw classid 1:10 + tc filter add dev ${IF} parent 1: protocol ipv6 prio 4 handle 2 fw classid 1:11 fi #delete any existing rules @@ -57,6 +57,6 @@ iptables -t mangle -A OUTPUT -p tcp -m tcp --dport 8333 ! -d ${LOCALNET_V4} -j M iptables -t mangle -A OUTPUT -p tcp -m tcp --sport 8333 ! -d ${LOCALNET_V4} -j MARK --set-mark 0x2 if [ -n "${LOCALNET_V6}" ] ; then - ip6tables -t mangle -A OUTPUT -p tcp -m tcp --dport 8333 ! -d ${LOCALNET_V6} -j MARK --set-mark 0x4 - ip6tables -t mangle -A OUTPUT -p tcp -m tcp --sport 8333 ! -d ${LOCALNET_V6} -j MARK --set-mark 0x4 + ip6tables -t mangle -A OUTPUT -p tcp -m tcp --dport 8333 ! -d ${LOCALNET_V6} -j MARK --set-mark 0x4 + ip6tables -t mangle -A OUTPUT -p tcp -m tcp --sport 8333 ! -d ${LOCALNET_V6} -j MARK --set-mark 0x4 fi diff --git a/contrib/verify-commits/gpg.sh b/contrib/verify-commits/gpg.sh index 3579a70a699c..bcb117f19a05 100755 --- a/contrib/verify-commits/gpg.sh +++ b/contrib/verify-commits/gpg.sh @@ -9,27 +9,27 @@ if [ "$BITCOIN_VERIFY_COMMITS_ALLOW_SHA1" = 1 ]; then printf '%s\n' "$INPUT" | gpg --trust-model always "$@" 2>/dev/null exit $? else - # Note how we've disabled SHA1 with the --weak-digest option, disabling - # signatures - including selfsigs - that use SHA1. While you might think that - # collision attacks shouldn't be an issue as they'd be an attack on yourself, - # in fact because what's being signed is a commit object that's - # semi-deterministically generated by untrusted input (the pull-req) in theory - # an attacker could construct a pull-req that results in a commit object that - # they've created a collision for. Not the most likely attack, but preventing - # it is pretty easy so we do so as a "belt-and-suspenders" measure. - for LINE in $(gpg --version); do - case "$LINE" in - "gpg (GnuPG) 1.4.1"*|"gpg (GnuPG) 2.0."*) - echo "Please upgrade to at least gpg 2.1.10 to check for weak signatures" > /dev/stderr - printf '%s\n' "$INPUT" | gpg --trust-model always "$@" 2>/dev/null - exit $? - ;; - # We assume if you're running 2.1+, you're probably running 2.1.10+ - # gpg will fail otherwise - # We assume if you're running 1.X, it is either 1.4.1X or 1.4.20+ - # gpg will fail otherwise - esac - done - printf '%s\n' "$INPUT" | gpg --trust-model always --weak-digest sha1 "$@" 2>/dev/null - exit $? + # Note how we've disabled SHA1 with the --weak-digest option, disabling + # signatures - including selfsigs - that use SHA1. While you might think that + # collision attacks shouldn't be an issue as they'd be an attack on yourself, + # in fact because what's being signed is a commit object that's + # semi-deterministically generated by untrusted input (the pull-req) in theory + # an attacker could construct a pull-req that results in a commit object that + # they've created a collision for. Not the most likely attack, but preventing + # it is pretty easy so we do so as a "belt-and-suspenders" measure. + for LINE in $(gpg --version); do + case "$LINE" in + "gpg (GnuPG) 1.4.1"*|"gpg (GnuPG) 2.0."*) + echo "Please upgrade to at least gpg 2.1.10 to check for weak signatures" > /dev/stderr + printf '%s\n' "$INPUT" | gpg --trust-model always "$@" 2>/dev/null + exit $? + ;; + # We assume if you're running 2.1+, you're probably running 2.1.10+ + # gpg will fail otherwise + # We assume if you're running 1.X, it is either 1.4.1X or 1.4.20+ + # gpg will fail otherwise + esac + done + printf '%s\n' "$INPUT" | gpg --trust-model always --weak-digest sha1 "$@" 2>/dev/null + exit $? fi diff --git a/depends/Makefile b/depends/Makefile index fde108d2c2c9..c377187b50ac 100644 --- a/depends/Makefile +++ b/depends/Makefile @@ -49,7 +49,7 @@ FALLBACK_DOWNLOAD_PATH ?= https://bitcoincore.org/depends-sources C_STANDARD ?= c11 CXX_STANDARD ?= c++20 -BUILD = $(shell ./config.guess) +BUILD = $(shell unset CC && ./config.guess) PATCHES_PATH = $(BASEDIR)/patches BASEDIR = $(CURDIR) HASH_LENGTH:=11 diff --git a/depends/README.md b/depends/README.md index 706c3db0d956..b12df1354e59 100644 --- a/depends/README.md +++ b/depends/README.md @@ -108,6 +108,18 @@ The following can be set when running make: `make FOO=bar` If some packages are not built, for example `make NO_WALLET=1`, the appropriate CMake cache variables will be set when generating the Bitcoin Core buildsystem. In this case, `-DENABLE_WALLET=OFF`. +## Compiler Configuration + +`CC` and `CXX` control target compilers. `build_CC` and `build_CXX` control +compilers for native build tools (e.g. `native_capnp`, `native_qt`), which +default to `gcc`/`g++` on Linux and `clang`/`clang++` on macOS/FreeBSD/OpenBSD +(see `./depends/builders/*.mk`). + +On a system where the default build compiler is not available (e.g. Linux +without gcc/g++), you could use the following to build all packages using clang: + + make -C depends build_CC=clang build_CXX=clang++ CC=clang CXX=clang++ + ## Cross compilation To build for another arch/OS: diff --git a/depends/builders/darwin.mk b/depends/builders/darwin.mk index 2b59353e84f3..dba4d1370dbc 100644 --- a/depends/builders/darwin.mk +++ b/depends/builders/darwin.mk @@ -5,7 +5,6 @@ build_darwin_RANLIB:=$(shell xcrun -f ranlib) build_darwin_STRIP:=$(shell xcrun -f strip) build_darwin_OBJDUMP:=$(shell xcrun -f objdump) build_darwin_NM:=$(shell xcrun -f nm) -build_darwin_DSYMUTIL:=$(shell xcrun -f dsymutil) build_darwin_SHA256SUM=shasum -a 256 build_darwin_DOWNLOAD=curl --location --fail --connect-timeout $(DOWNLOAD_CONNECT_TIMEOUT) --retry $(DOWNLOAD_RETRIES) -o @@ -17,7 +16,6 @@ darwin_RANLIB:=$(shell xcrun -f ranlib) darwin_STRIP:=$(shell xcrun -f strip) darwin_OBJDUMP:=$(shell xcrun -f objdump) darwin_NM:=$(shell xcrun -f nm) -darwin_DSYMUTIL:=$(shell xcrun -f dsymutil) x86_64_darwin_CFLAGS += -arch x86_64 x86_64_darwin_CXXFLAGS += -arch x86_64 diff --git a/depends/builders/default.mk b/depends/builders/default.mk index 2a1709d98ad2..fa7dfbb00530 100644 --- a/depends/builders/default.mk +++ b/depends/builders/default.mk @@ -13,7 +13,7 @@ build_$(build_os)_$1 ?= $$(default_build_$1) build_$(build_arch)_$(build_os)_$1 ?= $$(build_$(build_os)_$1) build_$1=$$(build_$(build_arch)_$(build_os)_$1) endef -$(foreach var,CC CXX AR TAR RANLIB NM STRIP SHA256SUM DOWNLOAD OBJDUMP DSYMUTIL TOUCH,$(eval $(call add_build_tool_func,$(var)))) +$(foreach var,CC CXX AR TAR RANLIB NM STRIP SHA256SUM DOWNLOAD OBJDUMP TOUCH,$(eval $(call add_build_tool_func,$(var)))) define add_build_flags_func build_$(build_arch)_$(build_os)_$1 += $(build_$(build_os)_$1) build_$1=$$(build_$(build_arch)_$(build_os)_$1) diff --git a/depends/builders/freebsd.mk b/depends/builders/freebsd.mk index 910de28bf36f..f66d3fcdb8c4 100644 --- a/depends/builders/freebsd.mk +++ b/depends/builders/freebsd.mk @@ -7,3 +7,9 @@ build_freebsd_DOWNLOAD = curl --location --fail --connect-timeout $(DOWNLOAD_CON # freebsd host on freebsd builder: override freebsd host preferences. freebsd_CC = clang freebsd_CXX = clang++ + +i686_freebsd_CFLAGS += -m32 +i686_freebsd_CXXFLAGS += -m32 + +x86_64_freebsd_CFLAGS += -m64 +x86_64_freebsd_CXXFLAGS += -m64 diff --git a/depends/hosts/darwin.mk b/depends/hosts/darwin.mk index 71fac7cc8909..373ab74e113c 100644 --- a/depends/hosts/darwin.mk +++ b/depends/hosts/darwin.mk @@ -6,23 +6,15 @@ LLD_VERSION=711 OSX_SDK=$(SDK_PATH)/Xcode-$(XCODE_VERSION)-$(XCODE_BUILD_ID)-extracted-SDK-with-libcxx-headers -# We can't just use $(shell command -v clang) because GNU Make handles builtins -# in a special way and doesn't know that `command` is a POSIX-standard builtin -# prior to 1af314465e5dfe3e8baa839a32a72e83c04f26ef, first released in v4.2.90. -# At the time of writing, GNU Make v4.2.1 is still being used in supported -# distro releases. -# -# Source: https://lists.gnu.org/archive/html/bug-make/2017-11/msg00017.html -clang_prog=$(shell $(SHELL) $(.SHELLFLAGS) "command -v clang") -clangxx_prog=$(shell $(SHELL) $(.SHELLFLAGS) "command -v clang++") +clang_prog=$(shell command -v clang) +clangxx_prog=$(shell command -v clang++) -darwin_AR=$(shell $(SHELL) $(.SHELLFLAGS) "command -v llvm-ar") -darwin_DSYMUTIL=$(shell $(SHELL) $(.SHELLFLAGS) "command -v dsymutil") -darwin_NM=$(shell $(SHELL) $(.SHELLFLAGS) "command -v llvm-nm") -darwin_OBJCOPY=$(shell $(SHELL) $(.SHELLFLAGS) "command -v llvm-objcopy") -darwin_OBJDUMP=$(shell $(SHELL) $(.SHELLFLAGS) "command -v llvm-objdump") -darwin_RANLIB=$(shell $(SHELL) $(.SHELLFLAGS) "command -v llvm-ranlib") -darwin_STRIP=$(shell $(SHELL) $(.SHELLFLAGS) "command -v llvm-strip") +darwin_AR=$(shell command -v llvm-ar) +darwin_NM=$(shell command -v llvm-nm) +darwin_OBJCOPY=$(shell command -v llvm-objcopy) +darwin_OBJDUMP=$(shell command -v llvm-objdump) +darwin_RANLIB=$(shell command -v llvm-ranlib) +darwin_STRIP=$(shell command -v llvm-strip) # Flag explanations: # diff --git a/depends/hosts/default.mk b/depends/hosts/default.mk index 22409c4004d6..21a9612aea48 100644 --- a/depends/hosts/default.mk +++ b/depends/hosts/default.mk @@ -39,5 +39,5 @@ host_$1 = $$($(host_arch)_$(host_os)_$1) host_$(release_type)_$1 = $$($(host_arch)_$(host_os)_$(release_type)_$1) endef -$(foreach tool,CC CXX AR RANLIB STRIP NM OBJCOPY OBJDUMP DSYMUTIL,$(eval $(call add_host_tool_func,$(tool)))) +$(foreach tool,CC CXX AR RANLIB STRIP NM OBJCOPY OBJDUMP,$(eval $(call add_host_tool_func,$(tool)))) $(foreach flags,CFLAGS CXXFLAGS CPPFLAGS LDFLAGS, $(eval $(call add_host_flags_func,$(flags)))) diff --git a/depends/hosts/freebsd.mk b/depends/hosts/freebsd.mk index b69535cc800e..240180f2fd2a 100644 --- a/depends/hosts/freebsd.mk +++ b/depends/hosts/freebsd.mk @@ -1,5 +1,26 @@ +FREEBSD_VERSION ?= 15.0 +FREEBSD_SDK=$(SDK_PATH)/freebsd-$(host)-$(FREEBSD_VERSION)/ + +clang_prog=$(shell command -v clang) +clangxx_prog=$(shell command -v clang++) + +freebsd_AR=$(shell command -v llvm-ar) +freebsd_NM=$(shell command -v llvm-nm) +freebsd_OBJCOPY=$(shell command -v llvm-objcopy) +freebsd_OBJDUMP=$(shell command -v llvm-objdump) +freebsd_RANLIB=$(shell command -v llvm-ranlib) +freebsd_STRIP=$(shell command -v llvm-strip) + + +freebsd_CC=$(clang_prog) --target=$(host) \ + --sysroot=$(FREEBSD_SDK) + +freebsd_CXX=$(clangxx_prog) --target=$(host) \ + --sysroot=$(FREEBSD_SDK) -stdlib=libc++ + freebsd_CFLAGS= freebsd_CXXFLAGS= +freebsd_LDFLAGS=-fuse-ld=lld freebsd_release_CFLAGS=-O2 freebsd_release_CXXFLAGS=$(freebsd_release_CFLAGS) @@ -7,25 +28,4 @@ freebsd_release_CXXFLAGS=$(freebsd_release_CFLAGS) freebsd_debug_CFLAGS=-O1 -g freebsd_debug_CXXFLAGS=$(freebsd_debug_CFLAGS) -ifeq (86,$(findstring 86,$(build_arch))) -i686_freebsd_CC=clang -m32 -i686_freebsd_CXX=clang++ -m32 -i686_freebsd_AR=ar -i686_freebsd_RANLIB=ranlib -i686_freebsd_NM=nm -i686_freebsd_STRIP=strip - -x86_64_freebsd_CC=clang -m64 -x86_64_freebsd_CXX=clang++ -m64 -x86_64_freebsd_AR=ar -x86_64_freebsd_RANLIB=ranlib -x86_64_freebsd_NM=nm -x86_64_freebsd_STRIP=strip -else -i686_freebsd_CC=$(default_host_CC) -m32 -i686_freebsd_CXX=$(default_host_CXX) -m32 -x86_64_freebsd_CC=$(default_host_CC) -m64 -x86_64_freebsd_CXX=$(default_host_CXX) -m64 -endif - freebsd_cmake_system_name=FreeBSD diff --git a/depends/hosts/mingw32.mk b/depends/hosts/mingw32.mk index 7db6afaef6a1..d433636fa4fb 100644 --- a/depends/hosts/mingw32.mk +++ b/depends/hosts/mingw32.mk @@ -1,7 +1,7 @@ -ifneq ($(shell $(SHELL) $(.SHELLFLAGS) "command -v $(host)-gcc-posix"),) +ifneq ($(shell command -v $(host)-gcc-posix),) mingw32_CC := $(host)-gcc-posix endif -ifneq ($(shell $(SHELL) $(.SHELLFLAGS) "command -v $(host)-g++-posix"),) +ifneq ($(shell command -v $(host)-g++-posix),) mingw32_CXX := $(host)-g++-posix endif diff --git a/depends/packages/boost.mk b/depends/packages/boost.mk index 02f59abe4d25..5be0e60b623a 100644 --- a/depends/packages/boost.mk +++ b/depends/packages/boost.mk @@ -6,7 +6,7 @@ $(package)_sha256_hash = 913ca43d49e93d1b158c9862009add1518a4c665e7853b349a6492d $(package)_build_subdir = build define $(package)_set_vars - $(package)_config_opts = -DBOOST_INCLUDE_LIBRARIES="multi_index;signals2;test" + $(package)_config_opts = -DBOOST_INCLUDE_LIBRARIES="multi_index;test" $(package)_config_opts += -DBOOST_TEST_HEADERS_ONLY=ON $(package)_config_opts += -DBOOST_ENABLE_MPI=OFF $(package)_config_opts += -DBOOST_ENABLE_PYTHON=OFF @@ -24,3 +24,7 @@ endef define $(package)_stage_cmds $(MAKE) DESTDIR=$($(package)_staging_dir) install endef + +define $(package)_postprocess_cmds + rm -rf share +endef diff --git a/depends/packages/native_capnp.mk b/depends/packages/native_capnp.mk index 0cd0dcdf9d92..d65a8b97cb18 100644 --- a/depends/packages/native_capnp.mk +++ b/depends/packages/native_capnp.mk @@ -1,9 +1,9 @@ package=native_capnp -$(package)_version=1.3.0 +$(package)_version=1.4.0 $(package)_download_path=https://capnproto.org/ $(package)_download_file=capnproto-c++-$($(package)_version).tar.gz $(package)_file_name=capnproto-cxx-$($(package)_version).tar.gz -$(package)_sha256_hash=098f824a495a1a837d56ae17e07b3f721ac86f8dbaf58896a389923458522108 +$(package)_sha256_hash=fa02378ad522b318916b9ad928d1372fc9abd43dd1f4f0392e50450f5c87828f define $(package)_set_vars $(package)_config_opts := -DBUILD_TESTING=OFF diff --git a/depends/packages/native_qt.mk b/depends/packages/native_qt.mk index 310c9f1329e6..2bf088c10aca 100644 --- a/depends/packages/native_qt.mk +++ b/depends/packages/native_qt.mk @@ -9,6 +9,7 @@ $(package)_patches := dont_hardcode_pwd.patch $(package)_patches += qtbase_skip_tools.patch $(package)_patches += rcc_hardcode_timestamp.patch $(package)_patches += qttools_skip_dependencies.patch +$(package)_patches += fix-macos26-qyield.patch $(package)_qttranslations_file_name=$(qt_details_qttranslations_file_name) $(package)_qttranslations_sha256_hash=$(qt_details_qttranslations_sha256_hash) @@ -97,9 +98,9 @@ ifneq ($(V),) $(package)_cmake_opts += --log-level=STATUS endif -ifeq ($(host_os),darwin) -$(package)_cmake_opts += -DQT_INTERNAL_XCODE_VERSION=$(XCODE_VERSION) +ifeq ($(build_os),darwin) $(package)_cmake_opts += -DQT_NO_APPLE_SDK_MAX_VERSION_CHECK=ON +$(package)_cmake_opts += -DQT_NO_XCODE_MIN_VERSION_CHECK=ON endif endef @@ -137,7 +138,8 @@ define $(package)_preprocess_cmds patch -p1 -i $($(package)_patch_dir)/dont_hardcode_pwd.patch && \ patch -p1 -i $($(package)_patch_dir)/qtbase_skip_tools.patch && \ patch -p1 -i $($(package)_patch_dir)/rcc_hardcode_timestamp.patch && \ - patch -p1 -i $($(package)_patch_dir)/qttools_skip_dependencies.patch + patch -p1 -i $($(package)_patch_dir)/qttools_skip_dependencies.patch && \ + patch -p1 -i $($(package)_patch_dir)/fix-macos26-qyield.patch endef define $(package)_config_cmds diff --git a/depends/packages/packages.mk b/depends/packages/packages.mk index 4fee4e18a396..22ae4787fe73 100644 --- a/depends/packages/packages.mk +++ b/depends/packages/packages.mk @@ -5,6 +5,7 @@ boost_packages = boost libevent_packages = libevent qrencode_linux_packages = qrencode +qrencode_freebsd_packages = qrencode qrencode_darwin_packages = qrencode qrencode_mingw32_packages = qrencode diff --git a/depends/packages/qt.mk b/depends/packages/qt.mk index 8d5ddfb89a89..9b7cec341d60 100644 --- a/depends/packages/qt.mk +++ b/depends/packages/qt.mk @@ -24,6 +24,7 @@ $(package)_patches += fix-gcc16-sfinae-qregularexpression.patch $(package)_patches += fix-gcc16-sfinae-qchar.patch $(package)_patches += fix-gcc16-sfinae-qbitarray.patch $(package)_patches += fix-gcc16-sfinae-qanystringview.patch +$(package)_patches += fix-macos26-qyield.patch $(package)_patches += fix-qbytearray-include.patch $(package)_qttranslations_file_name=$(qt_details_qttranslations_file_name) @@ -156,6 +157,7 @@ ifneq ($(LTO),) $(package)_config_opts_linux += -ltcg endif $(package)_config_opts_freebsd := $$($(package)_config_opts_linux) +$(package)_config_opts_freebsd += -no-feature-inotify $(package)_config_opts_mingw32 := -no-dbus $(package)_config_opts_mingw32 += -no-feature-freetype @@ -169,6 +171,7 @@ $(package)_config_env_darwin += OBJCXX="$$($(package)_cxx)" $(package)_cmake_opts := -DCMAKE_PREFIX_PATH=$(host_prefix) $(package)_cmake_opts += -DQT_FEATURE_cxx20=ON +$(package)_cmake_opts += -DQT_GENERATE_SBOM=OFF ifneq ($(V),) $(package)_cmake_opts += --log-level=STATUS endif @@ -206,8 +209,8 @@ $(package)_cmake_opts += -DCMAKE_DISABLE_FIND_PACKAGE_WrapSystemMd4c=TRUE $(package)_cmake_opts += -DCMAKE_DISABLE_FIND_PACKAGE_WrapZSTD=TRUE endif ifeq ($(host_os),linux) -# For some reason, the `-dbus-runtime` configure -# option does not work as expected. +# The `-dbus-runtime` configure option does not work +# https://qt-project.atlassian.net/browse/QTBUG-144864 $(package)_cmake_opts += -DINPUT_dbus=runtime endif ifeq ($(host_os),darwin) @@ -280,6 +283,7 @@ define $(package)_preprocess_cmds patch -p1 -i $($(package)_patch_dir)/fix-gcc16-sfinae-qchar.patch && \ patch -p1 -i $($(package)_patch_dir)/fix-gcc16-sfinae-qbitarray.patch && \ patch -p1 -i $($(package)_patch_dir)/fix-gcc16-sfinae-qanystringview.patch && \ + patch -p1 -i $($(package)_patch_dir)/fix-macos26-qyield.patch && \ patch -p1 -i $($(package)_patch_dir)/fix-qbytearray-include.patch endef ifeq ($(host),$(build)) diff --git a/depends/patches/qt/fix-macos26-qyield.patch b/depends/patches/qt/fix-macos26-qyield.patch new file mode 100644 index 000000000000..65514a01cc82 --- /dev/null +++ b/depends/patches/qt/fix-macos26-qyield.patch @@ -0,0 +1,44 @@ +commit a76004f16fdc43e1b7af83bfdf3f1a613491b234 +Author: Paul Wicking +Date: Thu Mar 26 07:09:43 2026 +0100 + + qyieldcpu: Fix compilation with macOS 26.4 SDK + + After updating to the macOS 26.4 SDK, qtbase fails to compile on + Apple Silicon with an implicit function declaration error for + __yield() in qyieldcpu.h. It appears that the SDK's Clang now + reports __has_builtin(__yield) as true, but __yield() requires + for its declaration. + + The compiler's own __builtin_arm_yield intrinsic was already checked + further down in the cascade. Moving it above the __yield check resolves + the build failure, without unnecessarily pulling in the header. + + Fixes: QTBUG-145239 + Change-Id: I94b4d8f72385a4944c272ed7a66d249537a82e7d + Reviewed-by: Tor Arne Vestbø + Reviewed-by: Fabian Kosmale + +--- a/qtbase/src/corelib/thread/qyieldcpu.h ++++ b/qtbase/src/corelib/thread/qyieldcpu.h +@@ -31,7 +31,9 @@ void qYieldCpu(void) + noexcept + #endif + { +-#if __has_builtin(__yield) ++#if __has_builtin(__builtin_arm_yield) ++ __builtin_arm_yield(); ++#elif __has_builtin(__yield) + __yield(); // Generic + #elif defined(_YIELD_PROCESSOR) && defined(Q_CC_MSVC) + _YIELD_PROCESSOR(); // Generic; MSVC's +@@ -45,9 +47,6 @@ void qYieldCpu(void) + _mm_pause(); + #elif defined(Q_PROCESSOR_X86) + __asm__("pause"); // hopefully asm() works in this compiler +- +-#elif __has_builtin(__builtin_arm_yield) +- __builtin_arm_yield(); + #elif defined(Q_PROCESSOR_ARM) && Q_PROCESSOR_ARM >= 7 && defined(Q_CC_GNU) + __asm__("yield"); // this works everywhere + diff --git a/doc/INSTALL_linux.md b/doc/INSTALL_linux.md new file mode 100644 index 000000000000..c6bec558feb7 --- /dev/null +++ b/doc/INSTALL_linux.md @@ -0,0 +1,29 @@ +Bitcoin Core +============= + +Below are notes on installing Bitcoin Core software on Linux systems. + +General Runtime Requirements +---------------------------- + +Bitcoin Core requires glibc (GNU C Library) 2.31 or newer. + +GUI Runtime Requirements +------------------------ + +The GUI executable, `bitcoin-qt`, is based on the Qt 6 framework and uses the `xcb` QPA (Qt Platform Abstraction) platform plugin +to run on X11. Its runtime library dependencies are as follows: +- `libfontconfig` +- `libfreetype` + +On Debian, Ubuntu, or their derivatives, you can run the following command to ensure all dependencies are installed: +```sh +sudo apt install libfontconfig1 libfreetype6 +``` + +On Fedora, run: +```sh +sudo dnf install fontconfig freetype +``` + +For other systems, please consult their documentation. diff --git a/doc/asmap-data.md b/doc/asmap-data.md index 09e2f95c9749..e3035e5857e7 100644 --- a/doc/asmap-data.md +++ b/doc/asmap-data.md @@ -41,9 +41,9 @@ To overcome this, multiple users can start the download process at the exact same time which leads to a high likelihood that their downloaded data will be similar enough that they receive the same output at the end of the process. This process is regularly coordinated at the [asmap-data](https://github.com/asmap/asmap-data) -project. If enough participants have joined the effort (5 or more is recommended) and a majority of the -participants have received the same result, the resulting ASMap file is added -to the repository for public use. Files will not be merged to the repository +project. If the result hash that was observed by the most participants is signed +by 5 participants or more, the resulting ASMap file is added to the repository for +public use. Files will not be merged to the repository without at least two additional reviewers confirming that the process described above was followed as expected and that the encoding step yielded the same file hash. New files are created on an ongoing basis but without any central planning diff --git a/doc/bips.md b/doc/bips.md index c814717a09fe..07e5024864c6 100644 --- a/doc/bips.md +++ b/doc/bips.md @@ -51,6 +51,8 @@ BIPs that are implemented by Bitcoin Core: * [`BIP 176`](https://github.com/bitcoin/bips/blob/master/bip-0176.mediawiki): Bits Denomination [QT only] is supported as of **v0.16.0** ([PR 12035](https://github.com/bitcoin/bitcoin/pull/12035)). * [`BIP 324`](https://github.com/bitcoin/bips/blob/master/bip-0324.mediawiki): The v2 transport protocol specified by BIP324 and the associated `NODE_P2P_V2` service bit are supported as of **v26.0**, but off by default ([PR 28331](https://github.com/bitcoin/bitcoin/pull/28331)). On by default as of **v27.0** ([PR 29347](https://github.com/bitcoin/bitcoin/pull/29347)). * [`BIP 325`](https://github.com/bitcoin/bips/blob/master/bip-0325.mediawiki): Signet test network is supported as of **v0.21.0** ([PR 18267](https://github.com/bitcoin/bitcoin/pull/18267)). +* [`BIP 327`](https://github.com/bitcoin/bips/blob/master/bip-0327.mediawiki): Key aggregation via `musig()` descriptors is supported as of **v30.0** ([PR 31244](https://github.com/bitcoin/bitcoin/pull/31244)). Signing is supported as of **v31.0** ([PR 29675](https://github.com/bitcoin/bitcoin/pull/29675)) +* [`BIP 328`](https://github.com/bitcoin/bips/blob/master/bip-0328.mediawiki): MuSig2 derivation via `musig()` descriptors is supported as of **v30.0** ([PR 31244](https://github.com/bitcoin/bitcoin/pull/31244)) * [`BIP 339`](https://github.com/bitcoin/bips/blob/master/bip-0339.mediawiki): Relay of transactions by wtxid is supported as of **v0.21.0** ([PR 18044](https://github.com/bitcoin/bitcoin/pull/18044)). * [`BIP 340`](https://github.com/bitcoin/bips/blob/master/bip-0340.mediawiki) [`341`](https://github.com/bitcoin/bips/blob/master/bip-0341.mediawiki) @@ -62,6 +64,7 @@ BIPs that are implemented by Bitcoin Core: always active as of **v24.0** ([PR 23536](https://github.com/bitcoin/bitcoin/pull/23536)). * [`BIP 350`](https://github.com/bitcoin/bips/blob/master/bip-0350.mediawiki): Addresses for native v1+ segregated Witness outputs use Bech32m instead of Bech32 as of **v22.0** ([PR 20861](https://github.com/bitcoin/bitcoin/pull/20861)). * [`BIP 371`](https://github.com/bitcoin/bips/blob/master/bip-0371.mediawiki): Taproot fields for PSBT as of **v24.0** ([PR 22558](https://github.com/bitcoin/bitcoin/pull/22558)). +* [`BIP 373`](https://github.com/bitcoin/bips/blob/master/bip-0373.mediawiki): MuSig2 fields for PSBT as of **v30.0** ([PR 31247](https://github.com/bitcoin/bitcoin/pull/31247)) * [`BIP 379`](https://github.com/bitcoin/bips/blob/master/bip-0379.md): Miniscript was partially implemented in **v24.0** ([PR 24148](https://github.com/bitcoin/bitcoin/pull/24148)), and fully implemented as of **v26.0** ([PR 27255](https://github.com/bitcoin/bitcoin/pull/27255)). * [`BIP 380`](https://github.com/bitcoin/bips/blob/master/bip-0380.mediawiki) [`381`](https://github.com/bitcoin/bips/blob/master/bip-0381.mediawiki) @@ -72,5 +75,6 @@ BIPs that are implemented by Bitcoin Core: Output Script Descriptors, and most of Script Expressions are implemented as of **v0.17.0** ([PR 13697](https://github.com/bitcoin/bitcoin/pull/13697)). * [`BIP 386`](https://github.com/bitcoin/bips/blob/master/bip-0386.mediawiki): tr() Output Script Descriptors are implemented as of **v22.0** ([PR 22051](https://github.com/bitcoin/bitcoin/pull/22051)). * [`BIP 387`](https://github.com/bitcoin/bips/blob/master/bip-0387.mediawiki): Tapscript Multisig Output Script Descriptors are implemented as of **v24.0** ([PR 24043](https://github.com/bitcoin/bitcoin/pull/24043)). +* [`BIP 390`](https://github.com/bitcoin/bips/blob/master/bip-0390.mediawiki): MuSig2 Descriptor parsing is implemented in **v30.0** ([PR 31244](https://github.com/bitcoin/bitcoin/pull/31244)) and signing in **v31.0** ([PR 29675](https://github.com/bitcoin/bitcoin/pull/29675)) * [`BIP 431`](https://github.com/bitcoin/bips/blob/master/bip-0431.mediawiki): transactions with nVersion=3 are standard and treated as Topologically Restricted Until Confirmation as of **v28.0** ([PR 29496](https://github.com/bitcoin/bitcoin/pull/29496)). * [`BIP 433`](https://github.com/bitcoin/bips/blob/master/bip-0433.mediawiki): Spending of Pay to Anchor (P2A) outputs is standard as of **v28.0** ([PR 30352](https://github.com/bitcoin/bitcoin/pull/30352)). diff --git a/doc/bitcoin-conf.md b/doc/bitcoin-conf.md index daa7fcba0003..e768961de3ee 100644 --- a/doc/bitcoin-conf.md +++ b/doc/bitcoin-conf.md @@ -65,7 +65,7 @@ Almost all options can be negated by being specified with a `no` prefix. For exa In general, negating an option is like setting it to `0` if it is a boolean or integer option, and setting it to an empty string or path or list if it is a string or path or list option. -However, there are exceptions to this general rule. For example, it is an error to negate some options (e.g. `-nodatadir` is disallowed), and some negated strings are treated like `"0"` instead of `""` (e.g. `-noproxy` is treated like `-proxy=0`), and some negating some lists can have side effects in addition to clearing the lists (e.g. `-noconnect` disables automatic connections in addition to dropping any manual connections specified previously with `-connect=`). When there are exceptions to the rule, they should either be obvious from context, or should be mentioned in usage documentation. Nonobvious, undocumented exceptions should be reported as bugs. +However, there are exceptions to this general rule. For example, it is an error to negate some options (e.g. `-nodatadir` is disallowed), and some negated strings are treated like `"0"` instead of `""` (e.g. `-noproxy` is treated like `-proxy=0`), and some negating lists can have side effects in addition to clearing the lists (e.g. `-noconnect` disables automatic connections in addition to dropping any manual connections specified previously with `-connect=`). When there are exceptions to the rule, they should either be obvious from context, or should be mentioned in usage documentation. Nonobvious, undocumented exceptions should be reported as bugs. ## Configuration File Path diff --git a/doc/build-freebsd.md b/doc/build-freebsd.md index b5940c0f7ce5..de373d1ecb15 100644 --- a/doc/build-freebsd.md +++ b/doc/build-freebsd.md @@ -1,6 +1,6 @@ # FreeBSD Build Guide -**Updated for FreeBSD [14.3](https://www.freebsd.org/releases/14.3R/announce/)** +**Updated for FreeBSD [15.0](https://www.freebsd.org/releases/15.0R/announce/)** This guide describes how to build bitcoind, command-line utilities, and GUI on FreeBSD. diff --git a/doc/build-osx.md b/doc/build-osx.md index 001c0188e8a3..3c2b0f3a2d97 100644 --- a/doc/build-osx.md +++ b/doc/build-osx.md @@ -1,6 +1,6 @@ # macOS Build Guide -**Updated for MacOS [15](https://www.apple.com/macos/macos-sequoia/)** +**Updated for MacOS [26](https://www.apple.com/os/macos/)** This guide describes how to build bitcoind, command-line utilities, and GUI on macOS. diff --git a/doc/cjdns.md b/doc/cjdns.md index 00db83dce7ec..9bdcec732db0 100644 --- a/doc/cjdns.md +++ b/doc/cjdns.md @@ -10,8 +10,8 @@ CJDNS is like a distributed, shared VPN with multiple entry points where every participant can reach any other participant. All participants use addresses from the `fc00::/8` network (reserved IPv6 range). Installation and configuration is done outside of Bitcoin Core, similarly to a VPN (either in the host/OS or on -the network router). See https://github.com/cjdelisle/cjdns#readme and -https://github.com/hyperboria/docs#hyperboriadocs for more information. +the network router). See https://github.com/cjdelisle/cjdns#readme for more +information. Compared to IPv4/IPv6, CJDNS provides end-to-end encryption and protects nodes from traffic analysis and filtering. @@ -24,46 +24,25 @@ somewhat centralized. I2P connections have a source address and I2P is slow. CJDNS is fast but does not hide the sender and the recipient from intermediate routers. -## Installing CJDNS and finding a peer to connect to the network +## Installing CJDNS To install and set up CJDNS, follow the instructions at https://github.com/cjdelisle/cjdns#how-to-install-cjdns. -You need to initiate an outbound connection to a peer on the CJDNS network -before it will work with your Bitcoin Core node. This is described in steps -["2. Find a friend"](https://github.com/cjdelisle/cjdns#2-find-a-friend) and -["3. Connect your node to your friend's -node"](https://github.com/cjdelisle/cjdns#3-connect-your-node-to-your-friends-node) -in the CJDNS documentation. +## Connecting to the CJDNS network -One quick way to accomplish these two steps is to query for available public -peers on [Hyperboria](https://github.com/hyperboria) by running the following: +As of CJDNS v22, nodes automatically discover and connect to peers via DNS +seeding. After installation, you can verify that your node has peers: -``` -git clone https://github.com/hyperboria/peers hyperboria-peers -cd hyperboria-peers -./testAvailable.py -``` - -For each peer, the `./testAvailable.py` script prints the filename of the peer's -credentials followed by the ping result. - -Choose one or several peers, copy their credentials from their respective files, -paste them into the relevant IPv4 or IPv6 "connectTo" JSON object in the -`cjdroute.conf` file you created in step ["1. Generate a new configuration -file"](https://github.com/cjdelisle/cjdns#1-generate-a-new-configuration-file), -and save the file. - -## Launching CJDNS + cjdnstool peers show -Typically, CJDNS might be launched from its directory with -`sudo ./cjdroute < cjdroute.conf` and it sheds permissions after setting up the -[TUN](https://en.wikipedia.org/wiki/TUN/TAP) interface. You may also [launch it as an -unprivileged user](https://github.com/cjdelisle/cjdns/blob/master/doc/non-root-user.md) -with some additional setup. +If you see peers with status `ESTABLISHED`, your node is connected and no +further peering setup is needed. -The network connection can be checked by running `./tools/peerStats` from the -CJDNS directory. +Manual peering may be useful if you want to guarantee a connection to a +specific node, or if you have disabled DNS seeding for privacy reasons. See +[doc/peering.md](https://github.com/cjdelisle/cjdns/blob/master/doc/peering.md) +in the CJDNS repository for details. ## Run Bitcoin Core with CJDNS diff --git a/doc/design/multiprocess.md b/doc/design/multiprocess.md index e72f2a031371..ad045cbba668 100644 --- a/doc/design/multiprocess.md +++ b/doc/design/multiprocess.md @@ -175,7 +175,7 @@ sequenceDiagram 4. **Handling in bitcoin-node** - Upon receiving the request, the Cap'n Proto dispatching code in the `bitcoin-node` process calls the `getBlockHash` method of the `Chain` [server class](#c-server-classes-in-generated-code). - The server class is automatically generated by the `mpgen` tool from the [`chain.capnp`](https://github.com/ryanofsky/bitcoin/blob/pr/ipc/src/ipc/capnp/chain.capnp) file in [`src/ipc/capnp/`](../../src/ipc/capnp/). - - The `getBlockHash` method of the generated `Chain` server subclass in `bitcoin-wallet` receives a Cap’n Proto request object with the `height` parameter, and calls the `getBlockHash` method on its local `Chain` object with the provided `height`. + - The `getBlockHash` method of the generated `Chain` server subclass in `bitcoin-node` receives a Cap’n Proto request object with the `height` parameter, and calls the `getBlockHash` method on its local `Chain` object with the provided `height`. - When the call returns, it encapsulates the return value in a Cap’n Proto response, which it sends back to the `bitcoin-wallet` process. 5. **Response and Return** diff --git a/doc/developer-notes.md b/doc/developer-notes.md index 31ffd370c2f9..18691811aa4d 100644 --- a/doc/developer-notes.md +++ b/doc/developer-notes.md @@ -225,16 +225,15 @@ To describe a class, use the same construct above the class definition: class CAlert ``` -To describe a member or variable use: +To describe a member or variable, place the comment on the line(s) before it, using `/**` and `*/`, `//!`, or `///`: ```c++ //! Description before the member int var; ``` -or -```c++ -int var; //!< Description after the member -``` +Avoid trailing (inline) member comments like `int var; //!< Description after the member`. + + - *Rationale*: Forgetting the `<` silently breaks Doxygen output. Also OK: ```c++ @@ -542,6 +541,13 @@ to a function that accepts a `std::string` parameter. An implicit conversion occ Use `IWYU pragma: export` very sparingly, as this enforces transitive inclusion of headers and undermines the specific purpose of IWYU. +The acceptable cases for using `IWYU pragma: export` are: +1. Facade headers. For example, see [`compat/compat.h`](/src/compat/compat.h). +2. Drop-in replacement headers. For example, see [`util/time.h`](/src/util/time.h). +3. Presenting a complete interface across multiple headers. + +A comment explaining the rationale is required for every use of `IWYU pragma: export`. + ### Performance profiling with perf Profiling is a good way to get a precise idea of where time is being spent in @@ -672,7 +678,7 @@ and its `cs_KeyStore` lock for example). - [ThreadHTTP (`b-http`)](https://doxygen.bitcoincore.org/httpserver_8cpp.html#abb9f6ea8819672bd9a62d3695070709c) : Libevent thread to listen for RPC and REST connections. -- [HTTP worker threads(`b-httpworker.x`)](https://doxygen.bitcoincore.org/httpserver_8cpp.html#aa6a7bc27265043bc0193220c5ae3a55f) +- [HTTP worker threads (`b-http_pool_x`)](https://doxygen.bitcoincore.org/httpserver_8cpp.html#a2ad0a49dc9b5e8117c0dee98c24187d8) : Threads to service RPC and REST requests. - [Indexer threads (`b-txindex`, etc)](https://doxygen.bitcoincore.org/class_base_index.html#a96a7407421fbf877509248bbe64f8d87) @@ -790,7 +796,7 @@ Common misconceptions are clarified in those sections: - Do not compare an iterator from one data structure with an iterator of another data structure (even if of the same type). - - *Rationale*: Behavior is undefined. In C++ parlor this means "may reformat + - *Rationale*: Behavior is undefined. In C++ parlance this means "may reformat the universe", in practice this has resulted in at least one hard-to-debug crash bug. - Watch out for out-of-bounds vector access. `&vch[vch.size()]` is illegal, @@ -854,19 +860,19 @@ Foo(vec); enum class Tabs { info, console, - network_graph, - peers }; int GetInt(Tabs tab) { - switch (tab) { - case Tabs::info: return 0; - case Tabs::console: return 1; - case Tabs::network_graph: return 2; - case Tabs::peers: return 3; - } // no default case, so the compiler can warn about missing cases - assert(false); + int ret = [&]() { + switch (tab) { + case Tabs::info: return 0; + case Tabs::console: return 1; + } // no default case, so the compiler can warn about missing cases + assert(false); + }(); + LogInfo("Tab %s", ret); + return ret; } ``` @@ -1411,9 +1417,9 @@ communication: using TipChangedFn = std::function; virtual std::unique_ptr handleTipChanged(TipChangedFn fn) = 0; - // Bad: returns boost connection specific to local process + // Bad: returns btcsignals connection specific to local process using TipChangedFn = std::function; - virtual boost::signals2::scoped_connection connectTipChanged(TipChangedFn fn) = 0; + virtual btcsignals::scoped_connection connectTipChanged(TipChangedFn fn) = 0; ``` - Interface methods should not be overloaded. diff --git a/doc/files.md b/doc/files.md index 8a11e08913cd..e8f286929264 100644 --- a/doc/files.md +++ b/doc/files.md @@ -165,5 +165,5 @@ This table describes the files installed by Bitcoin Core across different platfo ## Filesystem recommendations -When choosing a filesystem for the data directory (`datadir`) or blocks directory (`blocksdir`) on **macOS**,the `exFAT` filesystem should be avoided. +When choosing a filesystem for the data directory (`datadir`) or blocks directory (`blocksdir`) on **macOS**, the `exFAT` filesystem should be avoided. There have been multiple reports of database corruption and data loss when using this filesystem with Bitcoin Core, see [Issue #31454](https://github.com/bitcoin/bitcoin/issues/31454) for more details. diff --git a/doc/i2p.md b/doc/i2p.md index 624b651f62a9..2877c1e570ec 100644 --- a/doc/i2p.md +++ b/doc/i2p.md @@ -86,7 +86,7 @@ address is used for making outbound connections and accepting inbound connections. In the I2P network, the receiver of an inbound connection sees the address of -the initiator. This is unlike the Tor network, where the recipient does not +the initiator. This is unlike the Tor network, where the recipient does not know who is connecting to it. If your node is configured by setting `-i2pacceptincoming=0` to not accept diff --git a/doc/release-notes-24539.md b/doc/release-notes-24539.md deleted file mode 100644 index 63b4d70eafd7..000000000000 --- a/doc/release-notes-24539.md +++ /dev/null @@ -1,14 +0,0 @@ -New settings ------------- -- `-txospenderindex` enables the creation of a transaction output spender - index that, if present, will be scanned by `gettxspendingprevout` if a - spending transaction was not found in the mempool. - (#24539) - -Updated RPCs ------------- -- `gettxspendingprevout` has 2 new optional arguments: `mempool_only` and `return_spending_tx`. - If `mempool_only` is true it will limit scans to the mempool even if `txospenderindex` is available. - If `return_spending_tx` is true, the full spending tx will be returned. - In addition if `txospenderindex` is available and a confirmed spending transaction is found, - its block hash will be returned. (#24539) diff --git a/doc/release-notes-26201.md b/doc/release-notes-26201.md new file mode 100644 index 000000000000..66c9da540611 --- /dev/null +++ b/doc/release-notes-26201.md @@ -0,0 +1,4 @@ +RPC +--- + +- 'taproot' has been removed from 'getdeploymentinfo' because its historical activation height is no longer used anywhere in the codebase. (#26201) diff --git a/doc/release-notes-26988.md b/doc/release-notes-26988.md new file mode 100644 index 000000000000..7cd8f41a404c --- /dev/null +++ b/doc/release-notes-26988.md @@ -0,0 +1,8 @@ +Tools and Utilities +-------- + +- CLI -addrinfo now returns the full set of known addresses. In previous versions (v22.0 - v30.0) the set of returned + addresses was filtered for quality and recency. This was changed since it does not match the logic for selecting peers + to connect to, which does not filter. Note: CLI -addrinfo now requires bitcoind v26.0 or later, as it uses the + getaddrmaninfo RPC internally. Users querying older, unmaintained node versions would need to use an older bitcoin-cli + version. (#26988) diff --git a/doc/release-notes-29060.md b/doc/release-notes-29060.md new file mode 100644 index 000000000000..bb11dc91365f --- /dev/null +++ b/doc/release-notes-29060.md @@ -0,0 +1,10 @@ +- Logging and RPC + + - Bitcoin Core now reports a debug message explaining why transaction inputs are non-standard. + + - This information is now returned in the responses of the transaction-sending RPCs `submitpackage`, + `sendrawtransaction`, and `testmempoolaccept`, and is also logged to `debug.log` (if `mempoolrej` ++ debug category is enabled) when such transactions are received over the P2P network. + + - This does not change the existing error code `bad-txns-nonstandard-inputs`, but instead adds additional debug information to it. + diff --git a/doc/release-notes-29415.md b/doc/release-notes-29415.md deleted file mode 100644 index c0e0f3dc8881..000000000000 --- a/doc/release-notes-29415.md +++ /dev/null @@ -1,19 +0,0 @@ -P2P and network changes ------------------------ - -- Normally local transactions are broadcast to all connected peers with - which we do transaction relay. Now, for the `sendrawtransaction` RPC - this behavior can be changed to only do the broadcast via the Tor or - I2P networks. A new boolean option `-privatebroadcast` has been added - to enable this behavior. This improves the privacy of the transaction - originator in two aspects: - 1. Their IP address (and thus geolocation) is never known to the - recipients. - 2. If the originator sends two otherwise unrelated transactions, they - will not be linkable. This is because a separate connection is used - for broadcasting each transaction. (#29415) - -- New RPCs have been added to introspect and control private broadcast: - `getprivatebroadcastinfo` reports transactions currently being privately - broadcast, and `abortprivatebroadcast` removes matching - transactions from the private broadcast queue. diff --git a/doc/release-notes-31560.md b/doc/release-notes-31560.md new file mode 100644 index 000000000000..07a8f7798ed7 --- /dev/null +++ b/doc/release-notes-31560.md @@ -0,0 +1,8 @@ +Updated RPCs +------------ + +- The `dumptxoutset` RPC now supports writing to a named pipe + on UNIX-like systems (see mkfifo(1) and mkfifo(3) man pages). + This allows the raw UTXO set data to be consumed directly by + another process (e.g., the `contrib/utxo-tools/utxo_to_sqlite.py` + conversion script) without first writing it to disk. (#31560) diff --git a/doc/release-notes-32138.md b/doc/release-notes-32138.md deleted file mode 100644 index 566998508806..000000000000 --- a/doc/release-notes-32138.md +++ /dev/null @@ -1,3 +0,0 @@ -RPC and Startup Option ---- -The `-paytxfee` startup option and the `settxfee` RPC are now deleted after being deprecated in Bitcoin Core 30.0. They used to allow the user to set a static fee rate for wallet transactions, which could potentially lead to overpaying or underpaying. Users should instead rely on fee estimation or specify a fee rate per transaction using the `fee_rate` argument in RPCs such as `fundrawtransaction`, `sendtoaddress`, `send`, `sendall`, and `sendmany`. (#32138) diff --git a/doc/release-notes-33199.md b/doc/release-notes-33199.md deleted file mode 100644 index 90246d782730..000000000000 --- a/doc/release-notes-33199.md +++ /dev/null @@ -1,9 +0,0 @@ -Fee Estimation -======================== - -- The Bitcoin Core fee estimator minimum fee rate bucket was updated from **1 sat/vB** to **0.1 sat/vB**, - which matches the node’s default `minrelayfee`. - This means that for a given confirmation target, if a sub-1 sat/vB fee rate bucket is the minimum tracked - with sufficient data, its average value will be returned as the fee rate estimate. - -- Note: Restarting a node with this change invalidates previously saved estimates in `fee_estimates.dat`, the fee estimator will start tracking fresh stats. diff --git a/doc/release-notes-33259.md b/doc/release-notes-33259.md new file mode 100644 index 000000000000..46f339fe7b5c --- /dev/null +++ b/doc/release-notes-33259.md @@ -0,0 +1,4 @@ +RPC +--- + +The `getblockchaininfo` RPC now exposes progress for background validation if the `assumeutxo` feature is used. Once a node has synced from snapshot to tip, `verificationprogress` returns 1.0 and `initialblockdownload` false even though the node may still be validating blocks in the background. A new object, `backgroundvalidation`, provides details about the snapshot being validated, including snapshot height, number of blocks processed, best block hash, chainwork, median time, and verification progress. diff --git a/doc/release-notes-33414.md b/doc/release-notes-33414.md new file mode 100644 index 000000000000..977b88d7977d --- /dev/null +++ b/doc/release-notes-33414.md @@ -0,0 +1,9 @@ +Notable changes +=============== + +P2P and network changes +----------------------- + +Tor hidden services that are created automatically by Bitcoin Core will have +[PoW defenses](https://tpo.pages.torproject.net/onion-services/ecosystem/technology/security/pow/) +enabled if the Tor daemon supports that. (#33414) diff --git a/doc/release-notes-33555.md b/doc/release-notes-33555.md deleted file mode 100644 index a11af34fdfc6..000000000000 --- a/doc/release-notes-33555.md +++ /dev/null @@ -1,5 +0,0 @@ -Build System ------------- - -- The minimum supported Clang compiler version has been raised to 17.0 - (#33555). diff --git a/doc/release-notes-33629.md b/doc/release-notes-33629.md deleted file mode 100644 index 46adf220f5e5..000000000000 --- a/doc/release-notes-33629.md +++ /dev/null @@ -1,51 +0,0 @@ -Mempool -======= - -The mempool has been reimplemented with a new design ("cluster mempool"), to -facilitate better decision-making when constructing block templates, evicting -transactions, relaying transactions, and validating replacement transactions -(RBF). Most changes should be transparent to users, but some behavior changes -are noted: - -- The mempool no longer enforces ancestor or descendant size/count limits. - Instead, two new default policy limits are introduced governing connected - components, or clusters, in the mempool, limiting clusters to 64 transactions - and up to 101 kB in virtual size. Transactions are considered to be in the - same cluster if they are connected to each other via any combination of - parent/child relationships in the mempool. These limits can be overridden - using command line arguments; see the extended help (`-help-debug`) - for more information. - -- Within the mempool, transactions are ordered based on the feerate at which - they are expected to be mined, which takes into account the full set, or - "chunk", of transactions that would be included together (e.g., a parent and - its child, or more complicated subsets of transactions). This ordering is - utilized by the algorithms that implement transaction selection for - constructing block templates; eviction from the mempool when it is full; and - transaction relay announcements to peers. - -- The replace-by-fee validation logic has been updated so that transaction - replacements are only accepted if the resulting mempool's feerate diagram is - strictly better than before the replacement. This eliminates all known cases - of replacements occurring that make the mempool worse off, which was possible - under previous RBF rules. For singleton transactions (that are in clusters by - themselves) it's sufficient for a replacement to have a higher fee and - feerate than the original. See - [delvingbitcoin.org post](https://delvingbitcoin.org/t/an-overview-of-the-cluster-mempool-proposal/393#rbf-can-now-be-made-incentive-compatible-for-miners-11) - for more information. - -- Two new RPCs have been added: `getmempoolcluster` will provide the set of - transactions in the same cluster as the given transaction, along with the - ordering of those transactions and grouping into chunks; and - `getmempoolfeeratediagram` will return the feerate diagram of the entire - mempool. - -- Chunk size and chunk fees are now also included in the output of `getmempoolentry`. - -- The "CPFP Carveout" has been removed from the mempool logic. The CPFP carveout - allowed one additional child transaction to be added to a package that's already - at its descendant limit, but only if that child has exactly one ancestor - (the package's root) and is small (no larger than 10kvB). Nothing is allowed to - bypass the cluster count limit. It is expected that smart contracting use-cases - requiring similar functionality employ TRUC transactions and sibling eviction - instead going forward. diff --git a/doc/release-notes-33657.md b/doc/release-notes-33657.md deleted file mode 100644 index a9821323356b..000000000000 --- a/doc/release-notes-33657.md +++ /dev/null @@ -1,5 +0,0 @@ -New REST API ------------- - -- A new REST API endpoint (`/rest/blockpart/.?offset=&size=`) has been introduced - for efficiently fetching a range of bytes from block ``. diff --git a/doc/release-notes-33770.md b/doc/release-notes-33770.md deleted file mode 100644 index 58e118635fdd..000000000000 --- a/doc/release-notes-33770.md +++ /dev/null @@ -1,4 +0,0 @@ -`-asmap` requires explicit filename ------------------------------------ - -In previous releases, if `-asmap` was specified without a filename, this would try to load an `ip_asn.map` data file. Now loading an asmap file requires an explicit filename like `-asmap=ip_asn.map`. This change was made to make the option easier to understand, because it was confusing for there to be a default filename not actually loaded by default (https://github.com/bitcoin/bitcoin/issues/33386). Also this change makes the option more future-proof, because in upcoming releases, specifying `-asmap` will load embedded asmap data instead of an external file (https://github.com/bitcoin/bitcoin/pull/28792). diff --git a/doc/release-notes-33842.md b/doc/release-notes-33842.md deleted file mode 100644 index ad15f50b28bb..000000000000 --- a/doc/release-notes-33842.md +++ /dev/null @@ -1,4 +0,0 @@ -Build System ------------- - -- The minimum supported GCC compiler version has been raised to 12.1 (#33842). diff --git a/doc/release-notes-33872.md b/doc/release-notes-33872.md deleted file mode 100644 index 486a3b268786..000000000000 --- a/doc/release-notes-33872.md +++ /dev/null @@ -1,5 +0,0 @@ -P2P and network changes ------------------------ - -- The `-maxorphantx` startup option has been removed. It was - previously deprecated and has no effect anymore since v30.0. (#33872) diff --git a/doc/release-notes-33892.md b/doc/release-notes-33892.md deleted file mode 100644 index e9d41b801228..000000000000 --- a/doc/release-notes-33892.md +++ /dev/null @@ -1,8 +0,0 @@ -P2P and network changes ------------------------ - -- Transactions participating in one-parent-one-child package relay can now have the parent - with a feerate lower than the `-minrelaytxfee` feerate, even 0 fee. This expands the change - from 28.0 to also cover packages of non-TRUC transactions. Note that in general the - package child can have additional unconfirmed parents, but they must already be - in-mempool for the new package to be relayed. (#33892) diff --git a/doc/release-notes-34031.md b/doc/release-notes-34031.md deleted file mode 100644 index c0f29a9a803c..000000000000 --- a/doc/release-notes-34031.md +++ /dev/null @@ -1,4 +0,0 @@ -Net ---- -- `tor` has been removed as a network specification. It - was deprecated in favour of `onion` in v0.17.0. (#34031) diff --git a/doc/release-notes-34088.md b/doc/release-notes-34088.md deleted file mode 100644 index 5aa8a9d992f4..000000000000 --- a/doc/release-notes-34088.md +++ /dev/null @@ -1,2 +0,0 @@ -- When `-logsourcelocations` is enabled, the log output now contains just the - function name instead of the entire function signature. (#34088) diff --git a/doc/release-notes-34184.md b/doc/release-notes-34184.md deleted file mode 100644 index c582023eea2a..000000000000 --- a/doc/release-notes-34184.md +++ /dev/null @@ -1,8 +0,0 @@ -Mining IPC ----------- - -- `Mining.createNewBlock` now has a `cooldown` behavior (enabled by default) - that waits for IBD to finish and for the tip to catch up. This usually - prevents a flood of templates during startup, but is not guaranteed. (#34184) -- `Mining.interrupt()` can be used to interrupt `Mining.waitTipChanged` and - `Mining.createNewBlock`. (#34184) diff --git a/doc/release-notes-34197.md b/doc/release-notes-34197.md deleted file mode 100644 index 377ca9cc43a9..000000000000 --- a/doc/release-notes-34197.md +++ /dev/null @@ -1,7 +0,0 @@ -Updated RPCs ------------- - -- The `getpeerinfo` RPC no longer returns the `startingheight` field unless - the configuration option `-deprecatedrpc=startingheight` is used. The - `startingheight` field will be fully removed in the next major release. - (#34197) diff --git a/doc/release-notes-34512.md b/doc/release-notes-34512.md deleted file mode 100644 index b863448853f6..000000000000 --- a/doc/release-notes-34512.md +++ /dev/null @@ -1,8 +0,0 @@ -Updated RPCs ------------- - -- The `getblock` RPC now returns a `coinbase_tx` object at verbosity levels 1, 2, - and 3. It contains `version`, `locktime`, `sequence`, `coinbase` and - `witness`. This allows for efficiently querying coinbase - transaction properties without fetching the full transaction data at - verbosity 2+. (#34512) diff --git a/doc/release-notes-34568.md b/doc/release-notes-34568.md deleted file mode 100644 index e48772330c1e..000000000000 --- a/doc/release-notes-34568.md +++ /dev/null @@ -1,11 +0,0 @@ -Mining IPC ----------- - -The IPC mining interface now requires mining clients to use the latest `mining.capnp` schema. Clients built against older schemas will fail when calling `Init.makeMining` and receive an RPC error indicating the old mining interface is no longer supported. Mining clients must update to the latest schema and regenerate bindings to continue working. (#34568) - -Notable IPC mining interface changes since the last release: -- `Mining.createNewBlock` and `Mining.checkBlock` now require a `context` parameter. -- `Mining.waitTipChanged` now has a default `timeout` (effectively infinite / `maxDouble`) if the client omits it. -- `BlockTemplate.getCoinbaseTx()` now returns a structured `CoinbaseTx` instead of raw bytes. -- Removed `BlockTemplate.getCoinbaseCommitment()` and `BlockTemplate.getWitnessCommitmentIndex()`. -- Cap’n Proto default values were updated to match the corresponding C++ defaults for mining-related option structs (e.g. `BlockCreateOptions`, `BlockWaitOptions`, `BlockCheckOptions`). diff --git a/doc/release-notes-34692.md b/doc/release-notes-34692.md deleted file mode 100644 index 0336dfaf99e9..000000000000 --- a/doc/release-notes-34692.md +++ /dev/null @@ -1,6 +0,0 @@ -## Updated settings - -- The default `-dbcache` value has been increased to `1024` MiB from `450` MiB - on systems where at least `4096` MiB of RAM is detected. - This is a performance increase, but will use more memory. - To maintain the previous behaviour, set `-dbcache=450`. diff --git a/doc/release-notes-34796.md b/doc/release-notes-34796.md new file mode 100644 index 000000000000..a09786bfb9b0 --- /dev/null +++ b/doc/release-notes-34796.md @@ -0,0 +1,6 @@ +Updated RPCs +------------ + +- The `-deprecatedrpc=startingheight` configuration option has been removed. + The `getpeerinfo` RPC no longer returns the `startingheight` field, which + was previously deprecated in v31.0. (#34796) diff --git a/doc/release-notes/release-notes-28.4.md b/doc/release-notes/release-notes-28.4.md new file mode 100644 index 000000000000..b6af01a4b742 --- /dev/null +++ b/doc/release-notes/release-notes-28.4.md @@ -0,0 +1,81 @@ +Bitcoin Core version 28.4 is now available from: + + + +This release includes various bug fixes and performance +improvements, as well as updated translations. + +Please report bugs using the issue tracker at GitHub: + + + +To receive security and update notifications, please subscribe to: + + + +How to Upgrade +============== + +If you are running an older version, shut it down. Wait until it has completely +shut down (which might take a few minutes in some cases), then run the +installer (on Windows) or just copy over `/Applications/Bitcoin-Qt` (on macOS) +or `bitcoind`/`bitcoin-qt` (on Linux). + +Upgrading directly from a version of Bitcoin Core that has reached its EOL is +possible, but it might take some time if the data directory needs to be migrated. Old +wallet versions of Bitcoin Core are generally supported. + +Compatibility +============== + +Bitcoin Core is supported and extensively tested on operating systems +using the Linux Kernel 3.17+, macOS 11.0+, and Windows 7 and newer. Bitcoin +Core should also work on most other UNIX-like systems but is not as +frequently tested on them. It is not recommended to use Bitcoin Core on +unsupported systems. + +Notable changes +=============== + +### Wallet + +- #34156 wallet: fix unnamed legacy wallet migration failure +- #34215 wallettool: fix unnamed createfromdump failure walletsdir deletion +- #34226 wallet: test: Relative wallet failed migration cleanup +- #34370 Fix #34222 backport bugs + +### P2P + +- #33723 chainparams: remove dnsseed.bitcoin.dashjr-list-of-p2p-nodes.us + +### Build + +- #34227 guix: Fix `osslsigncode` tests + +### CI + +- #32513 ci: remove 3rd party js from windows dll gha job +- #34344 ci: update GitHub Actions versions +- #34463 ci: use macos-14 image + +### Misc + +- #34174 doc: update copyright year to 2026 + +Credits +======= + +Thanks to everyone who directly contributed to this release: + +- achow101 +- davidgumberg +- fanquake +- furszy +- Hennadii Stepanov +- Luke Dashjr +- m3dwards +- Padraic Slattery +- SatsAndSports + +As well as to everyone that helped with translations on +[Transifex](https://explore.transifex.com/bitcoin/bitcoin/). diff --git a/doc/tor.md b/doc/tor.md index e9db555fc98a..7003fcfe3000 100644 --- a/doc/tor.md +++ b/doc/tor.md @@ -181,6 +181,10 @@ Add these lines to your `/etc/tor/torrc` (or equivalent config file): HiddenServiceDir /var/lib/tor/bitcoin-service/ HiddenServicePort 8333 127.0.0.1:8334 + # If `tor --list-modules` shows "pow: yes", then enable PoW protection. + # It is available in tor-0.4.8.1-alpha and newer when configured with + # `./configure --enable-gpl`. + HiddenServicePoWDefensesEnabled 1 The directory can be different of course, but virtual port numbers should be equal to your bitcoind's P2P listen port (8333 by default), and target addresses and ports diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index ad18115bbc5f..b37f3c8ca5cf 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -56,6 +56,8 @@ add_subdirectory(crypto) add_subdirectory(util) if(ENABLE_IPC) add_subdirectory(ipc) +else() + add_library(bitcoin_ipc STATIC EXCLUDE_FROM_ALL ipc/stub.cpp) endif() add_library(bitcoin_consensus STATIC EXCLUDE_FROM_ALL @@ -97,6 +99,7 @@ add_library(bitcoin_common STATIC EXCLUDE_FROM_ALL common/config.cpp common/init.cpp common/interfaces.cpp + common/license_info.cpp common/messages.cpp common/netif.cpp common/pcp.cpp @@ -143,7 +146,6 @@ target_link_libraries(bitcoin_common bitcoin_util univalue secp256k1 - Boost::headers $ $<$:ws2_32> ) @@ -166,7 +168,6 @@ if(ENABLE_WALLET) bitcoin_wallet bitcoin_common bitcoin_util - Boost::headers ) install_binary_component(bitcoin-wallet HAS_MANPAGE) endif() @@ -347,13 +348,14 @@ target_link_libraries(bitcoin_cli # Bitcoin Core RPC client if(BUILD_CLI) - add_executable(bitcoin-cli bitcoin-cli.cpp) + add_executable(bitcoin-cli bitcoin-cli.cpp init/basic.cpp) add_windows_resources(bitcoin-cli bitcoin-cli-res.rc) add_windows_application_manifest(bitcoin-cli) target_link_libraries(bitcoin-cli core_interface bitcoin_cli bitcoin_common + bitcoin_ipc bitcoin_util libevent::core libevent::extra diff --git a/src/addrdb.cpp b/src/addrdb.cpp index 129bbf215430..5db632c7e1ed 100644 --- a/src/addrdb.cpp +++ b/src/addrdb.cpp @@ -204,7 +204,7 @@ util::Result> LoadAddrman(const NetGroupManager& netgro const auto path_addr{args.GetDataDirNet() / "peers.dat"}; try { DeserializeFileDB(path_addr, *addrman); - LogInfo("Loaded %i addresses from peers.dat %dms", addrman->Size(), Ticks(SteadyClock::now() - start)); + LogInfo("Loaded %i addresses from peers.dat %dms", addrman->Size(), Ticks(SteadyClock::now() - start)); } catch (const DbNotFoundError&) { // Addrman can be in an inconsistent state after failure, reset it addrman = std::make_unique(netgroupman, deterministic, /*consistency_check_ratio=*/check_addrman); diff --git a/src/addrman.cpp b/src/addrman.cpp index 2e5149093c42..d3dae59ae790 100644 --- a/src/addrman.cpp +++ b/src/addrman.cpp @@ -24,26 +24,6 @@ #include #include -/** Over how many buckets entries with tried addresses from a single group (/16 for IPv4) are spread */ -static constexpr uint32_t ADDRMAN_TRIED_BUCKETS_PER_GROUP{8}; -/** Over how many buckets entries with new addresses originating from a single group are spread */ -static constexpr uint32_t ADDRMAN_NEW_BUCKETS_PER_SOURCE_GROUP{64}; -/** Maximum number of times an address can occur in the new table */ -static constexpr int32_t ADDRMAN_NEW_BUCKETS_PER_ADDRESS{8}; -/** How old addresses can maximally be */ -static constexpr auto ADDRMAN_HORIZON{30 * 24h}; -/** After how many failed attempts we give up on a new node */ -static constexpr int32_t ADDRMAN_RETRIES{3}; -/** How many successive failures are allowed ... */ -static constexpr int32_t ADDRMAN_MAX_FAILURES{10}; -/** ... in at least this duration */ -static constexpr auto ADDRMAN_MIN_FAIL{7 * 24h}; -/** How recent a successful connection should be before we allow an address to be evicted from tried */ -static constexpr auto ADDRMAN_REPLACEMENT{4h}; -/** The maximum number of tried addr collisions to store */ -static constexpr size_t ADDRMAN_SET_TRIED_COLLISION_SIZE{10}; -/** The maximum time we'll spend trying to resolve a tried table collision */ -static constexpr auto ADDRMAN_TEST_WINDOW{40min}; int AddrInfo::GetTriedBucket(const uint256& nKey, const NetGroupManager& netgroupman) const { @@ -663,8 +643,8 @@ bool AddrManImpl::Good_(const CService& addr, bool test_before_evict, NodeSecond } // Output the entry we'd be colliding with, for debugging purposes auto colliding_entry = mapInfo.find(vvTried[tried_bucket][tried_bucket_pos]); - LogDebug(BCLog::ADDRMAN, "Collision with %s while attempting to move %s to tried table. Collisions=%d\n", - colliding_entry != mapInfo.end() ? colliding_entry->second.ToStringAddrPort() : "", + LogDebug(BCLog::ADDRMAN, "Collision with %s while attempting to move %s to tried table. Collisions=%d", + colliding_entry != mapInfo.end() ? colliding_entry->second.ToStringAddrPort() : "", addr.ToStringAddrPort(), m_tried_collisions.size()); return false; diff --git a/src/addrman.h b/src/addrman.h index 8368e30b7b76..94e7d3e65379 100644 --- a/src/addrman.h +++ b/src/addrman.h @@ -19,6 +19,27 @@ #include #include +/** Over how many buckets entries with tried addresses from a single group (/16 for IPv4) are spread */ +static constexpr uint32_t ADDRMAN_TRIED_BUCKETS_PER_GROUP{8}; +/** Over how many buckets entries with new addresses originating from a single group are spread */ +static constexpr uint32_t ADDRMAN_NEW_BUCKETS_PER_SOURCE_GROUP{64}; +/** Maximum number of times an address can occur in the new table */ +static constexpr int32_t ADDRMAN_NEW_BUCKETS_PER_ADDRESS{8}; +/** How old addresses can maximally be */ +static constexpr auto ADDRMAN_HORIZON{30 * 24h}; +/** After how many failed attempts we give up on a new node */ +static constexpr int32_t ADDRMAN_RETRIES{3}; +/** How many successive failures are allowed ... */ +static constexpr int32_t ADDRMAN_MAX_FAILURES{10}; +/** ... in at least this duration */ +static constexpr auto ADDRMAN_MIN_FAIL{7 * 24h}; +/** How recent a successful connection should be before we allow an address to be evicted from tried */ +static constexpr auto ADDRMAN_REPLACEMENT{4h}; +/** The maximum number of tried addr collisions to store */ +static constexpr size_t ADDRMAN_SET_TRIED_COLLISION_SIZE{10}; +/** The maximum time we'll spend trying to resolve a tried table collision */ +static constexpr auto ADDRMAN_TEST_WINDOW{40min}; + class InvalidAddrManVersionError : public std::ios_base::failure { public: diff --git a/src/arith_uint256.cpp b/src/arith_uint256.cpp index 392f052c0afa..545139900a54 100644 --- a/src/arith_uint256.cpp +++ b/src/arith_uint256.cpp @@ -5,8 +5,9 @@ #include -#include #include +#include +#include #include @@ -194,7 +195,7 @@ arith_uint256& arith_uint256::SetCompact(uint32_t nCompact, bool* pfNegative, bo uint32_t arith_uint256::GetCompact(bool fNegative) const { - int nSize = (bits() + 7) / 8; + int nSize = CeilDiv(bits(), 8u); uint32_t nCompact = 0; if (nSize <= 3) { nCompact = GetLow64() << 8 * (3 - nSize); diff --git a/src/banman.cpp b/src/banman.cpp index 499595a458ca..3c1f64e2263c 100644 --- a/src/banman.cpp +++ b/src/banman.cpp @@ -36,7 +36,7 @@ void BanMan::LoadBanlist() if (m_ban_db.Read(m_banned)) { SweepBanned(); // sweep out unused entries - LogDebug(BCLog::NET, "Loaded %d banned node addresses/subnets %dms\n", m_banned.size(), + LogDebug(BCLog::NET, "Loaded %d banned node addresses/subnets %dms", m_banned.size(), Ticks(SteadyClock::now() - start)); } else { LogInfo("Recreating the banlist database"); @@ -65,7 +65,7 @@ void BanMan::DumpBanlist() m_is_dirty = true; } - LogDebug(BCLog::NET, "Flushed %d banned node addresses/subnets to disk %dms\n", banmap.size(), + LogDebug(BCLog::NET, "Flushed %d banned node addresses/subnets to disk %dms", banmap.size(), Ticks(SteadyClock::now() - start)); } diff --git a/src/bench/CMakeLists.txt b/src/bench/CMakeLists.txt index 50b29a14667d..e1d5e4097ff4 100644 --- a/src/bench/CMakeLists.txt +++ b/src/bench/CMakeLists.txt @@ -77,6 +77,7 @@ if(ENABLE_WALLET) wallet_balance.cpp wallet_create.cpp wallet_create_tx.cpp + wallet_encrypt.cpp wallet_loading.cpp wallet_ismine.cpp wallet_migration.cpp diff --git a/src/bench/addrman.cpp b/src/bench/addrman.cpp index d28030e4baaa..fc081d9ff4b0 100644 --- a/src/bench/addrman.cpp +++ b/src/bench/addrman.cpp @@ -161,18 +161,13 @@ static void AddrManAddThenGood(benchmark::Bench& bench) CreateAddresses(); - bench.run([&] { - // To make the benchmark independent of the number of evaluations, we always prepare a new addrman. - // This is necessary because AddrMan::Good() method modifies the object, affecting the timing of subsequent calls - // to the same method and we want to do the same amount of work in every loop iteration. - // - // This has some overhead (exactly the result of AddrManAdd benchmark), but that overhead is constant so improvements in - // AddrMan::Good() will still be noticeable. - AddrMan addrman{EMPTY_NETGROUPMAN, /*deterministic=*/false, ADDRMAN_CONSISTENCY_CHECK_RATIO}; - AddAddressesToAddrMan(addrman); - - markSomeAsGood(addrman); - }); + std::optional addrman; + bench.epochIterations(1) + .setup([&] { + addrman.emplace(EMPTY_NETGROUPMAN, /*deterministic=*/false, ADDRMAN_CONSISTENCY_CHECK_RATIO); + AddAddressesToAddrMan(*addrman); + }) + .run([&] { markSomeAsGood(*addrman); }); } BENCHMARK(AddrManAdd); diff --git a/src/bench/bench.cpp b/src/bench/bench.cpp index 0b2ee6e30d18..45d1b360f659 100644 --- a/src/bench/bench.cpp +++ b/src/bench/bench.cpp @@ -20,8 +20,6 @@ using namespace std::chrono_literals; -const std::function G_TEST_LOG_FUN{}; - /** * Retrieves the available test setup command line arguments that may be used * in the benchmark. They will be used only if the benchmark utilizes a diff --git a/src/bench/ccoins_caching.cpp b/src/bench/ccoins_caching.cpp index 2b7315f4c169..12ea07608010 100644 --- a/src/bench/ccoins_caching.cpp +++ b/src/bench/ccoins_caching.cpp @@ -26,8 +26,7 @@ static void CCoinsCaching(benchmark::Bench& bench) ECC_Context ecc_context{}; FillableSigningProvider keystore; - CCoinsView coinsDummy; - CCoinsViewCache coins(&coinsDummy); + CCoinsViewCache coins{&CoinsViewEmpty::Get()}; std::vector dummyTransactions = SetupDummyInputs(keystore, coins, {11 * COIN, 50 * COIN, 21 * COIN, 22 * COIN}); @@ -49,8 +48,7 @@ static void CCoinsCaching(benchmark::Bench& bench) // Benchmark. const CTransaction tx_1(t1); bench.run([&] { - bool success{AreInputsStandard(tx_1, coins)}; - assert(success); + assert(ValidateInputsStandardness(tx_1, coins).IsValid()); }); } diff --git a/src/bench/checkblock.cpp b/src/bench/checkblock.cpp index 765b8b0dadcd..cbba543f2d8e 100644 --- a/src/bench/checkblock.cpp +++ b/src/bench/checkblock.cpp @@ -27,38 +27,30 @@ static void DeserializeBlockTest(benchmark::Bench& bench) { - DataStream stream(benchmark::data::block413567); - std::byte a{0}; - stream.write({&a, 1}); // Prevent compaction - - bench.unit("block").run([&] { - CBlock block; - stream >> TX_WITH_WITNESS(block); - bool rewound = stream.Rewind(benchmark::data::block413567.size()); - assert(rewound); - }); + DataStream stream; + bench.unit("block").epochIterations(1) + .setup([&] { stream = DataStream{benchmark::data::block413567}; }) + .run([&] { CBlock block; stream >> TX_WITH_WITNESS(block); }); } -static void DeserializeAndCheckBlockTest(benchmark::Bench& bench) +static void CheckBlockTest(benchmark::Bench& bench) { - DataStream stream(benchmark::data::block413567); - std::byte a{0}; - stream.write({&a, 1}); // Prevent compaction - ArgsManager bench_args; const auto chainParams = CreateChainParams(bench_args, ChainType::MAIN); - bench.unit("block").run([&] { - CBlock block; // Note that CBlock caches its checked state, so we need to recreate it here - stream >> TX_WITH_WITNESS(block); - bool rewound = stream.Rewind(benchmark::data::block413567.size()); - assert(rewound); - - BlockValidationState validationState; - bool checked = CheckBlock(block, validationState, chainParams->GetConsensus()); - assert(checked); - }); + CBlock block; + bench.unit("block").epochIterations(1) + .setup([&] { + block = CBlock{}; + DataStream stream{benchmark::data::block413567}; + stream >> TX_WITH_WITNESS(block); + }) + .run([&] { + BlockValidationState validationState; + bool checked = CheckBlock(block, validationState, chainParams->GetConsensus()); + assert(checked); + }); } BENCHMARK(DeserializeBlockTest); -BENCHMARK(DeserializeAndCheckBlockTest); +BENCHMARK(CheckBlockTest); diff --git a/src/bench/coin_selection.cpp b/src/bench/coin_selection.cpp index 2f108a310b4a..74d8e4b6006c 100644 --- a/src/bench/coin_selection.cpp +++ b/src/bench/coin_selection.cpp @@ -124,17 +124,14 @@ static CAmount make_hard_case(int utxos, std::vector& utxo_pool) static void BnBExhaustion(benchmark::Bench& bench) { - // Setup std::vector utxo_pool; - - bench.run([&] { - // Benchmark - CAmount target = make_hard_case(17, utxo_pool); - (void)SelectCoinsBnB(utxo_pool, target, /*cost_of_change=*/0, MAX_STANDARD_TX_WEIGHT); // Should exhaust - - // Cleanup - utxo_pool.clear(); - }); + CAmount target; + bench.epochIterations(1) + .setup([&] { target = make_hard_case(17, utxo_pool); }) + .run([&] { + auto res{SelectCoinsBnB(utxo_pool, target, /*cost_of_change=*/0, MAX_STANDARD_TX_WEIGHT)}; // Should exhaust + ankerl::nanobench::doNotOptimizeAway(res); + }); } BENCHMARK(CoinSelection); diff --git a/src/bench/load_external.cpp b/src/bench/load_external.cpp index 3350d16ac020..128d531f97c0 100644 --- a/src/bench/load_external.cpp +++ b/src/bench/load_external.cpp @@ -62,12 +62,17 @@ static void LoadExternalBlockFile(benchmark::Bench& bench) std::multimap blocks_with_unknown_parent; FlatFilePos pos; - bench.run([&] { - // "rb" is "binary, O_RDONLY", positioned to the start of the file. - // The file will be closed by LoadExternalBlockFile(). - AutoFile file{fsbridge::fopen(blkfile, "rb")}; - testing_setup->m_node.chainman->LoadExternalBlockFile(file, &pos, &blocks_with_unknown_parent); - }); + bench.epochIterations(1) + .setup([&] { + blocks_with_unknown_parent.clear(); + pos = FlatFilePos{}; + }) + .run([&] { + // "rb" is "binary, O_RDONLY", positioned to the start of the file. + // The file will be closed by LoadExternalBlockFile(). + AutoFile file{fsbridge::fopen(blkfile, "rb")}; + testing_setup->m_node.chainman->LoadExternalBlockFile(file, &pos, &blocks_with_unknown_parent); + }); fs::remove(blkfile); } diff --git a/src/bench/nanobench.h b/src/bench/nanobench.h index 127240d3c7ea..1f798b848b3d 100644 --- a/src/bench/nanobench.h +++ b/src/bench/nanobench.h @@ -137,6 +137,11 @@ class Result; class Rng; class BigO; +namespace detail { +template +class SetupRunner; +} // namespace detail + /** * @brief Renders output from a mustache-like template and benchmark results. * @@ -819,7 +824,7 @@ class Bench { /** * @brief Minimum time each epoch should take. * - * Default is zero, so we are fully relying on clockResolutionMultiple(). In most cases this is exactly what you want. If you see + * Default is 1ms, so we are mostly relying on clockResolutionMultiple(). In most cases this is exactly what you want. If you see * that the evaluation is unreliable with a high `err%`, you can increase either minEpochTime() or minEpochIterations(). * * @see maxEpochTime, minEpochIterations @@ -1007,7 +1012,21 @@ class Bench { Bench& config(Config const& benchmarkConfig); ANKERL_NANOBENCH(NODISCARD) Config const& config() const noexcept; + /** + * @brief Configure an untimed setup step per epoch (fluent API). + * + * Example: `bench.setup(...).run(...);` + */ + template + detail::SetupRunner setup(SetupOp setupOp); + private: + template + Bench& runImpl(SetupOp& setupOp, Op&& op); + + template + friend class detail::SetupRunner; + Config mConfig{}; std::vector mResults{}; }; @@ -1207,14 +1226,44 @@ constexpr uint64_t Rng::rotl(uint64_t x, unsigned k) noexcept { return (x << k) | (x >> (64U - k)); } +namespace detail { + +template +class SetupRunner { +public: + explicit SetupRunner(SetupOp setupOp, Bench& bench) + : mSetupOp(std::move(setupOp)) + , mBench(bench) {} + + template + ANKERL_NANOBENCH_NO_SANITIZE("integer") + Bench& run(Op&& op) { + return mBench.runImpl(mSetupOp, std::forward(op)); + } + +private: + SetupOp mSetupOp; + Bench& mBench; +}; +} // namespace detail + template ANKERL_NANOBENCH_NO_SANITIZE("integer") Bench& Bench::run(Op&& op) { + auto setupOp = [] {}; + return runImpl(setupOp, std::forward(op)); +} + +template +ANKERL_NANOBENCH_NO_SANITIZE("integer") +Bench& Bench::runImpl(SetupOp& setupOp, Op&& op) { // It is important that this method is kept short so the compiler can do better optimizations/ inlining of op() detail::IterationLogic iterationLogic(*this); auto& pc = detail::performanceCounters(); while (auto n = iterationLogic.numIters()) { + setupOp(); + pc.beginMeasure(); Clock::time_point const before = Clock::now(); while (n-- > 0) { @@ -1229,6 +1278,11 @@ Bench& Bench::run(Op&& op) { return *this; } +template +detail::SetupRunner Bench::setup(SetupOp setupOp) { + return detail::SetupRunner(std::move(setupOp), *this); +} + // Performs all evaluations. template Bench& Bench::run(char const* benchmarkName, Op&& op) { diff --git a/src/bench/sign_transaction.cpp b/src/bench/sign_transaction.cpp index 96af48c57248..5405265b230e 100644 --- a/src/bench/sign_transaction.cpp +++ b/src/bench/sign_transaction.cpp @@ -42,12 +42,15 @@ static void SignTransactionSingleInput(benchmark::Bench& bench, InputType input_ keystore.pubkeys.emplace(key_id, pubkey); // Create specified locking script type - CScript prev_spk; - switch (input_type) { - case InputType::P2WPKH: prev_spk = GetScriptForDestination(WitnessV0KeyHash(pubkey)); break; - case InputType::P2TR: prev_spk = GetScriptForDestination(WitnessV1Taproot(XOnlyPubKey{pubkey})); break; - default: assert(false); - } + CScript prev_spk = [&]() { + switch (input_type) { + case InputType::P2WPKH: + return GetScriptForDestination(WitnessV0KeyHash(pubkey)); + case InputType::P2TR: + return GetScriptForDestination(WitnessV1Taproot(XOnlyPubKey{pubkey})); + } // no default case, so the compiler can warn about missing cases + assert(false); + }(); prev_spks.push_back(prev_spk); } diff --git a/src/bench/streams_findbyte.cpp b/src/bench/streams_findbyte.cpp index 45e93d777d87..47b2ad740cac 100644 --- a/src/bench/streams_findbyte.cpp +++ b/src/bench/streams_findbyte.cpp @@ -22,10 +22,9 @@ static void FindByte(benchmark::Bench& bench) file.seek(0, SEEK_SET); BufferedFile bf{file, /*nBufSize=*/file_size + 1, /*nRewindIn=*/file_size}; - bench.run([&] { - bf.SetPos(0); - bf.FindByte(std::byte(1)); - }); + bench.epochIterations(1) + .setup([&] { bf.SetPos(0); }) + .run([&] { bf.FindByte(std::byte(1)); }); assert(file.fclose() == 0); } diff --git a/src/bench/strencodings.cpp b/src/bench/strencodings.cpp index a0767b495fe3..c00de181b544 100644 --- a/src/bench/strencodings.cpp +++ b/src/bench/strencodings.cpp @@ -3,7 +3,9 @@ // file COPYING or http://www.opensource.org/licenses/mit-license.php. #include -#include +#include +#include +#include #include #include @@ -11,7 +13,8 @@ static void HexStrBench(benchmark::Bench& bench) { - auto const& data = benchmark::data::block413567; + FastRandomContext rng{/*fDeterministic=*/true}; + auto data{rng.randbytes(MAX_BLOCK_WEIGHT)}; bench.batch(data.size()).unit("byte").run([&] { auto hex = HexStr(data); ankerl::nanobench::doNotOptimizeAway(hex); diff --git a/src/bench/util_time.cpp b/src/bench/util_time.cpp index bc3e3892f1fe..19ffd0e04985 100644 --- a/src/bench/util_time.cpp +++ b/src/bench/util_time.cpp @@ -3,7 +3,7 @@ // file COPYING or http://www.opensource.org/licenses/mit-license.php. #include - +#include #include static void BenchTimeDeprecated(benchmark::Bench& bench) @@ -15,11 +15,10 @@ static void BenchTimeDeprecated(benchmark::Bench& bench) static void BenchTimeMock(benchmark::Bench& bench) { - SetMockTime(111); + NodeClockContext clock_ctx{111s}; bench.run([&] { (void)GetTime(); }); - SetMockTime(0); } static void BenchTimeMillis(benchmark::Bench& bench) diff --git a/src/bench/verify_script.cpp b/src/bench/verify_script.cpp index e740f86ce036..b0ef4988ce11 100644 --- a/src/bench/verify_script.cpp +++ b/src/bench/verify_script.cpp @@ -2,9 +2,10 @@ // Distributed under the MIT software license, see the accompanying // file COPYING or http://www.opensource.org/licenses/mit-license.php. +#include #include -#include #include +#include #include #include #include