From f74b275ffc41d7119d771ee7c66c0771eb9dae80 Mon Sep 17 00:00:00 2001 From: Stringintech Date: Sun, 12 Oct 2025 15:04:11 +0330 Subject: [PATCH 1/7] Squashed 'depend/bitcoin/' changes from 2ac9d60c54a..81cec737e68 81cec737e68 kernel: Fix bitcoin-chainstate for windows 1826c485ddc kernel: Add Purpose section to header documentation d7e618aa981 kernel: Allowing reducing exports fb7f5241331 kernel: Add pure kernel bitcoin-chainstate dd0bdf279ef Kernel: Add functions for working with outpoints eaa6abfc733 kernel: Add block hash type and block tree utility functions to C header 824ddf2885a kernel: Add function to read block undo data from disk to C header 76cab0768b1 kernel: Add functions to read block from disk to C header e41f6f459a2 kernel: Add function for copying block data to C header 39c647647a2 kernel: Add functions for the block validation state to C header 8a19a9d6070 kernel: Add validation interface to C header 38a990dd482 kernel: Add interrupt function to C header fee8f6ff38b kernel: Add import blocks function to C header c29a6b87ccd kernel: Add chainstate load options for in-memory dbs in C header e788b3ba065 kernel: Add options for reindexing in C header 2707fc515c5 kernel: Add block validation to C header 51a24c4004e kernel: Add chainstate loading when instantiating a ChainstateManager ea01a8caf35 kernel: Add chainstate manager option for setting worker threads add5904e0ac kernel: Add chainstate manager object to C header 37a3395d271 kernel: Add notifications context option to C header d838a934be0 kernel: Add chain params context option to C header dc58ae9fc04 kernel: Add kernel library context object 77449975962 kernel: Add logging to kernel library C header dc504f57b3b kernel: Introduce initial kernel C header API b510893d007 Merge bitcoin/bitcoin#33494: depends: Update URL for `qrencode` package source tarball ec5841888de Merge bitcoin/bitcoin#32513: ci: remove 3rd party js from windows dll gha job d735e2e9b39 Merge bitcoin/bitcoin#32998: Bump SCRIPT_VERIFY flags to 64 bit de1dc6b47ba Merge bitcoin/bitcoin#33515: Improve LastCommonAncestor performance + add tests 919e6d01e93 Merge bitcoin/bitcoin#33489: build: Drop support for EOL macOS 13 452ea592811 Merge bitcoin/bitcoin#33454: net: support overriding the proxy selection in ConnectNode() a33bd767a37 Merge bitcoin/bitcoin#33464: p2p: Use network-dependent timers for inbound inv scheduling 2578da69f41 Merge bitcoin/bitcoin#33485: test: set par=2 in default config for functional test framework 25dbe4bc86d Merge bitcoin/bitcoin#33533: test: addrman: check isTerrible when time is more than 10min in the future cfb0d74698a Merge bitcoin/bitcoin#33121: test: fix p2p_leak_tx.py 86eaa4d6cd5 Merge bitcoin/bitcoin#33482: contrib: fix macOS deployment with no translations 007900ee9b8 Merge bitcoin/bitcoin#33434: depends: static libxcb-cursor 8e47ed6906d test: addrman: check isTerrible when time is more than 10min in the future 3635d62f5a9 chain: make use of pskip in LastCommonAncestor (optimization) 2e09d66fbb7 tests: add unit tests for CBlockIndex::GetAncestor and LastCommonAncestor 156927903d6 ci: Check windows manifests for all executables e1a1b14c935 ci: use a more generic way of finding mt.exe 1ed00a0d39d Merge bitcoin/bitcoin#33504: Mempool: Do not enforce TRUC checks on reorg c76de2eea18 net: support overriding the proxy selection in ConnectNode() 75353a01635 Merge bitcoin/bitcoin#32326: net: improve the interface around FindNode() and avoid a recursive mutex lock 87e7f37918d doc: clarify peer address in getpeerinfo and addnode RPC help 2a4450ccbbe net: change FindNode() to not return a node and rename it 4268abae1a1 net: avoid recursive m_nodes_mutex lock in DisconnectNode() acc7f2a433b Merge bitcoin/bitcoin#33401: ci: Remove bash -c from cmake invocation using eval 1aaaaa078bb fuzz: Drop unused workaround after Apple-Clang bump fadad7a4947 Drop support for EOL macOS 13 50194029e7c ci: Remove bash -c from cmake invocation using eval f41f97240c0 Merge bitcoin/bitcoin#28584: Fuzz: extend CConnman tests cc4a2cc6bdc Merge bitcoin/bitcoin#33453: docs: Undeprecate datacarrier and datacarriersize configuration options 7502d4e9403 Merge bitcoin/bitcoin#33260: test: Use extra_port() helper in feature_bind_extra.py 14ae71f323d test: make notfound_on_unannounced more reliable 99bc552980d test: fix (w)txid confusion in p2p_leak_tx.py 576dd97cb91 test: increase timeout in p2p_leak_tx.py 8f73d952214 Merge bitcoin/bitcoin#33299: wallet: reduce unconditional logging during load 0f7d4ee4e82 p2p: Use different inbound inv timer per network 93a70a42d30 depends: Update URL for `qrencode` package source tarball 6de80512632 depends: Use hash instead of file name for package download stamp 46135d90ea9 depends: Drop redundant check for downloaded file 771978952a9 depends: Fix `$(package)_fetched` target 25212dfdb4c Merge bitcoin/bitcoin#33487: ci: use latest versions of lint deps 06df14ba75b test: add more TRUC reorg coverge 26e71c237d9 Mempool: Do not enforce TRUC checks on reorg bbe8e9063c1 fuzz: don't bypass_limits for most mempool harnesses d4f47f97715 ci: use latest versions of lint deps fc861332b35 wallet, log: reduce unconditional logging during load 3a4d1a25cf9 net: merge AlreadyConnectedToAddress() and FindNode(CNetAddr) d8fe258cd61 Merge bitcoin/bitcoin#33484: doc: rpc: fix case typo in `finalizepsbt` help (final_scriptwitness) dda5228e02c test: set par=2 in default config for functional test framework ff05bebcc42 doc: rpc: fix case typo in `finalizepsbt` help (final_scriptwitness) 200150beba6 Merge bitcoin/bitcoin#33313: test/refactor: use test deque to avoid quadratic iteration 7e08445449f Merge bitcoin/bitcoin#33399: key: use static context for libsecp256k1 calls where applicable 7b5261f7ef3 contrib: fix using macdploy script without translations. 65e909dfdd9 Merge bitcoin/bitcoin#33430: rpc: addpeeraddress: throw on invalid IP 31b29f8eb62 Merge bitcoin/bitcoin#33229: multiprocess: Don't require bitcoin -m argument when IPC options are used e62e0a12b33 Merge bitcoin/bitcoin#33230: cli: Handle arguments that can be either JSON or string 7ae0497eef8 ci: remove 3rd party js from windows dll gha job 05d984b1a4f Merge bitcoin/bitcoin#33475: bugfix: miner: fix `addPackageTxs` unsigned integer overflow b807dfcdc59 miner: fix `addPackageTxs` unsigned integer overflow d41b503ae12 Merge bitcoin/bitcoin#33446: rpc: fix getblock(header) returns target for tip 5ae8edbc304 Merge bitcoin/bitcoin#33158: macdeploy: avoid use of `Bitcoin Core` in Linux cross build df67bb6fd84 test: Remove convert_to_json_for_cli 44a493e150a cli: Allow arguments to be both strings and json ad4a49090da Merge bitcoin/bitcoin#33408: msvc: Update vcpkg manifest dd61f08fd52 Merge bitcoin/bitcoin#33031: wallet: Set descriptor cache upgraded flag for migrated wallets 350692e561c Merge bitcoin/bitcoin#33388: test: don't throw from the destructor of DebugLogHelper 94db966a3bb net: use generic network key for addrcache eca50854e1c depends: static libxcb_cursor 89144eb473c Merge bitcoin/bitcoin#33448: net/rpc: Report inv information for debugging eaa1a3cd0b3 Merge bitcoin/bitcoin#33425: ci: remove Clang build from msan fuzz job b77137a5644 ci: link against -lstdc++ in native fuzz with msan job a86e1a6e32d Merge bitcoin/bitcoin#33427: rpc: Always return per-wtxid entries in submitpackage tx-results 6861dadfcb1 Merge bitcoin/bitcoin#33459: doc: remove unrelated `bitcoin-wallet` binary from `libbitcoin_ipc` description 3b3ab3a50a0 Merge bitcoin/bitcoin#33302: ci: disable cirrus cache in 32bit arm job 2738b63e025 test: validate behaviour of getpeerinfo last_inv_sequence and inv_to_send fbde8d9a81d doc: remove unrelated `bitcoin-wallet` binary from `libbitcoin_ipc` description 34fefb63358 Merge bitcoin/bitcoin#33435: system: improve handling around GetTotalRAM() 56791b58295 test: split out `system_ram_tests` to signal when total ram cannot be determined 337a6e73861 system: improve handling around GetTotalRAM() 451ba9ada41 datacarrier: Undeprecate configuration option 77b2ebb8118 rpc/net: report per-peer last_inv_sequence bf7996cbc3b rpc: fix getblock(header) returns target for tip 4c3c1f42cf7 test: add block 2016 to mock mainnet 953544d0286 Merge bitcoin/bitcoin#33429: fuzz: reduce iterations in slow targets df101c97c26 Merge bitcoin/bitcoin#33422: build: Remove lingering Windows registry & shortcuts (#32132 follow-up) 56c6daa64f6 Merge bitcoin/bitcoin#28592: p2p: Increase tx relay rate 79752b9c0b6 build(windows): Remove lingering registry entries and shortcuts upon install cad9a7fd737 rpc: Always return per-wtxid entries in submitpackage tx-results 6a33970fef1 fuzz: Reduce iterations in slow targets edb871cba22 Merge bitcoin/bitcoin#33412: Update libmultiprocess subtree to fix intermittent mptest hang 2427939935f test: forbid copying of DebugLogHelper d6aa266d432 test: don't throw from the destructor of DebugLogHelper eaf2c464758 Merge bitcoin/bitcoin#33378: Remove unnecessary casts when calling socket operations 5aec516b2ce Merge bitcoin/bitcoin#33333: coins: warn on oversized `-dbcache` 316a0c51327 rpc: addpeeraddress: throw on invalid IP 74fa028da1e Merge bitcoin/bitcoin#33420: test: Avoid interface_ipc.py Duplicate ID errors 168360f4ae4 coins: warn on oversized -dbcache 6c720459bee system: add helper for fetching total system memory e9c52272ebd test: Avoid interface_ipc.py Duplicate ID errors c49a43591f8 Merge commit '535fa0ad0d2637f845beae92ea9dbbbbbe377c74' into pr/subtree-5 535fa0ad0d2 Squashed 'src/ipc/libmultiprocess/' changes from 13424cf2ecc1..47d79db8a552 453b0fa286e bitcoin: Make wrapper not require -m 1444ed855f4 Merge bitcoin/bitcoin#33407: cmake: Install `bitcoin` manpage 29e836fae66 test: add tool_bitcoin to test bitcoin wrapper behavior 0972f550402 init: add exe name to bitcoind, bitcoin-node -version output to be able to distinguish these in tests 2b0cd1f3fb2 Merge bitcoin/bitcoin#33395: net: do not apply whitelist permissions to onion inbounds ef20c2d11d9 build, msvc: Update vcpkg manifest baseline 1ff9e929489 key: use static context for libsecp256k1 calls where applicable f563ce90818 net: Do not apply whitelist permission to onion inbounds 947bed28fe6 Merge bitcoin/bitcoin#33380: test: Add submitblock test in interface_ipc 7584a4fda95 cmake: Install `bitcoin` manpage 67f632b6deb net: remove unnecessary casts in socket operations c4adfbf7062 Merge bitcoin/bitcoin#33373: depends: systemtap 5.3 5aa3d3135d2 Merge bitcoin/bitcoin#33391: test: Prevent disk space warning during node_init_tests bdf01c6f612 test: Prevent disk space warning during node_init_tests 0a26731c4cc test: Add submitblock test in interface_ipc 2d6a0c46491 Merge bitcoin/bitcoin#33379: cmake: Fix regression in `secp256k1.cmake` 9193c3e4340 cmake: Fix regression in `secp256k1.cmake` 28efd724b47 depends: systemtap 5.3 75e6984ec8c test/refactor: use test deque to avoid quadratic iteration 652424ad162 test: additional test coverage for script_verify_flags 00c253d4941 ci: disable cirrus cache in 32bit arm job ff18b6bbaf3 ci: refactor docker action to return provider str 8e434a84999 macdeploy: rename macOS output to bitcoin-macos-app.zip 05353d9cf08 macdeploy: combine appname & -zip arguments fabc2615af2 test: Use extra_port() helper in feature_bind_extra.py 417437eb01a script/verify_flags: extend script_verify_flags to 64 bits 3cbbcb66efc script/interpreter: make script_verify_flag_name an ordinary enum bddcadee82d script/verify_flags: make script_verify_flags type safe a5ead122fe0 script/interpreter: introduce script_verify_flags typename 4577fb2b1e0 rpc: have getdeploymentinfo report script verify flags a3986935f07 validation: export GetBlockScriptFlags() 5db8cd2d37e Move mapFlagNames and FormatScriptFlags logic to script/interpreter.h adefb51c543 rpc/net: add per-peer inv_to_send sizes 88b0647f027 wallet: Always write last hardened cache flag in migrated wallets 8a08eef645e tests: Check that the last hardened cache upgrade occurs 0802398e749 fuzz: make it possible to mock (fuzz) CThreadInterrupt 6d9e5d130d2 fuzz: add CConnman::SocketHandler() to the tests 3265df63a48 fuzz: add CConnman::InitBinds() to the tests 91cbf4dbd86 fuzz: add CConnman::CreateNodeFromAcceptedSocket() to the tests 50da7432ec1 fuzz: add CConnman::OpenNetworkConnection() to the tests e6a917c8f8e fuzz: add Fuzzed NetEventsInterface and use it in connman tests e883b377688 fuzz: set the output argument of FuzzedSock::Accept() b81f37031c8 p2p: Increase tx relay rate REVERT: 2ac9d60c54a kernel: Fix bitcoin-chainstate for windows REVERT: 08e2a7ebbb9 kernel: Add Purpose section to header documentation REVERT: 9d95715fe46 kernel: Allowing reducing exports REVERT: 241f306df61 kernel: Add pure kernel bitcoin-chainstate REVERT: 3ed3d6b9c25 kernel: Add functions to get the block hash from a block REVERT: 3fe143dc6c3 kernel: Add block index utility functions to C header REVERT: 224dbec1ce5 kernel: Add function to read block undo data from disk to C header REVERT: 4e5b9c66d36 kernel: Add functions to read block from disk to C header REVERT: e4ef0011f7e kernel: Add function for copying block data to C header REVERT: 3e7711d271d kernel: Add functions for the block validation state to C header REVERT: 984305a1afb kernel: Add validation interface to C header REVERT: ff1fe96997b kernel: Add interrupt function to C header REVERT: b45d0abbea2 kernel: Add import blocks function to C header REVERT: dc939ae9471 kernel: Add chainstate load options for in-memory dbs in C header REVERT: 0ea93d86242 kernel: Add options for reindexing in C header REVERT: 5817e2e79bd kernel: Add block validation to C header REVERT: 32d9e4a547b kernel: Add chainstate loading when instantiating a ChainstateManager REVERT: e3c03bae40b kernel: Add chainstate manager option for setting worker threads REVERT: f6978da0f73 kernel: Add chainstate manager object to C header REVERT: 63d6e4fade2 kernel: Add notifications context option to C header REVERT: ee9c2c7ceac kernel: Add chain params context option to C header REVERT: 2919e083e1b kernel: Add kernel library context object REVERT: 7967ffa7476 kernel: Add logging to kernel library C header REVERT: c76dcaafbc7 kernel: Introduce initial kernel C header API git-subtree-dir: depend/bitcoin git-subtree-split: 81cec737e68b91f5edf90179b81aa620a5a68677 --- .github/actions/configure-docker/action.yml | 9 +- .github/workflows/ci.yml | 91 +++-- ci/lint/01_install.sh | 8 +- ci/test/00_setup_env_native_fuzz_with_msan.sh | 5 +- ci/test/01_base_install.sh | 17 - ci/test/03_test_script.sh | 3 +- cmake/module/Maintenance.cmake | 18 +- cmake/secp256k1.cmake | 3 +- contrib/guix/libexec/build.sh | 2 +- contrib/guix/symbol-check.py | 3 +- contrib/macdeploy/macdeployqtplus | 32 +- depends/funcs.mk | 6 +- depends/hosts/darwin.mk | 2 +- depends/packages/libxcb_util_cursor.mk | 2 +- depends/packages/qrencode.mk | 5 +- depends/packages/systemtap.mk | 4 +- doc/build-unix.md | 6 - doc/design/libraries.md | 2 +- doc/release-notes-empty-template.md | 2 +- share/qt/Info.plist.in | 2 +- share/setup.nsi.in | 13 + src/CMakeLists.txt | 45 ++- src/bench/verify_script.cpp | 2 +- src/bitcoin-chainstate.cpp | 2 +- src/bitcoin.cpp | 32 +- src/bitcoind.cpp | 11 +- src/chain.cpp | 19 +- src/common/args.cpp | 8 +- src/common/args.h | 8 +- src/common/system.cpp | 30 +- src/common/system.h | 6 + src/compat/compat.h | 8 - src/consensus/params.h | 3 +- src/consensus/tx_verify.cpp | 2 +- src/consensus/tx_verify.h | 3 +- src/deploymentinfo.h | 2 + src/httpserver.cpp | 2 +- src/i2p.cpp | 8 +- src/i2p.h | 14 +- src/init.cpp | 9 +- src/init/bitcoin-gui.cpp | 1 + src/init/bitcoin-node.cpp | 1 + src/init/bitcoin-qt.cpp | 3 + src/init/bitcoind.cpp | 3 + src/interfaces/init.h | 1 + src/ipc/libmultiprocess/.gitignore | 5 + src/ipc/libmultiprocess/ci/configs/llvm.bash | 2 +- .../libmultiprocess/ci/configs/olddeps.bash | 4 +- .../libmultiprocess/ci/configs/sanitize.bash | 2 +- src/ipc/libmultiprocess/ci/scripts/ci.sh | 21 +- src/ipc/libmultiprocess/include/mp/proxy-io.h | 72 +++- .../libmultiprocess/include/mp/proxy-types.h | 8 +- .../libmultiprocess/include/mp/type-context.h | 50 +-- src/ipc/libmultiprocess/include/mp/util.h | 11 + src/ipc/libmultiprocess/shell.nix | 14 +- src/ipc/libmultiprocess/src/mp/proxy.cpp | 80 +++-- src/kernel/bitcoinkernel.cpp | 209 +++++++++--- src/kernel/bitcoinkernel.h | 231 +++++++++++-- src/kernel/bitcoinkernel_wrapper.h | 205 +++++++++-- src/key.cpp | 20 +- src/net.cpp | 209 ++++++------ src/net.h | 90 ++++- src/net_processing.cpp | 42 ++- src/net_processing.h | 2 + src/netbase.cpp | 4 +- src/node/caches.cpp | 30 +- src/node/caches.h | 7 + src/node/miner.cpp | 4 +- src/policy/policy.h | 6 +- src/rpc/blockchain.cpp | 11 +- src/rpc/client.cpp | 34 +- src/rpc/mempool.cpp | 15 +- src/rpc/net.cpp | 42 ++- src/rpc/rawtransaction.cpp | 2 +- src/script/interpreter.cpp | 68 +++- src/script/interpreter.h | 70 ++-- src/script/verify_flags.h | 71 ++++ src/signet.cpp | 2 +- src/test/CMakeLists.txt | 8 +- src/test/addrman_tests.cpp | 8 +- src/test/caches_tests.cpp | 40 +++ src/test/chain_tests.cpp | 85 +++++ src/test/denialofservice_tests.cpp | 18 +- src/test/fuzz/coins_view.cpp | 2 +- src/test/fuzz/connman.cpp | 72 +++- src/test/fuzz/eval_script.cpp | 2 +- src/test/fuzz/fuzz.cpp | 2 +- src/test/fuzz/i2p.cpp | 9 +- src/test/fuzz/mini_miner.cpp | 2 +- src/test/fuzz/p2p_headers_presync.cpp | 2 +- src/test/fuzz/package_eval.cpp | 2 +- src/test/fuzz/script.cpp | 4 +- .../fuzz/script_assets_test_minimizer.cpp | 30 +- src/test/fuzz/script_flags.cpp | 15 +- .../secp256k1_ec_seckey_import_export_der.cpp | 8 +- src/test/fuzz/signature_checker.cpp | 2 +- src/test/fuzz/tx_pool.cpp | 16 +- src/test/fuzz/txdownloadman.cpp | 4 +- src/test/fuzz/util/CMakeLists.txt | 1 + src/test/fuzz/util/net.cpp | 27 ++ src/test/fuzz/util/net.h | 40 +++ src/test/fuzz/util/threadinterrupt.cpp | 22 ++ src/test/fuzz/util/threadinterrupt.h | 33 ++ src/test/i2p_tests.cpp | 12 +- src/test/kernel/test_kernel.cpp | 319 +++++++++++++++--- src/test/key_tests.cpp | 4 +- src/test/multisig_tests.cpp | 2 +- src/test/net_peer_connection_tests.cpp | 14 +- src/test/net_tests.cpp | 27 +- src/test/node_init_tests.cpp | 7 +- src/test/script_assets_tests.cpp | 12 +- src/test/script_tests.cpp | 39 ++- src/test/sigopcount_tests.cpp | 4 +- src/test/sock_tests.cpp | 2 +- src/test/system_ram_tests.cpp | 32 ++ src/test/transaction_tests.cpp | 87 ++--- src/test/txvalidationcache_tests.cpp | 6 +- src/test/util/logging.cpp | 8 +- src/test/util/logging.h | 21 +- src/test/util/net.cpp | 2 +- src/test/util/net.h | 20 +- src/test/util/script.cpp | 2 +- src/test/util/script.h | 3 +- src/util/threadinterrupt.cpp | 7 +- src/util/threadinterrupt.h | 24 +- src/validation.cpp | 63 ++-- src/validation.h | 10 +- src/wallet/load.cpp | 2 + src/wallet/sqlite.cpp | 3 - src/wallet/wallet.cpp | 2 +- src/wallet/walletdb.cpp | 6 + src/wallet/walletdb.h | 3 + test/functional/data/README.md | 14 +- test/functional/data/mainnet_alt.json | 6 +- test/functional/feature_assumeutxo.py | 2 +- test/functional/feature_bind_extra.py | 20 +- test/functional/feature_coinstatsindex.py | 6 +- test/functional/feature_index_prune.py | 8 +- test/functional/interface_ipc.py | 50 ++- test/functional/mempool_datacarrier.py | 12 - test/functional/mempool_truc.py | 33 +- test/functional/mining_mainnet.py | 31 +- test/functional/p2p_leak_tx.py | 72 ++-- test/functional/rpc_blockchain.py | 1 + test/functional/rpc_getblockstats.py | 8 +- test/functional/rpc_help.py | 2 +- test/functional/rpc_net.py | 7 +- test/functional/rpc_packages.py | 14 +- test/functional/test_framework/blocktools.py | 4 +- .../test_framework/test_framework.py | 15 +- test/functional/test_framework/util.py | 1 + test/functional/test_runner.py | 14 +- test/functional/tool_bitcoin.py | 111 ++++++ .../wallet_backwards_compatibility.py | 43 ++- test/functional/wallet_migration.py | 25 +- test/functional/wallet_reorgsrestore.py | 2 +- test/lint/check-doc.py | 2 +- vcpkg.json | 4 +- 158 files changed, 2820 insertions(+), 985 deletions(-) create mode 100644 src/ipc/libmultiprocess/.gitignore create mode 100644 src/script/verify_flags.h create mode 100644 src/test/caches_tests.cpp create mode 100644 src/test/chain_tests.cpp create mode 100644 src/test/fuzz/util/threadinterrupt.cpp create mode 100644 src/test/fuzz/util/threadinterrupt.h create mode 100644 src/test/system_ram_tests.cpp create mode 100755 test/functional/tool_bitcoin.py diff --git a/.github/actions/configure-docker/action.yml b/.github/actions/configure-docker/action.yml index c78df86..09a1e6f 100644 --- a/.github/actions/configure-docker/action.yml +++ b/.github/actions/configure-docker/action.yml @@ -1,9 +1,12 @@ name: 'Configure Docker' description: 'Set up Docker build driver and configure build cache args' inputs: - use-cirrus: - description: 'Use cirrus cache' + cache-provider: + description: 'gha or cirrus cache provider' required: true + options: + - gh + - cirrus runs: using: 'composite' steps: @@ -32,7 +35,7 @@ runs: # which are set automatically when running on GitHub infra: https://docs.docker.com/build/cache/backends/gha/#synopsis # Use cirrus cache host - if [[ ${{ inputs.use-cirrus }} == 'true' ]]; then + if [[ ${{ inputs.cache-provider }} == 'cirrus' ]]; then url_args="url=${CIRRUS_CACHE_HOST},url_v2=${CIRRUS_CACHE_HOST}" else url_args="" diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index f0fb0f1..39dc017 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -33,15 +33,15 @@ jobs: name: 'determine runners' runs-on: ubuntu-latest outputs: - use-cirrus-runners: ${{ steps.runners.outputs.use-cirrus-runners }} + provider: ${{ steps.runners.outputs.provider }} steps: - id: runners run: | if [[ "${REPO_USE_CIRRUS_RUNNERS}" == "${{ github.repository }}" ]]; then - echo "use-cirrus-runners=true" >> "$GITHUB_OUTPUT" + echo "provider=cirrus" >> "$GITHUB_OUTPUT" echo "::notice title=Runner Selection::Using Cirrus Runners" else - echo "use-cirrus-runners=false" >> "$GITHUB_OUTPUT" + echo "provider=gha" >> "$GITHUB_OUTPUT" echo "::notice title=Runner Selection::Using GitHub-hosted runners" fi @@ -105,7 +105,7 @@ jobs: name: ${{ matrix.job-name }} # Use any image to support the xcode-select below, but hardcode version to avoid silent upgrades (and breaks). # See: https://github.com/actions/runner-images#available-images. - runs-on: macos-14 + runs-on: macos-15 # When a contributor maintains a fork of the repo, any pull request they make # to their own fork, or to the main repository, will trigger two CI runs: @@ -123,10 +123,10 @@ jobs: include: - job-type: standard file-env: './ci/test/00_setup_env_mac_native.sh' - job-name: 'macOS 14 native, arm64, no depends, sqlite only, gui' + job-name: 'macOS native, no depends, sqlite only, gui' - job-type: fuzz file-env: './ci/test/00_setup_env_mac_native_fuzz.sh' - job-name: 'macOS 14 native, arm64, fuzz' + job-name: 'macOS native, fuzz' env: DANGER_RUN_CI_ON_HOST: 1 @@ -145,8 +145,8 @@ jobs: # Use the earliest Xcode supported by the version of macOS denoted in # doc/release-notes-empty-template.md and providing at least the # minimum clang version denoted in doc/dependencies.md. - # See: https://developer.apple.com/documentation/xcode-release-notes/xcode-15-release-notes - sudo xcode-select --switch /Applications/Xcode_15.0.app + # See: https://developer.apple.com/documentation/xcode-release-notes/xcode-16-release-notes + sudo xcode-select --switch /Applications/Xcode_16.0.app clang --version - name: Install Homebrew packages @@ -211,11 +211,16 @@ jobs: steps: - *CHECKOUT - - name: Configure Developer Command Prompt for Microsoft Visual C++ - # Using microsoft/setup-msbuild is not enough. - uses: ilammy/msvc-dev-cmd@v1 - with: - arch: x64 + - &SET_UP_VS + name: Set up VS Developer Prompt + shell: pwsh -Command "$PSVersionTable; $PSNativeCommandUseErrorActionPreference = $true; $ErrorActionPreference = 'Stop'; & '{0}'" + run: | + $vswherePath = "${env:ProgramFiles(x86)}\Microsoft Visual Studio\Installer\vswhere.exe" + $installationPath = & $vswherePath -latest -property installationPath + & "${env:COMSPEC}" /s /c "`"$installationPath\Common7\Tools\vsdevcmd.bat`" -arch=x64 -no_logo && set" | foreach-object { + $name, $value = $_ -split '=', 2 + echo "$name=$value" >> $env:GITHUB_ENV + } - name: Get tool information shell: pwsh @@ -263,14 +268,26 @@ jobs: run: | cmake --build . -j $NUMBER_OF_PROCESSORS --config Release - - name: Get bitcoind manifest + - name: Check executable manifests if: matrix.job-type == 'standard' working-directory: build + shell: pwsh -Command "$PSVersionTable; $PSNativeCommandUseErrorActionPreference = $true; $ErrorActionPreference = 'Stop'; & '{0}'" run: | - mt.exe -nologo -inputresource:bin/Release/bitcoind.exe -out:bitcoind.manifest - cat bitcoind.manifest - echo - mt.exe -nologo -inputresource:bin/Release/bitcoind.exe -validate_manifest + mt.exe -nologo -inputresource:bin\Release\bitcoind.exe -out:bitcoind.manifest + Get-Content bitcoind.manifest + + Get-ChildItem -Filter "bin\Release\*.exe" | ForEach-Object { + $exeName = $_.Name + + # Skip as they currently do not have manifests + if ($exeName -eq "fuzz.exe" -or $exeName -eq "bench_bitcoin.exe" -or $exeName -eq "test_bitcoin-qt.exe" -or $exeName -eq "test_kernel.exe" -or $exeName -eq "bitcoin-chainstate.exe") { + Write-Host "Skipping $exeName (no manifest present)" + return + } + + Write-Host "Checking $exeName" + & mt.exe -nologo -inputresource:$_.FullName -validate_manifest + } - name: Run test suite if: matrix.job-type == 'standard' @@ -313,7 +330,7 @@ jobs: windows-cross: name: 'Linux->Windows cross, no tests' needs: runners - runs-on: ${{ needs.runners.outputs.use-cirrus-runners == 'true' && 'ghcr.io/cirruslabs/ubuntu-runner-amd64:24.04-sm' || 'ubuntu-24.04' }} + runs-on: ${{ needs.runners.outputs.provider == 'cirrus' && 'ghcr.io/cirruslabs/ubuntu-runner-amd64:24.04-sm' || 'ubuntu-24.04' }} if: ${{ vars.SKIP_BRANCH_PUSH != 'true' || github.event_name == 'pull_request' }} env: @@ -333,7 +350,7 @@ jobs: - name: Configure Docker uses: ./.github/actions/configure-docker with: - use-cirrus: ${{ needs.runners.outputs.use-cirrus-runners }} + cache-provider: ${{ needs.runners.outputs.provider }} - name: CI script run: ./ci/test_run_all.sh @@ -371,19 +388,26 @@ jobs: - name: Run bitcoind.exe run: ./bin/bitcoind.exe -version - - name: Find mt.exe tool - shell: pwsh - run: | - $sdk_dir = (Get-ItemProperty 'HKLM:\SOFTWARE\Wow6432Node\Microsoft\Windows Kits\Installed Roots' -Name KitsRoot10).KitsRoot10 - $sdk_latest = (Get-ChildItem "$sdk_dir\bin" -Directory | Where-Object { $_.Name -match '^\d+\.\d+\.\d+\.\d+$' } | Sort-Object Name -Descending | Select-Object -First 1).Name - "MT_EXE=${sdk_dir}bin\${sdk_latest}\x64\mt.exe" >> $env:GITHUB_ENV + - *SET_UP_VS - - name: Get bitcoind manifest - shell: pwsh + - name: Check executable manifests + shell: pwsh -Command "$PSVersionTable; $PSNativeCommandUseErrorActionPreference = $true; $ErrorActionPreference = 'Stop'; & '{0}'" run: | - & $env:MT_EXE -nologo -inputresource:bin\bitcoind.exe -out:bitcoind.manifest + mt.exe -nologo -inputresource:bin\bitcoind.exe -out:bitcoind.manifest Get-Content bitcoind.manifest - & $env:MT_EXE -nologo -inputresource:bin\bitcoind.exe -validate_manifest + + Get-ChildItem -Filter "bin\*.exe" | ForEach-Object { + $exeName = $_.Name + + # Skip as they currently do not have manifests + if ($exeName -eq "fuzz.exe" -or $exeName -eq "bench_bitcoin.exe" -or $exeName -eq "test_kernel.exe") { + Write-Host "Skipping $exeName (no manifest present)" + return + } + + Write-Host "Checking $exeName" + & mt.exe -nologo -inputresource:$_.FullName -validate_manifest + } - name: Run unit tests # Can't use ctest here like other jobs as we don't have a CMake build tree. @@ -423,7 +447,7 @@ jobs: ci-matrix: name: ${{ matrix.name }} needs: runners - runs-on: ${{ needs.runners.outputs.use-cirrus-runners == 'true' && matrix.cirrus-runner || matrix.fallback-runner }} + runs-on: ${{ needs.runners.outputs.provider == 'cirrus' && matrix.cirrus-runner || matrix.fallback-runner }} if: ${{ vars.SKIP_BRANCH_PUSH != 'true' || github.event_name == 'pull_request' }} timeout-minutes: ${{ matrix.timeout-minutes }} @@ -440,6 +464,7 @@ jobs: fallback-runner: 'ubuntu-24.04-arm' timeout-minutes: 120 file-env: './ci/test/00_setup_env_arm.sh' + provider: 'gha' - name: 'ASan + LSan + UBSan + integer, no depends, USDT' cirrus-runner: 'ghcr.io/cirruslabs/ubuntu-runner-amd64:24.04-md' # has to match container in ci/test/00_setup_env_native_asan.sh for tracing tools @@ -514,7 +539,7 @@ jobs: - name: Configure Docker uses: ./.github/actions/configure-docker with: - use-cirrus: ${{ needs.runners.outputs.use-cirrus-runners }} + cache-provider: ${{ matrix.provider || needs.runners.outputs.provider }} - name: Enable bpfcc script if: ${{ env.CONTAINER_NAME == 'ci_native_asan' }} @@ -551,7 +576,7 @@ jobs: - name: Configure Docker uses: ./.github/actions/configure-docker with: - use-cirrus: ${{ needs.runners.outputs.use-cirrus-runners }} + cache-provider: ${{ needs.runners.outputs.provider }} - name: CI script run: | diff --git a/ci/lint/01_install.sh b/ci/lint/01_install.sh index 75f8911..0d8cca9 100755 --- a/ci/lint/01_install.sh +++ b/ci/lint/01_install.sh @@ -41,10 +41,10 @@ python3 --version ${CI_RETRY_EXE} pip3 install \ codespell==2.4.1 \ lief==0.16.6 \ - mypy==1.4.1 \ - pyzmq==25.1.0 \ - ruff==0.5.5 \ - vulture==2.6 + mypy==1.18.2 \ + pyzmq==27.1.0 \ + ruff==0.13.2 \ + vulture==2.14 SHELLCHECK_VERSION=v0.11.0 curl -sL "https://github.com/koalaman/shellcheck/releases/download/${SHELLCHECK_VERSION}/shellcheck-${SHELLCHECK_VERSION}.linux.x86_64.tar.xz" | \ diff --git a/ci/test/00_setup_env_native_fuzz_with_msan.sh b/ci/test/00_setup_env_native_fuzz_with_msan.sh index c71772b..0d90605 100755 --- a/ci/test/00_setup_env_native_fuzz_with_msan.sh +++ b/ci/test/00_setup_env_native_fuzz_with_msan.sh @@ -7,12 +7,15 @@ export LC_ALL=C.UTF-8 export CI_IMAGE_NAME_TAG="mirror.gcr.io/ubuntu:24.04" +export APT_LLVM_V="21" LIBCXX_DIR="/cxx_build/" export MSAN_FLAGS="-fsanitize=memory -fsanitize-memory-track-origins=2 -fno-omit-frame-pointer -g -O1 -fno-optimize-sibling-calls" -LIBCXX_FLAGS="-nostdinc++ -nostdlib++ -isystem ${LIBCXX_DIR}include/c++/v1 -L${LIBCXX_DIR}lib -Wl,-rpath,${LIBCXX_DIR}lib -lc++ -lc++abi -lpthread -Wno-unused-command-line-argument" +# -lstdc++ to resolve link issues due to upstream packaging +LIBCXX_FLAGS="-nostdinc++ -nostdlib++ -isystem ${LIBCXX_DIR}include/c++/v1 -L${LIBCXX_DIR}lib -Wl,-rpath,${LIBCXX_DIR}lib -lc++ -lc++abi -lpthread -Wno-unused-command-line-argument -lstdc++" export MSAN_AND_LIBCXX_FLAGS="${MSAN_FLAGS} ${LIBCXX_FLAGS}" export CONTAINER_NAME="ci_native_fuzz_msan" +export PACKAGES="clang-${APT_LLVM_V} llvm-${APT_LLVM_V} llvm-${APT_LLVM_V}-dev libclang-${APT_LLVM_V}-dev libclang-rt-${APT_LLVM_V}-dev" export DEP_OPTS="DEBUG=1 NO_QT=1 CC=clang CXX=clang++ CFLAGS='${MSAN_FLAGS}' CXXFLAGS='${MSAN_AND_LIBCXX_FLAGS}'" export GOAL="all" # Setting CMAKE_{C,CXX}_FLAGS_DEBUG flags to an empty string ensures that the flags set in MSAN_FLAGS remain unaltered. diff --git a/ci/test/01_base_install.sh b/ci/test/01_base_install.sh index 6944ab4..ce46098 100755 --- a/ci/test/01_base_install.sh +++ b/ci/test/01_base_install.sh @@ -58,23 +58,6 @@ fi if [[ -n "${USE_INSTRUMENTED_LIBCPP}" ]]; then ${CI_RETRY_EXE} git clone --depth=1 https://github.com/llvm/llvm-project -b "llvmorg-21.1.1" /llvm-project - if [ -n "${APT_LLVM_V}" ]; then - - cmake -G Ninja -B /clang_build/ \ - -DLLVM_ENABLE_PROJECTS="clang" \ - -DCMAKE_BUILD_TYPE=Release \ - -DLLVM_TARGETS_TO_BUILD=Native \ - -DLLVM_ENABLE_RUNTIMES="compiler-rt;libcxx;libcxxabi;libunwind" \ - -S /llvm-project/llvm - - ninja -C /clang_build/ "$MAKEJOBS" - ninja -C /clang_build/ install-runtimes - - update-alternatives --install /usr/bin/clang++ clang++ /clang_build/bin/clang++ 100 - update-alternatives --install /usr/bin/clang clang /clang_build/bin/clang 100 - update-alternatives --install /usr/bin/llvm-symbolizer llvm-symbolizer /clang_build/bin/llvm-symbolizer 100 - fi - cmake -G Ninja -B /cxx_build/ \ -DLLVM_ENABLE_RUNTIMES="libcxx;libcxxabi;libunwind" \ -DCMAKE_BUILD_TYPE=Release \ diff --git a/ci/test/03_test_script.sh b/ci/test/03_test_script.sh index 05e4d8f..cee09cd 100755 --- a/ci/test/03_test_script.sh +++ b/ci/test/03_test_script.sh @@ -130,7 +130,8 @@ if [[ "${RUN_TIDY}" == "true" ]]; then BITCOIN_CONFIG_ALL="$BITCOIN_CONFIG_ALL -DCMAKE_EXPORT_COMPILE_COMMANDS=ON" fi -bash -c "cmake -S $BASE_ROOT_DIR -B ${BASE_BUILD_DIR} $BITCOIN_CONFIG_ALL $BITCOIN_CONFIG" || ( +eval "CMAKE_ARGS=($BITCOIN_CONFIG_ALL $BITCOIN_CONFIG)" +cmake -S "$BASE_ROOT_DIR" -B "$BASE_BUILD_DIR" "${CMAKE_ARGS[@]}" || ( cd "${BASE_BUILD_DIR}" # shellcheck disable=SC2046 cat $(cmake -P "${BASE_ROOT_DIR}/ci/test/GetCMakeLogFiles.cmake") diff --git a/cmake/module/Maintenance.cmake b/cmake/module/Maintenance.cmake index 5f4b1d8..7f29bc9 100644 --- a/cmake/module/Maintenance.cmake +++ b/cmake/module/Maintenance.cmake @@ -96,24 +96,24 @@ function(add_macos_deploy_target) VERBATIM ) - string(REPLACE " " "-" osx_volname ${CLIENT_NAME}) + set(macos_zip "bitcoin-macos-app") if(CMAKE_HOST_APPLE) add_custom_command( - OUTPUT ${PROJECT_BINARY_DIR}/${osx_volname}.zip - COMMAND Python3::Interpreter ${PROJECT_SOURCE_DIR}/contrib/macdeploy/macdeployqtplus ${macos_app} ${osx_volname} -translations-dir=${QT_TRANSLATIONS_DIR} -zip + OUTPUT ${PROJECT_BINARY_DIR}/${macos_zip}.zip + COMMAND Python3::Interpreter ${PROJECT_SOURCE_DIR}/contrib/macdeploy/macdeployqtplus ${macos_app} -translations-dir=${QT_TRANSLATIONS_DIR} -zip=${macos_zip} DEPENDS ${PROJECT_BINARY_DIR}/${macos_app}/Contents/MacOS/Bitcoin-Qt VERBATIM ) add_custom_target(deploydir - DEPENDS ${PROJECT_BINARY_DIR}/${osx_volname}.zip + DEPENDS ${PROJECT_BINARY_DIR}/${macos_zip}.zip ) add_custom_target(deploy - DEPENDS ${PROJECT_BINARY_DIR}/${osx_volname}.zip + DEPENDS ${PROJECT_BINARY_DIR}/${macos_zip}.zip ) else() add_custom_command( OUTPUT ${PROJECT_BINARY_DIR}/dist/${macos_app}/Contents/MacOS/Bitcoin-Qt - COMMAND ${CMAKE_COMMAND} -E env OBJDUMP=${CMAKE_OBJDUMP} $ ${PROJECT_SOURCE_DIR}/contrib/macdeploy/macdeployqtplus ${macos_app} ${osx_volname} -translations-dir=${QT_TRANSLATIONS_DIR} + COMMAND ${CMAKE_COMMAND} -E env OBJDUMP=${CMAKE_OBJDUMP} $ ${PROJECT_SOURCE_DIR}/contrib/macdeploy/macdeployqtplus ${macos_app} -translations-dir=${QT_TRANSLATIONS_DIR} DEPENDS ${PROJECT_BINARY_DIR}/${macos_app}/Contents/MacOS/Bitcoin-Qt VERBATIM ) @@ -128,13 +128,13 @@ function(add_macos_deploy_target) ) else() add_custom_command( - OUTPUT ${PROJECT_BINARY_DIR}/dist/${osx_volname}.zip + OUTPUT ${PROJECT_BINARY_DIR}/dist/${macos_zip}.zip WORKING_DIRECTORY dist - COMMAND ${PROJECT_SOURCE_DIR}/cmake/script/macos_zip.sh ${ZIP_EXECUTABLE} ${osx_volname}.zip + COMMAND ${PROJECT_SOURCE_DIR}/cmake/script/macos_zip.sh ${ZIP_EXECUTABLE} ${macos_zip}.zip VERBATIM ) add_custom_target(deploy - DEPENDS ${PROJECT_BINARY_DIR}/dist/${osx_volname}.zip + DEPENDS ${PROJECT_BINARY_DIR}/dist/${macos_zip}.zip ) endif() endif() diff --git a/cmake/secp256k1.cmake b/cmake/secp256k1.cmake index 15f1aac..5302f51 100644 --- a/cmake/secp256k1.cmake +++ b/cmake/secp256k1.cmake @@ -2,6 +2,8 @@ # Distributed under the MIT software license, see the accompanying # file COPYING or https://opensource.org/license/mit/. +enable_language(C) + function(add_secp256k1 subdir) message("") message("Configuring secp256k1 subtree...") @@ -30,7 +32,6 @@ function(add_secp256k1 subdir) string(STRIP "${SECP256K1_APPEND_LDFLAGS} ${APPEND_LDFLAGS}" SECP256K1_APPEND_LDFLAGS) set(SECP256K1_APPEND_LDFLAGS ${SECP256K1_APPEND_LDFLAGS} CACHE STRING "" FORCE) # We want to build libsecp256k1 with the most tested RelWithDebInfo configuration. - enable_language(C) foreach(config IN LISTS CMAKE_BUILD_TYPE CMAKE_CONFIGURATION_TYPES) if(config STREQUAL "") continue() diff --git a/contrib/guix/libexec/build.sh b/contrib/guix/libexec/build.sh index f23133f..bbf6c64 100755 --- a/contrib/guix/libexec/build.sh +++ b/contrib/guix/libexec/build.sh @@ -369,7 +369,7 @@ mkdir -p "$DISTSRC" ;; *darwin*) cmake --build build --target deploy ${V:+--verbose} - mv build/dist/Bitcoin-Core.zip "${OUTDIR}/${DISTNAME}-${HOST}-unsigned.zip" + mv build/dist/bitcoin-macos-app.zip "${OUTDIR}/${DISTNAME}-${HOST}-unsigned.zip" mkdir -p "unsigned-app-${HOST}" cp --target-directory="unsigned-app-${HOST}" \ contrib/macdeploy/detached-sig-create.sh diff --git a/contrib/guix/symbol-check.py b/contrib/guix/symbol-check.py index d808ef6..7804a2c 100755 --- a/contrib/guix/symbol-check.py +++ b/contrib/guix/symbol-check.py @@ -112,7 +112,6 @@ 'libfontconfig.so.1', # font support 'libfreetype.so.6', # font parsing 'libdl.so.2', # programming interface to dynamic linker -'libxcb-cursor.so.0', 'libxcb-icccm.so.4', 'libxcb-image.so.0', 'libxcb-shm.so.0', @@ -249,7 +248,7 @@ def check_MACHO_libraries(binary) -> bool: return ok def check_MACHO_min_os(binary) -> bool: - if binary.build_version.minos == [13,0,0]: + if binary.build_version.minos == [14,0,0]: return True return False diff --git a/contrib/macdeploy/macdeployqtplus b/contrib/macdeploy/macdeployqtplus index ba532d7..476ac13 100755 --- a/contrib/macdeploy/macdeployqtplus +++ b/contrib/macdeploy/macdeployqtplus @@ -390,12 +390,11 @@ Note, that the "dist" folder will be deleted before deploying on each run. Optionally, Qt translation files (.qm) can be added to the bundle.""") ap.add_argument("app_bundle", nargs=1, metavar="app-bundle", help="application bundle to be deployed") -ap.add_argument("appname", nargs=1, metavar="appname", help="name of the app being deployed") ap.add_argument("-verbose", nargs="?", const=True, help="Output additional debugging information") ap.add_argument("-no-plugins", dest="plugins", action="store_false", default=True, help="skip plugin deployment") ap.add_argument("-no-strip", dest="strip", action="store_false", default=True, help="don't run 'strip' on the binaries") ap.add_argument("-translations-dir", nargs=1, metavar="path", default=None, help="Path to Qt's translations. Base translations will automatically be added to the bundle's resources.") -ap.add_argument("-zip", nargs="?", const="", metavar="zip", help="create a .zip containing the app bundle") +ap.add_argument("-zip", nargs=1, metavar="zip", help="create a .zip containing the app bundle") config = ap.parse_args() @@ -404,7 +403,6 @@ verbose = config.verbose # ------------------------------------------------ app_bundle = config.app_bundle[0] -appname = config.appname[0] if not os.path.exists(app_bundle): sys.stderr.write(f"Error: Could not find app bundle \"{app_bundle}\"\n") @@ -416,10 +414,6 @@ if os.path.exists("dist"): print("+ Removing existing dist folder +") shutil.rmtree("dist") -if os.path.exists(appname + ".zip"): - print("+ Removing existing .zip +") - os.unlink(appname + ".zip") - # ------------------------------------------------ target = os.path.join("dist", "Bitcoin-Qt.app") @@ -466,18 +460,18 @@ if config.translations_dir: sys.stderr.write(f"Error: Could not find translation dir \"{config.translations_dir[0]}\"\n") sys.exit(1) -print("+ Adding Qt translations +") + print("+ Adding Qt translations +") -translations = Path(config.translations_dir[0]) + translations = Path(config.translations_dir[0]) -regex = re.compile('qt_[a-z]*(.qm|_[A-Z]*.qm)') + regex = re.compile('qt_[a-z]*(.qm|_[A-Z]*.qm)') -lang_files = [x for x in translations.iterdir() if regex.match(x.name)] + lang_files = [x for x in translations.iterdir() if regex.match(x.name)] -for file in lang_files: - if verbose: - print(file.as_posix(), "->", os.path.join(applicationBundle.resourcesPath, file.name)) - shutil.copy2(file.as_posix(), os.path.join(applicationBundle.resourcesPath, file.name)) + for file in lang_files: + if verbose: + print(file.as_posix(), "->", os.path.join(applicationBundle.resourcesPath, file.name)) + shutil.copy2(file.as_posix(), os.path.join(applicationBundle.resourcesPath, file.name)) # ------------------------------------------------ @@ -499,7 +493,13 @@ if platform.system() == "Darwin": # ------------------------------------------------ if config.zip is not None: - shutil.make_archive('{}'.format(appname), format='zip', root_dir='dist', base_dir='Bitcoin-Qt.app') + name = config.zip[0] + + if os.path.exists(name + ".zip"): + print("+ Removing existing .zip +") + os.unlink(name + ".zip") + + shutil.make_archive('{}'.format(name), format='zip', root_dir='dist', base_dir='Bitcoin-Qt.app') # ------------------------------------------------ diff --git a/depends/funcs.mk b/depends/funcs.mk index 28baf47..6c38334 100644 --- a/depends/funcs.mk +++ b/depends/funcs.mk @@ -36,9 +36,8 @@ define fetch_file_inner endef define fetch_file - ( test -f $$($(1)_source_dir)/$(4) || \ ( $(call fetch_file_inner,$(1),$(2),$(3),$(4),$(5)) || \ - $(call fetch_file_inner,$(1),$(FALLBACK_DOWNLOAD_PATH),$(3),$(4),$(5)))) + $(call fetch_file_inner,$(1),$(FALLBACK_DOWNLOAD_PATH),$(3),$(4),$(5))) endef # Shell script to create a source tarball in $(1)_source from local directory @@ -109,7 +108,7 @@ $(1)_prefixbin:=$($($(1)_type)_prefix)/bin/ $(1)_all_sources=$($(1)_file_name) $($(1)_extra_sources) #stamps -$(1)_fetched=$(SOURCES_PATH)/download-stamps/.stamp_fetched-$(1)-$($(1)_file_name).hash +$(1)_fetched=$(SOURCES_PATH)/download-stamps/.stamp_fetched-$(1)-$($(1)_version)-$($(1)_sha256_hash).hash $(1)_extracted=$$($(1)_extract_dir)/.stamp_extracted $(1)_preprocessed=$$($(1)_extract_dir)/.stamp_preprocessed $(1)_cleaned=$$($(1)_extract_dir)/.stamp_cleaned @@ -247,7 +246,6 @@ endif $($(1)_fetched): mkdir -p $$(@D) $(SOURCES_PATH) rm -f $$@ - touch $$@ cd $$(@D); $($(1)_fetch_cmds) cd $($(1)_source_dir); $(foreach source,$($(1)_all_sources),$(build_SHA256SUM) $(source) >> $$(@);) touch $$@ diff --git a/depends/hosts/darwin.mk b/depends/hosts/darwin.mk index 7ec2fd9..d33b681 100644 --- a/depends/hosts/darwin.mk +++ b/depends/hosts/darwin.mk @@ -1,4 +1,4 @@ -OSX_MIN_VERSION=13.0 +OSX_MIN_VERSION=14.0 OSX_SDK_VERSION=14.0 XCODE_VERSION=15.0 XCODE_BUILD_ID=15A240d diff --git a/depends/packages/libxcb_util_cursor.mk b/depends/packages/libxcb_util_cursor.mk index b308890..288afea 100644 --- a/depends/packages/libxcb_util_cursor.mk +++ b/depends/packages/libxcb_util_cursor.mk @@ -6,7 +6,7 @@ $(package)_sha256_hash=0e9c5446dc6f3beb8af6ebfcc9e27bcc6da6fe2860f7fc07b99144dfa $(package)_dependencies=libxcb libxcb_util_render libxcb_util_image define $(package)_set_vars -$(package)_config_opts = --disable-static +$(package)_config_opts = --disable-shared $(package)_config_opts += --disable-dependency-tracking --enable-option-checking endef diff --git a/depends/packages/qrencode.mk b/depends/packages/qrencode.mk index e3f6140..9aae62f 100644 --- a/depends/packages/qrencode.mk +++ b/depends/packages/qrencode.mk @@ -1,8 +1,9 @@ package=qrencode $(package)_version=4.1.1 -$(package)_download_path=https://fukuchi.org/works/qrencode/ +$(package)_download_path=https://github.com/fukuchi/libqrencode/archive/refs/tags/ +$(package)_download_file=v$($(package)_version).tar.gz $(package)_file_name=$(package)-$($(package)_version).tar.gz -$(package)_sha256_hash=da448ed4f52aba6bcb0cd48cac0dd51b8692bccc4cd127431402fca6f8171e8e +$(package)_sha256_hash=5385bc1b8c2f20f3b91d258bf8ccc8cf62023935df2d2676b5b67049f31a049c $(package)_patches=cmake_fixups.patch define $(package)_set_vars diff --git a/depends/packages/systemtap.mk b/depends/packages/systemtap.mk index c912e18..668099b 100644 --- a/depends/packages/systemtap.mk +++ b/depends/packages/systemtap.mk @@ -1,8 +1,8 @@ package=systemtap -$(package)_version=4.8 +$(package)_version=5.3 $(package)_download_path=https://sourceware.org/ftp/systemtap/releases/ $(package)_file_name=$(package)-$($(package)_version).tar.gz -$(package)_sha256_hash=cbd50a4eba5b261394dc454c12448ddec73e55e6742fda7f508f9fbc1331c223 +$(package)_sha256_hash=966a360fb73a4b65a8d0b51b389577b3c4f92a327e84aae58682103e8c65a69a $(package)_patches=remove_SDT_ASM_SECTION_AUTOGROUP_SUPPORT_check.patch define $(package)_preprocess_cmds diff --git a/doc/build-unix.md b/doc/build-unix.md index bfb3bd3..d9bbb35 100644 --- a/doc/build-unix.md +++ b/doc/build-unix.md @@ -81,8 +81,6 @@ the necessary parts of Qt, the libqrencode and pass `-DBUILD_GUI=ON`. Skip if yo sudo apt-get install qt6-base-dev qt6-tools-dev qt6-l10n-tools qt6-tools-dev-tools libgl-dev -For Qt 6.5 and later, the `libxcb-cursor0` package must be installed at runtime. - Additionally, to support Wayland protocol for modern desktop environments: sudo apt install qt6-wayland @@ -133,8 +131,6 @@ the necessary parts of Qt, the libqrencode and pass `-DBUILD_GUI=ON`. Skip if yo sudo dnf install qt6-qtbase-devel qt6-qttools-devel -For Qt 6.5 and later, the `xcb-util-cursor` package must be installed at runtime. - Additionally, to support Wayland protocol for modern desktop environments: sudo dnf install qt6-qtwayland @@ -182,8 +178,6 @@ the necessary parts of Qt, the libqrencode and pass `-DBUILD_GUI=ON`. Skip if yo apk add qt6-qtbase-dev qt6-qttools-dev -For Qt 6.5 and later, the `xcb-util-cursor` package must be installed at runtime. - The GUI will be able to encode addresses in QR codes unless this feature is explicitly disabled. To install libqrencode, run: apk add libqrencode-dev diff --git a/doc/design/libraries.md b/doc/design/libraries.md index 102b927..b20c803 100644 --- a/doc/design/libraries.md +++ b/doc/design/libraries.md @@ -8,7 +8,7 @@ | *libbitcoin_crypto* | Hardware-optimized functions for data encryption, hashing, message authentication, and key derivation. | | *libbitcoin_kernel* | Consensus engine and support library used for validation by *libbitcoin_node*. | | *libbitcoinqt* | GUI functionality used by *bitcoin-qt* and *bitcoin-gui* executables. | -| *libbitcoin_ipc* | IPC functionality used by *bitcoin-node*, *bitcoin-wallet*, *bitcoin-gui* executables to communicate when [`-DENABLE_IPC=ON`](multiprocess.md) is used. | +| *libbitcoin_ipc* | IPC functionality used by *bitcoin-node* and *bitcoin-gui* executables to communicate when [`-DENABLE_IPC=ON`](multiprocess.md) is used. | | *libbitcoin_node* | P2P and RPC server functionality used by *bitcoind* and *bitcoin-qt* executables. | | *libbitcoin_util* | Home for common functionality shared by different executables and libraries. Similar to *libbitcoin_common*, but lower-level (see [Dependencies](#dependencies)). | | *libbitcoin_wallet* | Wallet functionality used by *bitcoind* and *bitcoin-wallet* executables. | diff --git a/doc/release-notes-empty-template.md b/doc/release-notes-empty-template.md index 0e8dc77..7f419cb 100644 --- a/doc/release-notes-empty-template.md +++ b/doc/release-notes-empty-template.md @@ -36,7 +36,7 @@ Compatibility ============== Bitcoin Core is supported and tested on operating systems using the -Linux Kernel 3.17+, macOS 13+, and Windows 10+. Bitcoin +Linux Kernel 3.17+, macOS 14+, and Windows 10+. 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. diff --git a/share/qt/Info.plist.in b/share/qt/Info.plist.in index 5ff7361..e33f377 100644 --- a/share/qt/Info.plist.in +++ b/share/qt/Info.plist.in @@ -3,7 +3,7 @@ LSMinimumSystemVersion - 13 + 14 LSArchitecturePriority diff --git a/share/setup.nsi.in b/share/setup.nsi.in index 2160cc0..387d781 100644 --- a/share/setup.nsi.in +++ b/share/setup.nsi.in @@ -113,6 +113,19 @@ Section -post SEC0001 WriteRegStr HKCR "@CLIENT_TARNAME@" "" "URL:Bitcoin" WriteRegStr HKCR "@CLIENT_TARNAME@\DefaultIcon" "" $INSTDIR\@BITCOIN_GUI_NAME@@EXEEXT@ WriteRegStr HKCR "@CLIENT_TARNAME@\shell\open\command" "" '"$INSTDIR\@BITCOIN_GUI_NAME@@EXEEXT@" "%1"' + + # Lingering since fb2b05b1259d3e69e6e675adfa30b429424c7625 which removed the suffix + DeleteRegValue HKCU "${REGKEY} (64-bit)\Components" Main + DeleteRegKey HKCU "SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\$(^Name) (64-bit)" + Delete /REBOOTOK "$SMPROGRAMS\$StartMenuGroup\Uninstall $(^Name) (64-bit).lnk" + Delete /REBOOTOK "$SMPROGRAMS\$StartMenuGroup\$(^Name) (64-bit).lnk" + DeleteRegValue HKCU "${REGKEY} (64-bit)" StartMenuGroup + DeleteRegValue HKCU "${REGKEY} (64-bit)" Path + DeleteRegKey /IfEmpty HKCU "${REGKEY} (64-bit)\Components" + DeleteRegKey /IfEmpty HKCU "${REGKEY} (64-bit)" + + # Lingering since 77b2923f87131a407f7d4193c54db22375130403 + Delete /REBOOTOK "$SMPROGRAMS\$StartMenuGroup\Bitcoin Core (testnet, 64-bit).lnk" SectionEnd # Macro for selecting uninstaller sections diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index f69a806..81c8577 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -292,8 +292,8 @@ if(BUILD_BITCOIN_BIN) add_executable(bitcoin bitcoin.cpp) add_windows_resources(bitcoin bitcoin-res.rc) add_windows_application_manifest(bitcoin) - target_link_libraries(bitcoin core_interface bitcoin_util) - install_binary_component(bitcoin) + target_link_libraries(bitcoin core_interface bitcoin_common bitcoin_util) + install_binary_component(bitcoin HAS_MANPAGE) endif() # Bitcoin Core bitcoind. @@ -407,27 +407,26 @@ if(BUILD_KERNEL_LIB) if (BUILD_KERNEL_TEST) add_subdirectory(test/kernel) endif() -endif() - -if(BUILD_UTIL_CHAINSTATE) - add_executable(bitcoin-chainstate - bitcoin-chainstate.cpp - ) - # TODO: The `SKIP_BUILD_RPATH` property setting can be deleted - # in the future after reordering Guix script commands to - # perform binary checks after the installation step. - # Relevant discussions: - # - https://github.com/hebasto/bitcoin/pull/236#issuecomment-2183120953 - # - https://github.com/bitcoin/bitcoin/pull/30312#issuecomment-2191235833 - set_target_properties(bitcoin-chainstate PROPERTIES - SKIP_BUILD_RPATH OFF - ) - target_link_libraries(bitcoin-chainstate - PRIVATE - core_interface - bitcoinkernel - ) - install_binary_component(bitcoin-chainstate INTERNAL) + if(BUILD_UTIL_CHAINSTATE) + add_executable(bitcoin-chainstate + bitcoin-chainstate.cpp + ) + # TODO: The `SKIP_BUILD_RPATH` property setting can be deleted + # in the future after reordering Guix script commands to + # perform binary checks after the installation step. + # Relevant discussions: + # - https://github.com/hebasto/bitcoin/pull/236#issuecomment-2183120953 + # - https://github.com/bitcoin/bitcoin/pull/30312#issuecomment-2191235833 + set_target_properties(bitcoin-chainstate PROPERTIES + SKIP_BUILD_RPATH OFF + ) + target_link_libraries(bitcoin-chainstate + PRIVATE + core_interface + bitcoinkernel + ) + install_binary_component(bitcoin-chainstate INTERNAL) + endif() endif() diff --git a/src/bench/verify_script.cpp b/src/bench/verify_script.cpp index 8d7e92a..062f9a0 100644 --- a/src/bench/verify_script.cpp +++ b/src/bench/verify_script.cpp @@ -24,7 +24,7 @@ static void VerifyScriptBench(benchmark::Bench& bench) { ECC_Context ecc_context{}; - const uint32_t flags{SCRIPT_VERIFY_WITNESS | SCRIPT_VERIFY_P2SH}; + const script_verify_flags flags{SCRIPT_VERIFY_WITNESS | SCRIPT_VERIFY_P2SH}; const int witnessversion = 0; // Key pair. diff --git a/src/bitcoin-chainstate.cpp b/src/bitcoin-chainstate.cpp index 24127d0..4a4bd87 100644 --- a/src/bitcoin-chainstate.cpp +++ b/src/bitcoin-chainstate.cpp @@ -72,7 +72,7 @@ class TestValidationInterface : public ValidationInterface // IWYU pragma: keep #include +#include #include #include #include @@ -47,7 +48,7 @@ Run '%s help' to see additional commands (e.g. for testing and debugging). )"; struct CommandLine { - bool use_multiprocess{false}; + std::optional use_multiprocess; bool show_version{false}; bool show_help{false}; std::string_view command; @@ -55,6 +56,7 @@ struct CommandLine { }; CommandLine ParseCommandLine(int argc, char* argv[]); +bool UseMultiprocess(const CommandLine& cmd); static void ExecCommand(const std::vector& args, std::string_view argv0); int main(int argc, char* argv[]) @@ -78,9 +80,9 @@ int main(int argc, char* argv[]) return EXIT_FAILURE; } } else if (cmd.command == "gui") { - args.emplace_back(cmd.use_multiprocess ? "bitcoin-gui" : "bitcoin-qt"); + args.emplace_back(UseMultiprocess(cmd) ? "bitcoin-gui" : "bitcoin-qt"); } else if (cmd.command == "node") { - args.emplace_back(cmd.use_multiprocess ? "bitcoin-node" : "bitcoind"); + args.emplace_back(UseMultiprocess(cmd) ? "bitcoin-node" : "bitcoind"); } else if (cmd.command == "rpc") { args.emplace_back("bitcoin-cli"); // Since "bitcoin rpc" is a new interface that doesn't need to be @@ -143,6 +145,30 @@ CommandLine ParseCommandLine(int argc, char* argv[]) return cmd; } +bool UseMultiprocess(const CommandLine& cmd) +{ + // If -m or -M options were explicitly specified, there is no need to + // further parse arguments to determine which to use. + if (cmd.use_multiprocess) return *cmd.use_multiprocess; + + ArgsManager args; + args.SetDefaultFlags(ArgsManager::ALLOW_ANY); + std::string error_message; + auto argv{cmd.args}; + argv.insert(argv.begin(), nullptr); + if (!args.ParseParameters(argv.size(), argv.data(), error_message)) { + tfm::format(std::cerr, "Warning: failed to parse subcommand command line options: %s\n", error_message); + } + if (!args.ReadConfigFiles(error_message, true)) { + tfm::format(std::cerr, "Warning: failed to parse subcommand config: %s\n", error_message); + } + args.SelectConfigNetwork(args.GetChainTypeString()); + + // If any -ipc* options are set these need to be processed by a + // multiprocess-capable binary. + return args.IsArgSet("-ipcbind") || args.IsArgSet("-ipcconnect") || args.IsArgSet("-ipcfd"); +} + //! Execute the specified bitcoind, bitcoin-qt or other command line in `args` //! using src, bin and libexec directory paths relative to this executable, where //! the path to this executable is specified in `wrapper_argv0`. diff --git a/src/bitcoind.cpp b/src/bitcoind.cpp index ceb3c99..a4373da 100644 --- a/src/bitcoind.cpp +++ b/src/bitcoind.cpp @@ -132,11 +132,16 @@ static bool ParseArgs(NodeContext& node, int argc, char* argv[]) return true; } -static bool ProcessInitCommands(ArgsManager& args) +static bool ProcessInitCommands(interfaces::Init& init, ArgsManager& args) { // Process help and version before taking care about datadir if (HelpRequested(args) || args.GetBoolArg("-version", false)) { - std::string strUsage = CLIENT_NAME " daemon version " + FormatFullVersion() + "\n"; + std::string strUsage = CLIENT_NAME " daemon version " + FormatFullVersion(); + if (const char* exe_name{init.exeName()}) { + strUsage += " "; + strUsage += exe_name; + } + strUsage += "\n"; if (args.GetBoolArg("-version", false)) { strUsage += FormatParagraph(LicenseInfo()); @@ -277,7 +282,7 @@ MAIN_FUNCTION ArgsManager& args = *Assert(node.args); if (!ParseArgs(node, argc, argv)) return EXIT_FAILURE; // Process early info return commands such as -help or -version - if (ProcessInitCommands(args)) return EXIT_SUCCESS; + if (ProcessInitCommands(*init, args)) return EXIT_SUCCESS; // Start application if (!AppInit(node) || !Assert(node.shutdown_signal)->wait()) { diff --git a/src/chain.cpp b/src/chain.cpp index 4e2d1bf..3dd2263 100644 --- a/src/chain.cpp +++ b/src/chain.cpp @@ -5,6 +5,7 @@ #include #include +#include #include std::string CBlockFileInfo::ToString() const @@ -158,18 +159,26 @@ int64_t GetBlockProofEquivalentTime(const CBlockIndex& to, const CBlockIndex& fr /** Find the last common ancestor two blocks have. * Both pa and pb must be non-nullptr. */ const CBlockIndex* LastCommonAncestor(const CBlockIndex* pa, const CBlockIndex* pb) { + // First rewind to the last common height (the forking point cannot be past one of the two). if (pa->nHeight > pb->nHeight) { pa = pa->GetAncestor(pb->nHeight); } else if (pb->nHeight > pa->nHeight) { pb = pb->GetAncestor(pa->nHeight); } - - while (pa != pb && pa && pb) { + while (pa != pb) { + // Jump back until pa and pb have a common "skip" ancestor. + while (pa->pskip != pb->pskip) { + // This logic relies on the property that equal-height blocks have equal-height skip + // pointers. + Assume(pa->nHeight == pb->nHeight); + Assume(pa->pskip->nHeight == pb->pskip->nHeight); + pa = pa->pskip; + pb = pb->pskip; + } + // At this point, pa and pb are different, but have equal pskip. The forking point lies in + // between pa/pb on the one end, and pa->pskip/pb->pskip on the other end. pa = pa->pprev; pb = pb->pprev; } - - // Eventually all chain branches meet at the genesis block. - assert(pa == pb); return pa; } diff --git a/src/common/args.cpp b/src/common/args.cpp index ff30ec5..d44cd43 100644 --- a/src/common/args.cpp +++ b/src/common/args.cpp @@ -266,7 +266,13 @@ std::optional ArgsManager::GetArgFlags(const std::string& name) co return search->second.m_flags; } } - return std::nullopt; + return m_default_flags; +} + +void ArgsManager::SetDefaultFlags(std::optional flags) +{ + LOCK(cs_args); + m_default_flags = flags; } fs::path ArgsManager::GetPathArg(std::string arg, const fs::path& default_value) const diff --git a/src/common/args.h b/src/common/args.h index da19cbd..d907ad7 100644 --- a/src/common/args.h +++ b/src/common/args.h @@ -137,6 +137,7 @@ class ArgsManager std::string m_network GUARDED_BY(cs_args); std::set m_network_only_args GUARDED_BY(cs_args); std::map> m_available_args GUARDED_BY(cs_args); + std::optional m_default_flags GUARDED_BY(cs_args){}; bool m_accept_any_command GUARDED_BY(cs_args){true}; std::list m_config_sections GUARDED_BY(cs_args); std::optional m_config_path GUARDED_BY(cs_args); @@ -375,10 +376,15 @@ class ArgsManager /** * Return Flags for known arg. - * Return nullopt for unknown arg. + * Return default flags for unknown arg. */ std::optional GetArgFlags(const std::string& name) const; + /** + * Set default flags to return for an unknown arg. + */ + void SetDefaultFlags(std::optional); + /** * Get settings file path, or return false if read-write settings were * disabled with -nosettings. diff --git a/src/common/system.cpp b/src/common/system.cpp index 7af792d..35a6f44 100644 --- a/src/common/system.cpp +++ b/src/common/system.cpp @@ -11,19 +11,25 @@ #include #include -#ifndef WIN32 -#include -#else -#include +#ifdef WIN32 #include +#include +#include +#else +#include +#include #endif #ifdef HAVE_MALLOPT_ARENA_MAX #include #endif +#include +#include +#include #include #include +#include #include #include #include @@ -105,6 +111,22 @@ int GetNumCores() return std::thread::hardware_concurrency(); } +std::optional GetTotalRAM() +{ + [[maybe_unused]] auto clamp{[](uint64_t v) { return size_t(std::min(v, uint64_t{std::numeric_limits::max()})); }}; +#ifdef WIN32 + if (MEMORYSTATUSEX m{}; (m.dwLength = sizeof(m), GlobalMemoryStatusEx(&m))) return clamp(m.ullTotalPhys); +#elif defined(__APPLE__) || \ + defined(__FreeBSD__) || \ + defined(__NetBSD__) || \ + defined(__OpenBSD__) || \ + defined(__illumos__) || \ + defined(__linux__) + if (long p{sysconf(_SC_PHYS_PAGES)}, s{sysconf(_SC_PAGESIZE)}; p > 0 && s > 0) return clamp(1ULL * p * s); +#endif + return std::nullopt; +} + // Obtain the application startup time (used for uptime calculation) int64_t GetStartupTime() { diff --git a/src/common/system.h b/src/common/system.h index a4b56be..2184f1d 100644 --- a/src/common/system.h +++ b/src/common/system.h @@ -9,6 +9,7 @@ #include // IWYU pragma: keep #include +#include #include // Application startup time (used for uptime calculation) @@ -29,4 +30,9 @@ void runCommand(const std::string& strCommand); */ int GetNumCores(); +/** + * Return the total RAM available on the current system, if detectable. + */ +std::optional GetTotalRAM(); + #endif // BITCOIN_COMMON_SYSTEM_H diff --git a/src/compat/compat.h b/src/compat/compat.h index 05210b7..acb57b2 100644 --- a/src/compat/compat.h +++ b/src/compat/compat.h @@ -75,14 +75,6 @@ typedef unsigned int SOCKET; typedef SSIZE_T ssize_t; #endif -// The type of the option value passed to getsockopt & setsockopt -// differs between Windows and non-Windows. -#ifndef WIN32 -typedef void* sockopt_arg_type; -#else -typedef char* sockopt_arg_type; -#endif - #ifdef WIN32 // Export main() and ensure working ASLR when using mingw-w64. // Exporting a symbol will prevent the linker from stripping diff --git a/src/consensus/params.h b/src/consensus/params.h index 6344349..f33ff15 100644 --- a/src/consensus/params.h +++ b/src/consensus/params.h @@ -6,6 +6,7 @@ #ifndef BITCOIN_CONSENSUS_PARAMS_H #define BITCOIN_CONSENSUS_PARAMS_H +#include