Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[pull] master from bitcoin:master #116

Open
wants to merge 4,625 commits into
base: master
Choose a base branch
from
Open

[pull] master from bitcoin:master #116

wants to merge 4,625 commits into from

Conversation

pull[bot]
Copy link

@pull pull bot commented Oct 20, 2023

See Commits and Changes for more details.


Created by pull[bot]

Can you help keep this open source service alive? 💖 Please sponsor : )

@pull pull bot added the ⤵️ pull label Oct 20, 2023
@ghost
Copy link

ghost commented Oct 20, 2023

👇 Click on the image for a new way to code review

Review these changes using an interactive CodeSee Map

Legend

CodeSee Map legend

MarcoFalke and others added 28 commits December 19, 2024 14:41
Future code can now use std::span in stream serialization, similar to
the existing serialization helpers for std::array or Span.
The std::span constructor requires std::ranges::borrowed_range, which
tries to protect against dangling references.

One way to disable the check is to specify the std::span's element type
as const in the constructor call.

Otherwise, a compile error will look like:

 include/c++/span: note: candidate constructor not viable: no known conversion from 'std::vector<unsigned char>' to 'const span<unsigned char>' for 1st argument
      |       span(const span&) noexcept = default;
      |       ^    ~~~~~~~~~~~
 ...
 include/c++/span: note: candidate template ignored: constraints not satisfied [with _Range = std::vector<unsigned char>]
      |         span(_Range&& __range)
      |         ^
 include/c++/span: note: because 'std::vector<unsigned char>' does not satisfy 'borrowed_range'
      |           && (ranges::borrowed_range<_Range> || is_const_v<element_type>)
      |               ^
 include/c++/bits/ranges_base.h: note: because 'std::vector<unsigned char>' does not satisfy '__maybe_borrowed_range'
      |       = range<_Tp> && __detail::__maybe_borrowed_range<_Tp>;
      |                       ^
 include/c++/bits/ranges_base.h: note: because 'is_lvalue_reference_v<std::vector<unsigned char> >' evaluated to false
      |         = is_lvalue_reference_v<_Tp>
      |           ^
 include/c++/bits/ranges_base.h: note: and 'enable_borrowed_range<remove_cvref_t<vector<unsigned char, allocator<unsigned char> > > >' evaluated to false
      |           || enable_borrowed_range<remove_cvref_t<_Tp>>;
      |              ^
 include/c++/span: note: and 'is_const_v<element_type>' evaluated to false
      |           && (ranges::borrowed_range<_Range> || is_const_v<element_type>)
      |                                                 ^
On systems such as NetBSD, this change enables the execution of
functional tests.
81cea5d Ensure m_tip_block is never ZERO (Sjors Provoost)
e058544 Make m_tip_block an std::optional (Sjors Provoost)

Pull request description:

  Suggested in #31297 (comment)

ACKs for top commit:
  fjahr:
    re-ACK 81cea5d
  tdb3:
    code review re ACK 81cea5d
  l0rinc:
    ACK 81cea5d

Tree-SHA512: 31a75ba29e3d567bab32e4e7925a419d9d7a4d2d85ed1c1012116d8d22adc14d31d5b4ce5f6c499c994188dcd26a01cced05be74f94c892fc90ae17a6783a472
fadd568 fuzz: Fix misplaced SeedRand::ZEROS (MarcoFalke)

Pull request description:

  After commit fae63bf this must be placed even before test_setup. This is nice, because it makes the usage consistently appear in the first line.

  The change is moving a `SeedRandomForTest(SeedRand::ZEROS)` to happen earlier. This is fine, because it will either have no effect, or make the code more deterministic, because after commit fae63bf, no other re-seeding other than `ZEROS` can happen in fuzz tests.

ACKs for top commit:
  marcofleon:
    Re ACK fadd568
  brunoerg:
    code review ACK fadd568
  hodlinator:
    ACK fadd568

Tree-SHA512: 54eadf19a1e850157a280fb252ece8797f37a9a50d3b0a01aa2c267bacbe8ef4ddea6cf3faadcbaa4ab9f53148edf08e3cee5dfb3eae928db582adf8373a5206
This change fixes tests on systems where `python3` is not available
in the `PATH`, causing the shebang `#!/usr/bin/env python3` to fail.
Use character literals instead of integer hex values (i.e. `'\x5b','\x0a', ...` instead of `0x5b, 0x0a, ...`) for generated headers.
This avoids C++11 narrowing warnings in a more concise way than using explicit char casts.

Extra whitespace is also removed between elements for brevity.
Also, extend the pass2.json test to the maximum depth possible. The two
tests are now similar to fail45.json and pass4.json, except for the
string element in the inner-most array.

Also, sort.
…-mode" preset

e196190 cmake: Remove unused `BUILD_TESTING` variable from "dev-mode" preset (Hennadii Stepanov)

Pull request description:

  On the master branch @ bb57017:
  ```
  $ cmake -B build --preset dev-mode -DWITH_MULTIPROCESS=OFF
  <snip>
  -- Configuring done (12.0s)
  -- Generating done (0.1s)
  CMake Warning:
    Manually-specified variables were not used by the project:

      BUILD_TESTING

  -- Build files have been written to: /home/hebasto/git/bitcoin/build
  ```

  This PR resolves the issue.

  The removed `BUILD_TESTING` variable is a part of the [`CTest`](https://cmake.org/cmake/help/latest/module/CTest.html) module, which we do not include in the project.

ACKs for top commit:
  TheCharlatan:
    ACK e196190

Tree-SHA512: 8110a0f5bdcdd0844ce7dd75160a61d8b3aff95e12da1ec4d55c56c82da41145736da0fad072adeb97551c99e46683a3493435c3bac7d8e4e62ea6086f60fb7a
…mq.py`

be1a2e5 doc: Install `py3-zmq` port on OpenBSD for `interface_zmq.py` (Hennadii Stepanov)

Pull request description:

  On OpenBSD, Python's `zmq` module is provided as a separate [port](https://www.ports.to/path/net/py-zmq,python3.html).

  This PR updates the OpenBSD Build Guide to include this port, enabling the `interface_zmq.py` functional test.

  Also updates the documented OpenBSD version.

ACKs for top commit:
  theStack:
    Tested ACK be1a2e5

Tree-SHA512: 4d560385b94e8c7491aa19d2157d8a799617e08136601dc565a909d4c74e12582a1d273bc97ad7c2d0e57c5cf7377560ba02ef58c12f8991652322553740d2ba
b871020 guix: disable timezone tools & profiling in glibc (fanquake)
23b8a42 guix: bump glibc 2.31 to 7b27c450c34563a28e634cccb399cd415e71ebfe (fanquake)

Pull request description:

  An additional commit has been backported to the 2.31 branch:
  https://sourceware.org/git/?p=glibc.git;a=shortlog;h=refs/heads/release/2.31/master.

  Pass `--disable-timezone-tools`: removes `var/profiles/x86_64-linux-gnu/sbin/zdump`.
  Pass `--disable-profile`: profiling is disabled by default, but make that explicit.

ACKs for top commit:
  theuni:
    utACK b871020
  hebasto:
    ACK b871020.

Tree-SHA512: 0d9a0e7451cc42384bbdd0b46c740c7aa964dc12e3f0376de586bf90e57799ebb04675892861cb38a53b5ca0e265061fa7111596cf1c94171303d0d048785ab4
By setting DANGER_DOCKER_BUILD_CACHE_HOST_DIR, the task-specific
docker images built during the CI run can be cached. This allows,
for example, ephemeral CI runners to reuse the docker images (or
layers of it) from earlier runs, by persisting the image cache
before the ephemeral CI runner is shut down. The cache keyed by
`CONTAINER_NAME`.

As --cache-to doesn't remove old cache files, the existing cache
is removed after a successful `docker build` and the newly cached
image is moved to it's location to avoid the cache from growing
indefinitly with old, unused layers.

When --cache-from doesn't find the directory, the cached version is
a cache-miss, or the cache can't be imported for whatever other reason,
it warns and `docker build` continues by building the docker image.

This feature is opt-in. The documentation for the cache type=local
can be found https://docs.docker.com/build/cache/backends/local/

This replaces #31377
This change fixes compilation on NetBSD with GCC 14.
Setting a large `-dbcache` size postpones the index writes until the coins cache size exceeds the specified limit.
This causes the final flush after manual termination to seemingly hang forever (e.g. tens of minutes for 20 GiB);
Now that the `dbcache` upper cap has been lifted, this will become even more apparent, so a warning will be shown when large UTXO sets are flushed (currently >1 GiB), such as:
> 2024-12-18T18:25:03Z Flushed fee estimates to fee_estimates.dat.
> 2024-12-18T18:25:03Z [warning] Flushing large (1 GiB) UTXO set to disk, it may take several minutes
> 2024-12-18T18:25:09Z Shutdown: done

Note that the related BCLog::BENCH units were also converted to `KiB` from `kB` to unify the bases.

Co-authored-by: Cory Fields <[email protected]>
The mutex (required by TestBlockValidity) must be held after creating
the block, until TestBlockValidity is called. Otherwise, it is possible
that the chain advances in the meantime and leads to a crash in
TestBlockValidity:

 Assertion failed: pindexPrev && pindexPrev == chainstate.m_chain.Tip() (validation.cpp: TestBlockValidity: 4338)

The diff can be reviewed with the git options
--ignore-all-space --function-context
If AssumeUtxo background sync is completed in this
ActivateBestChain() call, the GetRole() function
returns "normal" instead of "background" for this chainstate.
This would make the wallet (which ignores BlockConnected
notifcation for the background chainstate) process it, change
m_last_block_processed_height, and display an incorrect
balance.
Use a third node for this, which doesn't get restarted like the second
node.
This test would fail without the previous commit.
…ct logging

06443b8 net: clarify if we ever sent or received from peer (Sjors Provoost)
1d01ad4 net: add LogIP() helper, use in net_processing (Sjors Provoost)
937ef9e net_processing: use CNode::DisconnectMsg helper (Sjors Provoost)
ad22442 net: additional disconnection logging (Sjors Provoost)

Pull request description:

  While debugging unexpected disconnections, possibly related to #28331, I found some additional [net] logging to be useful.

  All cases where we disconnect now come with a log message that has the word `disconnecting`:

  * all calls to `CloseSocketDisconnect()` log `disconnecting peer=…`
  * wherever we set `pnode->fDisconnect = true;`
  * for all `InactivityCheck` cases (which in turn sets `fDisconnect`)
  * replaces "dropping" with "disconnecting" in `Network not active, dropping peer=…`

  A few exceptions are listed here: #28521 (comment)

  I changed `CloseSocketDisconnect()` to no longer log `disconnecting`, and instead have all the call sites do so.

  This PR introduces two helper functions on `CNode`: `DisconnectMsg` and `LogIP`. The second and third commit use these helpers in `net_processing.cpp` so these disconnect messages are more consistent now (e.g. some didn't log the IP). No new messages are added there though.

  The `LogIP()` helper is rarely used outside of a disconnect event, but it's available for future use.

  Any `LogPrint` this PR touches is replaced with `LogDebug` (superseded by #30750), and every `LogPrintf ` with `LogInfo`.

ACKs for top commit:
  davidgumberg:
    reACK 06443b8
  vasild:
    ACK 06443b8
  danielabrozzoni:
    ACK 06443b8
  hodlinator:
    ACK 06443b8

Tree-SHA512: 525f4c11568616e1d48455a3fcab9e923da7432377fe9230468c15403d2e9b7ce712112df8fbd547cfec01dce0d1f26107cfc1b90f78cfc1fe13e08d57b08464
5709718 coins: warn on shutdown for big UTXO set flushes (Lőrinc)

Pull request description:

  Split out of #30611 (comment)

  Setting a large `-dbcache` size postpones the index writes until the coins cache size exceeds the specified limit. This causes the final flush after manual termination to seemingly hang forever (e.g. tens of minutes for 20 GiB); Now that the `dbcache` upper cap has been lifted, this will become even more apparent, so a warning will be shown when large UTXO sets are flushed (currently >1 GiB), such as:
  > 2024-12-18T18:25:03Z Flushed fee estimates to fee_estimates.dat.
  > 2024-12-18T18:25:03Z [warning] Flushing large (1 GiB) UTXO set to disk, it may take several minutes
  > 2024-12-18T18:25:09Z Shutdown: done

  ---

  You can reproduce it by starting `bitcoind` with a large `-dbcache`:
  > mkdir demo  && cmake -B build -DCMAKE_BUILD_TYPE=Release && cmake --build build -j$(nproc) && build/src/bitcoind -datadir=demo **-dbcache=10000**

  Waiting until the used memory is over 1 GiB
  > 2024-12-18T18:25:02Z UpdateTip: [...] progress=0.069009 cache=**1181.1MiB**(8827981txo)

  And cancelling the process from the terminal:
  > ^C2024-12-18T18:25:03Z tor: Thread interrupt
  > [...]
  > 2024-12-18T18:25:03Z **[warning] Flushing large (1 GiB) UTXO set to disk, it may take several minutes*

ACKs for top commit:
  sipa:
    utACK 5709718
  tdb3:
    re ACK 5709718
  1440000bytes:
    ACK 5709718
  danielabrozzoni:
    tACK 5709718

Tree-SHA512: 608cf797de788501ccb2986508c155f5660c5f6f7a414524bfcc2820cfa9ebe3da558d13f2317d1f121a82d49ffe1e711a1152c743c22dab9f9807363f4ed8d5
To get the maximum size of a satisfaction for a descriptor
without considering the max sig, the parameter `use_max_sig`
should be false.
fanquake and others added 30 commits January 23, 2025 10:54
…arp bug

733fa0b miner: never create a template which exploits the timewarp bug (Antoine Poinsot)

Pull request description:

  This check was introduced in #30681 but only enabled for testnet4. To avoid potentially creating an invalid block template if a soft fork to fix the timewarp attack were to activate in the future, we should have this check on all networks. It also seems wise for our miner to not support it whether or not a soft fork activates to fix it at the consensus level.

ACKs for top commit:
  Sjors:
    ACK 733fa0b
  fjahr:
    utACK 733fa0b
  TheCharlatan:
    ACK 733fa0b

Tree-SHA512: 9b3bc8b26a57f93425b17dda80bcfac4ecb750a3d26bc3eb8df619135634e369ac15982fac0c9770b1df207bd2e418ffe02a98f37968f024e55262d97715a4f5
…ipts

d38ade7 qa: Use `sys.executable` when invoking other Python scripts (Hennadii Stepanov)

Pull request description:

  This PR fixes the `rpc_signer.py` and `wallet_signer.py` functional tests on systems where `python3` is not available in the `PATH`, causing the shebang `#!/usr/bin/env python3` to fail.

  Here are logs on NetBSD 10.0:
  - without this PR:
  ```
  $ python3.12 ./build/test/functional/test_runner.py rpc_signer.py wallet_signer.py
  Temporary test directory at /tmp/test_runner_₿_🏃_20241219_160538
  Remaining jobs: [rpc_signer.py, wallet_signer.py --descriptors]
  1/2 - rpc_signer.py failed, Duration: 1 s

  stdout:
  2024-12-19T16:05:40.012000Z TestFramework (INFO): PRNG seed is: 1833166631173850775
  2024-12-19T16:05:40.012000Z TestFramework (INFO): Initializing test directory /tmp/test_runner_₿_🏃_20241219_160538/rpc_signer_1
  2024-12-19T16:05:40.754000Z TestFramework (ERROR): Assertion failed
  Traceback (most recent call last):
    File "/home/hebasto/dev/bitcoin/test/functional/test_framework/util.py", line 160, in try_rpc
      fun(*args, **kwds)
    File "/home/hebasto/dev/bitcoin/test/functional/test_framework/coverage.py", line 50, in __call__
      return_val = self.auth_service_proxy_instance.__call__(*args, **kwargs)
                   ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    File "/home/hebasto/dev/bitcoin/test/functional/test_framework/authproxy.py", line 146, in __call__
      raise JSONRPCException(response['error'], status)
  test_framework.authproxy.JSONRPCException: RunCommandParseJSON error: process(/home/hebasto/dev/bitcoin/test/functional/mocks/signer.py enumerate) returned 127: env: python3: No such file or directory
   (-1)

  During handling of the above exception, another exception occurred:

  Traceback (most recent call last):
    File "/home/hebasto/dev/bitcoin/test/functional/test_framework/test_framework.py", line 135, in main
      self.run_test()
    File "/home/hebasto/dev/bitcoin/build/test/functional/rpc_signer.py", line 72, in run_test
      assert_raises_rpc_error(-1, 'fingerprint not found',
    File "/home/hebasto/dev/bitcoin/test/functional/test_framework/util.py", line 151, in assert_raises_rpc_error
      assert try_rpc(code, message, fun, *args, **kwds), "No exception raised"
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    File "/home/hebasto/dev/bitcoin/test/functional/test_framework/util.py", line 166, in try_rpc
      raise AssertionError(
  AssertionError: Expected substring not found in error message:
  substring: 'fingerprint not found'
  error message: 'RunCommandParseJSON error: process(/home/hebasto/dev/bitcoin/test/functional/mocks/signer.py enumerate) returned 127: env: python3: No such file or directory
  '.
  2024-12-19T16:05:40.756000Z TestFramework (INFO): Stopping nodes
  2024-12-19T16:05:40.873000Z TestFramework (WARNING): Not cleaning up dir /tmp/test_runner_₿_🏃_20241219_160538/rpc_signer_1
  2024-12-19T16:05:40.873000Z TestFramework (ERROR): Test failed. Test logging available at /tmp/test_runner_₿_🏃_20241219_160538/rpc_signer_1/test_framework.log
  2024-12-19T16:05:40.873000Z TestFramework (ERROR):
  2024-12-19T16:05:40.873000Z TestFramework (ERROR): Hint: Call /home/hebasto/dev/bitcoin/test/functional/combine_logs.py '/tmp/test_runner_₿_🏃_20241219_160538/rpc_signer_1' to consolidate all logs
  2024-12-19T16:05:40.873000Z TestFramework (ERROR):
  2024-12-19T16:05:40.873000Z TestFramework (ERROR): If this failure happened unexpectedly or intermittently, please file a bug and provide a link or upload of the combined log.
  2024-12-19T16:05:40.873000Z TestFramework (ERROR): https://github.com/bitcoin/bitcoin/issues
  2024-12-19T16:05:40.873000Z TestFramework (ERROR):

  stderr:

  Remaining jobs: [wallet_signer.py --descriptors]
  2/2 - wallet_signer.py --descriptors failed, Duration: 1 s

  stdout:
  2024-12-19T16:05:40.014000Z TestFramework (INFO): PRNG seed is: 7530764367977090686
  2024-12-19T16:05:40.014000Z TestFramework (INFO): Initializing test directory /tmp/test_runner_₿_🏃_20241219_160538/wallet_signer_0
  2024-12-19T16:05:40.526000Z TestFramework (ERROR): JSONRPC error
  Traceback (most recent call last):
    File "/home/hebasto/dev/bitcoin/test/functional/test_framework/test_framework.py", line 135, in main
      self.run_test()
    File "/home/hebasto/dev/bitcoin/build/test/functional/wallet_signer.py", line 66, in run_test
      self.test_valid_signer()
    File "/home/hebasto/dev/bitcoin/build/test/functional/wallet_signer.py", line 83, in test_valid_signer
      self.nodes[1].createwallet(wallet_name='hww', disable_private_keys=True, descriptors=True, external_signer=True)
    File "/home/hebasto/dev/bitcoin/test/functional/test_framework/test_node.py", line 935, in createwallet
      return self.__getattr__('createwallet')(wallet_name, disable_private_keys, blank, passphrase, avoid_reuse, descriptors, load_on_startup, external_signer)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    File "/home/hebasto/dev/bitcoin/test/functional/test_framework/coverage.py", line 50, in __call__
      return_val = self.auth_service_proxy_instance.__call__(*args, **kwargs)
                   ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    File "/home/hebasto/dev/bitcoin/test/functional/test_framework/authproxy.py", line 146, in __call__
      raise JSONRPCException(response['error'], status)
  test_framework.authproxy.JSONRPCException: RunCommandParseJSON error: process(/home/hebasto/dev/bitcoin/test/functional/mocks/signer.py enumerate) returned 127: env: python3: No such file or directory
   (-1)
  2024-12-19T16:05:40.528000Z TestFramework (INFO): Stopping nodes
  2024-12-19T16:05:40.645000Z TestFramework (WARNING): Not cleaning up dir /tmp/test_runner_₿_🏃_20241219_160538/wallet_signer_0
  2024-12-19T16:05:40.646000Z TestFramework (ERROR): Test failed. Test logging available at /tmp/test_runner_₿_🏃_20241219_160538/wallet_signer_0/test_framework.log
  2024-12-19T16:05:40.646000Z TestFramework (ERROR):
  2024-12-19T16:05:40.646000Z TestFramework (ERROR): Hint: Call /home/hebasto/dev/bitcoin/test/functional/combine_logs.py '/tmp/test_runner_₿_🏃_20241219_160538/wallet_signer_0' to consolidate all logs
  2024-12-19T16:05:40.646000Z TestFramework (ERROR):
  2024-12-19T16:05:40.646000Z TestFramework (ERROR): If this failure happened unexpectedly or intermittently, please file a bug and provide a link or upload of the combined log.
  2024-12-19T16:05:40.646000Z TestFramework (ERROR): https://github.com/bitcoin/bitcoin/issues
  2024-12-19T16:05:40.646000Z TestFramework (ERROR):

  stderr:

  TEST                           | STATUS    | DURATION

  rpc_signer.py                  | ✖ Failed  | 1 s
  wallet_signer.py --descriptors | ✖ Failed  | 1 s

  ALL                            | ✖ Failed  | 2 s (accumulated)
  Runtime: 1 s

  ```
  - with this PR:
  ```
  $ python3.12 ./build/test/functional/test_runner.py rpc_signer.py wallet_signer.py
  Temporary test directory at /tmp/test_runner_₿_🏃_20241219_160011
  Remaining jobs: [rpc_signer.py, wallet_signer.py --descriptors]
  1/2 - rpc_signer.py passed, Duration: 2 s
  Remaining jobs: [wallet_signer.py --descriptors]
  2/2 - wallet_signer.py --descriptors passed, Duration: 3 s

  TEST                           | STATUS    | DURATION

  rpc_signer.py                  | ✓ Passed  | 2 s
  wallet_signer.py --descriptors | ✓ Passed  | 3 s

  ALL                            | ✓ Passed  | 5 s (accumulated)
  Runtime: 3 s

  ```

ACKs for top commit:
  maflcko:
    lgtm ACK d38ade7
  stickies-v:
    ACK d38ade7 . I have a minor concern about `sys.executable` not being guaranteed to return a valid Python path, but this patch seems good enough as is so no blocker.

Tree-SHA512: 91fe0abc0b7e2b599c5562f8b225ba60f94c5bd6baa77d8df532155ef4d3ef6c6a862cee7f4a7f565ed4bb3251adcda813b4a4f79be1aa6a4ffdfda8b4e53415
fa9aced test: Check that reindex with prune wipes blk files (MarcoFalke)
fa9593e test: Use high-level python types (MarcoFalke)

Pull request description:

  This adds missing test coverage for `CleanupBlockRevFiles`.

ACKs for top commit:
  TheCharlatan:
    Re-ACK fa9aced
  l0rinc:
    ACK fa9aced
  tdb3:
    re ACK fa9aced

Tree-SHA512: b31ff8a896ce344437715e7fb7efdb8cd7e11470e8465d8972fddfdb58ffd78257786c4060e8596cc53b6278f8ac6a9b6eb05a06e9df58b8b240bdaa719a8e5b
…walletdescriptor`

4da7bfd test: add coverage for unknown address type for `createwalletdescriptor` (brunoerg)

Pull request description:

  Calling `createwalletdescriptor` RPC with an unknown address type throws an error. This PR adds test coverage for it as done for other RPCs (`getnewaddress `, `getrawchangeaddress`, etc).

ACKs for top commit:
  maflcko:
    lgtm ACK 4da7bfd
  rkrux:
    tACK 4da7bfd

Tree-SHA512: 490bc3ffeb70b0f26db0a44d3950d7410fef35d4056487f2e82c081fb14ca277a18943c487235e0163a29f90fc741a262c29835beb9f41936affa4e73ddad25f
Trying to shut down a node after a test failure may fail and lead to an
RPC error.

Also, it is confusing to sidestep the existing fallback to kill any
leftover nodes on a test failure.

So just rely on the fallback.

Idea by Hodlinator.

Co-Authored-By: Hodlinator <[email protected]>
…sing MSan

5c3e4d8 doc: add a section about using MSan (Antoine Poinsot)

Pull request description:

  Just a couple lines in a subsection of the sanitizers section mentioning that using the memory sanitizer is a bit more involve than other sanitizers, describing the steps and pointing to an example.

ACKs for top commit:
  fanquake:
    ACK 5c3e4d8
  dergoegge:
    ACK 5c3e4d8

Tree-SHA512: 4ff73c2dd0f25cb96148e54bd867b8d340bd0fbc9b9a736a705125039352eb1d40bd724f9f262a44d3dbd1bea8f03166cf30e571d882fec02ceb1dd399ef7422
fad83e7 doc: Fix incorrect send RPC docs (MarcoFalke)

Pull request description:

  It would be good to have accurate RPC docs, so that humans and machines can read them and rely on them.

  This fixes one issue.

ACKs for top commit:
  fjahr:
    utACK fad83e7
  rkrux:
    tACK fad83e7
  luke-jr:
    tACK fad83e7

Tree-SHA512: 65d0cc18a62ef44833621464d74b743d24ffe2b853596dce2c4f423df0495142d50387c02ba1b54f5ca77d4ddb083d55116a8ac92698aa6558762d841664911e
81b9800 fix typos (wgyt)

Pull request description:

ACKs for top commit:
  maflcko:
    lgtm ACK 81b9800

Tree-SHA512: 6a4f718c0afb0e3bf80ab7fa7fed32f882614c60b6e4972f54584aecac2f19384d781232e923a47b72d76229af907ebf7717d7b34f9be6c00394ce5d7ed0b8d4
8996fef test: p2p: check that INV messages not matching wtxidrelay are ignored (Sebastian Falbesoner)
e0b3336 test: p2p: fix sending of manual INVs in tx download test (Sebastian Falbesoner)

Pull request description:

  The `test_inv_block` sub-test in p2p_tx_download.py has a subtle bug: the manual msg_inv announcements from peers currently have no effect, since they don't match the wtxidrelay setting (=true by default for `P2PInterface` instances) and are hence ignored by the nodes (since 2d282e0 / PR #18044):

  https://github.com/bitcoin/bitcoin/blob/e7c479495509c068215b73f6df070af2d406ae15/src/net_processing.cpp#L3904-L3911

  Though the test still passes on master, it does so without the intended scenario of asking an additional peer (triggering the GETDATA_TX_INTERVAL delay). Fix this by sending the INV message with MSG_WTX instead of MSG_TX. This increases the test run time by about one minute intentionally.

  It might be good to avoid issues like this in the future, happy to add test framework improvements if someone has a concrete idea.

  (Got into the topic of tx/wtx announcements via the discussion #31397 (comment))

ACKs for top commit:
  maflcko:
    ACK 8996fef 😸
  danielabrozzoni:
    ACK 8996fef
  mzumsande:
    Code Review ACK 8996fef

Tree-SHA512: 3da26f9539c89d64c3b0d0579d9af2a6a4577615eed192506e1fb4318421b235f99a6672a497dea3050fba85dad32678f37fd2cda9ecb70cbf52982db37982e8
2656a56 tests: add a test for the new blocksdir lock (Cory Fields)
bdc0a68 init: lock blocksdir in addition to datadir (Cory Fields)
cabb2e5 refactor: introduce a more general LockDirectories for init (Cory Fields)
1db331b init: allow a new xor key to be written if the blocksdir is newly created (Cory Fields)

Pull request description:

  This probably should've been included in #12653 when `-blocksdir` was introduced. Credit TheCharlatan for noticing that it's missing.

  This guards against 2 processes running with separate datadirs but the same blocksdir. I didn't add `walletdir` as I assume sqlite has us covered there.

  It's not likely to happen currently, but may be more relevant in the future with applications using the kernel. Note that the kernel does not currently do any dir locking, but it should.

ACKs for top commit:
  maflcko:
    review ACK 2656a56 🏼
  kevkevinpal:
    ACK [2656a56](2656a56)
  achow101:
    ACK 2656a56
  tdb3:
    Code review and light test ACK 2656a56

Tree-SHA512: 3ba17dc670126adda104148e14d1322ea4f67d671c84aaa9c08c760ef778ca1936832c0dc843cd6367e09939f64c6f0a682b0fa23a5967e821b899dff1fff961
…chmark

18619b4 wallet: remove BDB dependency from wallet migration benchmark (furszy)

Pull request description:

  Part of the legacy wallet removal working path #20160.

  Stops creating a bdb database in the wallet migration benchmark.
  Instead, the benchmark now creates the db in memory and re-uses it for the migration process.

ACKs for top commit:
  achow101:
    ACK 18619b4
  brunoerg:
    code review ACK 18619b4
  theStack:
    Code-review ACK 18619b4

Tree-SHA512: a107deee3d2c00b980e3606be07d038ca524b98251442956d702a7996e2ac5e2901f656482018cacbac8ef6a628ac1fb03f677d1658aeaded4036d834a95d7e0
… is too low

92787dd test: raise an error when target_vsize is below tx virtual size (ismaelsadeeq)
a8780c9 test: raise an error if output value is <= 0 in `create_self_transfer` (ismaelsadeeq)
f6e8893 test: test that `create_self_transfer_multi` respects `target_vsize` (ismaelsadeeq)

Pull request description:

  This is a simple test PR that does two things:

  1. Raise an exception in `_bulk_tx_` when `target_vsize` is too low, i.e., below the tx vsize.
  2. Addresses some review comments from #30162, which are:
     - Raise an error if the output value is less than or equal to zero in `create_self_transfer`.
  This prevents creating transactions with a value of 0 or less.
     - Add a test to verify that `create_self_transfer_multi` also respects the passed `target_vsize`.

ACKs for top commit:
  achow101:
    ACK 92787dd
  theStack:
    ACK 92787dd
  rkrux:
    reACK 92787dd
  glozow:
    ACK 92787dd

Tree-SHA512: 1f2767f2cf715ed65074c5fff347eec160b142685777d833d5e872cfef364d3dc1916b52ee442e99c7b9a8d514ff62bc67a9899d8854f65a4b93ac3ae300d18e
…low-up)

1b51616 test: improve rogue calls in mining functions (i-am-yuvi)

Pull request description:

  #31403 follow-up, see [comment](#31403 (review))

  - Rename `invalid_call` parameter to `called_by_framework` in `generateblock`, `generatetoaddress` and `generatetodescriptor` mining methods to better express its intended usage.
  - Add explicit assertion message clarifying that these functions should only be called by TestFramework itself to maintain proper node synchronization.

ACKs for top commit:
  maflcko:
    lgtm ACK 1b51616
  achow101:
    ACK 1b51616
  hodlinator:
    re-ACK 1b51616
  Prabhat1308:
    ACK [1b51616](1b51616)

Tree-SHA512: 56832626fe54dcaa07dacb4f9c960c0a83fad3fb12272155114ac697856c59b7f44805e1152eddeec7a5e8f7daf487382dc01b5b9ae2e74b62b2df6bd1f81f77
This should be the final update to the libmultiprocess package via the depends
system. It brings in the libmultiprocess cmake changes from
chaincodelabs/libmultiprocess#136 needed to support
building as subtree. After this, a followup PR will add libmultiprocess as a
git subtree and depends will just use the git subtree instead of hardcoding its
own version hash.

Since there have been libmultiprocess API changes since the last update, this
commit also updates bitcoin code to be compatible with them.

This update brings in the following changes:

chaincodelabs/libmultiprocess#121 ProxyClientBase: avoid static_cast to partially constructed object
chaincodelabs/libmultiprocess#120 proxy-types.h: add static_assert to detect int/enum size mismatch
chaincodelabs/libmultiprocess#127 ProxyClientBase: avoid static_cast to partially destructed object
chaincodelabs/libmultiprocess#129 Fix "disconnected: write(m_post_fd, &buffer, 1): Broken pipe" EventLoop shutdown races.
chaincodelabs/libmultiprocess#130 refactor: Add CleanupRun function to dedup clean list code
chaincodelabs/libmultiprocess#131 doc: fix startAsyncThread comment
chaincodelabs/libmultiprocess#133 Fix debian "libatomic not found" error in downstream builds
chaincodelabs/libmultiprocess#94 c++ 20 cleanups
chaincodelabs/libmultiprocess#135 refactor: proxy-types.h API cleanup
chaincodelabs/libmultiprocess#136 cmake: Support being included with add_subdirectory
chaincodelabs/libmultiprocess#137 doc: Fix broken markdown links
Add regression test for serialization bug in IPC mining code that is not
currently being called anywhere reported:

Sjors#71
chaincodelabs/libmultiprocess#122
f588328 Add a fuzz test for Num3072 multiplication and inversion (Pieter Wuille)
a26ce62 Safegcd based modular inverse for Num3072 (Pieter Wuille)
91ce8ce Add benchmark for MuHash finalization (Pieter Wuille)

Pull request description:

  This implements a safegcd-based modular inverse for MuHash3072. It is a fairly straightforward translation of [the libsecp256k1 implementation](bitcoin-core/secp256k1#831), with the following changes:
  * Generic for 32-bit and 64-bit
  * Specialized for the specific MuHash3072 modulus (2^3072 - 1103717).
  * A bit more C++ish
  * Far fewer sanity checks

  A benchmark is also included for MuHash3072::Finalize. The new implementation is around 100x faster on x86_64 for me (from 5.8 ms to 57 μs); for 32-bit code the factor is likely even larger.

  For more information:
    * [Original paper](https://gcd.cr.yp.to/papers.html) by Daniel J. Bernstein and Bo-Yin Yang
    * [Implementation](bitcoin-core/secp256k1#767) for libsecp256k1 by Peter Dettman; and the [final](bitcoin-core/secp256k1#831) version
    * [Explanation](https://github.com/bitcoin-core/secp256k1/blob/master/doc/safegcd_implementation.md) of the algorithm using Python snippets
    * [Analysis](https://github.com/sipa/safegcd-bounds) of the maximum number of iterations the algorithm needs
     * [Formal proof in Coq](https://medium.com/blockstream/a-formal-proof-of-safegcd-bounds-695e1735a348) by Russell O'Connor (for the 256-bit version of the algorithm; here we use a 3072-bit one).

ACKs for top commit:
  achow101:
    ACK f588328
  TheCharlatan:
    Re-ACK f588328
  dergoegge:
    tACK f588328

Tree-SHA512: 275872c61d30817a82901dee93fc7153afca55c32b72a95b8768f3fd464da1b09b36f952f30e70225e766b580751cfb9b874b2feaeb73ffaa6943c8062aee19a
Updated three GitHub links to avoid redirects.
faf2f2c test: Avoid redundant stop and error spam on shutdown (MarcoFalke)
fae3bf6 test: Avoid redundant stop and error spam on startup failure (MarcoFalke)
fa0dc09 test: Remove --noshutdown flag (MarcoFalke)
fad441f test: Treat leftover process as error (MarcoFalke)

Pull request description:

  The `--noshutdown` flag is brittle, confusing, and redundant:

  * Someone wanting to inspect the state after a test failure will likely also want to debug the state on the python side, so the option is redundant with `--pdbonfailure`. If there was a use case to replicate `--pdbonfailure` without starting pdb, a dedicated flag could be added for that use case.
  * It is brittle to use the flag for a passing test, because it will disable checks in the test. For example, on shutdown LSan will perform a leak check, and the test framework will check that the node did not crash, and it will check that the node did not print errors to stderr.

  Fix all issues by removing it.

  Also, tidy up startup error messages to be less confusing as a result.

ACKs for top commit:
  hodlinator:
    re-ACK faf2f2c
  pablomartin4btc:
    re tACK faf2f2c

Tree-SHA512: 46d7ae59c7be88b93f1f9e0b6be21af0fc101e646512e2c5e725682cb18bfec8aa010e0ebe89ce9ffe239e5caac0da5f81cc97b79e738d26ca5fa31930e8e4e3
…6 regressions

fa8ade3 refactor: Avoid GCC false positive error (MarcoFalke)
fa40807 ci: Enable DEBUG=1 for one GCC-12+ build to catch 117966 regressions (MarcoFalke)

Pull request description:

  It is possible that someone accidentally removes the workaround in fa9e048, or more likely that someone accidentally adds new code without the workaround.

  Avoid this by adding a temporary CI check.

  This can be tested by reverting the workaround and observing a failure.

ACKs for top commit:
  hebasto:
    ACK fa8ade3, I've tested locally on Ubuntu 24.04.

Tree-SHA512: 7ee1538fd5304a5ab91ac8c7619a573548d7e0345592a1e9d38b3b73729e09e7c77a9ee703d64cf02a8218de3148376d7836e294abb939aa7533034ba36dfb6c
1681c08 doc: update links in ci.yml (espi3)

Pull request description:

  Updated three outdated GitHub links to avoid redirects.

ACKs for top commit:
  Sjors:
    ACK 1681c08

Tree-SHA512: 0ef934ebf308f0fee338cb6ac80b2826b9d442285c64af9e2547b020f5f0e5a0eaba7efeee6220e55790b78649d3060470ce65f35cb0ecc1f60041e5d640c6cb
…ng to subtree

4e0aa18 test: Add test for IPC serialization bug (Ryan Ofsky)
2221c88 depends: Update libmultiprocess library before converting to subtree (Ryan Ofsky)

Pull request description:

  This should be the final update to the libmultiprocess package via the depends system. It brings in the libmultiprocess cmake changes from chaincodelabs/libmultiprocess#136 needed to support building as subtree. After this, followup PR #31741 will add libmultiprocess as a git subtree and depends will just use the git subtree instead of hardcoding its own version hash.

  Since there have been libmultiprocess API changes since the last update, this commit also updates bitcoin code to be compatible with them.

  This update has the following new changes since previous update #31105:

  chaincodelabs/libmultiprocess#121 ProxyClientBase: avoid static_cast to partially constructed object
  chaincodelabs/libmultiprocess#120 proxy-types.h: add static_assert to detect int/enum size mismatch
  chaincodelabs/libmultiprocess#127 ProxyClientBase: avoid static_cast to partially destructed object
  chaincodelabs/libmultiprocess#129 Fix "disconnected: write(m_post_fd, &buffer, 1): Broken pipe" EventLoop shutdown races.
  chaincodelabs/libmultiprocess#130 refactor: Add CleanupRun function to dedup clean list code
  chaincodelabs/libmultiprocess#131 doc: fix startAsyncThread comment
  chaincodelabs/libmultiprocess#133 Fix debian "libatomic not found" error in downstream builds
  chaincodelabs/libmultiprocess#94 c++ 20 cleanups
  chaincodelabs/libmultiprocess#135 refactor: proxy-types.h API cleanup
  chaincodelabs/libmultiprocess#136 cmake: Support being included with add_subdirectory
  chaincodelabs/libmultiprocess#137 doc: Fix broken markdown links

ACKs for top commit:
  Sjors:
    ACK 4e0aa18
  vasild:
    ACK 4e0aa18
  TheCharlatan:
    ACK 4e0aa18

Tree-SHA512: 6d81cdf7f44762c7f476212295f6224054fd0a61315bb54786bc7758a2b33e5a2fce925c71e36f7bda320049aa14e7218a458ceb03dacbb869632c466c4789b0
The timeout is due to outstanding txrequests with
python peers. Fix this by disconnecting these peers
after they send their txns, they aren't needed after
this point anyway.
551a094 net: Switch to DisconnectMsg in CConnman (Hodlinator)
bbac176 net: Bring back log message when resetting socket (Hodlinator)
04b848e net: Specify context in disconnecting log message (Hodlinator)
0c4954a net_processing: Add missing use of DisconnectMsg (Hodlinator)

Pull request description:

  - Add missing calls to `DisconnectMsg()` - #28521 (comment)
  - Specify context when stopping nodes - #28521 (comment)
  - Bring back log message when resetting socket in case new entrypoints are added - #28521 (comment)
  - Use `DisconnectMsg()` in `CConnman` as well - #28521 (comment)

ACKs for top commit:
  Sjors:
    re-utACK 551a094
  l0rinc:
    utACK 551a094
  davidgumberg:
    Tested and Review ACK 551a094
  achow101:
    ACK 551a094
  danielabrozzoni:
    ACK 551a094

Tree-SHA512: 95ab8e7436e20ca3abc949ea09697facb6fbeb19981ddc7e0bf294e7ec914e72cbf836c21184a2a887f04cb264f26daf5b0cbcbebc9db633a7b1672b4e488063
…s, support all page sizes)

d45eb39 test: compare BDB dumps of test framework parser and wallet tool (Sebastian Falbesoner)
01ddd9f test: complete BDB parser (handle internal/overflow pages, support all page sizes) (Sebastian Falbesoner)

Pull request description:

  This PR adds missing features to our test framework's BDB parser with the goal of hopefully being able to read all legacy wallets that are created with current and past versions of Bitcoin Core. This could be useful both for making review of #26606 easier and to also possibly improve our functional tests for the wallet BDB-ro parser by additionally validating it with an alternative implementation. The second commits introduces a test that create a legacy wallet with huge label strings (in order to create overflow pages, i.e. pages needed for key/value data than is larger than the page size) and compares the dump outputs of wallet tool and the extended test framework BDB parser.
  It can be exercised via `$ ./test/functional/tool_wallet.py --legacy`. BDB support has to be compiled in (obviously).

  For some manual tests regarding different page sizes, the following patch can be used:
  ```diff
  diff --git a/src/wallet/bdb.cpp b/src/wallet/bdb.cpp
  index 38cca32f80..1bf39323d3 100644
  --- a/src/wallet/bdb.cpp
  +++ b/src/wallet/bdb.cpp
  @@ -395,6 +395,7 @@ void BerkeleyDatabase::Open()
                               DB_BTREE,                                 // Database type
                               nFlags,                                   // Flags
                               0);
  +            pdb_temp->set_pagesize(1<<9); /* valid BDB pagesizes are from 1<<9 (=512) to <<16 (=65536) */

               if (ret != 0) {
                   throw std::runtime_error(strprintf("BerkeleyDatabase: Error %d, can't open database %s", ret, strFile));
  ```
  I verified that the newly introduced test passes with all valid page sizes between 512 and 65536.

ACKs for top commit:
  achow101:
    ACK d45eb39
  furszy:
    utACK d45eb39
  brunoerg:
    code review ACK d45eb39

Tree-SHA512: 9f8ac80452545f4fcd24a17ea6f9cf91b487cfb1fcb99a0ba9153fa4e3b239daa126454e26109fdcb72eb1c76a4ee3b46fd6af21dc318ab67bd12b3ebd26cfdd
cddcbaf RPC: improve SFFO arg parsing, error catching and coverage (furszy)
4f4cd35 rpc: decouple sendtoaddress 'subtractfeefromamount' boolean parsing (furszy)

Pull request description:

  Following changes were made:

  1) Catch and signal error for duplicate string destinations.
  2) Catch and signal error for invalid value type.
  3) Catch and signal error for string destination not found in tx outputs.
  4) Improved `InterpretSubtractFeeFromOutputInstructions()` code organization.
  5) Added test coverage for all possible error failures.

  Also, fixed two PEP 8 warnings at the 'wallet_sendmany.py' file:
  - PEP 8: E302 expected 2 blank lines, found 1 at the SendmanyTest class declaration.
  - PEP 8: E303 too many blank lines (2) at skip_test_if_missing_module() and set_test_params()

ACKs for top commit:
  achow101:
    ACK cddcbaf
  murchandamus:
    crACK cddcbaf
  naiyoma:
    TACK [https://github.com/bitcoin/bitcoin/pull/30844/commits/cddcbaf81e8e3d107cd321ee2c9a7fd786a8917e](https://github.com/bitcoin/bitcoin/pull/30844/commits/cddcbaf81e8e3d107cd321ee2c9a7fd786a8917e)
  ismaelsadeeq:
    Code review and Tested ACK cddcbaf

Tree-SHA512: c9c15582b81101a93987458d155394ff2c9ca42864624c034ee808a31c3a7d7f55105dea98e86fce17d3c7b2c1a6b5b77942da66b287f8b8881a60cde78c1a3c
e87429a ci: optionally use local docker build cache (0xb10c)

Pull request description:

  By setting `DANGER_DOCKER_BUILD_CACHE_HOST_DIR`, the task-specific docker images built during the CI run can be cached. This allows, for example, ephemeral CI runners to reuse the docker images (or layers of it) from earlier runs, by persisting the image cache before the ephemeral CI runner is shut down. The cache keyed by `CONTAINER_NAME`.

  As `--cache-to` doesn't remove old cache files, the existing cache is removed after a successful `docker build` and the newly cached image is moved to it's location to avoid the cache from growing indefinitely with old, unused layers.

  When `--cache-from` doesn't find the directory, the cached version is a cache-miss, or the cache can't be imported for whatever other reason, it warns and `docker build` continues by building the docker image.

  This feature is opt-in. The documentation for the docker build cache of `type=local` can be found on https://docs.docker.com/build/cache/backends/local/

  This replaces #31377 - some of the discussion there might provide more context.

ACKs for top commit:
  maflcko:
    I haven't tested this, and it looks harmless and is easy to revert, if needed. So lgtm ACK e87429a
  achow101:
    ACK e87429a
  TheCharlatan:
    tACK e87429a
  willcl-ark:
    ACK e87429a

Tree-SHA512: 0887c395dee2e2020394933246d4c1bfb6dde7165219cbe93eccfe01379e05c75dce8920b6edd7df07364c703fcee7be4fba8fa45fd0e0e89da9e24759f67a71
152a2dc test: fix intermittent timeout in p2p_1p1c_network.py (Martin Zumsande)

Pull request description:

  The timeout is due to outstanding txrequests with python peers, which have the same timeout (`60s`) as the mempool sync timeout.
  I explained this in more detail in #31721 (comment) and also mentioned there how to reproduce it.

  Fix this by disconnecting the python peers after they send their txns, they aren't needed after this point anyway because the main goal of the test is the sync between the 4 full nodes.

  Fixes #31721

ACKs for top commit:
  achow101:
    ACK 152a2dc
  instagibbs:
    reACK 152a2dc
  marcofleon:
    ACK 152a2dc
  glozow:
    reACK 152a2dc

Tree-SHA512: 908c58933d8e9fcca91425fce1b7c9c7cb7121a6d26840630e03a442356ad2a327d1e087df72a19caa97024ea827593e10f2ff93838f88939458e73df9857df0
8888ee4 ci: Allow build dir on CI host (MarcoFalke)

Pull request description:

  This is required to pass cross builds on to a different machine after the build.

  See for example #31176, but this pull will also allow someone to implement it outside this repo.

ACKs for top commit:
  davidgumberg:
    lgtm ACK 8888ee4
  hebasto:
    re-ACK 8888ee4.

Tree-SHA512: a1e2c32bc1b95efbd0b48287ac5b49e0e1bacbf5a5800845be5352bbdd3e17fa478e90348b2e94e95cf3ae863cdf75ab444089376588f6f8eec438f73a4b5b97
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.