Commit graph

41969 commits

Author SHA1 Message Date
MarcoFalke
fa103db2bb
scripted-diff: Rename SetHex to SetHexDeprecated
SetHex is fragile, because it accepts any non-hex input or any length of
input, without error feedback. This can lead to issues when the input is
truncated or otherwise corrupted.

Document the problem by renaming the method.

In the future, the fragile method should be removed from the public
interface.

-BEGIN VERIFY SCRIPT-
 sed -i 's/SetHex/SetHexDeprecated/g' $( git grep -l SetHex ./src )
-END VERIFY SCRIPT-
2024-07-24 09:15:34 +02:00
MarcoFalke
fafe4b8051
test: refactor: Replace SetHex with uint256 constructor directly
This avoids a hex-decoding and makes the next commit smaller.
2024-07-24 09:14:57 +02:00
Hennadii Stepanov
ec0e805d11
depends: Bump libmultiprocess for CMake fixes 2024-07-23 20:04:53 +01:00
Ryan Ofsky
7cc00bfc86
Merge bitcoin/bitcoin#30436: fix: Make TxidFromString() respect string_view length
09ce3501fa fix: Make TxidFromString() respect string_view length (Hodlinator)
01e314ce0a refactor: Change base_blob::SetHex() to take std::string_view (Hodlinator)
2f5577dc2e test: uint256 - Garbage suffixes and zero padding (Hodlinator)
f11f816800 refactor: Make uint256_tests no longer use deprecated BOOST_CHECK() (Hodlinator)
f0eeee2dc1 test: Add test for TxidFromString() behavior (Ryan Ofsky)

Pull request description:

  ### Problem

  Prior to this, `TxidFromString()` was passing `string_view::data()` into `uint256S()` which meant it would only receive the a naked `char*` pointer and potentially scan past the `string_view::length()` until it found a null terminator (or some other non-hex character).

  Appears to have been a fully dormant bug as callers were either passing a string literal or `std::string` directly to `TxidFromFromString()`, meaning a null terminator always existed at `pointer[length()]`. Bug existed since original merge of `TxidFromString()`.

  ### Solution

  Make `uint256S()` (and `base_blob::SetHex()`) take and operate on `std::string_view` instead of `const char*` and have `TxidFromString()` pass that in.

  (PR was prompted by comment in https://github.com/bitcoin/bitcoin/pull/30377#issuecomment-2208857200 (referring to https://github.com/bitcoin/bitcoin/pull/28922#discussion_r1404437378)).

ACKs for top commit:
  maflcko:
    re-ACK 09ce3501fa 🕓
  paplorinc:
    ACK 09ce3501fa
  ryanofsky:
    Code review ACK 09ce3501fa. I think the current code changes are about as small as you could make to fix the bug without introducing a string copy, and the surrounding test improvements are all very nice and welcome.

Tree-SHA512: c2c10551785fb6688d1e2492ba42a8eee4c19abbe8461bb0774d56a70c23cd6b0718d2641632890bee880c06202dee148126447dd2264eaed4f5fee7e1bcb581
2024-07-23 14:19:27 -04:00
Ava Chow
ed2d775e0e
Merge bitcoin/bitcoin#30408: rpc: doc: use "output script" terminology consistently in "asm"/"hex" results
29eafd5733 rpc: doc: use "output script" terminology consistently in "asm"/"hex" results (Sebastian Falbesoner)

Pull request description:

  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 (probably most?) 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) from murchandamus 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

ACKs for top commit:
  maflcko:
    ACK 29eafd5733
  achow101:
    ACK 29eafd5733
  BrandonOdiwuor:
    ACK 29eafd5733
  tdb3:
    ACK 29eafd5733

Tree-SHA512: 62eb92d42bc44e36dc3090df7b248a123868a74af253d2046de02086e688bf6ff98307b927ba2fee3d599f85e073aeb8eca90ed15105ca63b648b6796cfa340b
2024-07-23 13:49:10 -04:00
MarcoFalke
fa3ea3b83c
test: Fix intermittent issue in p2p_v2_misbehaving.py
Without the fix, the test could fail intermittently. For example:

 node0 2024-07-22T16:31:54.104994Z [httpworker.0] [rpc/request.cpp:232] [parse] [rpc] ThreadRPCServer method=setmocktime user=__cookie__
 test  2024-07-22T16:31:54.291000Z TestFramework (INFO): Sending first 4 bytes of ellswift which match network magic
 test  2024-07-22T16:31:54.292000Z TestFramework (INFO): If a response is received, assertion failure would happen in our custom data_received() function
 test  2024-07-22T16:31:54.292000Z TestFramework.p2p (DEBUG): Connecting to Bitcoin Node: 127.0.0.1:12644
 test  2024-07-22T16:31:54.293000Z TestFramework.p2p (DEBUG): Connected & Listening: 127.0.0.1:12644
 test  2024-07-22T16:31:54.588000Z TestFramework.p2p (DEBUG): sending 4050 bytes of garbage data
 test  2024-07-22T16:31:54.588000Z TestFramework (INFO): Sending remaining ellswift and garbage which are different from V1_PREFIX. Since a response is
 test  2024-07-22T16:31:54.588000Z TestFramework (INFO): expected now, our custom data_received() function wouldn't result in assertion failure
 node0 2024-07-22T16:31:55.523868Z (mocktime: 2024-07-22T16:31:54Z) [net] [net.cpp:3764] [CNode] [net] Added connection peer=0
 node0 2024-07-22T16:31:55.625145Z (mocktime: 2024-07-22T16:31:54Z) [net] [net.cpp:1814] [CreateNodeFromAcceptedSocket] [net] connection from 127.0.0.1:45154 accepted
 node0 2024-07-22T16:31:55.625769Z (mocktime: 2024-07-22T16:31:54Z) [http] [httpserver.cpp:305] [http_request_cb] [http] Received a POST request for / from 127.0.0.1:33320
 node0 2024-07-22T16:31:55.626543Z (mocktime: 2024-07-22T16:31:54Z) [httpworker.1] [rpc/request.cpp:232] [parse] [rpc] ThreadRPCServer method=getpeerinfo user=__cookie__
 test  2024-07-22T16:31:55.818000Z TestFramework (ERROR): Unexpected exception caught during testing
                                   Traceback (most recent call last):
                                     File "/ci_container_base/ci/scratch/build/bitcoin-x86_64-pc-linux-gnu/test/functional/test_framework/test_framework.py", line 132, in main
                                       self.run_test()
                                     File "/ci_container_base/ci/scratch/build/bitcoin-x86_64-pc-linux-gnu/test/functional/p2p_v2_misbehaving.py", line 133, in run_test
                                       self.test_earlykeyresponse()
                                     File "/ci_container_base/ci/scratch/build/bitcoin-x86_64-pc-linux-gnu/test/functional/p2p_v2_misbehaving.py", line 151, in test_earlykeyresponse
                                       self.wait_until(lambda: node0.getpeerinfo()[-1]["bytesrecv"] > 4)
                                     File "/ci_container_base/ci/scratch/build/bitcoin-x86_64-pc-linux-gnu/test/functional/test_framework/test_framework.py", line 791, in wait_until
                                       return wait_until_helper_internal(test_function, timeout=timeout, timeout_factor=self.options.timeout_factor)
                                              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
                                     File "/ci_container_base/ci/scratch/build/bitcoin-x86_64-pc-linux-gnu/test/functional/test_framework/util.py", line 289, in wait_until_helper_internal
                                       if predicate():
                                          ^^^^^^^^^^^
                                     File "/ci_container_base/ci/scratch/build/bitcoin-x86_64-pc-linux-gnu/test/functional/p2p_v2_misbehaving.py", line 151, in <lambda>
                                       self.wait_until(lambda: node0.getpeerinfo()[-1]["bytesrecv"] > 4)
                                                               ~~~~~~~~~~~~~~~~~~~^^^^
                                   IndexError: list index out of range
2024-07-23 19:48:40 +02:00
MarcoFalke
55555574d1
net: Log accepted connection after m_nodes.push_back
Otherwise, the debug log could read confusingly, when the getpeerinfo()
RPC (calling GetNodeStats) happens after the "accepted connection" log
line, but returns an empty list.

For example, the following timeline in the debug log could correspond to
a getpeerinfo reply that is empty:

[net] [net.cpp:3764] [CNode] Added connection peer=0
[net] [net.cpp:1814] [CreateNodeFromAcceptedSocket] connection from 127.0.0.1:45154 accepted
[http] [httpserver.cpp:305] [http_request_cb] Received a POST request for / from 127.0.0.1:33320
[httpworker.1] [rpc/request.cpp:232] [parse] ThreadRPCServer method=getpeerinfo user=__cookie__

Fix it by moving the log line.
2024-07-23 19:37:59 +02:00
Ava Chow
8ae79f1155
Merge bitcoin/bitcoin#30403: test, assumeutxo: Remove resolved todo comments and add new test
d63ef73800 test: Add loadtxoutset test with tip on snapshot block (Fabian Jahr)
c2f86d4bcb test: Remove already resolved assumeutxo todo comments (Fabian Jahr)

Pull request description:

  The first commit removes three Todos that have been addressed previously (see commit message for details).

  The second message resolves another todo by adding the missing test case. This is a special case of "the tip has more work than the snapshot" where the tip is the same block as the snapshot base block.

  Related to #28648.

ACKs for top commit:
  jrakibi:
    ACK [d63ef73](d63ef73800)
  achow101:
    ACK d63ef73800
  maflcko:
    ACK d63ef73800
  alfonsoromanz:
    Re ACK d63ef73800

Tree-SHA512: 8d5a25fc0b26531db3a9740132694138f2103b7b42eeb1d4a64095bfc901c1372e23601c0855c7def84c8a4e185d10611e4e830c4e479f1b663ae6ed53abb130
2024-07-23 13:36:11 -04:00
fanquake
d1592d2eee
guix: use gcc-12 to compile winpthreads
Currently, winpthreads is compiled with GCC 11, when we want to be using
GCC 12 for all compilation.
2024-07-23 16:57:02 +01:00
fanquake
a517029646
depends: switch to building expat with CMake
Add a patch to set the minimum CMake to 3.16.
2024-07-23 15:37:01 +01:00
fanquake
b23690e821
guix: use GCC 12.4.0 over 12.3.0
Our patch might be merged upstream soon:
https://lists.gnu.org/archive/html/guix-patches/2024-06/msg01025.html.

In the mean time, it's easy us for us to use the newer version of GCC.
2024-07-23 14:37:28 +01:00
fanquake
8b41ede55e
guix: consolidate back to GCC 12 toolchain for all HOSTS
Using GCC 11 for the macOS build hasn't been required since #21778, and
at this point, given a toolchain is still needed (#30206), it makes more
sense to (re-)use 12, rather than make all builders compile another
GCC toolchain.
2024-07-23 13:54:14 +01:00
Hodlinator
09ce3501fa
fix: Make TxidFromString() respect string_view length
Prior to this, passing string_view::data() into uint256S() meant the latter would only receive the a naked char* pointer and potentially scan past the string_view::length() until it found a null terminator (or some other non-hex character).

Appears to have been a fully dormant bug as callers were either passing a string literal or std::string directly to TxidFromFromString(), meaning null terminator always existed at pointer[length()]. Bug existed since original merge of TxidFromString(), discussed in https://github.com/bitcoin/bitcoin/pull/28922#discussion_r1404437378.
2024-07-23 14:51:39 +02:00
Hodlinator
01e314ce0a
refactor: Change base_blob::SetHex() to take std::string_view
Clarify that hex strings are parsed as little-endian.
2024-07-23 14:51:36 +02:00
Hodlinator
2f5577dc2e
test: uint256 - Garbage suffixes and zero padding 2024-07-23 14:44:30 +02:00
merge-script
51ac4792e5
Merge bitcoin/bitcoin#30504: doc: use proper doxygen formatting for CTxMemPool::cs
6a5e9e40e1 doc: use proper doxygen formatting for CTxMemPool::cs (Vasil Dimov)

Pull request description:

  Having `@par title` followed by an empty line renders improperly in Doxygen - it results in a paragraph with a title but without a body.

  https://www.doxygen.nl/manual/commands.html#cmdpar

  This also results in a compiler warning (or error) with Clang 19:

  ```
  ./txmempool.h:368:34: error: empty paragraph passed to '@par' command [-Werror,-Wdocumentation]
    368 |      * @par Consistency guarantees
        |        ~~~~~~~~~~~~~~~~~~~~~~~~~~^
  1 error generated.
  ```

ACKs for top commit:
  maflcko:
    review ACK 6a5e9e40e1
  tdb3:
    ACK 6a5e9e40e1

Tree-SHA512: 2c4c9e5fd4bd44754800a9bcfff74df101afc060b84451c45aa098e4ceb05a47f28a36f8473b31222552fad6339b752a148e6b1c7d41c2003f515b3eb4060902
2024-07-23 13:31:55 +01:00
Hodlinator
f11f816800
refactor: Make uint256_tests no longer use deprecated BOOST_CHECK() 2024-07-23 14:15:39 +02:00
Ryan Ofsky
f0eeee2dc1
test: Add test for TxidFromString() behavior 2024-07-23 14:08:46 +02:00
Vasil Dimov
6a5e9e40e1
doc: use proper doxygen formatting for CTxMemPool::cs
Having `@par title` followed by an empty line renders improperly in
Doxygen - it results in a paragraph with a title but without a body.

https://www.doxygen.nl/manual/commands.html#cmdpar

This also results in a compiler warning (or error) with Clang 19:

```
./txmempool.h:368:34: error: empty paragraph passed to '@par' command [-Werror,-Wdocumentation]
  368 |      * @par Consistency guarantees
      |        ~~~~~~~~~~~~~~~~~~~~~~~~~~^
1 error generated.
```
2024-07-23 12:21:41 +02:00
merge-script
910d38b22f
Merge bitcoin/bitcoin#30474: fuzz: Speed up PickValue in txorphan
fa33a63bd9 fuzz: Speed up PickValue in txorphan (MarcoFalke)

Pull request description:

  `PickValue` will advance a begin iterator on the `outpoints` set, which is expensive, because it only has a `++` operator. As it is called in a loop of `num_in` (~`outpoints.size()`), the runtime is `O(outpoints.size() ^ 2)`.

  Fix it by making the runtime linear.

ACKs for top commit:
  glozow:
    ACK fa33a63bd9, thanks for taking the suggestion
  dergoegge:
    utACK fa33a63bd9

Tree-SHA512: 33f440d97c6834d907d43a8d29e4fb2c995f0d244460bd079af100f13d3607a53e44a0db52f4eb5c487d98df0ff4f2f6d987bf94b922ae9f4506f1295ad6214c
2024-07-23 10:49:36 +01:00
MarcoFalke
fa33a63bd9
fuzz: Speed up PickValue in txorphan
Co-Authored-By: l0rinc <pap.lorinc@gmail.com>
2024-07-23 10:37:58 +02:00
merge-script
8754d055c6
Merge bitcoin/bitcoin#30494: fuzz: reduce keypool size in scriptpubkeyman target
dcb4ec9449 fuzz: reduce keypool size in scriptpubkeyman target (brunoerg)

Pull request description:

  Fixes #30476

  This PR reduces keypool size in scriptpubkeyman fuzz target to avoid spend a lot of time in `TopUp` (which is obviously called by many spkm functions).

  For reference:

  This PR:
  ```
  INFO: Running with entropic power schedule (0xFF, 100).
  INFO: Seed: 1845055748
  INFO: Loaded 1 modules   (1225616 inline 8-bit counters): 1225616 [0x106346fe0, 0x106472370),
  INFO: Loaded 1 PC tables (1225616 PCs): 1225616 [0x106472370,0x107725c70),
  ./src/test/fuzz/fuzz: Running 1 inputs 10 time(s) each.
  Running: ./qa-assets/fuzz_seed_corpus/scriptpubkeyman/c9b8928cecb1edc192fb2d5816b4b7878cdfcf50
  Executed ./qa-assets/fuzz_seed_corpus/scriptpubkeyman/c9b8928cecb1edc192fb2d5816b4b7878cdfcf50 in 250 ms
  ```

  Master:
  ```
  INFO: Running with entropic power schedule (0xFF, 100).
  INFO: Seed: 2004906948
  INFO: Loaded 1 modules   (1225603 inline 8-bit counters): 1225603 [0x104196f80, 0x1042c2303),
  INFO: Loaded 1 PC tables (1225603 PCs): 1225603 [0x1042c2308,0x105575b38),
  ./src/test/fuzz/fuzz: Running 1 inputs 10 time(s) each.
  Running: ./qa-assets/fuzz_seed_corpus/scriptpubkeyman/c9b8928cecb1edc192fb2d5816b4b7878cdfcf50
  Executed ./qa-assets/fuzz_seed_corpus/scriptpubkeyman/c9b8928cecb1edc192fb2d5816b4b7878cdfcf50 in 21016 ms
  ```

ACKs for top commit:
  maflcko:
    review ACK dcb4ec9449
  dergoegge:
    utACK dcb4ec9449

Tree-SHA512: d818b228d5f1dd0d5c665d8e54cf5dd8e378604039eaac114fc34366ece4420b9b2519d898f2dc2410960b873f0b91bbad4a534a35658477aed6ef48f3458137
2024-07-22 18:10:40 +01:00
merge-script
b927a39c63
Merge bitcoin/bitcoin#30488: depends: Fix CMake-generated libevent*.pc files
8c935e625e depends: Fix CMake-generated `libevent*.pc` files (Hennadii Stepanov)

Pull request description:

  Broken out of #30454. This is a backport of the merged upstream PR: https://github.com/libevent/libevent/pull/1622.

  Note that after #29835 we might end up dropping pkg-config and using the installed CMake files directly, but that depends on whether or not enough distros actually ship those files.

  Either way, having fixed up .pc files won't hurt.

ACKs for top commit:
  hebasto:
    ACK 8c935e625e.
  fanquake:
    ACK 8c935e625e

Tree-SHA512: 259c2ad78fb9e90370a7205dc71c40acda1a872f6509435133bc1c4c2c3de57366e80679aa083e13ed85e7966883dc470c0147ee171a2ed0171a18cd5ffc99b3
2024-07-22 17:59:47 +01:00
merge-script
55e473c43e
Merge bitcoin/bitcoin#30500: Fix lint-spelling warnings
bccfca0382 Fix lint-spelling warnings (Lőrinc)

Pull request description:

  These warnings were often polluting the CI output, e.g. https://github.com/bitcoin/bitcoin/pull/30499/checks?check_run_id=27745036545

  > ./test/lint/lint-spelling.py

  before the change:
  ```
  doc/design/libraries.md💯 targetted ==> targeted
  doc/developer-notes.md:495: dependant ==> dependent
  src/bench/sign_transaction.cpp:49: hashIn ==> hashing, hash in
  src/bitcoin-chainstate.cpp:213: hashIn ==> hashing, hash in
  src/bitcoin-chainstate.cpp:213: hashIn ==> hashing, hash in
  src/coins.cpp:24: viewIn ==> viewing, view in
  src/coins.cpp:24: viewIn ==> viewing, view in
  src/coins.cpp:29: viewIn ==> viewing, view in
  src/coins.cpp:29: viewIn ==> viewing, view in
  src/coins.h:44: outIn ==> outing, out in
  src/coins.h:44: outIn ==> outing, out in
  src/coins.h:45: outIn ==> outing, out in
  src/coins.h:45: outIn ==> outing, out in
  src/coins.h:215: viewIn ==> viewing, view in
  src/coins.h:220: viewIn ==> viewing, view in
  src/primitives/transaction.h:37: hashIn ==> hashing, hash in
  src/primitives/transaction.h:37: hashIn ==> hashing, hash in
  src/protocol.cpp:51: hashIn ==> hashing, hash in
  src/protocol.cpp:51: hashIn ==> hashing, hash in
  src/protocol.h:497: hashIn ==> hashing, hash in
  src/qt/forms/optionsdialog.ui:344: incomin ==> incoming
  src/qt/optionsdialog.cpp:445: proxys ==> proxies
  src/rpc/mining.cpp:987: hashIn ==> hashing, hash in
  src/rpc/mining.cpp:987: hashIn ==> hashing, hash in
  src/script/interpreter.h:298: amountIn ==> amounting, amount in
  src/script/interpreter.h:298: amountIn ==> amounting, amount in
  src/script/interpreter.h:299: amountIn ==> amounting, amount in
  src/script/interpreter.h:299: amountIn ==> amounting, amount in
  src/script/sigcache.h:70: amountIn ==> amounting, amount in
  src/script/sigcache.h:70: amountIn ==> amounting, amount in
  src/signet.cpp:144: amountIn ==> amounting, amount in
  src/test/fuzz/util/net.cpp:386: occured ==> occurred
  src/test/fuzz/util/net.cpp:398: occured ==> occurred
  src/util/vecdeque.h:79: deques ==> dequeues
  src/util/vecdeque.h:160: deques ==> dequeues
  src/util/vecdeque.h:184: deques ==> dequeues
  src/util/vecdeque.h:194: deques ==> dequeues
  src/validation.cpp:2130: re-declared ==> redeclared
  src/validation.h:348: outIn ==> outing, out in
  src/validation.h:349: outIn ==> outing, out in
  test/functional/wallet_bumpfee.py:851: atleast ==> at least
  ```

ACKs for top commit:
  Sjors:
    ACK bccfca0382
  josibake:
    ACK bccfca0382

Tree-SHA512: 71d5f0d3319db50eaf9bcb9cb61da5da01767c60f5a782955a3f20e7149882049e33ebcc1788a71f109da2d7010fd1119c0a68c181f7a692de966cbd7e7511ae
2024-07-22 17:56:22 +01:00
merge-script
038730a795
Merge bitcoin/bitcoin#30501: lint: Add missing docker.io prefix to ci/lint_imagefile
fa7bee13bf lint: Use git clone --depth=1 (MarcoFalke)
fadb7c2a91 lint: Add missing docker.io prefix to ci/lint_imagefile (MarcoFalke)

Pull request description:

  Currently, the `ci/lint_imagefile` may pick the wrong (non-native) architecture due to the missing prefix.

  For example, assuming the user has previously pulled an s390x image:

  ```
  $ podman run --rm 'docker.io/s390x/debian:bookworm' dpkg --print-architecture
  exec /usr/bin/dpkg: exec format error
  ```

  Now, `debian:bookworm` will refer to the same image:

  ```
  $ podman run --rm 'debian:bookworm' dpkg --print-architecture
  exec /usr/bin/dpkg: exec format error
  ```

  However, `docker.io/debian:bookworm` works fine:

  ```
   $ podman run --rm 'docker.io/debian:bookworm' dpkg --print-architecture
  arm64
  ```

  (Also includes a nit-fix from https://github.com/bitcoin/bitcoin/pull/30499#discussion_r1686470495)

ACKs for top commit:
  paplorinc:
    utACK fa7bee13bf
  hebasto:
    ACK fa7bee13bf.

Tree-SHA512: 4b6d562c14c67bef984ad25f6a3a1ef7f1059dc2859c603c45083b36bcacafa3248fc74176e2e4626fdc39507e9353f458ddbc4077f805c03e970df46af02224
2024-07-22 17:53:19 +01:00
merge-script
c69ba20bce
Merge bitcoin/bitcoin#29723: depends: build zeromq with CMake
0388ad0d65 depends: switch zmq to CMake (Cory Fields)
fefb3bbe5b depends: add zeromq no librt patch (fanquake)
a522ef1542 depends: add zeromq cmake minimum patch (fanquake)
cbbc229adf depends: add zeromq windows usage patch (fanquake)
2de68d6d38 depends: add zeromq builtin sha1 patch (fanquake)
0c8605253a depends: add zeromq mktemp macos patch (fanquake)

Pull request description:

  This picks up a change, which is a switch to building zeromq with CMake. It includes a number of patches, some which have already been upstreamed (see each patch for details).

ACKs for top commit:
  hebasto:
    ACK 0388ad0d65.

Tree-SHA512: 5567e432b4e4e0446c41d502bd61810a80b329dea2399b5d9d9f6e79acc450d1c6ba861c8238ba895de98338cfc5dc44ad2bf86ee8c222ecb3fbf47d6eb60da4
2024-07-22 17:49:27 +01:00
MarcoFalke
fa7bee13bf
lint: Use git clone --depth=1
No need to download and store more than that.
2024-07-22 17:30:12 +02:00
MarcoFalke
fadb7c2a91
lint: Add missing docker.io prefix to ci/lint_imagefile 2024-07-22 17:27:14 +02:00
merge-script
98537a0212
Merge bitcoin/bitcoin#30499: lint: Use consistent out-of-tree build for python and test_runner
fa8d73e86e lint: Use consistent out-of-tree build for python and test_runner (MarcoFalke)
fa0f859885 doc: Clarify intent of ./ci/lint_run_all.sh (MarcoFalke)
fa9ad59f87 lint: Use $CI_RETRY_EXE when building ./ci/lint_imagefile (MarcoFalke)

Pull request description:

  Fixes https://github.com/bitcoin/bitcoin/issues/30496

  Seems odd to sometimes do an out-of-tree build (via `./ci/lint_imagefile`, see `test/lint/README.md`) and sometimes not (via Cirrus CI, see `./ci/lint_run_all.sh`).

  Fix it by doing an out-of-tree build consistently in the same location.

  Also, fix `$CI_RETRY_EXE`, while touching this.

ACKs for top commit:
  josibake:
    utACK fa8d73e86e
  willcl-ark:
    utACK fa8d73e86e
  paplorinc:
    utACK fa8d73e86e

Tree-SHA512: 4181ca14299a798850f5e05f180f3305a3378081ca8dabf6ab2da6115997cc17f6ef0f10db9b2b31618e59231083e5c4a971432d27b4d77903e655be21155abb
2024-07-22 16:16:43 +01:00
MarcoFalke
fa8d73e86e
lint: Use consistent out-of-tree build for python and test_runner
This mirrors the build by ./ci/lint_imagefile, which is done out-of-tree
in "/".

Otherwise, there could be errors due to a dirty tree.
2024-07-22 14:01:24 +02:00
Lőrinc
bccfca0382 Fix lint-spelling warnings
These warnings were often polluting the CI output, e.g. https://github.com/bitcoin/bitcoin/pull/30499/checks?check_run_id=27745036545

> ./test/lint/lint-spelling.py

before the change:
```
doc/design/libraries.md💯 targetted ==> targeted
doc/developer-notes.md:495: dependant ==> dependent
src/bench/sign_transaction.cpp:49: hashIn ==> hashing, hash in
src/bitcoin-chainstate.cpp:213: hashIn ==> hashing, hash in
src/bitcoin-chainstate.cpp:213: hashIn ==> hashing, hash in
src/coins.cpp:24: viewIn ==> viewing, view in
src/coins.cpp:24: viewIn ==> viewing, view in
src/coins.cpp:29: viewIn ==> viewing, view in
src/coins.cpp:29: viewIn ==> viewing, view in
src/coins.h:44: outIn ==> outing, out in
src/coins.h:44: outIn ==> outing, out in
src/coins.h:45: outIn ==> outing, out in
src/coins.h:45: outIn ==> outing, out in
src/coins.h:215: viewIn ==> viewing, view in
src/coins.h:220: viewIn ==> viewing, view in
src/primitives/transaction.h:37: hashIn ==> hashing, hash in
src/primitives/transaction.h:37: hashIn ==> hashing, hash in
src/protocol.cpp:51: hashIn ==> hashing, hash in
src/protocol.cpp:51: hashIn ==> hashing, hash in
src/protocol.h:497: hashIn ==> hashing, hash in
src/qt/forms/optionsdialog.ui:344: incomin ==> incoming
src/qt/optionsdialog.cpp:445: proxys ==> proxies
src/rpc/mining.cpp:987: hashIn ==> hashing, hash in
src/rpc/mining.cpp:987: hashIn ==> hashing, hash in
src/script/interpreter.h:298: amountIn ==> amounting, amount in
src/script/interpreter.h:298: amountIn ==> amounting, amount in
src/script/interpreter.h:299: amountIn ==> amounting, amount in
src/script/interpreter.h:299: amountIn ==> amounting, amount in
src/script/sigcache.h:70: amountIn ==> amounting, amount in
src/script/sigcache.h:70: amountIn ==> amounting, amount in
src/signet.cpp:144: amountIn ==> amounting, amount in
src/test/fuzz/util/net.cpp:386: occured ==> occurred
src/test/fuzz/util/net.cpp:398: occured ==> occurred
src/util/vecdeque.h:79: deques ==> dequeues
src/util/vecdeque.h:160: deques ==> dequeues
src/util/vecdeque.h:184: deques ==> dequeues
src/util/vecdeque.h:194: deques ==> dequeues
src/validation.cpp:2130: re-declared ==> redeclared
src/validation.h:348: outIn ==> outing, out in
src/validation.h:349: outIn ==> outing, out in
test/functional/wallet_bumpfee.py:851: atleast ==> at least
```
2024-07-22 13:59:42 +02:00
MarcoFalke
fa0f859885
doc: Clarify intent of ./ci/lint_run_all.sh 2024-07-22 13:26:48 +02:00
MarcoFalke
fa9ad59f87
lint: Use $CI_RETRY_EXE when building ./ci/lint_imagefile
Previous code was confusing and brittle. For example, the full import
"source ./ci/test/00_setup_env.sh" and $PATH overwrite was not needed.

Fix it by simply copying the exe to /ci_retry and use that in
$CI_RETRY_EXE.

This is also a fix, because previously ci/lint_imagefile did use an
empty $CI_RETRY_EXE.
2024-07-22 13:20:24 +02:00
glozow
3a29ff5dea
Merge bitcoin/bitcoin#30463: qa: Functional test improvements
a8e3af1a82 qa: Do not assume running `feature_asmap.py` from source directory (Hennadii Stepanov)
9bf7ca6cad qa: Consider `cache` and `config.ini` relative to invocation directory (Hennadii Stepanov)
a0473442d1 scripted-diff: Add `__file__` argument to `BitcoinTestFramework.init()` (Hennadii Stepanov)

Pull request description:

  This PR includes changes split from https://github.com/bitcoin/bitcoin/pull/30454. They improve the functional test framework, allowing users to [run individual functional tests](https://github.com/hebasto/bitcoin/issues/146) from the build directory in the new CMake-based build system.

  This functionality is not available for out-of-source builds using the current Autotools-based build system, which always requires write permissions for the source directory. Nevertheless, this PR can be tested as suggested in https://github.com/bitcoin/bitcoin/pull/30463#issuecomment-2232618421:
  1. Make an out-of-source build:
  ```
  $ ./autogen.sh
  $ mkdir ../build && cd ../build
  $ ../bitcoin/configure
  $ make
  ```
  2. Create a symlink in the build directory to a functional test:
  ```
  $ ln --symbolic ../../../bitcoin/test/functional/wallet_disable.py ./test/functional/
  ```
  3. Run this symlink:
  ```
  $ ./test/functional/wallet_disable.py
  ```
  The last command fails on the master branch:
  ```
  Traceback (most recent call last):
    File "/home/hebasto/git/build/./test/functional/wallet_disable.py", line 31, in <module>
      DisableWalletTest().main()
      ^^^^^^^^^^^^^^^^^^^
    File "/home/hebasto/git/bitcoin/test/functional/test_framework/test_framework.py", line 106, in __init__
      self.parse_args()
    File "/home/hebasto/git/bitcoin/test/functional/test_framework/test_framework.py", line 210, in parse_args
      config.read_file(open(self.options.configfile))
                       ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  FileNotFoundError: [Errno 2] No such file or directory: '/home/hebasto/git/bitcoin/test/config.ini'

  ```
  and succeeds with this PR.

ACKs for top commit:
  maflcko:
    tested ACK a8e3af1a82 🎨
  glozow:
    ACK a8e3af1a82, tested with the steps in op
  stickies-v:
    ACK a8e3af1a82

Tree-SHA512: 899e4efc09edec13ea3f5b47825d03173fb21d3569c360deda7fa6a56b99b4d24e09ad4f0883bad1ee926b1c706e47ba07c6a6160c63c07c82b3cf4ae5816e91
2024-07-22 12:08:32 +01:00
merge-script
a1b8a917b1
Merge bitcoin/bitcoin#30473: fuzz: Limit parse_univalue input length
fa80b16b20 fuzz: Limit parse_univalue input length (MarcoFalke)

Pull request description:

  The new limit should be more than enough, and hopefully avoids fuzz input bloat, such as `parse_univalue/0426365704e09ddd704a058cc2add1cbf104c1a9`. C.f. https://cirrus-ci.com/task/6178647134961664?logs=ci#L3805

  ```
  Run parse_univalue with args ['/ci_container_base/ci/scratch/build/bitcoin-x86_64-pc-linux-gnu/src/test/fuzz/fuzz', '-runs=1', PosixPath('/ci_container_base/ci/scratch/qa-assets/fuzz_seed_corpus/parse_univalue')]INFO: Running with entropic power schedule (0xFF, 100).
  INFO: Seed: 572704560
  INFO: Loaded 1 modules   (623498 inline 8-bit counters): 623498 [0x561cba23a518, 0x561cba2d28a2),
  INFO: Loaded 1 PC tables (623498 PCs): 623498 [0x561cba2d28a8,0x561cbac56148),
  INFO:     3224 files found in /ci_container_base/ci/scratch/qa-assets/fuzz_seed_corpus/parse_univalue
  INFO: -max_len is not provided; libFuzzer will not generate inputs larger than 1048576 bytes
  INFO: seed corpus: files: 3224 min: 1b max: 1050370b total: 25114084b rss: 112Mb
  #1024pulse  cov: 10458 ft: 33444 corp: 906/32Kb exec/s: 341 rss: 154Mb
  #2048pulse  cov: 12081 ft: 55461 corp: 1668/192Kb exec/s: 227 rss: 228Mb
  Slowest unit: 15 s:
  artifact_prefix='./'; Test unit written to ./slow-unit-9df6997f2f4726843e82b3dfde46862599904d56
  Slowest unit: 309 s:
  artifact_prefix='./'; Test unit written to ./slow-unit-0426365704e09ddd704a058cc2add1cbf104c1a9
  #3226INITED cov: 12246 ft: 66944 corp: 2358/3510Kb exec/s: 6 rss: 1610Mb
  #3226DONE   cov: 12246 ft: 66944 corp: 2358/3510Kb lim: 282379 exec/s: 6 rss: 1610Mb
  Done 3226 runs in 477 second(s)

ACKs for top commit:
  dergoegge:
    utACK fa80b16b20
  brunoerg:
    utACK fa80b16b20

Tree-SHA512: b2ffbaaa4876be61be0e6c975ab65a842562d14079a13836202f8b5b5ef75e068e73df75c9bcc702379e123fcdb1dcd66951e31533fb4aaa6afe17dff160f7d0
2024-07-22 11:42:21 +01:00
brunoerg
dcb4ec9449 fuzz: reduce keypool size in scriptpubkeyman target 2024-07-20 12:52:19 -03:00
merge-script
8d57361157
Merge bitcoin/bitcoin#30491: Fix MSVC warning C4273 "inconsistent dll linkage"
7703884ab1 Fix MSVC warning C4273 "inconsistent dll linkage" (Hennadii Stepanov)

Pull request description:

  Broken out of https://github.com/bitcoin/bitcoin/pull/30454.

  When using CMake, the user can select the MSVC runtime library to be:
  1) Statically-linked (with the corresponding `x64-windows-static` vcpkg triplet) or
  2) Dynamically-linked (with the corresponding `x64-windows` vcpkg triplet)

  In the latter case, the compiler emits the [C4273](https://learn.microsoft.com/en-us/cpp/error-messages/compiler-warnings/compiler-warning-level-1-c4273) warning.

  As the "Necessary on some platforms" comment does not apply to MSVC, skip the declaration for MSVC.

  The MSVC build system in the master branch supports the statically-linked runtime only: ed739d14b5/build_msvc/common.init.vcxproj.in (L65)

ACKs for top commit:
  sipa:
    utACK 7703884ab1
  sipsorcery:
    utACK 7703884ab1.
  theuni:
    utACK 7703884ab1

Tree-SHA512: a42e1a0d48973217462e703c418f3e9ef9cb5236267c1bf32912aacaf68976cdd2b9229168523f7c2a99ee3f2fb1bf8add4f342796bdb1e4063ca026b761db51
2024-07-20 14:50:09 +01:00
merge-script
efeb39785a
Merge bitcoin/bitcoin#30490: depends: bump libmultiprocess for CMake fixes
d318c4ef56 depends: bump libmultiprocess for CMake fixes (Cory Fields)

Pull request description:

  Broken out of #30454 . Bumped [even further](4883197abc (r1684802528)) after https://github.com/chaincodelabs/libmultiprocess/pull/98 was merged upstream.

  hebasto Presumably this approach works now with the CMake branch?

ACKs for top commit:
  ryanofsky:
    Code review ACK d318c4ef56.

Tree-SHA512: 4b5491f73c0063d09e8339829cd831b1f4c441dd7b55a22037c9337c80cce19bb00a3e5cf925efa77d6d4e89ab45482f40f5799bc14948f8cabcbad3c3549430
2024-07-20 13:26:07 +01:00
Hennadii Stepanov
7703884ab1
Fix MSVC warning C4273 "inconsistent dll linkage"
When using CMake, the user can select the MSVC runtime library to be:
1) Statically-linked (with the corresponding `x64-windows-static` vcpkg
triplet) or
2) Dynamically-linked (with the corresponding `x64-windows` vcpkg
triplet)

In the latter case, the compiler emits the C4273 warning.

As the "Necessary on some platforms" comment does not apply to MSVC,
skip the declaration for MSVC.
2024-07-19 22:01:01 +01:00
Cory Fields
d318c4ef56 depends: bump libmultiprocess for CMake fixes 2024-07-19 18:32:56 +00:00
Hennadii Stepanov
8c935e625e depends: Fix CMake-generated libevent*.pc files
See https://github.com/libevent/libevent/pull/1622.
2024-07-19 17:45:53 +00:00
TheCharlatan
fae0db0360
fuzz: Deglobalize signature cache in sigcache test
The body of the fuzz test should ideally be a pure function. If data is
persisted in the cache over many iterations, and there is a crash,
reproducing it from the input might be difficult.
2024-07-19 17:17:02 +02:00
MarcoFalke
fa80b16b20
fuzz: Limit parse_univalue input length 2024-07-19 15:39:02 +02:00
MarcoFalke
fa18fc7050
log: Remove NOLINT(bitcoin-unterminated-logprintf) 2024-07-19 15:09:00 +02:00
Cory Fields
0388ad0d65
depends: switch zmq to CMake
The CMake WIN32_WINNT autodetection is broken, and must be set
manually. We may want to set is explicitly in any case, but the
brokenness should also be fixed upstream.

Also patch out depends paths, that would cause non-determinism.

Co-authored-by: fanquake <fanquake@gmail.com>
2024-07-19 13:38:21 +01:00
TheCharlatan
f46b220256
fuzz: Use BasicTestingSetup for coins_view target 2024-07-19 13:37:35 +02:00
TheCharlatan
9e2a723d5d
test: Add arguments for creating a slimmer setup
Adds more testing options for creating an environment without networking
and a validation interface. This is useful for improving the performance
of the utxo snapshot fuzz test, which constructs a new TestingSetup on
each iteration.
2024-07-19 13:37:31 +02:00
fanquake
fefb3bbe5b
depends: add zeromq no librt patch 2024-07-19 10:00:24 +01:00
fanquake
a522ef1542
depends: add zeromq cmake minimum patch 2024-07-19 10:00:24 +01:00
fanquake
cbbc229adf
depends: add zeromq windows usage patch 2024-07-19 10:00:24 +01:00