Commit Graph

76 Commits

Author SHA1 Message Date
MarcoFalke
fa7da227da
refactor: Fix implicit-signed-integer-truncation in cuckoocache.h 2021-11-29 14:32:51 +01:00
MarcoFalke
16d698cdcf
Merge bitcoin/bitcoin#23517: scripted-diff: Move miner to src/node
fa4e09924b refactor: Replace validation.h include with forward-decl in miner.h (MarcoFalke)
fa0739a7d3 style: Sort file list after rename (MarcoFalke)
fa53e3a58c scripted-diff: Move miner to src/node (MarcoFalke)

Pull request description:

  It is impossible to run the miner without a node (validation, chainstate, mempool, rpc, ...). Also, the module is in the node library. Thus, it should be moved to `src/node`.

  Also, replace the `validation.h` include in the header with a forward-declaration.

ACKs for top commit:
  theStack:
    Code-review ACK fa4e09924b

Tree-SHA512: 791e6caa5839d8dc83b0f58f3f49bc0a7e3c1710822e8a44dede254c87b6f7531a0586fb95e8a067c181457a3895ad6041718aa2a2fac64cfc136bf04bb851d5
2021-11-26 09:03:39 +01:00
MarcoFalke
fae5fec0fe
test: Remove sanitizer suppression implicit-signed-integer-truncation:netaddress.cpp
This reverts commit fa865287e5.

This was fixed in commit efd6f904c7.
2021-11-19 16:45:43 +01:00
MarcoFalke
fa53e3a58c
scripted-diff: Move miner to src/node
-BEGIN VERIFY SCRIPT-
 # Move module
 git mv src/miner.cpp src/node/
 git mv src/miner.h   src/node/
 # Replacements
 sed -i 's:miner\.h:node/miner.h:g'     $(git grep -l miner)
 sed -i 's:miner\.cpp:node/miner.cpp:g' $(git grep -l miner)
 sed -i 's:MINER_H:NODE_MINER_H:g'      $(git grep -l MINER_H)
-END VERIFY SCRIPT-
2021-11-16 10:04:55 +01:00
fanquake
c1fb30633b
Merge bitcoin/bitcoin#23114: Add minisketch subtree and integrate into build/test
29173d6c6c ubsan: add minisketch exceptions (Cory Fields)
54b5e1aeab Add thin Minisketch wrapper to pick best implementation (Pieter Wuille)
ee9dc71c1b Add basic minisketch tests (Pieter Wuille)
0659f12b13 Add minisketch dependency (Gleb Naumenko)
0eb7928ab8 Add MSVC build configuration for libminisketch (Pieter Wuille)
8bc166d5b1 build: add minisketch build file and include it (Cory Fields)
b2904ceb85 build: add configure checks for minisketch (Cory Fields)
b6487dc4ef Squashed 'src/minisketch/' content from commit 89629eb2c7 (fanquake)

Pull request description:

  This takes over #21859, which has [recently switched](https://github.com/bitcoin/bitcoin/pull/21859#issuecomment-921899200) to my integration branch. A few more build issues came up (and have been fixed) since, and after discussing with sipa it was decided I would open a PR to shepherd any final changes through.

  > This adds a `src/minisketch` subtree, taken from the master branch of https://github.com/sipa/minisketch, to prepare for Erlay implementation (see #21515). It gets configured for just supporting 32-bit fields (the only ones we're interested in in the context of Erlay), and some code on top is added:
  > * A very basic unit test (just to make sure compilation & running works; actual correctness checking is done through minisketch's own tests).
  > * A wrapper in `minisketchwrapper.{cpp,h}` that runs a benchmark to determine which field implementation to use.

  Only changes since my last update to the branch in the previous PR have been rebasing on master and fixing an issue with a header in an introduced file.

ACKs for top commit:
  naumenkogs:
    ACK 29173d6c6c

Tree-SHA512: 1217d3228db1dd0de12c2919314e1c3626c18a416cf6291fec99d37e34fb6eec8e28d9e9fb935f8590273b8836cbadac313a15f05b4fd9f9d3024c8ce2c80d02
2021-11-12 10:00:49 +08:00
Hennadii Stepanov
96c7db9373
test: Add ios_base::width tsan suppression 2021-10-27 11:41:03 +03:00
Cory Fields
29173d6c6c
ubsan: add minisketch exceptions 2021-10-21 09:39:26 +08:00
MarcoFalke
fa1e5de2db
scripted-diff: Move bloom to src/common
-BEGIN VERIFY SCRIPT-
 # Move to directory
 mkdir                src/common
 git mv src/bloom.cpp src/common/
 git mv src/bloom.h   src/common/

 # Replace occurrences
 sed -i 's|\<bloom\.cpp\>|common/bloom.cpp|g' $(git grep -l 'bloom.cpp')
 sed -i 's|\<bloom\.h\>|common/bloom.h|g'     $(git grep -l 'bloom.h')
 sed -i 's|BITCOIN_BLOOM_H|BITCOIN_COMMON_BLOOM_H|g' $(git grep -l 'BLOOM_H')
-END VERIFY SCRIPT-
2021-10-05 11:10:37 +02:00
MarcoFalke
fa5e8c1044
Revert "test: Add missing suppression signed-integer-overflow:addrman.cpp"
This reverts commit facb534c37.
2021-09-22 09:01:06 +02:00
MarcoFalke
facb534c37
test: Add missing suppression signed-integer-overflow:addrman.cpp 2021-09-08 19:43:42 +02:00
MarcoFalke
fa865287e5
test: Add temporary sanitizer suppression implicit-signed-integer-truncation:netaddress.cpp 2021-07-29 18:51:27 +02:00
MarcoFalke
fa9ebedec3
Reject invalid coin height and output index when loading assumeutxo 2021-06-09 22:20:01 +02:00
MarcoFalke
faca40ec68
test: Add temporary coinstats suppressions 2021-06-09 19:48:45 +02:00
Martin Ankerl
44d05d0a69 test: remove sanitizer suppression for nanobench
In #21738 an ASAN suppression for nanobench was added. This is not needed any more,as nanobench.h already includes the necessary suppressions for the relevant code.
2021-06-01 12:00:21 +02:00
eugene
9c891b64ff net: initialize nMessageSize to max uint32_t instead of -1
nMessageSize is uint32_t and is set to -1. This will warn with
-fsanitize=implicit-integer-sign-change.
2021-05-11 11:21:29 -04:00
MarcoFalke
1fcf66af68
Merge bitcoin/bitcoin#21798: fuzz: Create a block template in tx_pool targets
fa03d0acd6 fuzz: Create a block template in tx_pool targets (MarcoFalke)
fa61ce5cf5 fuzz: Limit mocktime to MTP in tx_pool targets (MarcoFalke)
fab646b8ea fuzz: Use correct variant of ConsumeRandomLengthString instead of hardcoding a maximum size (MarcoFalke)
fae2c8bc54 fuzz: Allow to pass min/max to ConsumeTime (MarcoFalke)

Pull request description:

  Relatively simple check to ensure a block can always be created from the mempool

ACKs for top commit:
  practicalswift:
    Tested ACK fa03d0acd6

Tree-SHA512: e613376ccc88591cbe594db14ea21ebc9b2b191f6325b3aa4ee0cd379695352ad3b480e286134ef6ee30f043d486cf9792a1bc7e44445c41045ac8c3b931c7ff
2021-05-06 16:06:20 +02:00
MarcoFalke
fa03d0acd6
fuzz: Create a block template in tx_pool targets 2021-05-05 20:12:00 +02:00
practicalswift
575792e6ff fuzz: Add -fsanitize=integer suppression needed for RPC fuzzer 2021-05-03 19:33:46 +00:00
MarcoFalke
fa00bb2c5c
test: Add missing shift-base:nanobench.h suppression
Otherwise it is not possible to run bench_bitcoin with clang-12 + ASAN
compiled.

Output:

$ src/bench/bench_bitcoin
bench/nanobench.h:1107:15: runtime error: left shift of 4982565676696827473 by 27 places cannot be represented in type 'uint64_t' (aka 'unsigned long')
    #0 0x5623d6a13137 in ankerl::nanobench::Rng::rotl(unsigned long, unsigned int) /bitcoin/ci/scratch/build/bitcoin-x86_64-pc-linux-gnu/src/./bench/nanobench.h:1107:15
    #1 0x5623d6a13137 in ankerl::nanobench::Rng::operator()() /bitcoin/ci/scratch/build/bitcoin-x86_64-pc-linux-gnu/src/./bench/nanobench.h:1075:10
    #2 0x5623d6a05c5b in ankerl::nanobench::Rng::Rng(unsigned long) /bitcoin/ci/scratch/build/bitcoin-x86_64-pc-linux-gnu/src/./bench/nanobench.h:3135:9
    #3 0x5623d6a0ca51 in ankerl::nanobench::detail::IterationLogic::Impl::Impl(ankerl::nanobench::Bench const&) /bitcoin/ci/scratch/build/bitcoin-x86_64-pc-linux-gnu/src/./bench/nanobench.h:2206:13
    #4 0x5623d69f8f73 in ankerl::nanobench::detail::IterationLogic::IterationLogic(ankerl::nanobench::Bench const&) /bitcoin/ci/scratch/build/bitcoin-x86_64-pc-linux-gnu/src/./bench/nanobench.h:2215:18
    #5 0x5623d690f165 in ankerl::nanobench::Bench& ankerl::nanobench::Bench::run<AddrManAdd(ankerl::nanobench::Bench&)::$_0>(AddrManAdd(ankerl::nanobench::Bench&)::$_0&&) /bitcoin/ci/scratch/build/bitcoin-x86_64-pc-linux-gnu/src/./bench/nanobench.h:1114:28
    #6 0x5623d690e26e in AddrManAdd(ankerl::nanobench::Bench&) /bitcoin/ci/scratch/build/bitcoin-x86_64-pc-linux-gnu/src/bench/addrman.cpp:76:11
    #7 0x5623d69279d6 in void std::__invoke_impl<void, void (*&)(ankerl::nanobench::Bench&), ankerl::nanobench::Bench&>(std::__invoke_other, void (*&)(ankerl::nanobench::Bench&), ankerl::nanobench::Bench&) /usr/bin/../lib/gcc/x86_64-linux-gnu/10/../../../../include/c++/10/bits/invoke.h:60:14
    #8 0x5623d6927921 in std::enable_if<is_invocable_r_v<void, void (*&)(ankerl::nanobench::Bench&), ankerl::nanobench::Bench&>, void>::type std::__invoke_r<void, void (*&)(ankerl::nanobench::Bench&), ankerl::nanobench::Bench&>(void (*&)(ankerl::nanobench::Bench&), ankerl::nanobench::Bench&) /usr/bin/../lib/gcc/x86_64-linux-gnu/10/../../../../include/c++/10/bits/invoke.h:110:2
    #9 0x5623d692775f in std::_Function_handler<void (ankerl::nanobench::Bench&), void (*)(ankerl::nanobench::Bench&)>::_M_invoke(std::_Any_data const&, ankerl::nanobench::Bench&) /usr/bin/../lib/gcc/x86_64-linux-gnu/10/../../../../include/c++/10/bits/std_function.h:291:9
    #10 0x5623d692dbd5 in std::function<void (ankerl::nanobench::Bench&)>::operator()(ankerl::nanobench::Bench&) const /usr/bin/../lib/gcc/x86_64-linux-gnu/10/../../../../include/c++/10/bits/std_function.h:622:14
    #11 0x5623d692cd44 in benchmark::BenchRunner::RunAll(benchmark::Args const&) /bitcoin/ci/scratch/build/bitcoin-x86_64-pc-linux-gnu/src/bench/bench.cpp:65:13
    #12 0x5623d69282bf in main /bitcoin/ci/scratch/build/bitcoin-x86_64-pc-linux-gnu/src/bench/bench_bitcoin.cpp:63:5
    #13 0x7f6812010564 in __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x28564)
    #14 0x5623d685f4dd in _start (/bitcoin/ci/scratch/build/bitcoin-x86_64-pc-linux-gnu/src/bench/bench_bitcoin+0x13754dd)

SUMMARY: UndefinedBehaviorSanitizer: invalid-shift-base bench/nanobench.h:1107:15 in

$ clang --version
Ubuntu clang version 12.0.0-1ubuntu1
Target: x86_64-pc-linux-gnu
Thread model: posix
InstalledDir: /usr/bin
2021-04-20 12:46:06 +02:00
Hennadii Stepanov
f2ef5a8afd
test: Fix TSan suppression
This change fixes locally running tests.
2021-04-14 13:27:48 +03:00
MarcoFalke
fadea0bf37
Revert "test: Add tsan supp for leveldb::DBImpl::DeleteObsoleteFiles"
I can no longer observe the need for this suppression.

This reverts commit fa1fc536bb.
2021-04-14 06:56:59 +02:00
MarcoFalke
fadbd99885
test: Remove spurious double lock tsan suppressions by bumping to clang-12 2021-04-13 19:54:39 +02:00
fanquake
328aaac80d
Merge #21597: test: Document race:validation_chainstatemanager_tests suppression
fab19871ba test: Document race:validation_chainstatemanager_tests suppression (MarcoFalke)

Pull request description:

ACKs for top commit:
  jamesob:
    ACK fab19871ba
  practicalswift:
    ACK fab19871ba

Tree-SHA512: 3f1838b4cf11eba768ce06826cd4b57c9065669b61a5530af44216fc96535ebf37124b47a8de8f72aedf32345157a72d2208cd63214481a9cb56c063f05db5dd
2021-04-06 10:33:30 +08:00
MarcoFalke
fa04eb7d78
test: Document why no symbol names can be used for suppressions 2021-04-05 16:23:13 +02:00
MarcoFalke
fab19871ba
test: Document race:validation_chainstatemanager_tests suppression 2021-04-05 13:31:04 +02:00
practicalswift
585854ac66 test: Replace blanket UBSan signed integer overflow suppression for txmempool.cpp with specific suppression 2021-04-04 21:10:15 +00:00
MarcoFalke
fad8a97b21
test: Add missing suppression for signed-integer-overflow:txmempool.cpp 2021-04-03 17:39:41 +02:00
James O'Beirne
4d8de04f32
tests: add snapshot activation test 2021-02-12 07:53:37 -06:00
MarcoFalke
faff3991a9
ci: Fuzz with integer sanitizer 2021-01-26 12:50:43 +01:00
practicalswift
f0f8b1a076 fuzz: Add UBSan suppressions needed for fuzz tests to not warn under -fsanitize=integer 2021-01-25 20:55:36 +00:00
Anthony Towns
a568b82feb net_processing: split PeerManager into interface and implementation classes 2021-01-09 23:27:45 +10:00
MarcoFalke
fa6c114ae6
test: Add sanitizer suppressions for AMD EPYC CPUs 2021-01-04 12:29:41 +01:00
MarcoFalke
fa749fbea3
rpc: Replace boost::variant with std::variant for RPCArg.m_fallback 2021-01-01 15:08:07 +01:00
MarcoFalke
e669c3156f
Merge #20748: test: Add race:SendZmqMessage tsan suppression
fa957f8dc9 test: Add race:SendZmqMessage tsan suppression (MarcoFalke)

Pull request description:

  Add suppression for `race:SendZmqMessage`, which isn't covered by the existing `zmq::*` suppression

  Fixes #20618

ACKs for top commit:
  hebasto:
    re-ACK fa957f8dc9, as my previous comment is not directly related to this pull changes.

Tree-SHA512: 8642a8b79bbfa4bee89042b66e528f27fd78c5e84a33023df440662e9114e31445fd7b04940f44b11fa4ab7438d346385a21816289c818cce9958a9b16730452
2020-12-23 12:32:33 +01:00
MarcoFalke
fa957f8dc9
test: Add race:SendZmqMessage tsan suppression 2020-12-22 21:53:13 +01:00
Hennadii Stepanov
3e1571285f
Update TSan suppressions 2020-12-22 20:24:23 +02:00
Hennadii Stepanov
d71e29e3e8
qa: Correct epoll_ctl data race suppression
Fixup of #20218. Comments must start from the beginning of the line.
2020-12-22 17:34:29 +02:00
Hennadii Stepanov
e1e68b6305
test: Fix inconsistent lock order in wallet_tests/CreateWallet 2020-12-10 20:49:06 +02:00
Jonas Schnelli
0f020cdf0a sanitizers: Add suppression for unsigned-integer-overflow in libstdc++ basic_string.tcc 2020-11-20 08:40:50 +01:00
practicalswift
0ccb3addf6 tests: Remove no longer needed UBSan suppression (float-divide-by-zero in validation.cpp) 2020-11-12 18:58:59 +00:00
fanquake
c82336c493
Remove references to CreateWalletFromFile
CWallet::CreateWalletFromFile() was removed in
8b5e7297c0 but these references remain.
2020-11-12 13:12:29 +08:00
MarcoFalke
d9f5132736
Merge #20344: wallet: fix scanning progress calculation for single block range
5e146022da wallet: fix scanning progress calculation for single block range (Sebastian Falbesoner)

Pull request description:

  If the blockchain is rescanned for a single block (i.e. start and stop hashes are equal, and with that also the estimated start/stop verification progress values) the progress calculation could lead to a NaN value caused by a division by zero (0.0/0.0), resulting in an invalid JSON result for the `getwalletinfo` RPC.  This PR fixes this behaviour by setting the progress to zero in that special case. Fixes #20297.

  The behaviour can easily be reproduced by continuously running single block rescans in an endless loop, e.g. via
  ```bash
  #!/bin/bash
  while true
  do
      bitcoin-cli rescanblockchain $(bitcoin-cli getblockcount)
  done
  ```

  and at the same time perform some `getwalletinfo` RPCs.

  On the master branch, this leads to frequent invalid responses (tested on mainchain):
  ```
  $ bitcoin-cli getwalletinfo
  error: couldn't parse reply from server
  $ curl --user `cat ~/.bitcoin/.cookie` --data-binary '{"jsonrpc": "1.0", "id": "curltest", "method": "getwalletinfo", "params": []}' -H 'content-type: text/plain;' http://127.0.0.1:8332/
  {"result":{"walletname":"","walletversion":169900,"format":"bdb","balance":0.00000000,"unconfirmed_balance":0.00000000,"immature_balance":0.00000000,"txcount":0,"keypoololdest":1603677276,"keypoolsize":1000,"hdseedid":"3196e33ecb47c7130e6ca60f2f895f9259860dca","keypoolsize_hd_internal":1000,"paytxfee":0.00000000,"private_keys_enabled":true,"avoid_reuse":false,"scanning":{"duration":0,"progress":},"descriptors":false},"error":null,"id":"curltest"}
  ```
  (note that missing value for "progress" in the JSON result).

  On the PR branch, the behaviour doesn't occur anymore.

ACKs for top commit:
  MarcoFalke:
    review ACK 5e146022da
  promag:
    Core review ACK 5e146022da.

Tree-SHA512: f0e6aad5a6cd08b36c5fe820fff0ef26663229b39169a4dbe757f3c795a41cf5c69c9dc90efe7515675ae1059307f8971123781a0514d10704123a6f28b125ab
2020-11-11 16:11:01 +01:00
Sebastian Falbesoner
5e146022da wallet: fix scanning progress calculation for single block range
If the blockchain is rescanned for a single block (i.e. start and stop hashes
are equal, and with that also the estimated verification progress) the progress
calculation could lead to a NaN value caused by a division by zero, resulting in
an invalid JSON result for the getwalletinfo RPC.  Fixed by setting the progress
to zero in that special case.

Co-authored-by: MarcoFalke <falke.marco@gmail.com>
2020-11-11 13:15:00 +01:00
MarcoFalke
fa949b3c13
test: Suppress epoll_ctl data race 2020-11-11 10:10:31 +01:00
Antoine Poinsot
a3abeec33a
policy/fees: remove a floating-point division by zero
Reported-by: practicalswift <practicalswift@users.noreply.github.com>
Signed-off-by: Antoine Poinsot <darosior@protonmail.com>
2020-09-14 16:23:23 +02:00
John Newbery
58bd369b0d scripted-diff: [net processing] Rename PeerLogicValidation to PeerManager
-BEGIN VERIFY SCRIPT-
sed -i 's/PeerLogicValidation/PeerManager/g' $(git grep -l PeerLogicValidation ./src ./test)
sed -i 's/peer_logic/peerman/g' $(git grep -l peer_logic ./src ./test)
-END VERIFY SCRIPT-

PeerLogicValidation was originally net_processing's implementation to
the validation interface. It has since grown to contain much of
net_processing's logic. Therefore rename it to reflect its
responsibilities.

Suggested in
https://github.com/bitcoin/bitcoin/pull/10756#pullrequestreview-53892618.
2020-09-07 11:15:48 +01:00
MarcoFalke
fa1fc536bb
test: Add tsan supp for leveldb::DBImpl::DeleteObsoleteFiles 2020-08-29 09:55:44 +02:00
Hennadii Stepanov
9a2f12680b
ci: Add tsan suppression for race in DatabaseBatch 2020-07-16 22:41:10 +03:00
Hennadii Stepanov
a76dafa51d
ci: Add tsan suppression for race in BerkeleyBatch 2020-07-05 18:23:26 +03:00
MarcoFalke
fa12d8d3ed
ci: Add tsan suppression for race in wallet 2020-06-30 19:36:25 -04:00