Commit graph

41815 commits

Author SHA1 Message Date
Ava Chow
9adebe1455
Merge bitcoin/bitcoin#29154: tests: improve wallet multisig descriptor test and docs
d93b794709 tests: improve wallet multisig descriptor test and docs (Michael Dietz)

Pull request description:

  It is best to store all key origin information
  (master key fingerprint and all derivation steps)
  in the multisig descriptor. Being explicit with
  this information should be beneficial if this approach is used with other wallets/signers (whether hardware or software). There is no harm including all of this with xpubs (if anything it simplifies the test code) and makes this example/docs more complete and safer incase it is referenced by others.

ACKs for top commit:
  S3RK:
    Code Review ACK d93b794709
  achow101:
    ACK d93b794709

Tree-SHA512: 0e5c4d13f060489405e6cf50c8a09911f5a0cee71023649235afd80a5e3aae38d52c6e12ad4660205b9357b09f45596941391bdcf6fceccbe07c4e5a1592a482
2024-07-09 20:09:07 -04:00
Ava Chow
10677713ca
Merge bitcoin/bitcoin#30396: random: add benchmarks and drop unnecessary Shuffle function
6ecda04fef random: drop ad-hoc Shuffle in favor of std::shuffle (Pieter Wuille)
da28a26aae bench random: benchmark more functions, and add InsecureRandomContext (Pieter Wuille)
0a9bbc64c1 random bench refactor: move to new bench/random.cpp (Pieter Wuille)

Pull request description:

  This adds benchmarks for various operations on `FastRandomContext` and `InsecureRandomContext`, and then removes the ad-hoc `Shuffle` functions, now that it appears that standard library `std::shuffle` has comparable performance. The other reason for keeping `Shuffle`, namely the fact that libstdc++ used self-move (which debug mode panics on) has been fixed as well (see https://github.com/bitcoin/bitcoin/pull/29625#discussion_r1658344049).

ACKs for top commit:
  achow101:
    ACK 6ecda04fef
  hodlinator:
    ACK 6ecda04fef
  dergoegge:
    Code review ACK 6ecda04fef

Tree-SHA512: 2560b7312410581ff2b9bd0716e0f1558d910b5eadb9544785c972384985ac0f11f72d6b2797cfe2e7eb71fa57c30cffd98cc009cb4ee87a18b1524694211417
2024-07-09 17:52:47 -04:00
Ava Chow
c51c694ede
Merge bitcoin/bitcoin#29431: test/BIP324: disconnection scenarios during v2 handshake
c9dacd958d test: Check that non empty version packet is ignored and no disconnection happens (stratospher)
997cc00b95 test: Check that disconnection happens when AAD isn't filled (stratospher)
b5e6238fdb test: Check that disconnection happens when garbage sent/received are different (stratospher)
ad1482d5a2 test: Check that disconnection happens when wrong garbage terminator is sent (stratospher)
e351576862 test: Check that disconnection happens when >4095 garbage bytes is sent (stratospher)
e075fd131d test: Introduce test types and modify v2 handshake function accordingly (stratospher)
7d07daa623 log: Add V2 handshake timeout (stratospher)
d4a1da8543 test: Make global TRANSPORT_VERSION variable an instance variable (stratospher)
c642b08c4e test: Log when the garbage is actually sent to transport layer (stratospher)
86cca2cba2 test: Support disconnect waiting for add_p2p_connection (stratospher)
bf9669af9c test: Rename early key response test and move random_bitflip to util (stratospher)

Pull request description:

  Add tests for the following v2 handshake scenarios:
  1. Disconnection happens when > `MAX_GARBAGE_LEN` bytes garbage is sent
  2. Disconnection happens when incorrect garbage terminator is sent
  3. Disconnection happens when garbage bytes are tampered with
  4. Disconnection happens when AAD of first encrypted packet after the garbage terminator is not filled
  5. bitcoind ignores non-empty version packet and no disconnection happens

  All these tests require a modified v2 P2P class (different from `EncryptedP2PState` used in `v2_p2p.py`) to implement our custom handshake behaviour based on different scenarios and have been kept in a single test file (`test/functional/p2p_v2_misbehaving.py`). Shifted the test in `test/functional/p2p_v2_earlykeyresponse.py` which is of the same pattern to this file too.

ACKs for top commit:
  achow101:
    ACK c9dacd958d
  mzumsande:
    ACK c9dacd958d
  theStack:
    Code-review ACK c9dacd958d

Tree-SHA512: 90df81f0c7f4ecf0a47762d290a618ded92cde9f83d3ef3cc70e1b005ecb16125ec39a9d80ce95f99e695d29abd63443240cb5490aa57c5bc8fa2e52149a0672
2024-07-09 16:37:27 -04:00
Ryan Ofsky
5239e935cf
Merge bitcoin/bitcoin#30329: fuzz: improve utxo_snapshot target
de71d4dece fuzz: improve utxo_snapshot target (Martin Zumsande)

Pull request description:

  Add the possibility of giving more guidance to the creation of the metadata and/or coins, so that the fuzzer gets the chance
  to reach more error conditions in ActivateSnapshot and sometimes successfully creates a valid snapshot.

  This also changes the asserts for the success case that were outdated (after #29370) and only didn't result in a crash because the fuzzer wasn't able to reach this code before.

ACKs for top commit:
  maflcko:
    re-ACK de71d4dece 🎆
  fjahr:
    utACK de71d4dece
  TheCharlatan:
    ACK de71d4dece

Tree-SHA512: 346974d594164544d8cd3df7d8362c905fd93116215e9f5df308dfdac55bab04d727bfd7fd001cf11318682d11ee329b4b4a43308124c04d64b67840ab8a58a0
2024-07-09 16:13:14 -04:00
Sebastian Falbesoner
16bd283b3a Reapply "test: p2p: check that connecting to ourself leads to disconnect"
This reverts commit 9ec2c53701 with
a tiny change included (identation of the wait_until call).
2024-07-09 21:36:35 +02:00
Sebastian Falbesoner
0dbcd4c148 net: prevent sending messages in NetEventsInterface::InitializeNode
Now that the queueing of the VERSION messages has been moved out of
`InitializeNode`, there is no need to pass a mutable `CNode` reference any
more. With a const reference, trying to send messages in this method would
lead to a compile-time error, e.g.:

----------------------------------------------------------------------------------------------------------------------------------
...
net_processing.cpp: In member function ‘virtual void {anonymous}::PeerManagerImpl::InitializeNode(const CNode&, ServiceFlags)’:
net_processing.cpp:1683:21: error: binding reference of type ‘CNode&’ to ‘const CNode’ discards qualifiers
 1683 |     PushNodeVersion(node, *peer);
...
----------------------------------------------------------------------------------------------------------------------------------
2024-07-09 21:36:35 +02:00
Sebastian Falbesoner
66673f1c13 net: fix race condition in self-connect detection
Initiating an outbound network connection currently involves the
following steps after the socket connection is established (see
 `CConnman::OpenNetworkConnection` method):
    1. set up node state
    2. queue VERSION message
    3. add new node to vector `m_nodes`

If we connect to ourself, it can happen that the sent VERSION message
(step 2) is received and processed locally *before* the node object
is added to the connection manager's `m_nodes` vector (step 3). In this
case, the self-connect remains undiscovered, as the detection doesn't
find the outbound peer in `m_nodes` yet (see `CConnman::CheckIncomingNonce`).

Fix this by swapping the order of 2. and 3., by taking the `PushNodeVersion`
call out of `InitializeNode` and doing that in the `SendMessages` method
instead, which is only called for `CNode` instances in `m_nodes`.

Thanks go to vasild, mzumsande, dergoegge and sipa for suggestions on
how to fix this.
2024-07-09 21:35:53 +02:00
Ryan Ofsky
c06b3764fe
Merge bitcoin/bitcoin#30395: rpc: Use untranslated error strings in loadtxoutset
fa5b8920be rpc: Use untranslated error strings in loadtxoutset (MarcoFalke)
fa45865778 refactor: Use named arguments to get path arg in loadtxoutset (MarcoFalke)

Pull request description:

  Motivation:
  * Some are not translated at all, anyway. See https://github.com/bitcoin/bitcoin/pull/30267#discussion_r1663631973
  * For others translation is not yet needed, because they are not called by the GUI (yet)
  * For others translations will never be needed, because they are RPC code. See https://github.com/bitcoin/bitcoin/pull/30267#discussion_r1663611194

  Also, while touching this:
  * Remove the trailing `\n`. See https://github.com/bitcoin/bitcoin/pull/30267#discussion_r1663647981
  * Add back the path. See https://github.com/bitcoin/bitcoin/pull/30267#discussion_r1663666751
  * Use named args to get the path.

ACKs for top commit:
  fjahr:
    re-ACK fa5b8920be
  tdb3:
    ACK fa5b8920be
  ryanofsky:
    Code review ACK fa5b8920be

Tree-SHA512: 46504dc5fd55a6274ef885dbe071aa9efb25bca247cd68cd86fb2ff066d70d295e0522e1fe42e63f1fdf7e4c89bd696220edaf06e33b804aba746492eafd852e
2024-07-09 15:11:54 -04:00
Greg Sanders
3f00aae140 package rbf: cpfp structure requires package > parent feerate 2024-07-09 13:18:04 -04:00
Greg Sanders
ad7f1f697f test package rbf boundary conditions more closely 2024-07-09 13:18:04 -04:00
glozow
09370529fb fuzz: mini_miner_selection fixups.
Delete asserts that are redundant with the == assert.
Add assertion that the coinbase isn't already in mock_template_txids.
2024-07-09 17:22:57 +01:00
glozow
de273d5300 MiniMiner: use FeeFrac in AncestorFeerateComparator
Comparing using FeeFracs is more precise, allows us to simply the
code since FeeFrac comparison internally does cross-multiplication,
and avoids potential overflow in the multiplication.

Previously, we were only comparing feerates up to 0.001sat/vB precision,
since CFeeRate comparison just looks at their respective nSatoshisPerK.
This could lead to MiniMiner selecting packages in the wrong order (i.e.
by txid) if their feerates were less than 0.001sat/vB different.
2024-07-09 17:22:51 +01:00
glozow
3c61cf3986 [doc] archive v26.2 release notes 2024-07-09 15:36:36 +01:00
glozow
79b8472040
Merge bitcoin/bitcoin#30393: refactor: use existing RNG object in ProcessGetBlockData
fa2e74879a net_processing: use existing RNG object in ProcessGetBlockData (MarcoFalke)

Pull request description:

  Small follow-up to commit 8e31cf9c9b

ACKs for top commit:
  dergoegge:
    Code review ACK fa2e74879a
  glozow:
    ACK fa2e74879a

Tree-SHA512: 12709c79e6eefad184609b7306e0f65cb00123e39636cf8b7d538feb25c05ba3c36aa41468886c904a5f44fea267e67f9c4fbbab8733753d1c891b90fa40ce8b
2024-07-09 14:38:03 +01:00
TheCharlatan
51fa26239a
refactor: Mark some static global vars as const
These were found while looking for static mutable state in the kernel
library.
2024-07-08 21:19:23 +02:00
TheCharlatan
39f9b80fba
refactor: De-globalize last notified header index
In future, users of the kernel library might run multiple chainstates in
parallel, or create and destroy multiple chainstates over the lifetime
of a process. Having static, mutable variables could lead to state
inconsistencies in these scenarios.
2024-07-08 21:19:22 +02:00
TheCharlatan
3443943f86
refactor: De-globalize validation benchmark timekeeping
In future, users of the kernel library might run multiple chainstates in
parallel, or create and destroy multiple chainstates over the lifetime
of a process. Having static, mutable variables could lead to state
inconsistencies in these scenarios.
2024-07-08 21:19:18 +02:00
Ryan Ofsky
1f9d30744d
Merge bitcoin/bitcoin#29855: psbt: Check non witness utxo outpoint early
9e13ccc50e psbt: Check non witness utxo outpoint early (Ava Chow)

Pull request description:

  A common issue that our fuzzers keep finding is that outpoints don't exist in the non witness utxos. Instead of trying to track this down and checking in various individual places, do the check early during deserialization. This also unifies the error message returned for this class of problems.

ACKs for top commit:
  maflcko:
    lgtm ACK 9e13ccc50e
  S3RK:
    tACK 9e13ccc50e
  dergoegge:
    utACK 9e13ccc50e

Tree-SHA512: 81b8055b146c6358052226578ddfec0ae5bd877968c7f4f62dc3d6a684545ea568f37c7f1bd619918441af9e453ba8b26531a2280d218da37fa15480f1b45d0e
2024-07-08 13:56:52 -04:00
Ryan Ofsky
94d56b9def
Merge bitcoin/bitcoin#30141: kernel: De-globalize validation caches
606a7ab862 kernel: De-globalize signature cache (TheCharlatan)
66d74bfc45 Expose CSignatureCache class in header (TheCharlatan)
021d38822c kernel: De-globalize script execution cache hasher (TheCharlatan)
13a3661aba kernel: De-globalize script execution cache (TheCharlatan)
ab14d1d6a4 validation: Don't error if maxsigcachesize exceeds uint32::max (TheCharlatan)

Pull request description:

  The validation caches are currently setup independently from where the rest of the validation code is initialized. This makes their ownership semantics unclear. There is also no clear enforcement on when and in what order they need to be initialized. The caches are always initialized in the `BasicTestingSetup` although a number of tests don't actually need them.

  Solve this by moving the caches from global scope into the `ChainstateManager` class. This simplifies the usage of the kernel library by no longer requiring manual setup of the caches prior to using the `ChainstateManager`. Tests that need to access the caches can instantiate them independently.

  ---
  This pull request is part of the [libbitcoinkernel project](https://github.com/bitcoin/bitcoin/issues/27587).

ACKs for top commit:
  stickies-v:
    re-ACK 606a7ab862
  glozow:
    reACK 606a7ab
  ryanofsky:
    Code review ACK 606a7ab862. Just small formatting, include, and static_assert changes since last review.

Tree-SHA512: e7f3ee41406e3b233832bb67dc3a63c4203b5367e5daeed383df9cb590f227fcc62eae31311029c077d5e81b273a37a88a364db3dee2efe91bb3b9c9ddc8a42e
2024-07-08 12:14:12 -04:00
Sebastian Falbesoner
29eafd5733 rpc: doc: use "output script" terminology consistently in "asm"/"hex" results
The wording "public key script" was likely chosen as a human-readable form of
the technical term `scriptPubKey`, but it doesn't seem to be really widespread.
Replace it by the more common term "output script" instead. Note that the
argument for the `decodescript` RPC is not necessarily an output script (it
could e.g. be also a redeem script), so in this case we just stay generic and
use "script".

See also the draft BIP "Terminology for Transaction Components"
(https://github.com/murchandamus/bips/blob/2022-04-tx-terminology/bip-tx-terminology.mediawiki)
which suggests to use "output script" as well.

Affects the help text of the following RPCs:
    - decodepsbt
    - decoderawtransaction
    - decodescript
    - getblock (if verbosity=3)
    - getrawtransaction (if verbosity=2,3)
    - gettxout
2024-07-08 17:21:55 +02:00
merge-script
1c11089c7f
Merge bitcoin/bitcoin#30263: build: Bump clang minimum supported version to 16
fa8f53273c refactor: Remove no longer needed clang-15 workaround for std::span (MarcoFalke)
9999dbc1bd fuzz: Clarify Apple-Clang-16 workaround (MarcoFalke)
fa7462c67a build: Bump clang minimum supported version to 16 (MarcoFalke)

Pull request description:

  Most supported operating systems ship with clang-16 (or later), so bump the minimum to that and allow new code to drop workarounds for previous clang bugs.

  For reference:
  * https://packages.debian.org/bookworm/clang-16
  * https://packages.ubuntu.com/noble/clang (clang-18)
  * CentOS-like 8/9 Stream: All Clang versions from 16 to 17
  * FreeBSD 12/13: All Clang versions from 16 to 18
  * OpenSuse Tumbleweed ships with https://software.opensuse.org/package/clang (`clang18`); No idea about OpenSuse Leap

  On operating systems where the clang version is not shipped by default, the user would have to use GCC, or install clang in a different way. For example:

  * https://packages.debian.org/bookworm/g++ (g++-12)
  * https://packages.ubuntu.com/jammy/g++ (g++-11)
  * https://apt.llvm.org/, or nix, or guix, or compile clang from source, ...

  **Ubuntu 22.04 LTS does not ship with clang-16**, so one of the above workarounds is needed there.

  macOS 13 is unaffected, and the previous minimum requirement of Xcode15.0 remains, see also b1ba1b178f/.github/workflows/ci.yml (L93). For macOS 11 (Big Sur) and 12 (Monterey) you need to install a more recent version of llvm, this remains unchanged as well, see b1ba1b178f/doc/build-osx.md (L54).

ACKs for top commit:
  hebasto:
    ACK fa8f53273c, I have reviewed the code and it looks OK.
  TheCharlatan:
    Re-ACK fa8f53273c
  stickies-v:
    ACK fa8f53273c

Tree-SHA512: 18b79f88301a63bb5e367d2f52fffccd5fb84409061800158e51051667f6581a4cd71d4859d4cfa6d23e47e92963ab637e5ad87e3170ed23b5bebfbe99e759e2
2024-07-08 16:20:17 +01:00
glozow
a83f050dbe
Merge bitcoin/bitcoin#30404: Use WITH_LOCK in Warnings::Set
6af51e8198 Use WITH_LOCK in Warnings::Set (Ava Chow)

Pull request description:

  The scope of the lock should be limited to just guarding m_warnings as anything listening on `NotifyAlertChanged` may execute code that requires the lock as well.

  Fixes #30400

ACKs for top commit:
  maflcko:
    lgtm ACK 6af51e8198
  TheCharlatan:
    ACK 6af51e8198
  glozow:
    ACK 6af51e8198
  willcl-ark:
    ACK 6af51e8198
  stickies-v:
    ACK 6af51e8198

Tree-SHA512: 9884046c70dcad996276931b6d154f0330200332403828f34f7f7b285fc0e770ba7b25056131ab24dcb8a4b18f58d31633aa17fbb09b0eaea8a29e28fca10ec4
2024-07-08 15:50:46 +01:00
Ryan Ofsky
e53a3fb9b1
Merge bitcoin/bitcoin#30355: wallet: use LogTrace for walletdb log messages at trace level
46819f5df6 wallet: use LogTrace for walletdb log messages at trace level (Anthony Towns)

Pull request description:

  Wallet sqlite logging is enabled by `-debug=walletdb -loglevel=walletdb:trace` however the actual log messages are sent at `BCLog::Level::Info`. Switch to the trace level to make this consistent. This adds `[walletdb:trace]` to the log output, eg:

  ```
  [httpworker.3] [wallet/sqlite.cpp:55] [TraceSqlCallback] [/tmp/bitcoin_func_test_4fsnatpg/node0/regtest/wallets/boring/wallet.dat] SQLite Statement: BEGIN EXCLUSIVE TRANSACTION
  ```

  becomes

  ```
  [httpworker.0] [wallet/sqlite.cpp:55] [TraceSqlCallback] [walletdb:trace] [/tmp/bitcoin_func_test_9lcwth4z/node0/regtest/wallets/boring/wallet.dat] SQLite Statement: BEGIN EXCLUSIVE TRANSACTION
  ```

ACKs for top commit:
  maflcko:
    ACK 46819f5df6
  ryanofsky:
    Code review ACK 46819f5df6. Nice catch!
  furszy:
    ACK 46819f5df6
  luke-jr:
    utACK 46819f5df6

Tree-SHA512: 6fc1bc63c2ee686d4ca8f4f558f06c0cd9e7813b5fce1588351f55ef8bedfc23c97ea443e54a6a447008fa79ea022b6d631cb010929932f1db23fa8e255e6482
2024-07-08 10:26:24 -04:00
MarcoFalke
fa690c8e53
test: [refactor] Pass TestOpts 2024-07-08 16:11:15 +02:00
MarcoFalke
3333bae9b2
tidy: modernize-use-equals-default 2024-07-08 11:12:01 +02:00
Ava Chow
6af51e8198 Use WITH_LOCK in Warnings::Set
The scope of the lock should be limited to just guarding m_warnings as
anything listening on `NotifyAlertChanged` may execute code that
requires the lock as well.
2024-07-06 13:00:53 -04:00
Luke Dashjr
b71bfd9eef GUI/OptionsDialog: Prefer to stretch actual options area rather than waste space 2024-07-06 16:00:26 +00:00
Pieter Wuille
6ecda04fef random: drop ad-hoc Shuffle in favor of std::shuffle
Benchmarks show it is no longer faster with modern standard C++ libraries,
and the debug-mode failure due to self-move has been fixed as well.
2024-07-06 09:06:36 -04:00
Pieter Wuille
da28a26aae bench random: benchmark more functions, and add InsecureRandomContext
Also rename the benchmark names to match the operation names
2024-07-06 09:06:01 -04:00
Hodlinator
e233ec036d
refactor: Use designated initializer
Block was recently touched (e2d1f84858) and the codebase recently switched to C++20 which allows this to improve robustness.
2024-07-05 22:04:58 +02:00
MarcoFalke
fa5b8920be
rpc: Use untranslated error strings in loadtxoutset 2024-07-05 17:55:50 +02:00
MarcoFalke
fa2e74879a
net_processing: use existing RNG object in ProcessGetBlockData
Minor follow-up to 8e31cf9c9b, which did
the same.
2024-07-05 16:59:31 +02:00
Pieter Wuille
0a9bbc64c1 random bench refactor: move to new bench/random.cpp 2024-07-05 09:51:26 -04:00
Alfonso Roman Zubeldia
5b7f70ba26 test: loadtxoutset in divergent chain with less work 2024-07-05 12:08:06 +02:00
MarcoFalke
fa45865778
refactor: Use named arguments to get path arg in loadtxoutset 2024-07-05 11:07:07 +02:00
TheCharlatan
606a7ab862
kernel: De-globalize signature cache
Move its ownership to the ChainstateManager class.

Next to simplifying usage of the kernel library by no longer requiring
manual setup of the cache prior to using validation code, it also slims
down the amount of memory allocated by BasicTestingSetup.

Use this opportunity to make SignatureCache RAII styled

Co-authored-by: Ryan Ofsky <ryan@ofsky.org>
2024-07-05 09:03:04 +02:00
Martin Zumsande
de71d4dece fuzz: improve utxo_snapshot target
Add the possibility of giving more guidance to the creation of the
metadata and/or coins, so that the fuzzer gets the chance
to reach more error conditions in ActivateSnapshot and sometimes
successfully creates a valid snapshot.

This also changes the asserts for the success case that were outdated,
and only didn't result in a crash because the fuzzer wasn't able
to reach this code before.
2024-07-04 20:12:47 -04:00
TheCharlatan
66d74bfc45
Expose CSignatureCache class in header
This is done in preparation for the following commit. Also rename it to
SignatureCache.
2024-07-04 22:45:27 +02:00
TheCharlatan
021d38822c
kernel: De-globalize script execution cache hasher
Move it to the ChainstateManager class.
2024-07-04 22:45:25 +02:00
TheCharlatan
13a3661aba
kernel: De-globalize script execution cache
Move its ownership to the ChainstateManager class.

Next to simplifying usage of the kernel library by no longer requiring
manual setup of the cache prior to using validation code, it also slims
down the amount of memory allocated by BasicTestingSetup.
2024-07-04 22:39:37 +02:00
TheCharlatan
ab14d1d6a4
validation: Don't error if maxsigcachesize exceeds uint32::max
Instead clamp it to uint32::max if it exceeds it.

Co-authored-by: Anthony Towns <aj@erisian.com.au>
2024-07-04 22:35:29 +02:00
Cory Fields
261f770333 contrib: rename cc to cxx in binary checking scripts 2024-07-04 20:16:16 +00:00
Cory Fields
a38c960005 contrib: use c++ rather than c for binary tests
We don't actually use a c compiler as part of Core's build (only for secp).
We should be testing against what we're actually using instead.
2024-07-04 20:16:16 +00:00
brunoerg
4383dc90ba fuzz: fix key size in crypter target
Set a max length for some previous
`ConsumeRandomLengthByteVector` usage.
2024-07-04 11:33:11 -03:00
merge-script
bd5d1688b4
Merge bitcoin/bitcoin#29835: depends: build libevent with CMake
f59e9057e2 depends: switch libevent to CMake (Cory Fields)

Pull request description:

  Switches libevent in depends to be built with CMake.

ACKs for top commit:
  TheCharlatan:
    ACK f59e9057e2
  willcl-ark:
    ACK f59e9057e2

Tree-SHA512: 875bf9bc57653c78775a1f8192a2c964fea8f4490d733ff796d9efb00e786f0ca9a7c1a3fd610cda032273c4f2ae06394585b03567d5f241ab073c83a47cf927
2024-07-04 14:28:16 +01:00
glozow
aa61d4feb0
Merge bitcoin/bitcoin#30388: validation: Check if mempool exists before size check in ActivateSnapshot
33c48c106c validation: Check if mempool exists before asserting in ActivateSnapshot (TheCharlatan)

Pull request description:

  The mempool is an optional component of the chainstate manager, so don't assume its presence and instead check if it is there first.

ACKs for top commit:
  maflcko:
    re-ACK 33c48c106c
  fjahr:
    ACK 33c48c106c

Tree-SHA512: 7a3568d5b7af45efa7bf54bae7bac1f00dc99bc9d47a744d73594f283c952be9500168f680d72f4aee09761da4e878ddca83ba675cdea8ee9e44eeff00ac09da
2024-07-04 14:23:54 +01:00
merge-script
5c0cd205a1
Merge bitcoin/bitcoin#29625: Several randomness improvements
ce8094246e random: replace construct/assign with explicit Reseed() (Pieter Wuille)
2ae392d561 random: use LogError for init failure (Pieter Wuille)
97e16f5704 tests: make fuzz tests (mostly) deterministic with fixed seed (Pieter Wuille)
2c91330dd6 random: cleanup order, comments, static (Pieter Wuille)
8e31cf9c9b net, net_processing: use existing RNG objects more (Pieter Wuille)
d5fcbe966b random: improve precision of MakeExponentiallyDistributed (Pieter Wuille)
cfb0dfe2cf random: convert GetExponentialRand into rand_exp_duration (Pieter Wuille)
4eaa239dc3 random: convert GetRand{Micros,Millis} into randrange (Pieter Wuille)
82de1b80d9 net: use GetRandMicros for cache expiration (Pieter Wuille)
ddc184d999 random: get rid of GetRand by inlining (Pieter Wuille)
e2d1f84858 random: make GetRand() support entire range (incl. max) (Pieter Wuille)
810cdf6b4e tests: overhaul deterministic test randomness (Pieter Wuille)
6cfdc5b104 random: convert XoRoShiRo128PlusPlus into full RNG (Pieter Wuille)
8cc2f45065 random: move XoRoShiRo128PlusPlus into random module (Pieter Wuille)
8f5ac0d0b6 xoroshiro128plusplus: drop comment about nonexisting copy() (Pieter Wuille)
8924f5120f random: modernize XoRoShiRo128PlusPlus a bit (Pieter Wuille)
ddb7d26cfd random: add RandomMixin::randbits with compile-known bits (Pieter Wuille)
21ce9d8658 random: Improve RandomMixin::randbits (Pieter Wuille)
9b14d3d2da random: refactor: move rand* utilities to RandomMixin (Pieter Wuille)
40dd86fc3b random: use BasicByte concept in randbytes (Pieter Wuille)
27cefc7fd6 random: add a few noexcepts to FastRandomContext (Pieter Wuille)
b3b382dde2 random: move rand256() and randbytes() to .h file (Pieter Wuille)
493a2e024e random: write rand256() in function of fillrand() (Pieter Wuille)

Pull request description:

  This PR contains a number of vaguely-related improvements to the random module.

  The specific changes and more detailed rationale is in the commit messages, but the highlights are:

  * `XoRoShiRo128PlusPlus` (previously a test-only RNG) moves to random.h and becomes `InsecureRandomContext`, which is even faster than `FastRandomContext` but non-cryptographic. It also gets all helper randomness functions (`randrange`, `fillrand`, ...), making it a lot more succinct to use.
  * During tests, **all** randomness is made deterministic (except for `GetStrongRandBytes`) but non-repeating (like `GetRand()` used to be when `g_mock_deterministic_tests` was used), either fixed, or from a random seed (overridden by env var).
  * Several infrequently used top-level functions (`GetRandMillis`, `GetRandMicros`, `GetExponentialRand`) are converted into member functions of `FastRandomContext` (and `InsecureRandomContext`).
  * `GetRand<T>()` (without argument) can now return the maximum value of the type (previously e.g. `GetRand<uint32_t>()` would never return 0xffffffff).

ACKs for top commit:
  achow101:
    ACK ce8094246e
  maflcko:
    re-ACK ce8094246e 🐈
  hodlinator:
    ACK ce8094246e
  dergoegge:
    utACK ce8094246e

Tree-SHA512: 79bc0cbafaf27e95012c1ce2947a8ca6f9a3c78af5f1f16e69354b6fc9b987a28858adf4cd356dc5baf21163e9af8dcc24e70f8d7173be870e8a3ddcdd47c02c
2024-07-04 11:26:43 +01:00
TheCharlatan
33c48c106c
validation: Check if mempool exists before asserting in ActivateSnapshot 2024-07-04 09:57:56 +02:00
Anthony Towns
6bbc2dd6c5 logging: Add thread safety annotations 2024-07-04 01:52:26 +10:00
merge-script
3714692644
Merge bitcoin/bitcoin#30380: lint: Ignore files ignored by git in the Markdown Link Checker
dea7afd5e4 lint: remove unneeded trailing line fix (willcl-ark)
4d942547a8 lint: ignore files ignored by git in mlc (willcl-ark)

Pull request description:

  Updating to MLC v0.18.0 includes a new feature which will ignore all files ignored by git: `mlc --gitignore`.

  This helps avoid false-positives flagged by this linter in non-project files, such as a developer might expect to have in their working directory (e.g. guix-builds, python venvs, etc.)

Top commit has no ACKs.

Tree-SHA512: 1752448e0c85abd3c73570a17cc69294de2248d7773c6499833ae33806f6c03f3f345261aa7b855a557b45982fbdcb8190e758d087c43b4fb0254fbb39173432
2024-07-03 11:42:32 +01:00