0
0
Fork 0
mirror of https://github.com/bitcoin/bitcoin.git synced 2025-02-11 11:16:09 -05:00
Commit graph

42518 commits

Author SHA1 Message Date
fanquake
be4f78275f
contrib: test for FORTIFY_SOURCE in security-check.py 2024-09-09 12:35:13 +01:00
merge-script
94bc3c4cc0
Merge bitcoin/bitcoin#30824: cmake: decouple FORTIFY_SOURCE check from Debug build type
30803a35d5 cmake: decouple FORTIFY_SOURCE check from Debug build type (fanquake)

Pull request description:

  `FORTIFY_SOURCE` should be used if `ENABLE_HARDENING=ON` and optimisations are being used. This should not be coupled to any particular build type, because even if the build type is `Debug`, optimisations might still be in use.

  Fixes: #30800.
  Also somewhat of a followup to https://github.com/bitcoin/bitcoin/pull/30778#discussion_r1742257436.

ACKs for top commit:
  ryanofsky:
    Code review ACK 30803a35d5
  TheCharlatan:
    ACK 30803a35d5

Tree-SHA512: 298f8805a5bb2f1ff54e51ea31324d712c2070cc3eba26561c31001ace4bfa37ae6d18531cbd45e2faf610a0a1b83b420fcde6e329e17f02b021d26563583913
2024-09-09 12:33:57 +01:00
merge-script
ba84c2774d
Merge bitcoin/bitcoin#30823: cmake: add USE_SOURCE_PERMISSIONS to all configure_file() usage
1f054eca4e cmake: add USE_SOURCE_PERMISSIONS to all configure_file usage (fanquake)

Pull request description:

  `USE_SOURCE_PERMISSIONS` is the default, so this should not change behaviour. However, being explicit makes it clear what we are doing.

  Related to #30815.

  See https://cmake.org/cmake/help/latest/command/configure_file.html#options.

ACKs for top commit:
  hebasto:
    ACK 1f054eca4e.
  TheCharlatan:
    ACK 1f054eca4e

Tree-SHA512: efed91b8aa0813100304ee58e169bbf5cfbb7db465ec4f7e6cbbae6053f09a36757bf96b4d1cb9ddf4c1cab0ceb3ab18805ebefa122535518ffb501c9b489d3d
2024-09-09 10:39:36 +01:00
merge-script
da3f4cb8ee
Merge bitcoin/bitcoin#30850: doc: fix minor typo
7a669fde18 docs: Fix minor typo (Gutflo)

Pull request description:

  Fix typo in doc/build-windows-msvc.md:
  - "Micsrosoft" -> Microsoft

  No test required.

ACKs for top commit:
  l0rinc:
    ACK 7a669fde18

Tree-SHA512: fd3815ebf449885e8a27d4f21e61a4482a7983ccfe40b13a4d658a304845775acd2f4f8acec2e85c24b6179223bb21baaecf1dd0a4d2921427686148ac1ed208
2024-09-09 10:34:21 +01:00
Gutflo
7a669fde18
docs: Fix minor typo 2024-09-08 20:25:53 +02:00
Hennadii Stepanov
1cc93fe7b4
build: Delete dead code that implements IF_CHECK_FAILED option 2024-09-08 16:34:04 +01:00
ion-
0b003e1ff7 docs: Updated debug build instructions for cmake 2024-09-08 18:29:01 +03:00
Hennadii Stepanov
341ad23809
build: Delete MSVC special case for BUILD_FOR_FUZZING option 2024-09-08 11:03:32 +01:00
Hennadii Stepanov
5c80192ff6
test: Drop no longer needed workarounds
`ctest` skips "no test cases matching filter" tests gracefully.
2024-09-08 09:05:39 +01:00
Hennadii Stepanov
ff54395de4
Update secp256k1 subtree to latest master 2024-09-07 18:15:41 +01:00
Hennadii Stepanov
611562806c Squashed 'src/secp256k1/' changes from 642c885b61..2f2ccc4695
2f2ccc4695 Merge bitcoin-core/secp256k1#1600: cmake: Introduce `SECP256K1_APPEND_LDFLAGS` variable
421ed1b46f cmake: Introduce `SECP256K1_APPEND_LDFLAGS` variable
1988855079 Merge bitcoin-core/secp256k1#1586: fix: remove duplicate 'the' from header file comment
b307614401 Merge bitcoin-core/secp256k1#1583: ci: Bump GCC_SNAPSHOT_MAJOR to 15
fa67b6752d refactor: Use array initialization for unterminated strings
9b0f37bff1 fix: remove duplicate 'the' from header file comment
e34b476730 ci: Bump GCC_SNAPSHOT_MAJOR to 15
3fdf146bad Merge bitcoin-core/secp256k1#1578: ci: Silent Homebrew's noisy reinstall warnings
f8c1b0e0e6 Merge bitcoin-core/secp256k1#1577: release cleanup: bump version after 0.5.1
7057d3c9af ci: Silent Homebrew's noisy reinstall warnings
c3e40d75db release cleanup: bump version after 0.5.1

git-subtree-dir: src/secp256k1
git-subtree-split: 2f2ccc469540fde6495959cec061e95aab033148
2024-09-07 18:12:35 +01:00
Hennadii Stepanov
b07fe666f2
build: Minimize I/O operations in GenerateHeaderFrom{Json,Raw}.cmake 2024-09-07 15:37:53 +01:00
Hennadii Stepanov
c45186ca54
ci: Switch from make to cmake --build 2024-09-07 14:38:16 +01:00
Hennadii Stepanov
6e5f33af58
ci: Handle log files regardless of CMake's version 2024-09-07 14:38:14 +01:00
Hennadii Stepanov
fdad128b52
build: Stop enabling CMake's CMP0141 policy
The `CMAKE_MSVC_DEBUG_INFORMATION_FORMAT` variable has not been used
since the merge of https://github.com/hebasto/bitcoin/pull/215 in the
CMake staging branch.
2024-09-06 22:07:31 +01:00
Hennadii Stepanov
b2a6f545b4
doc: Drop ctest command from Windows cross-compiling instructions
The ctest command was added hastily without considering the requirement
of Wine, which is generally not trivial to install.
2024-09-06 21:59:52 +01:00
Hennadii Stepanov
73b618582d
build: Print CMAKE_CXX_COMPILER_ARG1 in summary
When `-DCMAKE_CXX_COMPILER='clang++;-stdlib=libc++;-m32'` is provided,
`-stdlib=libc++ -m32` flags are printed in the summary now.
2024-09-06 21:59:52 +01:00
Hennadii Stepanov
f03c942095
build, test: Add missed log options 2024-09-06 21:59:51 +01:00
Hennadii Stepanov
6f2cb0eafd
doc: Amend comment about ZeroMQ config files 2024-09-06 21:59:46 +01:00
TheCharlatan
0dd16d7118
build: Add a pkg-config file for libbitcoinkernel 2024-09-06 21:35:07 +02:00
TheCharlatan
45be32f838
build: Produce a usable static kernel library
Since the move to cmake, the kernel static library that is installed
after a cmake --install build is unusable. It lacks symbols for the
internal libraries, besides those defined in the kernel library target.

This is because cmake, unlike the libtool archiver, does not combine
multiple static libraries into a single static library on installation.
This is likely an intentional design choice, since there were a bunch of
caveats to the way libtool calculated these libraries.

Fix this problem by installing all the required libraries. The user must
then link all of them along with the bitcoin kernel library.
2024-09-06 21:19:27 +02:00
stickies-v
43cd83b0c7
test: move uint256_tests/operator_with_self to arith_uint256_tests
move/formatting-only change.

These tests do not cover uint256, so move them to the appropriate
test suite. Additionally, apply clang-format suggestions.
2024-09-06 17:36:28 +02:00
stickies-v
c6c994cb2b
test: remove test-only uint160S
uint160S is a test-only function, and testing input that
is not allowed in uint160::FromHex() is superfluous.

Tests that can't use uint160::FromHex() because they use input
with non-hex digit characters are
a) modified by dropping the non-hex digit characters if that
provides useful test coverage.
b) dropped if the test without non-hex digit characters does
not provide useful test coverage, e.g. because it is now
duplicated.
2024-09-06 17:36:27 +02:00
stickies-v
62cc4656e2
test: remove test-only uint256S
uint256S was previously deprecated for being unsafe. All non-test
usage has already been removed in earlier commits.

1. Tests now use uint256::FromHex() or other constructors wherever
possible without further modification.
2. Tests that can't use uint256::FromHex() because they use input
with non-hex digit characters are
  a) modified by dropping the non-hex digit characters if that
     provides useful test coverage.
  b) dropped if the test without non-hex digit characters does
     not provide useful test coverage, e.g. because it is now
     duplicated.

Additionally, use BOOST_CHECK_EQUAL where relevant on touched lines
to make error messages more readable.
2024-09-06 17:36:18 +02:00
stickies-v
adc00ad728
test: remove test-only arith_uint256S
Tests that are solely testing constructing from a hex string
are dropped, others are modified to use a uint256 constructor
or the arith_uint256 uint64_t constructor.

Since an arith_uint256 can not be constructed from a string
directly, we need to ensure that test coverage on
UintToArith256(uint256::FromHex()) is not reduced.
uint256::FromHex() already has good test coverage, but
the test coverage on UintToArith256() and ArithToUint256()
is increased in this commit by upgrading the `conversion`
test case.

Moreover, since `uint256.h` does not have any dependencies
on `arith_uint256.h`, the conversion tests are moved to
`arith_uint256_tests.cpp` so the dependency can be cleaned
up entirely in a future commit.
2024-09-06 17:36:18 +02:00
merge-script
a5fa90706a
Merge bitcoin/bitcoin#30834: test: Work around boost compilation error
fa9d7d5d20 test: Work around boost compilation error (MarcoFalke)
fa3ecdf778 Revert "build: work around issue with Boost <= 1.80 and Clang >= 18" (MarcoFalke)

Pull request description:

  There seems to be an issue compiling the `chainstatemanager_rebalance_caches` test case with some specific versions of Boost in combination with some specific versions of Clang. For example, Boost 1.74 may fail in combination with Clang 18. [1]

  The error stems from a mixed-type closeness comparison. Given that the comparison is using floating point, and isn't meant to be exact, work around the compile error by ensuring both sides of the comparison are using the same type (`double`).

  This also allows to drop a previous workaround.

  [1] Error:

  ```
  In file included from /usr/include/boost/mpl/integral_c.hpp:32:
  /usr/include/boost/mpl/aux_/integral_wrapper.hpp:73:31: error: integer value -1 is outside the valid range of values [0, 3] for the enumeration type 'udt_builtin_mixture_enum' [-Wenum-constexpr-conversion]
     73 |     typedef AUX_WRAPPER_INST( BOOST_MPL_AUX_STATIC_CAST(AUX_WRAPPER_VALUE_TYPE, (value - 1)) ) prior;
        |                               ^
  /usr/include/boost/mpl/aux_/static_cast.hpp:24:47: note: expanded from macro 'BOOST_MPL_AUX_STATIC_CAST'
     24 | #   define BOOST_MPL_AUX_STATIC_CAST(T, expr) static_cast<T>(expr)
        |                                               ^
  In file included from ../../../src/test/validation_chainstatemanager_tests.cpp:8:
  In file included from ../../../src/node/chainstatemanager_args.h:9:
  In file included from ../../../src/validation.h:28:
  In file included from ../../../src/txmempool.h:26:
  In file included from /usr/include/boost/multi_index/hashed_index.hpp:38:
  In file included from /usr/include/boost/multi_index/detail/node_handle.hpp:22:
  In file included from /usr/include/boost/multi_index_container_fwd.hpp:18:
  In file included from /usr/include/boost/multi_index/indexed_by.hpp:17:
  In file included from /usr/include/boost/mpl/vector.hpp:36:
  In file included from /usr/include/boost/mpl/vector/vector20.hpp:18:
  In file included from /usr/include/boost/mpl/vector/vector10.hpp:18:
  In file included from /usr/include/boost/mpl/vector/vector0.hpp:24:
  In file included from /usr/include/boost/mpl/vector/aux_/clear.hpp:18:
  In file included from /usr/include/boost/mpl/vector/aux_/vector0.hpp:22:
  In file included from /usr/include/boost/mpl/vector/aux_/iterator.hpp:19:
  In file included from /usr/include/boost/mpl/plus.hpp:19:
  In file included from /usr/include/boost/mpl/aux_/arithmetic_op.hpp:17:
  In file included from /usr/include/boost/mpl/integral_c.hpp:32:
  /usr/include/boost/mpl/aux_/integral_wrapper.hpp:73:31: error: integer value -1 is outside the valid range of values [0, 3] for the enumeration type 'int_float_mixture_enum' [-Wenum-constexpr-conversion]
  /usr/include/boost/mpl/aux_/static_cast.hpp:24:47: note: expanded from macro 'BOOST_MPL_AUX_STATIC_CAST'
     24 | #   define BOOST_MPL_AUX_STATIC_CAST(T, expr) static_cast<T>(expr)
        |                                               ^
  2 errors generated.

ACKs for top commit:
  hebasto:
    ACK fa9d7d5d20.
  fanquake:
    ACK fa9d7d5d20

Tree-SHA512: 4964b23162f2351c7d3cf7e9efa7860d62f3b6717c3cc5be967d286f1ddb3539c2637247c79aa83123d36ff111ba77df22be2a25487ddd94dc1321d5e751dc70
2024-09-06 16:15:37 +01:00
Hennadii Stepanov
7b04fabe2d
build: Introduce "Kernel" installation component
This change enables building and installing only `libbitcoinkernel`,
without the need to disable other targets during the project build
system generation.
2024-09-06 15:58:55 +01:00
MarcoFalke
fa9d7d5d20
test: Work around boost compilation error 2024-09-06 15:57:33 +02:00
MarcoFalke
fa3ecdf778
Revert "build: work around issue with Boost <= 1.80 and Clang >= 18"
This reverts commit cd062d6684.
2024-09-06 15:57:00 +02:00
Russell Yanofsky
30073e6b3a multiprocess: Add -ipcbind option to bitcoin-node
Add `-ipcbind` option to `bitcoin-node` to listen on an IPC socket and accept
connections from other processes. In the future, there will be an `-ipcconnect`
option added to `bitcoin-wallet` and `bitcoin-node` to allow wallet and gui
processes to connect to the node and access it.

Example usage:

    src/bitcoin-node -regtest -debug -ipcbind=unix
    src/bitcoin-wallet -regtest -ipcconnect=unix info
    src/bitcoin-gui -regtest -ipcconnect=unix
    src/bitcoin-mine -regtest -ipcconnect=unix
2024-09-06 09:08:10 -04:00
merge-script
bbf95c0cc5
Merge bitcoin/bitcoin#30755: ci: Add missed configuration options to "Win64 native" job
ee22bf55e3 doc: Update and amend MSVC build guide (Hennadii Stepanov)
c07fdd6546 fuzz: Don't compile BDB-specific code on MSVC in `wallet_bdb_parser.cpp` (Hennadii Stepanov)
e07a3ede52 ci: Add missed configuration options to "Win64 native" job (Hennadii Stepanov)

Pull request description:

  Some build options were overlooked when the CMake staging branch dropped package autodetection.

  This PR restores them. Similar to https://github.com/bitcoin/bitcoin/pull/30740.

ACKs for top commit:
  maflcko:
    review-only ACK ee22bf55e3
  fanquake:
    ACK ee22bf55e3

Tree-SHA512: dbbfdf4347fbcda6ee24f7bd6041c383cfd9853fa717cfe0fbf2474cdd28435eba96da51c01684967c007b5346532c14fd923fcc3428efd607690a42175e39ad
2024-09-06 14:08:10 +01:00
Ryan Ofsky
73fe7d7230 multiprocess: Add unit tests for connect, serve, and listen functions 2024-09-06 09:08:10 -04:00
Russell Yanofsky
955d4077aa multiprocess: Add IPC connectAddress and listenAddress methods
Allow listening on and connecting to unix sockets.
2024-09-06 09:08:10 -04:00
Ryan Ofsky
4da20434d4 depends: Update libmultiprocess library for CustomMessage function and ThreadContext bugfix
The CustomMessage functions allow simplifying custom IPC type code, and the
bugfix is needed to prevent in a crash in a new test which creates and destroys
connections in a loop. Upstream PRs are:

https://github.com/chaincodelabs/libmultiprocess/pull/105 types: Add Custom{Build,Read,Pass}Message hooks
https://github.com/chaincodelabs/libmultiprocess/pull/106 Bugfix: Clean up ThreadContext pointers when Connection is destroyed
2024-09-06 09:08:10 -04:00
Hennadii Stepanov
ee22bf55e3
doc: Update and amend MSVC build guide 2024-09-06 12:19:27 +01:00
Hennadii Stepanov
c07fdd6546
fuzz: Don't compile BDB-specific code on MSVC in wallet_bdb_parser.cpp 2024-09-06 12:19:27 +01:00
Hennadii Stepanov
e07a3ede52
ci: Add missed configuration options to "Win64 native" job 2024-09-06 12:19:26 +01:00
fanquake
1f054eca4e
cmake: add USE_SOURCE_PERMISSIONS to all configure_file usage
`USE_SOURCE_PERMISSIONS` is the default, so this should not change
behaviour. However, being explicit makes it clear what we are doing.

Related to #30815.

See
https://cmake.org/cmake/help/latest/command/configure_file.html#options.
2024-09-06 10:52:19 +01:00
merge-script
0e5cd608da
Merge bitcoin/bitcoin#30415: contrib: fix check-deps.sh to check for weak symbols
3ae35b427f ci: run check-deps.sh as part of clang-tidy job (Ryan Ofsky)
0aaa1298a0 contrib: fix check-deps.sh when libraries do not import symbols (Ryan Ofsky)
3c99f5a38a contrib: fix check-deps.sh to check for weak symbols (Ryan Ofsky)
86c80e9cf2 contrib: make check-deps.sh script work with cmake (Ryan Ofsky)

Pull request description:

  Fix check-deps.sh to check for weak symbols so it can detect when an exported template function like is used from another library.

  Also update the script to work with cmake and configure it to run as part of CI.

  Problem was reported by hebasto in https://github.com/bitcoin/bitcoin/pull/29015#issuecomment-2209258843

ACKs for top commit:
  TheCharlatan:
    Re-ACK 3ae35b427f
  hebasto:
    ACK 3ae35b427f, I have reviewed the code and it looks OK. Also I've tested it locally.

Tree-SHA512: c3b58175450b675e6e848549b81bcfe42930ea9bcd693063867ce3f0ac3999c98cd2c3e961f163ff06641e8288f3a4e81530936a296a83d45d33364f27489521
2024-09-06 10:51:34 +01:00
merge-script
118b55c462
Merge bitcoin/bitcoin#30790: bench: Remove redundant logging benchmarks
fadbcd51fc bench: Remove redundant logging benchmarks (MarcoFalke)
fa8dd952e2 bench: Use LogInfo instead of the deprecated alias LogPrintf (MarcoFalke)

Pull request description:

  `LogPrint*ThreadNames` is redundant with `LogWith(out)ThreadNames`,
  because they all measure toggling the thread names (and check that it
  has no effect on performance).

  Fix it by removing the redundant ones. This also allows to drop a deprecated logging alias.

ACKs for top commit:
  stickies-v:
    ACK fadbcd51fc

Tree-SHA512: 4fe137f374aa4ee1aa0e1da4a1f9839c0e52c23dbb93198ecafee98de39d311cc47304bba4191f3807aa00c51b1eae543e3f270f03d341c84910e5e341a1d475
2024-09-06 09:50:19 +01:00
merge-script
c0cbe26a86
Merge bitcoin/bitcoin#30748: test: Pin and document TEST_DIR_PATH_ELEMENT, SeedRand::FIXED_SEED
fa84f9decd test: Pin and document TEST_DIR_PATH_ELEMENT (MarcoFalke)
2222f7a874 test: Rename SeedRand::SEED to FIXED_SEED for clarity (MarcoFalke)

Pull request description:

  Two small test changes:

  * A refactor to update the name and documentation around `SeedRand::FIXED_SEED`.
  * A change to extract and document `TEST_DIR_PATH_ELEMENT`, and to change its value to better match the `TMPDIR_PREFIX` in functional tests. The value previously included `PACKAGE_NAME`, which is cute, but doesn't explain why it was used (to include a space). So just use `test_common bitcoin` to achieve the same with less effort.

ACKs for top commit:
  hodlinator:
    ACK fa84f9decd
  ryanofsky:
    Code review ACK fa84f9decd

Tree-SHA512: eb35d6598bb08f9b996e3a4762d8f26b2441c0ca00780798e473015af735dfc9997120895a922b94d4b6ada45adadba4a686e9cf9c285ddf688848e764c64840
2024-09-06 09:42:02 +01:00
merge-script
c3af4b1ec3
Merge bitcoin/bitcoin#30822: cmake: scope Boost Test check to vcpkg
a7a4e11db8 cmake: scope Boost Test check to vcpkg (fanquake)

Pull request description:

  This check was added for `vcpkg`, given how it packages Boost. However, we don't need to run the check for other platforms, and it's quite slow. So, scope it to just `vcpkg`.

  On my machine, this reduces the time to run `time cmake -B build` from ~12 seconds, to ~6 seconds.

  Fixes: #30787.

ACKs for top commit:
  kevkevinpal:
    lgtm ACK [a7a4e11](a7a4e11db8)
  maflcko:
    review ACK a7a4e11db8
  davidgumberg:
    Tested ACK a7a4e11db8
  hebasto:
    re-ACK a7a4e11db8.

Tree-SHA512: 67cf3908a5381e21aeaa168a6f76b6e066d64a8ad2127d5ae9fe71a0f04bccf58a400726d9d4e228b3bdb6fca799034fd05a38388278fea30a1a841f6adac017
2024-09-06 09:34:46 +01:00
Ava Chow
7f472e9bcd
Merge bitcoin/bitcoin#30821: build: work around issue with Boost <= 1.80 and Clang >= 18
cd062d6684 build: work around issue with Boost <= 1.80 and Clang >= 18 (fanquake)

Pull request description:

  Our current minimum supported Boost is `1.73.0`. However, when compiling with Boost `1.74.0` (Debian Stable), using Clang `18`, compilation fails with:
  ```bash
  In file included from /usr/include/boost/mpl/integral_c.hpp:32:
  /usr/include/boost/mpl/aux_/integral_wrapper.hpp:73:31: error: integer value -1 is outside the valid range of values [0, 3] for the enumeration type 'udt_builtin_mixture_enum' [-Wenum-constexpr-conversion]
     73 |     typedef AUX_WRAPPER_INST( BOOST_MPL_AUX_STATIC_CAST(AUX_WRAPPER_VALUE_TYPE, (value - 1)) ) prior;
        |                               ^
  /usr/include/boost/mpl/aux_/static_cast.hpp:24:47: note: expanded from macro 'BOOST_MPL_AUX_STATIC_CAST'
     24 | #   define BOOST_MPL_AUX_STATIC_CAST(T, expr) static_cast<T>(expr)
        |                                               ^
  In file included from ../../../src/test/validation_chainstatemanager_tests.cpp:8:
  In file included from ../../../src/node/chainstatemanager_args.h:9:
  In file included from ../../../src/validation.h:28:
  In file included from ../../../src/txmempool.h:26:
  In file included from /usr/include/boost/multi_index/hashed_index.hpp:38:
  In file included from /usr/include/boost/multi_index/detail/node_handle.hpp:22:
  In file included from /usr/include/boost/multi_index_container_fwd.hpp:18:
  In file included from /usr/include/boost/multi_index/indexed_by.hpp:17:
  In file included from /usr/include/boost/mpl/vector.hpp:36:
  In file included from /usr/include/boost/mpl/vector/vector20.hpp:18:
  In file included from /usr/include/boost/mpl/vector/vector10.hpp:18:
  In file included from /usr/include/boost/mpl/vector/vector0.hpp:24:
  In file included from /usr/include/boost/mpl/vector/aux_/clear.hpp:18:
  In file included from /usr/include/boost/mpl/vector/aux_/vector0.hpp:22:
  In file included from /usr/include/boost/mpl/vector/aux_/iterator.hpp:19:
  In file included from /usr/include/boost/mpl/plus.hpp:19:
  In file included from /usr/include/boost/mpl/aux_/arithmetic_op.hpp:17:
  In file included from /usr/include/boost/mpl/integral_c.hpp:32:
  /usr/include/boost/mpl/aux_/integral_wrapper.hpp:73:31: error: integer value -1 is outside the valid range of values [0, 3] for the enumeration type 'int_float_mixture_enum' [-Wenum-constexpr-conversion]
  /usr/include/boost/mpl/aux_/static_cast.hpp:24:47: note: expanded from macro 'BOOST_MPL_AUX_STATIC_CAST'
     24 | #   define BOOST_MPL_AUX_STATIC_CAST(T, expr) static_cast<T>(expr)
        |                                               ^
  2 errors generated.
  ```

  Work around this issue by ignoring this diagnostic for this include. I did attempt to just downgrade the error into a warning, but that did not seem to work. Not a huge fan of inline warning/issue suppression, but this seems like the cleanest thing to do here (and easy to backport to `28.x`).

  Can be tested with something like:
  ```bash
  docker pull debian:bookworm
  docker run -it debian:bookworm /bin/bash

  apt update &&  apt install ccache cmake git pkg-config libboost-dev libevent-dev python3 libsqlite3-dev lsb-release wget software-properties-common gnupg
  git clone https://github.com/bitcoin/bitcoin

  wget https://apt.llvm.org/llvm.sh
  chmod +x llvm.sh
  ./llvm.sh 18

  cd bitcoin
  cmake -B build -DCMAKE_C_COMPILER=clang-18 -DCMAKE_CXX_COMPILER=clang++-18
  cmake --build build -j17
  <snip>
  In file included from /usr/include/boost/mpl/integral_c.hpp:32:
  /usr/include/boost/mpl/aux_/integral_wrapper.hpp:73:31: error: integer value -1 is outside the valid range of values [0, 3] for the enumeration type 'int_float_mixture_enum' [-Wenum-constexpr-conversion]
  /usr/include/boost/mpl/aux_/static_cast.hpp:24:47: note: expanded from macro 'BOOST_MPL_AUX_STATIC_CAST'
     24 | #   define BOOST_MPL_AUX_STATIC_CAST(T, expr) static_cast<T>(expr)
        |                                               ^
  2 errors generated.

  Apply the patch

  cmake --build build -j17
  ctest --test-dir build -j17
  ```

  Fixes #30751.

ACKs for top commit:
  achow101:
    ACK cd062d6684
  hebasto:
    ACK cd062d6684, tested on Fedora 40 using the downloaded [Boost 1.74](https://archives.boost.io/release/1.74.0/source/) and commands as follows:

Tree-SHA512: 13e5b3a544496ed2a6529ad45d03a2d872ebf41caaa06d0eec23a639d678ae1c55d73f2d4b164a4cc9e2c163264e736cd85eae90fde8089ca999cd810b16ecb5
2024-09-05 15:39:53 -04:00
Sergi Delgado Segura
d4c7c4009d init: error out if -maxconnections is negative 2024-09-05 11:43:46 -04:00
Sergi Delgado Segura
c773649481 init: improves file descriptors accounting and docs
The current logic for file descriptor accounting is pretty convoluted and hard
to follow. This is partially caused by the lack of documentation plus non-intuitive
variable naming (which was more intuitive when fewer things were accounted for, but
hasn't aged well). This has led to this accounting being error-prone and hard to maintain
(as shown in he previous commit).

Redefine some of the constants, plus document what are we accounting for so this can be
extended more easily

Remove FreeBSD workaround to #2695
2024-09-05 11:43:46 -04:00
Sergi Delgado Segura
29008a7ff4 init: fixes fd accounting regarding poll/select
We are computing our file descriptors limits based on whether we use
poll or select. However, we are taking that into account only partially
(subtracting from fd_max in one case, but from nFD later on). Moreover,
nBind is also only accounted for partially.

Simplify and fix this logic
2024-09-05 11:43:46 -04:00
fanquake
30803a35d5
cmake: decouple FORTIFY_SOURCE check from Debug build type
`FORTIFY_SOURCE` should be used if `ENABLE_HARDENING=ON` and optimisations
are being used. This should not be coupled to any particular build type,
because even if the build type is `Debug`, optimisations might still
be in use.

Fixes: #30800.
2024-09-05 16:34:17 +01:00
fanquake
a7a4e11db8
cmake: scope Boost Test check to vcpkg
This check was added for vcpkg, given how it packages Boost. However, we
don't need to run the check for other platforms, and it's quite slow.
So, scope it to VCPKG. On my machine, this reduces the time to run
`cmake -B build` from ~12 seconds, to ~6 seconds.

Fixes: #30787
2024-09-05 16:15:27 +01:00
merge-script
d661e2b1b7
Merge bitcoin/bitcoin#30812: lint: Check for release note snippets in the wrong folder
fa3a7ebe5b lint: Check for release note snippets in the wrong folder (MarcoFalke)

Pull request description:

  It is a common mistake to place the snippets in the wrong folder, where they could be missed. For example https://github.com/bitcoin/bitcoin/pull/30719#pullrequestreview-2262535007 or commit 84900ac34f.

  Fix all issues by adding a simple lint check.

  Can be tested by reverting a prior commit that violated the rule and then running the new check:

  ```
  git revert 35ef34eab7
  ( cd ./test/lint/test_runner/ && RUST_BACKTRACE=1 cargo run -- --lint=doc_release_note_snippets )

ACKs for top commit:
  l0rinc:
    ACK fa3a7ebe5b
  TheCharlatan:
    Re-ACK fa3a7ebe5b

Tree-SHA512: 65a13696178aa8f94daa12a767cc74861293c631c19da9ca23c0fd43cedd47e7928d0ef14ad9ad83a434c1ac0e006f5a632ba9679756e071dea65b3cbf927c2d
2024-09-05 14:53:48 +01:00
fanquake
cd062d6684
build: work around issue with Boost <= 1.80 and Clang >= 18
Our current minimum supported Boost is `1.73.0`. However, when compiling
with Boost `1.74.0` (Debian Stable), using Clang `18`, compilation fails
with:
```bash
In file included from /usr/include/boost/mpl/integral_c.hpp:32:
/usr/include/boost/mpl/aux_/integral_wrapper.hpp:73:31: error: integer value -1 is outside the valid range of values [0, 3] for the enumeration type 'udt_builtin_mixture_enum' [-Wenum-constexpr-conversion]
   73 |     typedef AUX_WRAPPER_INST( BOOST_MPL_AUX_STATIC_CAST(AUX_WRAPPER_VALUE_TYPE, (value - 1)) ) prior;
      |                               ^
/usr/include/boost/mpl/aux_/static_cast.hpp:24:47: note: expanded from macro 'BOOST_MPL_AUX_STATIC_CAST'
   24 | #   define BOOST_MPL_AUX_STATIC_CAST(T, expr) static_cast<T>(expr)
      |                                               ^
In file included from ../../../src/test/validation_chainstatemanager_tests.cpp:8:
In file included from ../../../src/node/chainstatemanager_args.h:9:
In file included from ../../../src/validation.h:28:
In file included from ../../../src/txmempool.h:26:
In file included from /usr/include/boost/multi_index/hashed_index.hpp:38:
In file included from /usr/include/boost/multi_index/detail/node_handle.hpp:22:
In file included from /usr/include/boost/multi_index_container_fwd.hpp:18:
In file included from /usr/include/boost/multi_index/indexed_by.hpp:17:
In file included from /usr/include/boost/mpl/vector.hpp:36:
In file included from /usr/include/boost/mpl/vector/vector20.hpp:18:
In file included from /usr/include/boost/mpl/vector/vector10.hpp:18:
In file included from /usr/include/boost/mpl/vector/vector0.hpp:24:
In file included from /usr/include/boost/mpl/vector/aux_/clear.hpp:18:
In file included from /usr/include/boost/mpl/vector/aux_/vector0.hpp:22:
In file included from /usr/include/boost/mpl/vector/aux_/iterator.hpp:19:
In file included from /usr/include/boost/mpl/plus.hpp:19:
In file included from /usr/include/boost/mpl/aux_/arithmetic_op.hpp:17:
In file included from /usr/include/boost/mpl/integral_c.hpp:32:
/usr/include/boost/mpl/aux_/integral_wrapper.hpp:73:31: error: integer value -1 is outside the valid range of values [0, 3] for the enumeration type 'int_float_mixture_enum' [-Wenum-constexpr-conversion]
/usr/include/boost/mpl/aux_/static_cast.hpp:24:47: note: expanded from macro 'BOOST_MPL_AUX_STATIC_CAST'
   24 | #   define BOOST_MPL_AUX_STATIC_CAST(T, expr) static_cast<T>(expr)
      |                                               ^
2 errors generated.
```

Work around this issue by ignoring this diagnostic for this include.
I did attempt to just downgrade the error into a warning, but that did
not seem to work.

See https://github.com/bitcoin/bitcoin/issues/30751 for further
discussion.
2024-09-05 14:45:21 +01:00