Commit graph

44387 commits

Author SHA1 Message Date
MarcoFalke
fa2b529f92
refactor: Remove redundant call to IsArgSet
Checking for IsArgSet before calling GetArg while providing an arbitrary
default value as fallback is both confusing and fragile.

It is confusing, because the provided fallback is dead code. So it would
be better to just call GetArg without a fallback.

Even better would be to provide the true fallback value and sanitize it
as if it were user-input, but this can be done in a follow-up.

Removing the redundant call to IsArgSet will have to be done either way,
so do it now.
2025-03-25 10:38:00 +01:00
MarcoFalke
fa29842c1f
refactor: Remove IsArgSet guard when fallback value is provided
Checking for IsArgSet before calling GetArg while providing the args
default value as fallback is both confusing and fragile.

It is confusing, because the provided fallback is dead code. So it would
be better to just call GetArg without a fallback.

However, ignoring the fallback value is fragile, because it would not be
sanitized.

Fix all issues by sanitizing the fallback value.
2025-03-25 10:37:42 +01:00
MarcoFalke
fa5674c264
fuzz: Fix off-by-one in package_rbf target 2025-03-25 09:38:25 +01:00
Ryan Ofsky
1d281daf86
Merge bitcoin/bitcoin#32095: doc: clarify that testnet min-difficulty is not optional
Some checks are pending
CI / test each commit (push) Waiting to run
CI / macOS 14 native, arm64, no depends, sqlite only, gui (push) Waiting to run
CI / macOS 14 native, arm64, fuzz (push) Waiting to run
CI / Win64 native, VS 2022 (push) Waiting to run
CI / Win64 native fuzz, VS 2022 (push) Waiting to run
CI / ASan + LSan + UBSan + integer, no depends, USDT (push) Waiting to run
288481aabd doc: clarify that testnet min-difficulty is not optional (Sjors Provoost)

Pull request description:

  When 20 minutes have gone by on testnet3 or testnet4, the next block `MUST` have difficulty 1. I've seen people be confused about this several times now in recent months. It doesn't help that the code comment is wrong. So fixing that.

  The reason is that `nBits` must match exactly:

  e568c1dd13/src/validation.cpp (L4212-L4215)

ACKs for top commit:
  fjahr:
    ACK 288481aabd
  kevkevinpal:
    ACK [288481a](288481aabd)

Tree-SHA512: 17d426301f386fa5810cceedfdb20a3523ab3ac2f17257ca7a525edd869fa409b150eff4cc258b27adecd0ded1c18ff48a9998fc9caed2faa461e410d4c5a884
2025-03-24 17:40:03 -04:00
Ryan Ofsky
a0d737cd7a
Merge bitcoin/bitcoin#32073: net: Block v2->v1 transport downgrade if !fNetworkActive
6869fb4170 net: Block v2->v1 transport downgrade if !CConnman::fNetworkActive (Hodlinator)

Pull request description:

  We might have just set `CNode::fDisconnect` in the first loop because of `!CConnman::fNetworkActive`.

  Attempting to reconnect using v1 transport just because `fNetworkActive` was set to `false` at the "right" stage in the v2 handshake does not make sense.

  Issue [discovered](https://github.com/bitcoin/bitcoin/pull/31633#discussion_r1930908304) by davidgumberg.

ACKs for top commit:
  davidgumberg:
    Tested and Reviewed ACK 6869fb4170
  mabu44:
    ACK 6869fb4170
  stratospher:
    ACK 6869fb4. I've reviewed the code but don't have strong preference for this branch vs master since only functional change is just a single log not being printed in a low probability scenario (we happen to be attempting v2 connection when P2P network activity is being turned off).
  vasild:
    ACK 6869fb4170

Tree-SHA512: 54f596e54c5a6546f2c3fec2609aa8d10dec3adcf1001ca16666d8b374b8d79d64397f46c90d9b3915b4e91a5041b6ced3044fd2a5b4fb4aa7282eb51f61296a
2025-03-24 16:54:40 -04:00
Ryan Ofsky
b3162d10ea
Merge bitcoin/bitcoin#31656: test: Add expected result assertions
a015b7e13d test: Add expected result assertions (yancy)

Pull request description:

  ~This is a trivial addition to the test suit, however it shouldn't be required to add debug statements and manually run the tests if someone needs to know the results of this test.~

  Add an assertion for the values returned. The goal of the test is to show that a minimal weight selection of UTXOs is returned by coin-grinder. Since there are multiple possible solutions, the added assertion shows that coin-grinder finds the solution with the lowest weight.  Without this assertion, it's ambiguous whether or not coin-grinder is returning the solution with the lowest weight.

  Remove the check that a result is returned since the expected result assertion implies a result.

ACKs for top commit:
  janb84:
    re ACK [a015b7e](a015b7e13d)
  murchandamus:
    ACK a015b7e13d

Tree-SHA512: ee3c2688b4a4a07ab209f7655c3956e62a1084419df5e87c27d751a38ff64d4c3457df2317f8077149a6947cdb05b249975de2b8f0e18ca8b17b41f4735fb1c6
2025-03-24 16:07:30 -04:00
Ryan Ofsky
5f3848c63b
Merge bitcoin/bitcoin#31278: wallet, rpc: deprecate settxfee and paytxfee
2f2ab47bf7 Release notes (Pol Espinasa)
bf194c920c wallet, rpc: deprecate settxfee and paytxfee (Pol Espinasa)

Pull request description:

  **Summary**

  This PR deprecates the settxfee RPC and paytxfee setting, marking it for removal in Bitcoin Core 31.0.

  **Motivation**

  The PR was initially motivated by https://github.com/bitcoin/bitcoin/issues/31088. The intention was to create a new function `settxfeerate` to allow users to set a static fee rate in `sat/vB` instead of `btc/kvB`.

  The `settxfee` RPC allows users to set a static fee rate for all transactions created by the wallet. However, in a dynamic fee environment, this can lead to poor fee choices, either overpaying when the mempool is empty or underpaying when congestion is high. The preferred approach is to rely on fee estimation, which is designed to adapt to network conditions, and is the one by default. Same argument apply for `paytxfee` setting.

  During discussion the consensus was that static fee settings are a footgun and that users should instead specify the fee rate per transaction if they don't want to rely on the fee estimation. Given this, rather than introducing a `settxfeerate` alternative, this PR goes towards removing `settxfee` and `paytxfee` entirely.

  **Key Changes**

  `settxfee` and `paytxfee` is now deprecated and will be removed in Bitcoin Core 31.0.
  Users should rely on fee estimation or explicitly specify a fee rate when constructing transactions.

  **Impact on Users**

  If users currently use settxfee or paytxfee, they should transition to specifying fees per transaction.
  No immediate breakage in 30.0 (must use `-deprecatedrpc=settxfee`), but `settxfee` and `paytxfee` will be removed in 31.0.

  **Alternative Approaches Considered**

  A settxfeerate alternative (using sat/vB) was initially proposed but ultimately rejected in favor of deprecating static fee setting entirely.

  **Notes for removal**
  - When removing paytxfee we should also update txconfirmtarget startup option help text.
  - Get back the comment from `rpc_deprecated.py` test. [+info](https://github.com/bitcoin/bitcoin/pull/31278#discussion_r1998876768)

ACKs for top commit:
  fjahr:
    re-ACK 2f2ab47bf7
  ismaelsadeeq:
    re-ACK 2f2ab47bf7
  rkrux:
    Concept and utACK 2f2ab47bf7

Tree-SHA512: 0272812cbe5a519737c5d0683acc2072e67559792b4a6472bca8b23426e5ce9e88a3a1eba987feda70a082b8b474b3126893848628d7bf11e1520357b18c8d3e
2025-03-24 13:40:31 -04:00
ismaelsadeeq
329a0dcdaf
doc: clarify the documentation of Assume 2025-03-24 15:28:41 +01:00
Hennadii Stepanov
fb2b05b125
build: Remove bitness suffix from Windows installer
Since support for 32-bit Windows has been dropped, the suffix is no
longer necessary.
2025-03-24 14:19:11 +00:00
Pieter Wuille
b2ea365648 txgraph: Add Get{Ancestors,Descendants}Union functions (feature)
Like GetAncestors and GetDescendants, but for the union of multiple inputs.
2025-03-24 10:03:06 -04:00
Pieter Wuille
54bceddd3a txgraph: Multiple inputs to Get{Ancestors,Descendant}Refs (preparation)
This is a preparation for the next commit, which adds a feature to request
the Refs to multiple ancestors/descendants at once.
2025-03-24 10:03:06 -04:00
Pieter Wuille
aded047019 txgraph: Add CountDistinctClusters function (feature) 2025-03-24 10:03:06 -04:00
Pieter Wuille
b685d322c9 txgraph: Add DoWork function (feature)
This can be called when the caller has time to spend now, and wants future operations
to be fast.
2025-03-24 10:03:06 -04:00
Pieter Wuille
295a1ca8bb txgraph: Expose ability to compare transactions (feature)
In order to make it possible for higher layers to compare transaction quality
(ordering within the implicit total ordering on the mempool), expose a comparison
function and test it.
2025-03-24 10:03:06 -04:00
Pieter Wuille
22c68cd153 txgraph: Allow Refs to outlive the TxGraph (feature) 2025-03-24 10:03:06 -04:00
Pieter Wuille
82fa3573e1 txgraph: Destroying Ref means removing transaction (feature)
Before this commit, if a TxGraph::Ref object is destroyed, it becomes impossible
to refer to, but the actual corresponding transaction node in the TxGraph remains,
and remains indefinitely as there is no way to remove it.

Fix this by making the destruction of TxGraph::Ref trigger immediate removal of
the corresponding transaction in TxGraph, both in main and staging if it exists.
2025-03-24 10:03:06 -04:00
Pieter Wuille
6b037ceddf txgraph: Cache oversizedness of graphs (optimization) 2025-03-24 10:03:06 -04:00
Pieter Wuille
8c70688965 txgraph: Add staging support (feature)
In order to make it easy to evaluate proposed changes to a TxGraph, introduce a
"staging" mode, where mutators (AddTransaction, AddDependency, RemoveTransaction)
do not modify the actual graph, but just a staging version of it. That staging
graph can then be commited (replacing the main one with it), or aborted (discarding
the staging).
2025-03-24 10:03:05 -04:00
Pieter Wuille
c99c7300b4 txgraph: Abstract out ClearLocator (refactor)
Move a number of related modifications to TxGraphImpl into a separate
function for removal of transactions. This is preparation for a later
commit where this will be useful in more than one place.
2025-03-24 10:01:51 -04:00
Pieter Wuille
34aa3da5ad txgraph: Group per-graph data in ClusterSet (refactor)
This is a preparation for a next commit where a TxGraph will start representing
potentially two distinct graphs (a main one, and a staging one with proposed
changes).
2025-03-24 10:01:51 -04:00
Pieter Wuille
36dd5edca5 txgraph: Special-case removal of tail of cluster (Optimization)
When transactions are removed from the tail of a cluster, we know the existing
linearization remains acceptable (if it already was), but may just need splitting
and postlinearization, so special case these into separate quality levels.
2025-03-24 10:01:51 -04:00
Pieter Wuille
5801e0fb2b txgraph: Delay chunking while sub-acceptable (optimization)
Chunk-based information (primarily, chunk feerates) are never accessed without
first bringing the relevant Clusters to an "acceptable" quality level. Thus,
while operations are ongoing and Clusters are not acceptable, we can omit
computing the chunkings and chunk feerates for Clusters.
2025-03-24 10:01:51 -04:00
Pieter Wuille
57f5499882 txgraph: Avoid looking up the same child cluster repeatedly (optimization)
Since m_deps_to_add has been sorted by child Cluster* already, all dependencies
with the same child will be processed consecutively. Take advantage of this by
remember the last partition merged with, and reusing that if applicable.
2025-03-24 10:01:51 -04:00
Pieter Wuille
1171953ac6 txgraph: Avoid representative lookup for each dependency (optimization)
The m_deps_to_add vector is sorted by child Cluster*, which matches the
order of an_clusters. This means we can walk through m_deps_to_add while
doing the representative lookups for an_clusters, and reuse them.
2025-03-24 10:01:51 -04:00
Pieter Wuille
64f69ec8c3 txgraph: Make max cluster count configurable and "oversize" state (feature)
Instead of leaving the responsibility on higher layers to guarantee that
no connected component within TxGraph (a barely exposed concept, except through
GetCluster()) exceeds the cluster count limit, move this responsibility to
TxGraph itself:
* TxGraph retains a cluster count limit, but it becomes configurable at construction
  time (this primarily helps with testing that it is properly enforced).
* It is always allowed to perform mutators on TxGraph, even if they would cause the
  cluster count limit to be exceeded. Instead, TxGraph exposes an IsOversized()
  function, which queries whether it is in a special "oversize" state.
* During oversize state, many inspectors are unavailable, but mutators remain valid,
  so the higher layer can "fix" the oversize state before continuing.
2025-03-24 10:01:51 -04:00
Pieter Wuille
1d27b74c8e txgraph: Add GetChunkFeerate function (feature)
This adds a function to query the chunk feerate of a transaction, by caching it
inside the Entry objects.
2025-03-24 10:00:26 -04:00
Pieter Wuille
c80aecc24d txgraph: Avoid per-group vectors for clusters & dependencies (optimization)
Instead construct a single vector with the list of all clusters in all groups,
and then store per-group offset/range in that list.

For dependencies, reuse m_deps_to_add, and store offset/range into that.
2025-03-24 09:49:49 -04:00
Pieter Wuille
ee57e93099 txgraph: Add internal sanity check function (tests)
To make testing more powerful, expose a function to perform an internal sanity
check on the state of a TxGraph. This is especially important as TxGraphImpl
contains many redundantly represented pieces of information:

* graph contains clusters, which refer to entries, but the entries refer back
* graph maintains pointers to Ref objects, which point back to the graph.

This lets us make sure they are always in sync.
2025-03-24 09:49:49 -04:00
Pieter Wuille
05abf336f9 txgraph: Add simulation fuzz test (tests)
This adds a simulation fuzz test for txgraph, by comparing with a naive
reimplementation that models the entire graph as a single DepGraph, and
clusters in TxGraph as connected components within that DepGraph.
2025-03-24 09:49:49 -04:00
Pieter Wuille
8ad3ed2681 txgraph: Add initial version (feature)
This adds an initial version of the txgraph module, with the TxGraph class.
It encapsulates knowledge about the fees, sizes, and dependencies between all
mempool transactions, but nothing else.

In particular, it lacks knowledge about txids, inputs, outputs, CTransactions,
... and so forth. Instead, it exposes a generic TxGraph::Ref type to reference
nodes in the TxGraph, which can be passed around and stored by layers on top.
2025-03-24 09:49:46 -04:00
Pieter Wuille
6eab3b2d73 feefrac: Introduce tagged wrappers to distinguish vsize/WU rates 2025-03-24 09:34:54 -04:00
Pieter Wuille
d449773899 scripted-diff: (refactor) ClusterIndex -> DepGraphIndex
Since cluster_linearize.h does not actually have a Cluster type anymore, it is more
appropriate to rename the index type to DepGraphIndex.

-BEGIN VERIFY SCRIPT-
sed -i 's/Data type to represent transaction indices in clusters./Data type to represent transaction indices in DepGraphs and the clusters they represent./' $(git grep -l 'using ClusterIndex')
sed -i 's|\<ClusterIndex\>|DepGraphIndex|g' $(git grep -l 'ClusterIndex')
-END VERIFY SCRIPT-
2025-03-24 09:34:54 -04:00
Pieter Wuille
bfeb69f6e0 clusterlin: Make IsAcyclic() a DepGraph member function
... instead of being a separate test-only function.

Also add a fuzz test for it returning false.
2025-03-24 09:34:54 -04:00
Pieter Wuille
0aa874a357 clusterlin: Add FixLinearization function + fuzz test
This function takes an existing ordering for transactions in a DepGraph, and
makes it a valid linearization for it (i.e., topological). Any topological
prefix of the input remains untouched.
2025-03-24 09:34:54 -04:00
Sebastian Falbesoner
8284229a28 refactor: deduplicate anchor witness program bytes (0x4e,0x73)
Co-authored-by: Gregory Sanders <gsanders87@gmail.com>
2025-03-23 21:58:39 +01:00
Sebastian Falbesoner
41f2f058d0 test: add missing segwitv1 test cases to script_standard_tests 2025-03-23 21:58:36 +01:00
Ryan Ofsky
770d39a376
Merge bitcoin/bitcoin#31887: CLI cleanups
Some checks are pending
CI / test each commit (push) Waiting to run
CI / macOS 14 native, arm64, no depends, sqlite only, gui (push) Waiting to run
CI / macOS 14 native, arm64, fuzz (push) Waiting to run
CI / Win64 native, VS 2022 (push) Waiting to run
CI / Win64 native fuzz, VS 2022 (push) Waiting to run
CI / ASan + LSan + UBSan + integer, no depends, USDT (push) Waiting to run
d423fd9ec8 cli, bugfix: for -getinfo, replace IsArgSet() with GetBoolArg() (Jon Atack)
e99e41b307 cli, refactor: simplify public-only classes with structs (Jon Atack)
fdbfd250fb cli, refactor: deduplicate NetworkStringToId() (Jon Atack)
be82139b2a cli, refactor: simplify DetailsRequested() (Jon Atack)

Pull request description:

  These have been accumulating over the past few years.

  Each is described in its commit message.

ACKs for top commit:
  pablomartin4btc:
    re-ACK d423fd9ec8
  hodlinator:
    Code review ACK d423fd9ec8
  l0rinc:
    ACK d423fd9ec8
  ryanofsky:
    Code review ACK d423fd9ec8, just running clang-format and updating commit messages since last review

Tree-SHA512: a8e5f7827cef308186d5a7c3a627d2cd8f57437f4465d181986e5d3274ff0e2b9faac252dd55d9257d66a7aa99fca62b3000cdc0988d23385df20ff1f870a046
2025-03-23 12:41:08 -04:00
Ryan Ofsky
a203928693
Merge bitcoin/bitcoin#30538: Doc: add a comment referencing past vulnerability next to where it was fixed
Some checks are pending
CI / test each commit (push) Waiting to run
CI / macOS 14 native, arm64, no depends, sqlite only, gui (push) Waiting to run
CI / macOS 14 native, arm64, fuzz (push) Waiting to run
CI / Win64 native, VS 2022 (push) Waiting to run
CI / Win64 native fuzz, VS 2022 (push) Waiting to run
CI / ASan + LSan + UBSan + integer, no depends, USDT (push) Waiting to run
eb0724f0de doc: banman: reference past vuln due to unbounded banlist (Antoine Poinsot)
ad616b6c01 doc: net: mention past vulnerability as rationale to limit incoming message size (Antoine Poinsot)
4489117c3f doc: txrequest: point to past censorship vulnerability in tx re-request handling (Antoine Poinsot)
68ac9542c4 doc: net_proc: reference past DoS vulnerability in orphan processing (Antoine Poinsot)
c02d9f6dd5 doc: net_proc: reference past defect regarding invalid GETDATA types (Antoine Poinsot)
5e3d9f21df doc: validation: add a reference to historical header spam vulnerability (Antoine Poinsot)

Pull request description:

  It is useful when reading code to have context about why it is written or behaves the way it does. Some instances in this PR may seem obvious but i think nonetheless offer important context to anyone willing to change (or review a change to) this code.

ACKs for top commit:
  ryanofsky:
    Code review ACK eb0724f0de. No changes since last review other than rebase

Tree-SHA512: 271902f45b8130d44153d793bc1096cd22b6ce05494e67c665a5bc45754e3fc72573d303ec8fc7db4098d473760282ddbf0c1cf316947539501dfd8d7d5b8828
2025-03-23 11:12:33 -04:00
Ryan Ofsky
b9c281011b
Merge bitcoin/bitcoin#31689: Benchmark Chainstate::ConnectBlock duration
7edaf8b64c Benchmark Chainstate::ConnectBlock duration (Eunovo)

Pull request description:

  Introduce benchmarks to evaluate ConnectBlock performance for:
  - Blocks containing only Schnorr signatures
  - Blocks containing both Schnorr and ECDSA signatures
  - Blocks containing only ECDSA signatures

  The benchmarks in this PR, focus on signature validation. Additional benchmarks may be added in the future to assess other aspects of ConnectBlock.

  This is the first step toward implementing Batch Verification of Schnorr Signatures in Core. It provides a way to test and measure the performance improvements of batch verification on Core.
  For more details on batch validation, refer to the [batch-verify module on secp](https://github.com/bitcoin-core/secp256k1/pull/1134) and [batch-verify on core](https://github.com/bitcoin/bitcoin/pull/29491).

ACKs for top commit:
  josibake:
    reACK 7edaf8b64c
  fjahr:
    utACK 7edaf8b64c
  l0rinc:
    ACK 7edaf8b64c

Tree-SHA512: 883c8a5e4e4de401ffb9ac9b6789b7fe0737afefbdaf02c6d7e1645392efc4f0d2d28b423ba7e34366a33608e0835793f5e7a1312b5c8063de14446319529cc7
2025-03-23 09:03:28 -04:00
fanquake
963355037f
depends: set CMAKE_*_COMPILER_TARGET in toolchain
According to the CMake docs, this is the correct way to setup a
toolchain file for cross-compilation using Clang. See
https://cmake.org/cmake/help/latest/manual/cmake-toolchains.7.html#cross-compiling-using-clang

Internally it looks like CMake will only take this variable into account
if it detects the compiler to be Clang, so this shouldn't effect other
builds, but in the case of our Apple cross builds, we'd end up with a
duplicated `--target=arm64-apple-darwin` on the compiler line, given we
are already setting `--target` for Darwin builds.

Would fix #31748.
2025-03-23 11:39:56 +08:00
merge-script
af3dee0b8d
Merge bitcoin/bitcoin#32074: contrib: Make deterministic-coverage error messages more readable
Some checks failed
CI / test each commit (push) Has been cancelled
CI / macOS 14 native, arm64, no depends, sqlite only, gui (push) Has been cancelled
CI / macOS 14 native, arm64, fuzz (push) Has been cancelled
CI / Win64 native, VS 2022 (push) Has been cancelled
CI / Win64 native fuzz, VS 2022 (push) Has been cancelled
CI / ASan + LSan + UBSan + integer, no depends, USDT (push) Has been cancelled
fa7a40d952 contrib: Print deterministic-coverage runs (MarcoFalke)
fa751639fb contrib: Make deterministic-coverage error messages more readable (MarcoFalke)

Pull request description:

  This is almost a "refactor" to tidy up the error messages. Apart from the messages, the behavior of the tools is identical.

  This was requested in https://github.com/bitcoin/bitcoin/pull/31901#discussion_r1969502508.

  Previously, the tool would abort the program early on some errors. Now, the tool propagates an `std::result::Result::Err` up to `main` via an early return. Getting rid of the aborts also allows to drop the `RUST_BACKTRACE` env setting.

ACKs for top commit:
  hodlinator:
    re-ACK fa7a40d952
  janb84:
    ACK [fa7a40d](fa7a40d952)

Tree-SHA512: 6c97861306e2fececa14b2d12deafb78995fc2bcf75e4e22773cb0ab4231de78834db9f1f89b30c49d77499433b1c16c1d90b97eb4069c81855bd2a7944b554f
2025-03-22 11:12:14 +08:00
brunoerg
0ff66b1c4a fuzz: coinselection: cover SetBumpFeeDiscount 2025-03-21 10:13:36 -03:00
brunoerg
28dc118001 fuzz: wallet: fix crypter target 2025-03-21 10:09:47 -03:00
merge-script
8046759305
Merge bitcoin/bitcoin#31870: fuzz: split coinselection harness
Some checks are pending
CI / test each commit (push) Waiting to run
CI / macOS 14 native, arm64, no depends, sqlite only, gui (push) Waiting to run
CI / macOS 14 native, arm64, fuzz (push) Waiting to run
CI / Win64 native, VS 2022 (push) Waiting to run
CI / Win64 native fuzz, VS 2022 (push) Waiting to run
CI / ASan + LSan + UBSan + integer, no depends, USDT (push) Waiting to run
ba82240553 fuzz: split `coinselection` harness (brunoerg)

Pull request description:

  This PR splits the `coinselection` fuzz harness into 3 targets (`coinselection_bnb`, `coinselection_knapsack`, `coinselection_srd`). The goal is to be able to fuzz each algorithm separately (to avoid performance issues) and also all of them together.

ACKs for top commit:
  janb84:
    Tested ACK [ba82240](ba82240553)
  maflcko:
    review ACK ba82240553 👐
  marcofleon:
    reACK ba82240553
  zaidmstrr:
    reACK [ba82240](ba82240553)

Tree-SHA512: 277cffd524e57d286dbbbcb2aa0a9f1d720b4c56331dfb0f4425e1666246330616508e47977da23f28a72705aa142bbaf536e2cf7fe4703a2cd2e4b2fd441d9d
2025-03-21 18:40:09 +08:00
merge-script
2db00278ea
Merge bitcoin/bitcoin#31910: qa: fix an off-by-one in utxo snapshot fuzz target and sanity check its snapshot data
63b534f97e fuzz: sanity check hardcoded snapshot in utxo_snapshot target (Antoine Poinsot)
3b85eba83a test util: split up ConnectBlock from MineBlock (Antoine Poinsot)
d1527f6b88 qa: correct off-by-one in utxo snapshot fuzz target (Antoine Poinsot)

Pull request description:

  The assumeutxo data for the fuzz target could change and invalidate the hash silently, preventing the fuzz target from reaching some code paths. Fix this by introducing a unit test which would break if the snapshot data the fuzz target relies on were to change.

  In implementing this i noticed the height used for coins in the fuzz target is actually off-by-one (as if the first block in the created chain was the genesis but it's block `1`), so fix that too.

ACKs for top commit:
  mzumsande:
    Code Review ACK 63b534f97e
  fjahr:
    tACK 63b534f97e

Tree-SHA512: 2399b6e74db9b78aab8efba67c57a405d2d7d880ae3b7d8518a1c96cc6266f61f5e77722cd999adeac5d3e03e73d84cf9ae7bdbcc0afae198cc87049dde4012f
2025-03-21 16:46:54 +08:00
merge-script
c9a61509ba
Merge bitcoin/bitcoin#31979: torcontrol: Limit reconnect timeout to max seconds and log delay in whole seconds
f708498293 torcontrol: Limit reconnect timeout to max seconds and log delay in whole seconds (Eval EXEC)

Pull request description:

  I'm reviewing the Tor controller's reconnect-related code and noticed that the reconnect timeout had no limit. This could lead to excessively long delays.

  This PR introduces a maximum reconnect timeout of 600 seconds (10 minutes) to prevent excessive delays in reconnection attempts. It also updates the log message to display the retry delay in whole seconds for better readability.

ACKs for top commit:
  mabu44:
    ACK f708498293
  laanwj:
    Code review ACK f708498293
  luke-jr:
    utACK f708498293

Tree-SHA512: 8f18c6c84da6b4e7328638fd74539fbd3dd44f46c5107638de56b72fc079487690861199ceba1197ca34421dcedf79a1ca6bacf2a918a683e71bce9ff710b5d4
2025-03-21 15:34:29 +08:00
merge-script
b43cfa20fd
Merge bitcoin/bitcoin#30142: doc: add guidance for RPC to developer notes
Some checks are pending
CI / test each commit (push) Waiting to run
CI / macOS 14 native, arm64, no depends, sqlite only, gui (push) Waiting to run
CI / macOS 14 native, arm64, fuzz (push) Waiting to run
CI / Win64 native, VS 2022 (push) Waiting to run
CI / Win64 native fuzz, VS 2022 (push) Waiting to run
CI / ASan + LSan + UBSan + integer, no depends, USDT (push) Waiting to run
c6eca6f396 doc: add guidance for RPC to developer notes (tdb3)

Pull request description:

  Adds guidance statements to the RPC interface section of the developer notes with examples of when to implement `-deprecatedrpc=`.

  Wanted to increase awareness of preferred RPC implementation approaches for newer contributors.

  This implements some of what's discussed in https://github.com/bitcoin/bitcoin/issues/29912#issuecomment-2081678433

  Opinions may differ, so please don't be shy.  We want to make RPC as solid/safe as possible.

  Examples of discussions where guidelines/context might have added value:
  https://github.com/bitcoin/bitcoin/pull/30212#issuecomment-2347371722
  https://github.com/bitcoin/bitcoin/pull/29845#discussion_r1571053657
  https://github.com/bitcoin/bitcoin/pull/30381#pullrequestreview-2160865613
  https://github.com/bitcoin/bitcoin/pull/29954#issuecomment-2103628952
  https://github.com/bitcoin/bitcoin/pull/30410#pullrequestreview-2167870869
  https://github.com/bitcoin/bitcoin/pull/30713
  https://github.com/bitcoin/bitcoin/pull/30381
  https://github.com/bitcoin/bitcoin/pull/29060#pullrequestreview-2406688998

ACKs for top commit:
  l0rinc:
    ACK c6eca6f396
  fjahr:
    ACK c6eca6f396
  maflcko:
    lgtm ACK c6eca6f396
  jonatack:
    ACK c6eca6f396

Tree-SHA512: 01a98a8dc0eb91762b225d3278cdb4a5e380ceb7486fd096b4ad9122bed859cea8584d8996d3dce51272fdb792f4a793a1bd1c5445efeb87f0a30f9b6e59a790
2025-03-21 13:47:48 +08:00
merge-script
85feb094d4
Merge bitcoin/bitcoin#32092: test: Fix intermittent issue in p2p_orphan_handling.py
fa310cc6f4 test: Fix intermittent issue in p2p_orphan_handling.py (MarcoFalke)

Pull request description:

  The test may fail intermittently when the `net` thread is lagging while calling `DeleteNode`. This may result in a split `getdata`, meaning that `peer2.wait_for_parent_requests([int(parent_peekaboo_AB["txid"], 16), int(parent_missing["txid"], 16)])` fails.

  Fix it by adding a sync on the `net` thread.

  Fixes #31700

ACKs for top commit:
  mzumsande:
    Code Review ACK fa310cc6f4

Tree-SHA512: e4a58093ab5b9e280c479b845fecb5d228e65519ea3dc2111b393202225fd0feded423e8812452454b6b9348cb37a9c1b01b9d1b1802e9f4aa76b9e56b4b54ef
2025-03-21 13:46:11 +08:00
merge-script
b858b72903
Merge bitcoin/bitcoin#31841: fuzz: Use immediate task runner to increase fuzz stability
fa4fb6a8f1 fuzz: Use serial task runner to increase fuzz stability (MarcoFalke)

Pull request description:

  Leaking a scheduler with a non-empty queue from the fuzz initialization phase into the fuzz target execution phase is problematic, because it messes with coverage data. This in turn is problematic, because it leads to:

  * Decrease in fuzz target execution stability (non-determinism when running the fuzz target).
  * Decrease in fuzz input merge stability (non-determinism when selecting a minimum set of fuzz input to reach maximum coverage), which leads to qa-assets bloat.

  Fix one such issue. Tracking issue: https://github.com/bitcoin/bitcoin/issues/29018

  Can be tested via: `RUST_BACKTRACE=1 cargo run --manifest-path ./contrib/devtools/deterministic-fuzz-coverage/Cargo.toml -- $PWD/bld-cmake $PWD/../b-c-qa-assets/fuzz_corpora/ partially_downloaded_block`.

  The failure is non-deterministic (obviously) and will show coverage in validation signals such as `UpdatedBlockTip` before this change and will have this one fixed after this change.

ACKs for top commit:
  marcofleon:
    ACK fa4fb6a8f1
  dergoegge:
    Code review ACK fa4fb6a8f1

Tree-SHA512: fd1f66562c1d3c21553c7dd324399cdc16faa2fedfdb8e7544ea6a68b8b356e7c81d81815ecf70e0d334307dab6b275c1889b3b889b6f15eec514beee22c95f4
2025-03-21 08:25:41 +08:00
MarcoFalke
fa7a40d952
contrib: Print deterministic-coverage runs 2025-03-20 15:59:14 +01:00