Commit Graph

43132 Commits

Author SHA1 Message Date
Ryan Ofsky
ccc2d3abcd
Merge bitcoin/bitcoin#31287: refactor: Avoid std::string format strings
fa1177e3d7 refactor: Avoid std::string format strings (MarcoFalke)

Pull request description:

  This changes some unchecked `std::string` format strings to use string literals, which are `consteval` checked at compile-time.

  Split out, because it is used in several pull requests.

ACKs for top commit:
  l0rinc:
    ACK fa1177e3d7
  tdb3:
    code review and light test ACK fa1177e3d7
  rkrux:
    tACK fa1177e3d7
  ryanofsky:
    Code review ACK fa1177e3d7

Tree-SHA512: 7cc70a49b07dadc386336687b463043e79e94a46d18db0184c9813218536e87e954a1afeb8739d5d8706e7b2f355d3f7984048c7de2725851b463985f1c5369f
2024-11-15 09:53:18 -05:00
Ava Chow
85bcfeea23
Merge bitcoin/bitcoin#30666: validation: fix m_best_header tracking and BLOCK_FAILED_CHILD assignment
0bd53d913c test: add test for getchaintips behavior with invalid chains (Martin Zumsande)
ccd98ea4c8 test: cleanup rpc_getchaintips.py (Martin Zumsande)
f5149ddb9b validation: mark blocks building on an invalid block as BLOCK_FAILED_CHILD (Martin Zumsande)
783cb7337f validation: call RecalculateBestHeader in InvalidChainFound (Martin Zumsande)
9275e9689a rpc: call RecalculateBestHeader as part of reconsiderblock (Martin Zumsande)
a51e91783a validation: add RecalculateBestHeader() function (Martin Zumsande)

Pull request description:

  `m_best_header` (the most-work header not known to be on an invalid chain) can be wrong in the context of invalidation / reconsideration of blocks. This can happen naturally (a valid header is received and stored in our block tree db; when the full block arrives, it is found to be invalid) or triggered by the user with the `invalidateblock` / `reconsiderblock` rpc.

  We don't currently use `m_best_header` for any critical things (see OP of #16974 for a list that still seems up-to-date), so it being wrong affects mostly rpcs.

  This PR proposes to recalculate it if necessary by looping over the block index and finding the best header. It also suggest to mark headers between an invalidatetd block and the previous `m_best_header` as invalid, so they won't be considered in the recalculation.
  It adds tests to `rpc_invalidateblock.py` and `rpc_getchaintips.py` that fail on master.

  One alternative to this suggested in the past would be to introduce a continuous tracking of header tips (#12138).
  While this might be more performant, it is also more complicated, and situations where we need this data are only be remotely triggerable by paying the cost of creating a valid PoW header for an invalid block.
  Therefore I think it isn't necessary to optimise for performance here, plus the solution in this PR doesn't perform any extra steps in the normal node operation where no invalidated blocks are encountered.

  Fixes  #26245

ACKs for top commit:
  fjahr:
    reACK 0bd53d913c
  achow101:
    ACK 0bd53d913c
  TheCharlatan:
    Re-ACK 0bd53d913c

Tree-SHA512: 23c2fc42d7c7bb4f9b4ba4949646b3d0031dd29ed15484e436afd66cd821ed48e0f16a1d02f45477b5d0d73a006f6e81a56b82d9721e0dee2e924219f528b445
2024-11-14 16:54:41 -05:00
Ava Chow
2257c6d68f
Merge bitcoin/bitcoin#30487: ci: skip Github CI on branch pushes for forks
8610bcef9d ci: skip Github CI on branch pushes for forks (Sjors Provoost)

Pull request description:

  When a contributor maintains a fork of the repo, any pull request they make to their own fork, or to the main repository, will trigger two CI runs one for the branch push and one for the pull request.

  After this PR when `SKIP_BRANCH_PUSH` is set, pushes made to git branches inside fork repositories will no longer trigger CI runs, unless the git branches are associated with PRs in the fork repository, or the main repository.

  The same behaviour was added for Cirrus in e9bfbb5414.

  Note to maintainers: `SKIP_BRANCH_PUSH=true` needs to be set for the GUI repo to maintain existing behaviour.

ACKs for top commit:
  m3dwards:
    ACK 8610bcef9d
  achow101:
    ACK 8610bcef9d
  vasild:
    ACK 8610bcef9d

Tree-SHA512: 4055153f03f0cb60a97ce26157ab9db40a4609dee9f060ed7b06aa8841df5bd8e1a42ff2ac0f20bd69e221e8e67bff062a9a361a291124070a03dd51c609e845
2024-11-14 16:45:07 -05:00
Ava Chow
380e1f44e8
Merge bitcoin/bitcoin#30349: benchmark: Improve SipHash_32b accuracy to avoid potential optimization issues
42066f45ff Refactor SipHash_32b benchmark to improve accuracy and avoid optimization issues (Lőrinc)

Pull request description:

  This PR stems from the discussions in https://github.com/bitcoin/bitcoin/pull/30317#discussion_r1649187336

  The previous benchmark for `SipHash` was slightly less accurate in representing real-world usage and allowed for potential compiler optimizations that could invalidate the benchmark.
  This change aims to ensure the benchmark produces more realistic results.

  By modifying the initial values and only incrementing the bytes of `val`, the benchmark should reflects a more typical usage patterns - and prevent the compiler from optimizing away the calculations.

  -------

  On my M1 processor the benchmark's speed changed significantly (but the CI seems to produce the same result as before):

  > cmake -B build -DCMAKE_BUILD_TYPE=Release -DBUILD_BENCH=ON && cmake --build build -j10 &&
  ./build/src/bench/bench_bitcoin --filter=SipHash_32b --min-time=1000

  Before:
  |               ns/op |                op/s |    err% |     total | benchmark
  |--------------------:|--------------------:|--------:|----------:|:----------
  |               35.15 |       28,445,856.66 |    0.2% |      1.10 | `SipHash_32b`

  After (note that only the benchmark changed):
  |               ns/op |                op/s |    err% |     total | benchmark
  |--------------------:|--------------------:|--------:|----------:|:----------
  |               22.05 |       45,350,886.64 |    0.3% |      1.10 | `SipHash_32b`

ACKs for top commit:
  maflcko:
    review ACK 42066f45ff
  achow101:
    ACK 42066f45ff
  hodlinator:
    ACK 42066f45ff

Tree-SHA512: 6bbe9d725d4c3396642e55ce48c31baa5339e56838d6d5fb377fb1069daa9292375e7020ceff7da0d78befffc1e984f717b5232217fe911989613480adaa937e
2024-11-14 16:36:33 -05:00
Ava Chow
1a8f51e745
Merge bitcoin/bitcoin#28843: [refactor] Cleanup BlockAssembler mempool usage
192dac1d33 [refactor] Cleanup BlockAssembler mempool usage (TheCharlatan)

Pull request description:

  The `addPackageTxs` method of the `BlockAssembler` currently has access to two mempool variables, as an argument and as a member. Clean this up and clarify that they both are the same mempool instance by removing the argument and instead only using the member variable in the method.

  This was noticed in this PR review: https://github.com/bitcoin/bitcoin/pull/25223#discussion_r898164322.

ACKs for top commit:
  achow101:
    ACK 192dac1d33
  danielabrozzoni:
    re-ACK 192dac1
  stickies-v:
    ACK 192dac1d33

Tree-SHA512: a5ae7d6d771fbb5b54f23624b4d3429acf07bbe38179a462a078c825d60c89a725ad4e13fe7067eebea7dfec63c56c8f39b5077b0d949d594f500affcc1272d1
2024-11-14 16:30:48 -05:00
merge-script
2d944e982c
Merge bitcoin/bitcoin#31285: guix: remove util-linux
4d66854982 ci: remove util-linux from centos CI (fanquake)
cdf34be7c9 guix: remove util-linux (fanquake)

Pull request description:

  `hexdump` was used for the tests, until CMake. This package is no-longer needed to complete a Guix build (or needed in the CI). `util-linux` has been in the manifest since Guix was first introduced (3e80ec3ea9).

  Guix build:
  ```bash
  b681575760a0d19445a17d0d54f50a65d705923caee3a7cd7502e6611950dc11  guix-build-4d668549825c/output/aarch64-linux-gnu/SHA256SUMS.part
  7af1420fedd8b4d10df650e92840287106dd74c289b6ef6fd2fd039387824647  guix-build-4d668549825c/output/aarch64-linux-gnu/bitcoin-4d668549825c-aarch64-linux-gnu-debug.tar.gz
  bd6520732b5c7805002a3227fe2d16f56a77453d913f5204e5be869aaf4a9534  guix-build-4d668549825c/output/aarch64-linux-gnu/bitcoin-4d668549825c-aarch64-linux-gnu.tar.gz
  83230468eb9289d294f7bdbb9b410cb7473a2e4dd1463097559dc0752f53cbc0  guix-build-4d668549825c/output/arm-linux-gnueabihf/SHA256SUMS.part
  b4d79380642763428b7ca79a66c5920797864b163759081be5369631b4c33c73  guix-build-4d668549825c/output/arm-linux-gnueabihf/bitcoin-4d668549825c-arm-linux-gnueabihf-debug.tar.gz
  65d0c3888ca98dc9c7a1d6c25c9d6bc66ca6435c1fb42178ef8794dfa3b40255  guix-build-4d668549825c/output/arm-linux-gnueabihf/bitcoin-4d668549825c-arm-linux-gnueabihf.tar.gz
  17d6297ddd9a94913987c596715e66cff0d91d726d06cca2eeb8f3c94056e8db  guix-build-4d668549825c/output/arm64-apple-darwin/SHA256SUMS.part
  02faa61796d88b3cff69feeddc50bc579195da3676e5daace2ffc2332f3cbc1a  guix-build-4d668549825c/output/arm64-apple-darwin/bitcoin-4d668549825c-arm64-apple-darwin-unsigned.tar.gz
  0e02ef1418f56f67c472dc785041c1988637e509e77337d2a6eeb69b0c4cd844  guix-build-4d668549825c/output/arm64-apple-darwin/bitcoin-4d668549825c-arm64-apple-darwin-unsigned.zip
  d4320588db28f4f98b5de4c2e725e02b2f5f1379e376e534f1e4509928d187d4  guix-build-4d668549825c/output/arm64-apple-darwin/bitcoin-4d668549825c-arm64-apple-darwin.tar.gz
  7aa217a438fb97f0438ed1d8478cbeb52fd974fac94cbe7cf6c780231e17d8d6  guix-build-4d668549825c/output/dist-archive/bitcoin-4d668549825c.tar.gz
  157f1b597eee99ee64722ec28a2770d6fea84bbd711f83ad22ab2bb6b44f15fc  guix-build-4d668549825c/output/powerpc64-linux-gnu/SHA256SUMS.part
  60569cdafcf802648c44d2c55758fc5cd2c00d4c37c0f31d9da95e8472438c57  guix-build-4d668549825c/output/powerpc64-linux-gnu/bitcoin-4d668549825c-powerpc64-linux-gnu-debug.tar.gz
  5e1581caf3404ffcb1b061d518465f584faf543e3da69b1b116f8a70368455d8  guix-build-4d668549825c/output/powerpc64-linux-gnu/bitcoin-4d668549825c-powerpc64-linux-gnu.tar.gz
  db62e80ca99b163d62fc4d473f87de56d97da52dd37ec5043aaaaf4cf96bde25  guix-build-4d668549825c/output/riscv64-linux-gnu/SHA256SUMS.part
  47905dd06466f5c197689f9e02d417f959904762321f6dc70e3bf2cc9a2fc04d  guix-build-4d668549825c/output/riscv64-linux-gnu/bitcoin-4d668549825c-riscv64-linux-gnu-debug.tar.gz
  558b9ff6aff7b1a49f7bbba81d57025192aca532e7ee6b90b61a36bba0bfd342  guix-build-4d668549825c/output/riscv64-linux-gnu/bitcoin-4d668549825c-riscv64-linux-gnu.tar.gz
  a946b5d730fa12f6e388db31e2e4b5de2c48653f16613146fb848ce9cdee8b81  guix-build-4d668549825c/output/x86_64-apple-darwin/SHA256SUMS.part
  6d0bfd4443507fe46422b099a2e92e28024c800a37d43539382ac0d8cb00f45d  guix-build-4d668549825c/output/x86_64-apple-darwin/bitcoin-4d668549825c-x86_64-apple-darwin-unsigned.tar.gz
  06ef2f4df72377b9f2bb872d624fdcbf391470e4694b85295eb529d90e37ff62  guix-build-4d668549825c/output/x86_64-apple-darwin/bitcoin-4d668549825c-x86_64-apple-darwin-unsigned.zip
  bc9fe0032d6f5e9d9576ddb9ea5333bb1d0741731dfa4da4ef1b3daf7dd9241d  guix-build-4d668549825c/output/x86_64-apple-darwin/bitcoin-4d668549825c-x86_64-apple-darwin.tar.gz
  4668e50be850961409a4ade5bb7522cc2366e9ab31542247243fa8473d100cb1  guix-build-4d668549825c/output/x86_64-linux-gnu/SHA256SUMS.part
  63662bbd98f8d71346ab24b956cb27a1aa03a48825e7c965ced0338024cc97e8  guix-build-4d668549825c/output/x86_64-linux-gnu/bitcoin-4d668549825c-x86_64-linux-gnu-debug.tar.gz
  514a726a2bae3944de8e1dbb606bade4f129f01477d5c607fb5e489b22792462  guix-build-4d668549825c/output/x86_64-linux-gnu/bitcoin-4d668549825c-x86_64-linux-gnu.tar.gz
  365a33f3046c680a399d9dabeaca589dd7918642c79f0c33205a724084ff5c1c  guix-build-4d668549825c/output/x86_64-w64-mingw32/SHA256SUMS.part
  306c6425c1cebaf9dae65853bc3035d478e7670c333616270d63c4ffd08ec724  guix-build-4d668549825c/output/x86_64-w64-mingw32/bitcoin-4d668549825c-win64-debug.zip
  817fff3665f49a9eda4e7929e95c645172f6f0432410f4a0319638ce80a50771  guix-build-4d668549825c/output/x86_64-w64-mingw32/bitcoin-4d668549825c-win64-setup-unsigned.exe
  f06e3a88a19b29dbad03e1667183eb295a2e6a6e6f69bcdd6f53c7ee4d777a7d  guix-build-4d668549825c/output/x86_64-w64-mingw32/bitcoin-4d668549825c-win64-unsigned.tar.gz
  ec1c6fc83198e7e9e1871f1ac25ac49c519a2dab11bb09e1a7153161cb284b79  guix-build-4d668549825c/output/x86_64-w64-mingw32/bitcoin-4d668549825c-win64.zip
  ```

ACKs for top commit:
  TheCharlatan:
    ACK 4d66854982

Tree-SHA512: 6550ee4f5b4646252afe72286c76f3a275ce5f700b2f6df161414df441c8d271c6d23e76c7a4de763dcc965a4a28b75fb1a71c08ed7eeac337857398d6b52128
2024-11-14 18:29:45 +00:00
MarcoFalke
fa1177e3d7
refactor: Avoid std::string format strings
Pass literal format strings instead of std::string so formats can be
checked at compile time.

Co-authored-by: Ryan Ofsky <ryan@ofsky.org>
Co-authored-by: stickies-v <stickies-v@protonmail.com>
2024-11-14 12:44:13 +01:00
merge-script
e546b4e1a0
Merge bitcoin/bitcoin#31225: doc: Fix grammatical errors in multisig-tutorial.md
ac286e0d1b doc: Fix grammatical errors in multisig-tutorial.md (secp512k2)

Pull request description:

  This pull request fixes grammatical errors in the `multisig-tutorial.md` document.

ACKs for top commit:
  Abdulkbk:
    ACK ac286e0d1b

Tree-SHA512: 684fe16e802431109957b9cde441353edeb16ffffde4282310c1a6f104adffc53347d00a2cf3a5969a78803f3177d6056ca37d3b7e8be52c2ec43ec0b9fcf4d9
2024-11-14 10:25:58 +00:00
merge-script
f44e39c9d0
Merge bitcoin/bitcoin#31174: tinyformat: Add compile-time checking for literal format strings
fe39acf88f tinyformat: Add compile-time checking for literal format strings (Ryan Ofsky)
184f34f2d0 util: Support dynamic width & precision in ConstevalFormatString (Ryan Ofsky)

Pull request description:

  Add compile-time checking for literal format strings passed to `strprintf` and `tfm::format` to make sure the right number of format arguments are passed.

  There is still no compile-time checking if non-literal `std::string` or `bilingual_str` format strings are passed, but this is improved in other PRs:

  - [#31061](https://github.com/bitcoin/bitcoin/pull/31061) implements compile-time checking for translated strings
  - [#31072](https://github.com/bitcoin/bitcoin/pull/31072) increases compile-time checking by using literal strings as format strings, instead of `std::string` and `bilingual_str`
  - [#31149](https://github.com/bitcoin/bitcoin/pull/31149) may drop the `std::string`  overload for `strprintf` to [require](https://github.com/bitcoin/bitcoin/pull/31149#issuecomment-2444579999) compile-time checking

ACKs for top commit:
  maflcko:
    re-ACK fe39acf88f 🕐
  l0rinc:
    ACK fe39acf88f
  hodlinator:
    re-ACK fe39acf88f

Tree-SHA512: f1ddef0c96b9468c5ffe31b42dc19f1922583dd14f2e180b618d992c98614c5cc7db9f9cd917ef503f833bbc7dbec78e4489d0035416dce6840837e1d66d87cb
2024-11-14 10:18:44 +00:00
merge-script
69c0313444
Merge bitcoin/bitcoin#31269: validation: Remove RECENT_CONSENSUS_CHANGE validation result
e80e4c6ff9 validation: Remove RECENT_CONSENSUS_CHANGE validation result (TheCharlatan)

Pull request description:

  The *_RECENT_CONSENSUS_CHANGE variants in the validation result enumerations were always unused. They seem to have been kept around speculatively for a soft fork after segwit, however they were never used for taproot either. This points at them not having a clear purpose. Based on the original pull requests' comments their usage was never entirely clear:
  https://github.com/bitcoin/bitcoin/pull/11639#issuecomment-370234133 https://github.com/bitcoin/bitcoin/pull/15141#discussion_r271039747

  Since they are part of the validation interface and need to be exposed by the kernel library keeping them around may also be confusing to future users of the library.

ACKs for top commit:
  sipa:
    ACK e80e4c6ff9
  naumenkogs:
    ACK e80e4c6ff9
  dergoegge:
    ACK e80e4c6ff9
  ajtowns:
    ACK e80e4c6ff9

Tree-SHA512: 0af17c4435bb1b5a4f43600da30545cbbe95a7d642419cabdefabfb82b9335d92262c1c48be7ca2f2a024078ae9447161228b6f951d2f508a51159a31947fb54
2024-11-14 09:43:47 +00:00
Ava Chow
4228259294
Merge bitcoin/bitcoin#31000: bench: add support for custom data directory
fa66e0887c bench: add support for custom data directory (furszy)
ad9c2cceda test, bench: specialize working directory name (furszy)

Pull request description:

  Expands the benchmark framework with the existing `-testdatadir` arg,
  enabling the ability to change the benchmark data directory.

  This is useful for running benchmarks on different storage devices, and
  not just under the OS `/tmp/` directory.

  A good use case is #28574, where we are benchmarking the wallet
  migration process on an HDD.

ACKs for top commit:
  maflcko:
    re-ACK fa66e0887c
  achow101:
    ACK fa66e0887c
  tdb3:
    re ACK fa66e0887c
  hodlinator:
    re-ACK fa66e0887c
  pablomartin4btc:
    re-ACK fa66e0887c

Tree-SHA512: 4e87206c07e26fe193c07074ae9eb0cc9c70a58aeea8cf27d18fb5425d77e4b00dbe0e6d6a75c17b427744e9066458b9a84e5ef7b0420f02a4fccb9c5ef4dacc
2024-11-13 19:14:23 -05:00
fanquake
4d66854982
ci: remove util-linux from centos CI 2024-11-13 15:51:45 +00:00
fanquake
cdf34be7c9
guix: remove util-linux 2024-11-13 15:51:17 +00:00
merge-script
36f5effa17
Merge bitcoin/bitcoin#31235: addrman: cap the max_pct to not exceed the maximum number of addresses
9c5775c331 addrman: cap the `max_pct` to not exceed the maximum number of addresses (brunoerg)

Pull request description:

  Fixes #31234

  This PR fixes a bad alloc issue in `GetAddresses` by capping the value `max_pct`. In practice, values greater than 100 should be treated as 100 since it's the percentage of addresses to return. Also, it limites the value `max_pct` in connman target to exercise values between 0 and 100.

ACKs for top commit:
  adamandrews1:
    Code Review ACK 9c5775c331
  marcofleon:
    Tested ACK 9c5775c331. Reproduced the crash on master and checked that this fixed it. The checks added to `GetAddr_` look reasonable.
  mzumsande:
    Code Review ACK 9c5775c331
  vasild:
    ACK 9c5775c331

Tree-SHA512: 2957ae561ccc37df71f43c1863216d2e563522ea70b9a4baee6990e0b4a1ddadccabdcb9115c131a9a57480367b5ebdd03e0e3d4c8583792e2b7d1911a0a06d3
2024-11-13 12:13:17 +00:00
merge-script
98ad249b69
Merge bitcoin/bitcoin#31277: doc: mention descriptorprocesspsbt in psbt.md
ebb6cd82ba doc: mention `descriptorprocesspsbt` in psbt.md (Sebastian Falbesoner)

Pull request description:

  Noticed that the `descriptorprocesspsbt` RPC call is currently not documented anywhere.

ACKs for top commit:
  sipa:
    ACK ebb6cd82ba
  kevkevinpal:
    ACK [ebb6cd8](ebb6cd82ba)
  danielabrozzoni:
    ACK ebb6cd82ba
  ismaelsadeeq:
    ACK ebb6cd82ba
  tdb3:
    ACK ebb6cd82ba

Tree-SHA512: 47f3c8693dfc79bf2d38176ee015efe8c1a1539b95f9e0eb3db7693e4ef39222ad2b5cb44d55042ca1eb4288ba5e486068f66c054ff0a59e989b6cdc8e4461f6
2024-11-13 09:25:57 +00:00
glozow
b0222bbb49
Merge bitcoin/bitcoin#30239: Ephemeral Dust
5c2e291060 bench: Add basic CheckEphemeralSpends benchmark (Greg Sanders)
3f6559fa58 Add release note for ephemeral dust (Greg Sanders)
71a6ab4b33 test: unit test for CheckEphemeralSpends (Greg Sanders)
21d28b2f36 fuzz: add ephemeral_package_eval harness (Greg Sanders)
127719f516 test: Add CheckMempoolEphemeralInvariants (Greg Sanders)
e2e30e89ba functional test: Add ephemeral dust tests (Greg Sanders)
4e68f90139 rpc: disallow in-mempool prioritisation of dusty tx (Greg Sanders)
e1d3e81ab4 policy: Allow dust in transactions, spent in-mempool (Greg Sanders)
04b2714fbb functional test: Add new -dustrelayfee=0 test case (Greg Sanders)

Pull request description:

  A replacement for https://github.com/bitcoin/bitcoin/pull/29001

  Now that we have 1P1C relay, TRUC transactions and sibling eviction, it makes sense to retarget this feature more narrowly by not introducing a new output type, and simple focusing on the feature of allowing temporary dust in the mempool.

  Users of this can immediately use dust outputs as:
  1. Single keyed anchor (can be shared by multiple parties)
  2. Single unkeyed anchor, ala P2A

  Which is useful when the parent transaction cannot have fees for technical or accounting reasons.

  What I'm calling "keyed" anchors would be used anytime you don't want a third party to be able to run off with the utxo. As a motivating example, in Ark there is the concept of a "forfeit transaction" which spends a "connector output". The connector output would ideally be 0-value, but you would not want that utxo spend by anyone, because this would cause financial loss for the coordinator of the service: https://arkdev.info/docs/learn/concepts#forfeit-transaction

  Note that this specific use-case likely doesn't work as it involves a tree of dust, but the connector idea in general demonstrates how it could be used.

  Another related example is connector outputs in BitVM2: https://bitvm.org/bitvm2.html .

  Note that non-TRUC usage will be impractical unless the minrelay requirement on individual transactions are dropped in general, which should happen post-cluster mempool.

  Lightning Network intends to use this feature post-29.0 if available: https://github.com/lightning/bolts/issues/1171#issuecomment-2373748582

  It's also useful for Ark, ln-symmetry, spacechains, Timeout Trees, and other constructs with large presigned trees or other large-N party smart contracts.

ACKs for top commit:
  glozow:
    reACK 5c2e291060 via range-diff. Nothing but a rebase and removing the conflict.
  theStack:
    re-ACK 5c2e291060

Tree-SHA512: 88e6a6b3b91dc425de47ccd68b7668c8e98c5683712e892c588f79ad639ae95c665e2d5563dd5e5797983e7542cbd1d4353bc90a7298d45a1843b05a417f09f5
2024-11-12 20:05:01 -05:00
glozow
1dda1892b6
Merge bitcoin/bitcoin#31037: test: enhance p2p_orphan_handling
9de9c858d5 test: enhance p2p_orphan_handling (tdb3)
33af14b62e test: reduce assert_debug_log reliance (tdb3)

Pull request description:

  Previously, `p2p_orphan_handling` relied on checking the debug log for orphanage changes.  This updates the tests to reduce debug log checking and add checks using `tx_in_orphanage()` and `getorphantxs` introduced in #30793.

ACKs for top commit:
  glozow:
    light code review ACK 9de9c858d5
  rkrux:
    tACK 9de9c858d5
  danielabrozzoni:
    ACK 9de9c858d5

Tree-SHA512: b53bf0d66d727c79eab972b736a074bd04ca652afd89d2a50830247f42734c61c4c2fa883fde179560e39469c81d0e7be478e1faa0992d3688d5e04d75c067d7
2024-11-12 12:36:55 -05:00
Greg Sanders
5c2e291060 bench: Add basic CheckEphemeralSpends benchmark 2024-11-12 09:41:24 -05:00
Greg Sanders
3f6559fa58 Add release note for ephemeral dust 2024-11-12 09:41:24 -05:00
Greg Sanders
71a6ab4b33 test: unit test for CheckEphemeralSpends 2024-11-12 09:41:24 -05:00
Greg Sanders
21d28b2f36 fuzz: add ephemeral_package_eval harness
Works a bit harder to get ephemeral dust
transactions into the mempool.
2024-11-12 09:41:24 -05:00
Greg Sanders
127719f516 test: Add CheckMempoolEphemeralInvariants
Checks that transactions in mempool with dust
follow expected invariants.
2024-11-12 09:24:54 -05:00
Greg Sanders
e2e30e89ba functional test: Add ephemeral dust tests 2024-11-12 09:24:54 -05:00
Greg Sanders
4e68f90139 rpc: disallow in-mempool prioritisation of dusty tx 2024-11-12 09:24:54 -05:00
Greg Sanders
e1d3e81ab4 policy: Allow dust in transactions, spent in-mempool
Also known as Ephemeral Dust.

We try to ensure that dust is spent in blocks by requiring:
  - ephemeral dust tx is 0-fee
  - ephemeral dust tx only has one dust output
  - If the ephemeral dust transaction has a child,
    the dust is spent by by that child.

0-fee requirement means there is no incentive to mine
a transaction which doesn't have a child bringing its
own fees for the transaction package.
2024-11-12 09:24:54 -05:00
Greg Sanders
04b2714fbb functional test: Add new -dustrelayfee=0 test case
This test would catch regressions where ephemeral
dust checks are being erroneously applied on outputs
that are not actually dust.
2024-11-12 09:24:54 -05:00
Sebastian Falbesoner
ebb6cd82ba doc: mention descriptorprocesspsbt in psbt.md 2024-11-12 14:56:12 +01:00
Sjors Provoost
8610bcef9d
ci: skip Github CI on branch pushes for forks
Consistent with Cirrus behavior introduced in e9bfbb5414.
2024-11-12 12:14:34 +01:00
merge-script
2b33322169
Merge bitcoin/bitcoin#31249: test: Add combinerawtransaction test to rpc_createmultisig
83fab3212c test: Add combinerawtransaction test to rpc_createmultisig (Ava Chow)

Pull request description:

  The only coverage of combinerawtransaction is in a legacy wallet only test. So also use it in rpc_createmultisig so that this RPC remains tested after the legacy wallet is removed.

  Split from #28710

ACKs for top commit:
  maflcko:
    re-ACK 83fab3212c
  BrandonOdiwuor:
    Re-ACK 83fab3212c
  Abdulkbk:
    ACK 83fab3212c
  brunoerg:
    code review ACK 83fab3212c
  rkrux:
    tACK 83fab3212c

Tree-SHA512: 383d88ff6c9b54337ed81c714026e527b0fed41d976959fd5c6863b49d0defa4ea13fdc3d984885c86a2b6380825cd66c17842cc31f20fbec4bc42d86aecbbfa
2024-11-12 10:58:33 +00:00
merge-script
3fb6229dcf
Merge bitcoin/bitcoin#31271: doc: correct typos
726cbee955 doc: correct typos (fanquake)
9fdfb73ca8 doc: fix typos (Afanti)

Pull request description:

  Includes #31253.
  Includes https://github.com/bitcoin/bitcoin/pull/31239#pullrequestreview-2425008603.
  Fixes remaining lint output.

ACKs for top commit:
  l0rinc:
    ACK 726cbee955
  rkrux:
    crACK 726cbee955
  tdb3:
    ACK 726cbee955

Tree-SHA512: 51978343f11fb5f0c6b824d92dbfc9999952373a9f790ab79ef8750f920f1c020c092ca874c9e39f478d12d85cdadcfd8c63dda0cbb02745bc55fda28d371e4c
2024-11-12 09:48:13 +00:00
furszy
fa66e0887c
bench: add support for custom data directory
Expands the benchmark framework with the existing '-testdatadir' arg,
enabling the ability to change the benchmark data directory.

This is useful for running benchmarks on different storage devices, and
not just under the OS /tmp/ directory.
2024-11-11 11:31:04 -05:00
furszy
ad9c2cceda
test, bench: specialize working directory name
Since G_TEST_GET_FULL_NAME is not initialized in the benchmark framework,
benchmarks using the unit test setup run in the same directory without
any clear distinction between them.
This poses an extra complication for locating any specific benchmark
directory during a failure.

In master, unit tests and benchmarks run in the following path:
/<OS_tmp_dir>/test_common bitcoin/<random_uint256>/

After this commit, unit tests and benchmarks are contained within its
own directory:
/<OS_tmp_dir>/test_common bitcoin/<test_name>/<time_in_nanoseconds>/

This makes it easier to find any benchmark run when a failure occurs.
2024-11-11 11:31:04 -05:00
brunoerg
9c5775c331 addrman: cap the max_pct to not exceed the maximum number of addresses
Co-authored-by: Vasil Dimov <vd@FreeBSD.org>
2024-11-11 12:47:53 -03:00
merge-script
8d340be924
Merge bitcoin/bitcoin#31181: cmake: Revamp FindLibevent module
5a96767e3f depends, libevent: Do not install *.pc files and remove patches for them (Hennadii Stepanov)
ffda355b5a cmake, refactor: Move `HAVE_EVHTTP_...` to `libevent` interface (Hennadii Stepanov)
b619bdc330 cmake: Revamp `FindLibevent` module (Hennadii Stepanov)

Pull request description:

  This PR generalizes the use of `find_package` / `pkg_check_modules`, prioritizing the former.

  Addresses https://github.com/bitcoin/bitcoin/pull/30903#issuecomment-2444700876:
  > We should also follow up with refactoring the libevent module, to more generically use CMake/pkg-config, rather than restricting the CMake usage to `vcpkg`. At that point, we'd likely be able to dump pkg-config for the depends path entirely.

  Similar to https://github.com/bitcoin/bitcoin/pull/30903.

ACKs for top commit:
  fanquake:
    ACK 5a96767e3f

Tree-SHA512: 181020c16ccd2821e718c73f264badcdc5e62980c4a8d9691e759efe2ea00da2326e26308d1dcfdeac01e9e27930428ecace9f36941deee951b751b138d7266c
2024-11-11 15:31:58 +00:00
merge-script
9a8e5adb16
Merge bitcoin/bitcoin#31267: refactor: Drop deprecated space in operator""_mst
faf2162565 refactor: Drop deprecated space in operator""_mst (MarcoFalke)

Pull request description:

  The space is deprecated according to https://en.cppreference.com/w/cpp/language/user_literal#Literal_operators and compilers will start to warn about this. For example, GCC-15 should warn when compiling under C++23, according to https://gcc.gnu.org/onlinedocs/gcc/C_002b_002b-Dialect-Options.html#index-Wdeprecated-literal-operator and Clang-20 will do so by default, according to https://clang.llvm.org/docs/DiagnosticsReference.html#wdeprecated-literal-operator.

  Fix it by removing the unused and deprecated space.

  Also, fix the iwyu include list, while touching the module.

ACKs for top commit:
  TheCharlatan:
    ACK faf2162565
  l0rinc:
    ACK faf2162565

Tree-SHA512: 888a7b57c91114e1f71b6278fa13783bde16a9b51f4df10ae4b6c7d62bf016d6c022128250e6962b459f66743ddeab774b4109064281654892ecdb5bc11b6be6
2024-11-11 14:21:10 +00:00
fanquake
726cbee955
doc: correct typos 2024-11-11 14:14:39 +00:00
Afanti
9fdfb73ca8
doc: fix typos
Fix typos in miniscript.h
2024-11-11 14:14:39 +00:00
merge-script
af6088701a
Merge bitcoin/bitcoin#31237: doc: Add missing 'blank=true' option in offline-signing-tutorial.md
ec375de39f doc: Add missing 'blank=true' option in offline-signing-tutorial.md (secp512k2)

Pull request description:

  Issue:

  The text mentions that the `createwallet` command should use the options `disable_private_keys=true, blank=true`, but the provided command only includes `disable_private_keys=true`, missing the `blank=true` option.

  Correction:

  Added `blank=true` to the command to match the options described in the text.

  Explanation:

  The `blank=true` option is necessary to create a blank wallet. Including this option ensures the command matches the options specified in the text.

ACKs for top commit:
  fanquake:
    ACK ec375de39f

Tree-SHA512: 8c145e3ef1598c5e13f2aa89e496f76bfe2fc6f47d5e740963acad18dd1f782655a822dc234862af8e5a08060ab7fe1039a3dcfa68455a9143fe2d849975927c
2024-11-11 14:13:13 +00:00
merge-script
7a52665302
Merge bitcoin/bitcoin#31239: test: clarify log messages when handling SOCKS5 proxy connections
99d9a093cf test: clarify log messages when handling SOCKS5 proxy connections (Vasil Dimov)

Pull request description:

  Clarify log messages when handling SOCKS5 proxy connections.

  Suggested in https://github.com/bitcoin/bitcoin/pull/29420#discussion_r1815521913

ACKs for top commit:
  mzumsande:
    Code Review ACK 99d9a093cf
  tdb3:
    code review ACK 99d9a093cf

Tree-SHA512: 06bc0e63fbc9fdd8144a161d65d02e6c99565960064e65782b9b4b2fdfdf18539a1cd9513e17a911eef1506525e411e8422b7b805ce4c2392fcca6620112e172
2024-11-11 14:08:49 +00:00
merge-script
900b17239f
Merge bitcoin/bitcoin#31259: doc: Fix missing comma in JSON example in REST-interface.md
5e3b444022 doc: Fix missing comma in JSON example in REST-interface.md (secp512k2)

Pull request description:

  This pull request addresses a minor issues in the REST-interface.md documentation:

  Missing Comma in JSON Example: In the "Query UTXO set" section, a missing comma after the "desc" field in the JSON example has been added to ensure valid JSON syntax.

ACKs for top commit:
  maflcko:
    lgtm ACK 5e3b444022
  Abdulkbk:
    ACK 5e3b444022

Tree-SHA512: d2d479c8a991d3380d16b7b140a375a90dca0fce0a024a4b8ccf842d703398fde14ae972349f5fbd2e0ce26aa6cd6d07c0262d9c09ddc4c6c466527cfbe0e1f1
2024-11-11 11:24:32 +00:00
MarcoFalke
faf2162565
refactor: Drop deprecated space in operator""_mst 2024-11-11 12:14:08 +01:00
merge-script
c889890e4a
Merge bitcoin/bitcoin#31264: doc: Fixup bitcoin-wallet manpage chain selection args
fa729ab4a2 doc: Fixup bitcoin-wallet manpage chain selection args (MarcoFalke)

Pull request description:

  The sentence is missing `-testnet4` and `-chain`. Instead of duplicating the full list (and having to keep it in sync), just refer to them as `(test)chain selection arguments`.

ACKs for top commit:
  willcl-ark:
    utACK fa729ab4a2
  tdb3:
    Code Review ACK fa729ab4a2
  rkrux:
    crACK fa729ab4a2

Tree-SHA512: e2cb6e2dd778a34e6c7e8ccde9794ab601e68bad68fe110f41cd73ac12ac3c5d0632fb59a48355f03ef0909f77ec5afd7ea50f301a998cb3ec76e115969f3e7e
2024-11-11 10:58:05 +00:00
merge-script
0f6d20e43f
Merge bitcoin/bitcoin#31163: scripted-diff: get rid of remaining "command" terminology in protocol.{h,cpp}
4120c7543e scripted-diff: get rid of remaining "command" terminology in protocol.{h,cpp} (Sebastian Falbesoner)

Pull request description:

  The confusing "command" terminology for the 12-byte field in the (v1) p2p message header was replaced with the more proper term "message type" in other modules already years ago, see eg #18533, #18937, #24078, #24141. This PR does the same for the protocol.{h,cpp} module to complete the replacements. Note that "GetCommand" is a method name also used in the `ArgsManager` (there it makes much more sense), so the scripted-diff lists for this replacement the files explicitly, rather than using `$(git grep -l ...)`.

ACKs for top commit:
  maflcko:
    review ACK 4120c7543e 🛒
  fjahr:
    Code review ACK 4120c7543e
  rkrux:
    tACK 4120c7543e

Tree-SHA512: 7b4dd30136392a145da95d2f3ba181c18c155ba6f3158e49e622d76811c6a45ef9b5c7539a979a04d8404faf18bb27f11457aa436d4e2998ece3deb2c9e59748
2024-11-11 10:54:20 +00:00
merge-script
5acd5e7f87
Merge bitcoin/bitcoin#31257: ci: make ctest stop on failure
36a22e5683 ci: make ctest stop on failure (furszy)

Pull request description:

  Make `ctest` stops when the first failure happens.
  Wasting less resources and notifying the developer faster when a failure occurs.

ACKs for top commit:
  maflcko:
    lgtm ACK 36a22e5683
  tdb3:
    code review and test ACK 36a22e5683

Tree-SHA512: 3abdb330e76aa312f7a5432e3d447a654e6689fc56e067b8e4d07ed8d677fc92f836e603aab0b2f175a6c039a5d50e5fd1160d503164321c1af44ad902f09605
2024-11-11 10:49:26 +00:00
merge-script
19f277711e
Merge bitcoin/bitcoin#26593: tracing: Only prepare tracepoint arguments when actually tracing
0de3e96e33 tracing: use bitcoind pid in bcc tracing examples (0xb10c)
411c6cfc6c tracing: only prepare tracepoint args if attached (0xb10c)
d524c1ec06 tracing: dedup TRACE macros & rename to TRACEPOINT (0xb10c)

Pull request description:

  Currently, if the tracepoints are compiled (e.g. in depends and release builds), we always prepare the tracepoint arguments regardless of the tracepoints being used or not. We made sure that the argument preparation is as cheap as possible, but we can almost completely eliminate any overhead for users not interested in the tracepoints (the vast majority), by gating the tracepoint argument preparation with an `if(something is attached to this tracepoint)`. To achieve this, we use the optional semaphore feature provided by SystemTap.

  The first commit simplifies and deduplicates our tracepoint macros from 13 TRACEx macros to a single TRACEPOINT macro. This makes them easier to use and also avoids more duplicate macro definitions in the second commit.

  The Linux tracing tools I'm aware of (bcc, bpftrace, libbpf, and systemtap) all support the semaphore gating feature. Thus, all existing tracepoints and their argument preparation is gated in the second commit. For details, please refer to the commit messages and the updated documentation in `doc/tracing.md`.

  Also adding unit tests that include all tracepoint macros to make sure there are no compiler problems with them (e.g. some varadiac extension not supported).

  Reviewers might want to check:
  - Do the tracepoints still work for you? Do the examples in `contrib/tracing/` run on your system (as bpftrace frequently breaks on every new version, please test master too if it should't work for you)? Do the CI interface tests still pass?
  - Is the new documentation clear?
  - The `TRACEPOINT_SEMAPHORE(event, context)` macros places global variables in our global namespace. Is this something we strictly want to avoid or maybe move to all `TRACEPOINT_SEMAPHORE`s to a separate .cpp file or even namespace? I like having the `TRACEPOINT_SEMAPHORE()` in same file as the `TRACEPOINT()`, but open for suggestion on alternative approaches.
  - Are newly added tracepoints in the unit tests visible when using `readelf -n build/src/test/test_bitcoin`? You can run the new unit tests with `./build/src/test/test_bitcoin --run_test=util_trace_tests* --log_level=all`.
  <details><summary>Two of the added unit tests demonstrate that we are only processing the tracepoint arguments when attached by having a test-failure condition in the tracepoint argument preparation. The following bpftrace script can be used to demonstrate that the tests do indeed fail when attached to the tracepoints.</summary>

  `fail_tests.bt`:

  ```c
  #!/usr/bin/env bpftrace

  usdt:./build/src/test/test_bitcoin:test:check_if_attached {
    printf("the 'check_if_attached' test should have failed\n");
  }

  usdt:./build/src/test/test_bitcoin:test:expensive_section {
    printf("the 'expensive_section' test should have failed\n");
  }
  ```

  Run the unit tests with `./build/src/test/test_bitcoin` and start `bpftrace fail_tests.bt -p $(pidof test_bitcoin)` in a separate terminal. The unit tests should fail with:

  ```
  Running 594 test cases...
  test/util_trace_tests.cpp(31): error: in "util_trace_tests/test_tracepoint_check_if_attached": check false has failed
  test/util_trace_tests.cpp(51): error: in "util_trace_tests/test_tracepoint_manual_tracepoint_active_check": check false has failed

  *** 2 failures are detected in the test module "Bitcoin Core Test Suite"
  ```

  </details>

  These links might provide more contextual information for reviewers:
  - [How SystemTap Userspace Probes Work by eklitzke](https://eklitzke.org/how-sytemtap-userspace-probes-work) (actually an example on Bitcoin Core; mentions that with semaphores "the overhead for an untraced process is effectively zero.")
  - [libbpf comment on USDT semaphore handling](1596a09b5d/src/usdt.c (L83-L92)) (can recommend the whole comment for background on how the tracepoints and tracing tools work together)
  - https://sourceware.org/systemtap/wiki/UserSpaceProbeImplementation#Semaphore_Handling

ACKs for top commit:
  willcl-ark:
    utACK 0de3e96e33
  laanwj:
    re-ACK 0de3e96e33
  jb55:
    utACK 0de3e96e33
  vasild:
    ACK 0de3e96e33

Tree-SHA512: 0e5e0dc5e0353beaf5c446e4be03d447e64228b1be71ee9972fde1d6fac3fac71a9d73c6ce4fa68975f87db2b2bf6eee2009921a2a145e24d83a475d007a559b
2024-11-11 10:33:28 +00:00
TheCharlatan
e80e4c6ff9
validation: Remove RECENT_CONSENSUS_CHANGE validation result
The *_RECENT_CONSENSUS_CHANGE variants in the validation result
enumerations were always unused. They seem to have been kept around
speculatively for a soft fork after segwit, however they were never used
for taproot either. This points at them not having a clear purpose.
Based on the original pull requests' comments their usage was never
entirely clear:
https://github.com/bitcoin/bitcoin/pull/11639#issuecomment-370234133
https://github.com/bitcoin/bitcoin/pull/15141#discussion_r271039747

Since they are part of the validation interface and need to exposed by
the kernel library keeping them around may also be confusing to future
users of the library.
2024-11-11 10:24:38 +01:00
MarcoFalke
fa729ab4a2
doc: Fixup bitcoin-wallet manpage chain selection args 2024-11-09 13:37:45 +01:00
secp512k2
5e3b444022
doc: Fix missing comma in JSON example in REST-interface.md
This pull request addresses a minor issues in the REST-interface.md documentation:

Missing Comma in JSON Example: In the "Query UTXO set" section, a missing comma after the "desc" field in the JSON example has been added to ensure valid JSON syntax.
2024-11-08 14:24:01 -08:00
Ava Chow
0903ce8dbc
Merge bitcoin/bitcoin#30592: Remove mempoolfullrbf
c189eec848 doc: release note for mempoolrullrbf removal (Greg Sanders)
d47297c6aa rpc: Mark fullrbf and bip125-replaceable as deprecated (Greg Sanders)
04a5dcee8a docs: remove requirement to signal bip125 (Greg Sanders)
111a23d9b3 Remove -mempoolfullrbf option (Greg Sanders)

Pull request description:

  Given https://github.com/bitcoin/bitcoin/pull/30493 and the related discussion on network uptake it's probably not helpful to have an option for a feature that will not be respected by the network in any meaningful way.

  Wallet changes can be done in another PR on its own cadence to account for possible fingerprinting, waiting for fullrbf logic to permeate the network, etc.

ACKs for top commit:
  stickies-v:
    re-ACK c189eec848
  achow101:
    ACK c189eec848
  murchandamus:
    ACK c189eec848
  rkrux:
    reACK c189eec848

Tree-SHA512: 9447f88f8f291c56c5bde70af0a91b0a4f5163aaaf173370fbfdaa3c3fd0b44120b14d3a1977f7ee10e27ffe9453f8a70dd38aad0ffb8c39cf145049d2550730
2024-11-08 13:51:29 -05:00
Ava Chow
f842d0801e
Merge bitcoin/bitcoin#29686: Update manpage descriptions
47f50c7af5 doc: add bitcoin-qt man description (willcl-ark)
40b82e3ab0 doc: add bitcoin-util man description (willcl-ark)
a7bf80f3a2 doc: add bitcoin-tx man description (willcl-ark)
3f9a516832 doc: add bitcoin-wallet man description (willcl-ark)
d8c0bb23ef doc: add bitcoin-cli man description (willcl-ark)
09abccfa77 doc: add bitcoind man description (willcl-ark)

Pull request description:

  Closes #29552

  Add better descriptions to help string for all binaries. Use format which is correctly detected by help2man when generating manpages.

  Examples:

  Before:

  ![image](https://github.com/bitcoin/bitcoin/assets/6606587/9f6a5dbd-b18b-416b-827b-1c260d7a1274)

  After:
  ![image](https://github.com/bitcoin/bitcoin/assets/6606587/179082a1-1082-4204-bad7-56260d0fdefc)

  Demonstration using `bitcoin-cli` also highlights removal of inline usage explanations which were being incorrectly formatted by `help2man`. This results in the following changed format to `bitcoin-cli --help`:

  ![image](https://github.com/bitcoin/bitcoin/assets/6606587/dbebb99f-e419-40cd-a82d-e87f33351fea)

ACKs for top commit:
  achow101:
    ACK 47f50c7af5
  tdb3:
    re ACK 47f50c7af5
  rkrux:
    tACK 47f50c7af5
  maflcko:
    ACK 47f50c7af5 📠

Tree-SHA512: 124a8877077b7d47758ea970949d472b2444e3ba65d2bfeb47ebbdb1f5f8d3bf0abe2c88714bb6c92ba0e36583f0b36aa6f016ea88b65f011c610096ea872182
2024-11-08 13:34:59 -05:00