Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion libbitcoinkernel-sys/bitcoin/.github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -510,7 +510,7 @@ jobs:
timeout-minutes: 240
file-env: './ci/test/00_setup_env_native_fuzz_with_valgrind.sh'

- name: 'previous releases, depends DEBUG'
- name: 'previous releases'
cirrus-runner: 'ghcr.io/cirruslabs/ubuntu-runner-amd64:24.04-md'
fallback-runner: 'ubuntu-24.04'
timeout-minutes: 120
Expand Down
6 changes: 4 additions & 2 deletions libbitcoinkernel-sys/bitcoin/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -463,6 +463,8 @@ else()
try_append_cxx_flags("-Wself-assign" TARGET warn_interface SKIP_LINK)
try_append_cxx_flags("-Wbidi-chars=any" TARGET warn_interface SKIP_LINK)
try_append_cxx_flags("-Wundef" TARGET warn_interface SKIP_LINK)
try_append_cxx_flags("-Wleading-whitespace=spaces" TARGET warn_interface SKIP_LINK)
try_append_cxx_flags("-Wtrailing-whitespace=any" TARGET warn_interface SKIP_LINK)

# Some compilers (gcc) ignore unknown -Wno-* options, but warn about all
# unknown options if any other warning is produced. Test the -Wfoo case, and
Expand Down Expand Up @@ -493,8 +495,8 @@ try_append_cxx_flags("-fmacro-prefix-map=A=B" TARGET core_interface SKIP_LINK
IF_CHECK_PASSED "-fmacro-prefix-map=${PROJECT_SOURCE_DIR}/src=."
)

# Currently all versions of gcc are subject to a class of bugs, see the
# gccbug_90348 test case (only reproduces on GCC 11 and earlier) and
# GCC versions 13.2 (and earlier) are subject to a class of bugs, see
# https://gcc.gnu.org/bugzilla/show_bug.cgi?id=90348 and the meta bug
# https://gcc.gnu.org/bugzilla/show_bug.cgi?id=111843. To work around that, set
# -fstack-reuse=none for all gcc builds. (Only gcc understands this flag).
try_append_cxx_flags("-fstack-reuse=none" TARGET core_interface)
Expand Down
3 changes: 2 additions & 1 deletion libbitcoinkernel-sys/bitcoin/ci/lint/01_install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,8 @@ ${CI_RETRY_EXE} apt-get update
# - curl/xz-utils (to install shellcheck)
# - git (used in many lint scripts)
# - gpg (used by verify-commits)
${CI_RETRY_EXE} apt-get install -y cargo curl xz-utils git gpg
# - moreutils (used by scripted-diff)
${CI_RETRY_EXE} apt-get install -y cargo curl xz-utils git gpg moreutils

PYTHON_PATH="/python_build"
if [ ! -d "${PYTHON_PATH}/bin" ]; then
Expand Down
5 changes: 1 addition & 4 deletions libbitcoinkernel-sys/bitcoin/ci/test/00_setup_env_arm.sh
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,7 @@ export GOAL="install"
export CI_LIMIT_STACK_SIZE=1
# -Wno-psabi is to disable ABI warnings: "note: parameter passing for argument of type ... changed in GCC 7.1"
# This could be removed once the ABI change warning does not show up by default
#
# -Wno-error=dangling-reference helps to work around a GCC 13.1 false-positive,
# fixed in later versions.
export BITCOIN_CONFIG=" \
-DREDUCE_EXPORTS=ON \
-DCMAKE_CXX_FLAGS='-Wno-psabi -Wno-error=dangling-reference -Wno-error=maybe-uninitialized' \
-DCMAKE_CXX_FLAGS='-Wno-psabi -Wno-error=maybe-uninitialized' \
"
Original file line number Diff line number Diff line change
Expand Up @@ -8,15 +8,16 @@ export LC_ALL=C.UTF-8

export CONTAINER_NAME=ci_native_previous_releases
export CI_IMAGE_NAME_TAG="mirror.gcr.io/ubuntu:22.04"
# Use minimum supported python3.10 and gcc-11, see doc/dependencies.md
export PACKAGES="gcc-11 g++-11 python3-zmq"
export DEP_OPTS="CC=gcc-11 CXX=g++-11"
# Use minimum supported python3.10 and gcc-12, see doc/dependencies.md
export PACKAGES="gcc-12 g++-12 python3-zmq"
export DEP_OPTS="CC=gcc-12 CXX=g++-12"
export TEST_RUNNER_EXTRA="--previous-releases --coverage --extended --exclude feature_dbcrash" # Run extended tests so that coverage does not fail, but exclude the very slow dbcrash
export GOAL="install"
export CI_LIMIT_STACK_SIZE=1
export DOWNLOAD_PREVIOUS_RELEASES="true"
export BITCOIN_CONFIG="\
-DWITH_ZMQ=ON -DBUILD_GUI=ON -DREDUCE_EXPORTS=ON \
--preset=dev-mode \
-DREDUCE_EXPORTS=ON \
-DCMAKE_BUILD_TYPE=Debug \
-DCMAKE_C_FLAGS='-funsigned-char' \
-DCMAKE_C_FLAGS_DEBUG='-g2 -O2' \
Expand Down
4 changes: 1 addition & 3 deletions libbitcoinkernel-sys/bitcoin/ci/test/00_setup_env_win64.sh
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,6 @@ export PACKAGES="g++-mingw-w64-x86-64-posix nsis"
export RUN_UNIT_TESTS=false
export RUN_FUNCTIONAL_TESTS=false
export GOAL="deploy"
# -Wno-error=dangling-reference helps to work around a GCC 13.1 false-positive,
# fixed in later versions.
export BITCOIN_CONFIG="-DREDUCE_EXPORTS=ON -DBUILD_GUI_TESTS=OFF -DBUILD_KERNEL_LIB=ON -DBUILD_KERNEL_TEST=ON \
-DCMAKE_CXX_FLAGS='-Wno-error=dangling-reference -Wno-error=maybe-uninitialized' \
-DCMAKE_CXX_FLAGS='-Wno-error=maybe-uninitialized' \
"
10 changes: 8 additions & 2 deletions libbitcoinkernel-sys/bitcoin/contrib/guix/libexec/build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -225,10 +225,15 @@ esac

# LDFLAGS
case "$HOST" in
*linux*) HOST_LDFLAGS="-Wl,--as-needed -Wl,--dynamic-linker=$glibc_dynamic_linker -static-libstdc++ -Wl,-O2" ;;
*linux*) HOST_LDFLAGS="-Wl,--as-needed -Wl,--dynamic-linker=$glibc_dynamic_linker -Wl,-O2" ;;
*mingw*) HOST_LDFLAGS="-Wl,--no-insert-timestamp" ;;
esac

# EXE FLAGS
case "$HOST" in
*linux*) CMAKE_EXE_LINKER_FLAGS="-DCMAKE_EXE_LINKER_FLAGS=${HOST_LDFLAGS} -static-libstdc++ -static-libgcc" ;;
esac

mkdir -p "$DISTSRC"
(
cd "$DISTSRC"
Expand All @@ -243,7 +248,8 @@ mkdir -p "$DISTSRC"
--toolchain "${BASEPREFIX}/${HOST}/toolchain.cmake" \
-DWITH_CCACHE=OFF \
-Werror=dev \
${CONFIGFLAGS}
${CONFIGFLAGS} \
"${CMAKE_EXE_LINKER_FLAGS}"

# Build Bitcoin Core
cmake --build build -j "$JOBS" ${V:+--verbose}
Expand Down
10 changes: 5 additions & 5 deletions libbitcoinkernel-sys/bitcoin/contrib/guix/manifest.scm
Original file line number Diff line number Diff line change
Expand Up @@ -99,10 +99,10 @@ chain for " target " development."))

(define* (make-bitcoin-cross-toolchain target
#:key
(base-gcc-for-libc linux-base-gcc)
(base-gcc-for-libc (gcc-libgcc-patches linux-base-gcc))
(base-kernel-headers base-linux-kernel-headers)
(base-libc glibc-2.31)
(base-gcc linux-base-gcc))
(base-gcc (gcc-libgcc-patches linux-base-gcc)))
"Convenience wrapper around MAKE-CROSS-TOOLCHAIN with default values
desirable for building Bitcoin Core release binaries."
(make-cross-toolchain target
Expand All @@ -111,7 +111,7 @@ desirable for building Bitcoin Core release binaries."
base-libc
base-gcc))

(define (gcc-mingw-patches gcc)
(define (gcc-libgcc-patches gcc)
(package-with-extra-patches gcc
(search-our-patches "gcc-remap-guix-store.patch")))

Expand All @@ -128,10 +128,10 @@ desirable for building Bitcoin Core release binaries."
(let* ((xbinutils (binutils-mingw-patches (cross-binutils target)))
(machine (substring target 0 (string-index target #\-)))
(pthreads-xlibc (winpthreads-patches (make-mingw-w64 machine
#:xgcc (cross-gcc target #:xgcc (gcc-mingw-patches base-gcc))
#:xgcc (cross-gcc target #:xgcc (gcc-libgcc-patches base-gcc))
#:with-winpthreads? #t)))
(pthreads-xgcc (cross-gcc target
#:xgcc (gcc-mingw-patches mingw-w64-base-gcc)
#:xgcc (gcc-libgcc-patches mingw-w64-base-gcc)
#:xbinutils xbinutils
#:libc pthreads-xlibc)))
;; Define a meta-package that propagates the resulting XBINUTILS, XLIBC, and
Expand Down
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
Without ffile-prefix-map, the debug symbols will contain paths for the
Without -ffile-prefix-map, the debug symbols will contain paths for the
guix store which will include the hashes of each package. However, the
hash for the same package will differ when on different architectures.
In order to be reproducible regardless of the architecture used to build
the package, map all guix store prefixes to something fixed, e.g. /usr.

--- a/libgcc/Makefile.in
+++ b/libgcc/Makefile.in
@@ -854,7 +854,7 @@ endif
@@ -857,7 +857,7 @@ endif
# libgcc_eh.a, only LIB2ADDEH matters. If we do, only LIB2ADDEHSTATIC and
# LIB2ADDEHSHARED matter. (Usually all three are identical.)

Expand All @@ -15,6 +15,15 @@ the package, map all guix store prefixes to something fixed, e.g. /usr.

ifeq ($(enable_shared),yes)

@@ -880,7 +880,7 @@ endif
# Build LIBUNWIND. Use -fno-exceptions so that the unwind library does
# not generate calls to __gcc_personality_v0.

-c_flags := -fno-exceptions
+c_flags := -fno-exceptions $(shell find /gnu/store -maxdepth 1 -mindepth 1 -type d -exec echo -n " -ffile-prefix-map={}=/usr" \;)

libunwind-objects += $(addsuffix $(objext),$(basename $(notdir $(LIBUNWIND))))

--
2.37.0

8 changes: 0 additions & 8 deletions libbitcoinkernel-sys/bitcoin/contrib/guix/symbol-check.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,31 +16,25 @@

# Debian 11 (Bullseye) EOL: 2026. https://wiki.debian.org/LTS
#
# - libgcc version 10.2.1 (https://packages.debian.org/bullseye/libgcc-s1)
# - libc version 2.31 (https://packages.debian.org/source/bullseye/glibc)
#
# Ubuntu 20.04 (Focal) EOL: 2030. https://wiki.ubuntu.com/ReleaseTeam
#
# - libgcc version 10.5.0 (https://packages.ubuntu.com/focal/libgcc1)
# - libc version 2.31 (https://packages.ubuntu.com/focal/libc6)
#
# CentOS Stream 9 EOL: 2027. https://www.centos.org/cl-vs-cs/#end-of-life
#
# - libgcc version 12.2.1 (https://mirror.stream.centos.org/9-stream/AppStream/x86_64/os/Packages/)
# - libc version 2.34 (https://mirror.stream.centos.org/9-stream/AppStream/x86_64/os/Packages/)
#
# See https://gcc.gnu.org/onlinedocs/libstdc++/manual/abi.html for more info.

MAX_VERSIONS = {
'GCC': (7,0,0),
'GLIBC': {
lief.ELF.ARCH.X86_64: (2,31),
lief.ELF.ARCH.ARM: (2,31),
lief.ELF.ARCH.AARCH64:(2,31),
lief.ELF.ARCH.PPC64: (2,31),
lief.ELF.ARCH.RISCV: (2,31),
},
'LIBATOMIC': (1,0),
'V': (0,5,0), # xkb (bitcoin-qt only)
}

Expand Down Expand Up @@ -93,11 +87,9 @@
# Allowed NEEDED libraries
ELF_ALLOWED_LIBRARIES = {
# bitcoind and bitcoin-qt
'libgcc_s.so.1', # GCC base support
'libc.so.6', # C library
'libpthread.so.0', # threading
'libm.so.6', # math library
'libatomic.so.1',
'ld-linux-x86-64.so.2', # 64-bit dynamic linker
'ld-linux.so.2', # 32-bit dynamic linker
'ld-linux-aarch64.so.1', # 64-bit ARM dynamic linker
Expand Down
2 changes: 0 additions & 2 deletions libbitcoinkernel-sys/bitcoin/depends/packages/qt.mk
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ $(package)_freebsd_dependencies := $($(package)_linux_dependencies)
$(package)_patches_path := $(qt_details_patches_path)
$(package)_patches := dont_hardcode_pwd.patch
$(package)_patches += qtbase-moc-ignore-gcc-macro.patch
$(package)_patches += qtbase_avoid_native_float16.patch
$(package)_patches += qtbase_avoid_qmain.patch
$(package)_patches += qtbase_platformsupport.patch
$(package)_patches += qtbase_plugins_cocoa.patch
Expand Down Expand Up @@ -257,7 +256,6 @@ endif
define $(package)_preprocess_cmds
patch -p1 -i $($(package)_patch_dir)/dont_hardcode_pwd.patch && \
patch -p1 -i $($(package)_patch_dir)/qtbase-moc-ignore-gcc-macro.patch && \
patch -p1 -i $($(package)_patch_dir)/qtbase_avoid_native_float16.patch && \
patch -p1 -i $($(package)_patch_dir)/qtbase_avoid_qmain.patch && \
patch -p1 -i $($(package)_patch_dir)/qtbase_platformsupport.patch && \
patch -p1 -i $($(package)_patch_dir)/qtbase_plugins_cocoa.patch && \
Expand Down

This file was deleted.

6 changes: 5 additions & 1 deletion libbitcoinkernel-sys/bitcoin/doc/build-unix.md
Original file line number Diff line number Diff line change
Expand Up @@ -46,10 +46,14 @@ Finally, clang (often less resource hungry) can be used instead of gcc, which is

#### Dependency Build Instructions

Build requirements:
Build requirements for the latest Debian "stable" release, or the latest Ubuntu LTS release:

sudo apt-get install build-essential cmake pkgconf python3

For Debian "oldstable", or earlier Ubuntu LTS releases, you may need to pick a
later compiler version, according to the [dependencies](/doc/dependencies.md)
documentation.

Now, you can either build from self-compiled [depends](#dependencies) or install the required dependencies:

sudo apt-get install libevent-dev libboost-dev
Expand Down
2 changes: 1 addition & 1 deletion libbitcoinkernel-sys/bitcoin/doc/dependencies.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ Bitcoin Core requires one of the following compilers.
| Dependency | Minimum required |
| --- | --- |
| [Clang](https://clang.llvm.org) | [17.0](https://github.com/bitcoin/bitcoin/pull/33555) |
| [GCC](https://gcc.gnu.org) | [11.1](https://github.com/bitcoin/bitcoin/pull/29091) |
| [GCC](https://gcc.gnu.org) | [12.1](https://github.com/bitcoin/bitcoin/pull/33842) |

## Required

Expand Down
4 changes: 4 additions & 0 deletions libbitcoinkernel-sys/bitcoin/doc/release-notes-33842.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
Build System
------------

- The minimum supported GCC compiler version has been raised to 12.1 (#33842).
5 changes: 4 additions & 1 deletion libbitcoinkernel-sys/bitcoin/src/bench/connectblock.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
#include <script/interpreter.h>
#include <sync.h>
#include <test/util/setup_common.h>
#include <undo.h>
#include <validation.h>

#include <cassert>
Expand Down Expand Up @@ -100,7 +101,9 @@ void BenchmarkConnectBlock(benchmark::Bench& bench, std::vector<CKey>& keys, std
auto* pindex{chainman->m_blockman.AddToBlockIndex(test_block, chainman->m_best_header)}; // Doing this here doesn't impact the benchmark
CCoinsViewCache viewNew{&chainstate.CoinsTip()};

assert(chainstate.ConnectBlock(test_block, test_block_state, pindex, viewNew));
CBlockUndo blockundo;
assert(chainstate.SpendBlock(test_block, pindex, viewNew, test_block_state, blockundo));
assert(chainstate.ConnectBlock(test_block, blockundo, test_block_state, pindex));
});
}

Expand Down
2 changes: 1 addition & 1 deletion libbitcoinkernel-sys/bitcoin/src/bitcoin-chainstate.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ class TestValidationInterface : public ValidationInterface

std::optional<std::string> m_expected_valid_block = std::nullopt;

void BlockChecked(const Block block, const BlockValidationState state) override
void BlockChecked(const Block block, const BlockValidationStateView state) override
{
auto mode{state.GetValidationMode()};
switch (mode) {
Expand Down
23 changes: 23 additions & 0 deletions libbitcoinkernel-sys/bitcoin/src/coins.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -163,6 +163,29 @@ const Coin& CCoinsViewCache::AccessCoin(const COutPoint &outpoint) const {
}
}

std::vector<std::reference_wrapper<const Coin>> CCoinsViewCache::AccessCoins(const CTransaction& tx) const
{
std::vector<std::reference_wrapper<const Coin>> coins;
coins.reserve(tx.vin.size());
for (const CTxIn& input : tx.vin) {
coins.emplace_back(AccessCoin(input.prevout));
}
return coins;
}

std::vector<CTxOut> CCoinsViewCache::GetUnspentOutputs(const CTransaction& tx) const
{
std::vector<CTxOut> spent_outputs;
spent_outputs.reserve(tx.vin.size());
for (const auto& txin : tx.vin) {
const COutPoint& prevout = txin.prevout;
const Coin& coin = AccessCoin(prevout);
assert(!coin.IsSpent());
spent_outputs.emplace_back(coin.out);
}
return spent_outputs;
}

bool CCoinsViewCache::HaveCoin(const COutPoint &outpoint) const {
CCoinsMap::const_iterator it = FetchCoin(outpoint);
return (it != cacheCoins.end() && !it->second.coin.IsSpent());
Expand Down
16 changes: 16 additions & 0 deletions libbitcoinkernel-sys/bitcoin/src/coins.h
Original file line number Diff line number Diff line change
Expand Up @@ -413,6 +413,22 @@ class CCoinsViewCache : public CCoinsViewBacked
*/
const Coin& AccessCoin(const COutPoint &output) const;

/**
* Return a vector of references to Coins in the cache, or coinEmpty if
* the Coin is not found.
*
* Generally, this should only be held for a short scope. The coins should
* generally not be held through any other calls to this cache.
*/
std::vector<std::reference_wrapper<const Coin>> AccessCoins(const CTransaction& tx) const;

/**
* Return a vector of unspent outputs of coins in the cache that are spent
* by the provided transaction. The coins they belong to must be unspent in
* the cache.
*/
std::vector<CTxOut> GetUnspentOutputs(const CTransaction& tx) const;

/**
* Add a coin. Set possible_overwrite to true if an unspent version may
* already exist in the cache.
Expand Down
Loading
Loading