Commit Graph

30538 Commits

Author SHA1 Message Date
pradumnasaraf 67c85bdb2f doc: Added hyperlink for doc/build 2021-09-09 19:53:12 +05:30
merge-script a5d00d4baf
Merge bitcoin/bitcoin#22788: scripted-diff: Use generate* from TestFramework
fa0b916971 scripted-diff: Use generate* from TestFramework (MarcoFalke)

Pull request description:

  This is needed for #22567.

  By using the newly added `generate*` member functions of the test framework, it paves the way to make it easier to implicitly call `sync_all` after block generation to avoid intermittent issues.

ACKs for top commit:
  jonatack:
    ACK fa0b916971

Tree-SHA512: e74a324b60250a87c08847cdfd7b6ce3e1d89b891659fd168f6dd7dc0aa718d0edd28285374a613f462f34f4ef8e12c90ad44fb58721c91b2ea691406ad22c2a
2021-09-09 14:02:45 +02:00
MarcoFalke eb1f5706df
Merge bitcoin/bitcoin#22925: test: Add missing suppression signed-integer-overflow:addrman.cpp
facb534c37 test: Add missing suppression signed-integer-overflow:addrman.cpp (MarcoFalke)

Pull request description:

  Steps to reproduce:

  [crash-d5f88bd8d0d460ffbab217b856b8582600c00503.log](https://github.com/bitcoin/bitcoin/files/7130854/crash-d5f88bd8d0d460ffbab217b856b8582600c00503.log)

  ```
  $ FUZZ=addrman ./src/test/fuzz/fuzz ./crash-d5f88bd8d0d460ffbab217b856b8582600c00503.log
  INFO: Running with entropic power schedule (0xFF, 100).
  INFO: Seed: 1257085025
  INFO: Loaded 1 modules   (379531 inline 8-bit counters): 379531 [0x562577b768a8, 0x562577bd3333),
  INFO: Loaded 1 PC tables (379531 PCs): 379531 [0x562577bd3338,0x56257819dbe8),
  ./src/test/fuzz/fuzz: Running 1 inputs 1 time(s) each.
  Running: ./crash-d5f88bd8d0d460ffbab217b856b8582600c00503.log
  addrman.cpp:80:14: runtime error: signed integer overflow: 2105390 - -9223372036854775808 cannot be represented in type 'long'
      #0 0x5625752f0179 in CAddrInfo::IsTerrible(long) const addrman.cpp:80:14
      #1 0x56257531917d in CAddrMan::GetAddr_(std::vector<CAddress, std::allocator<CAddress> >&, unsigned long, unsigned long, std::optional<Network>) const addrman.cpp:874:16
      #2 0x562574f0251b in CAddrMan::GetAddr(unsigned long, unsigned long, std::optional<Network>) const ./addrman.h:259:9
      #3 0x562574eff7ad in addrman_fuzz_target(Span<unsigned char const>) test/fuzz/addrman.cpp:295:26

  SUMMARY: UndefinedBehaviorSanitizer: signed-integer-overflow addrman.cpp:80:14 in

ACKs for top commit:
  practicalswift:
    cr ACK facb534c37

Tree-SHA512: 6368c48be8762c793f760d86caaf37a10caffa08f6903f3667dd08f7f67fade10f385fbffc451ddcbeeecc9fd02526ed97ab9de13398a75fffa55976a99af6b9
2021-09-09 10:27:39 +02:00
fanquake 17e27dd000
Merge bitcoin/bitcoin#22912: ci: Fix merge_script in MSVC task
f78cc90524 ci: Fix merge_script in MSVC task (Hennadii Stepanov)

Pull request description:

  The new `merge_script` in the MSVC build task does not really exit early when the task is triggered by a non-pr.

  In the current code e4aa9b15b9/.cirrus.yml (L104)

  the `exit 0` command exits from the PowerShell call, not the recent `merge_script`. This cause the next lines e4aa9b15b9/.cirrus.yml (L105-L107) are executed unconditionally.

  Here is an excerpt from [CI task log](https://api.cirrus-ci.com/v1/task/4578647416766464/logs/merge.log) for the ["Merge #22915: Remove confusing CAddrDB " commit](896649996b):
  ```
  ...
  C:\Users\ContainerAdministrator\AppData\Local\Temp\cirrus-ci-build>call powershell.exe -NoLogo -EncodedCommand ZwBpAHQAIAByAGUAcwBlAHQAIAAtAC0AaABhAHIAZAA=
  HEAD is now at 896649996 Merge bitcoin/bitcoin#22915: Remove confusing CAddrDB

  C:\Users\ContainerAdministrator\AppData\Local\Temp\cirrus-ci-build>if 0 NEQ 0 exit /b 0

  C:\Users\ContainerAdministrator\AppData\Local\Temp\cirrus-ci-build>call powershell.exe -NoLogo -EncodedCommand aQBmACAAKAAkAGUAbgB2ADoAQwBJAFIAUgBVAFMAXwBQAFIAIAAtAGUAcQAgACQAbgB1AGwAbAApACAAewAgAGUAeABpAHQAIAAwADsAIAB9AA==

  C:\Users\ContainerAdministrator\AppData\Local\Temp\cirrus-ci-build>if 0 NEQ 0 exit /b 0

  C:\Users\ContainerAdministrator\AppData\Local\Temp\cirrus-ci-build>call powershell.exe -NoLogo -EncodedCommand ZwBpAHQAIABmAGUAdABjAGgAIAAkAGUAbgB2ADoAQwBJAFIAUgBVAFMAXwBSAEUAUABPAF8AQwBMAE8ATgBFAF8AVQBSAEwAIAAkAGUAbgB2ADoAQwBJAFIAUgBVAFMAXwBCAEEAUwBFAF8AQgBSAEEATgBDAEgA
  From https://github.com/bitcoin/bitcoin
   * branch                HEAD       -> FETCH_HEAD

  C:\Users\ContainerAdministrator\AppData\Local\Temp\cirrus-ci-build>if 0 NEQ 0 exit /b 0

  C:\Users\ContainerAdministrator\AppData\Local\Temp\cirrus-ci-build>call powershell.exe -NoLogo -EncodedCommand ZwBpAHQAIABtAGUAcgBnAGUAIABGAEUAVABDAEgAXwBIAEUAQQBEAA==
  Already up to date.

  C:\Users\ContainerAdministrator\AppData\Local\Temp\cirrus-ci-build>if 0 NEQ 0 exit /b 0
  ```

  This PR fixes this issue, and makes `merge_script` log more readable.

ACKs for top commit:
  MarcoFalke:
    Concept ACK f78cc90524

Tree-SHA512: c88b115f99f9019a4100a10df051e32c05487612c13105d10873b9cf38965eeca731604d36610ae750cb1f93ba77ce97dca7599fe4984181210d0753be4eb9a0
2021-09-09 16:08:48 +08:00
MarcoFalke e4aa9b15b9
Merge bitcoin/bitcoin#22922: ci: Fix and enable tests on Windows
fa0c194db3 cirrus: Enable tests on windows (MarcoFalke)
fadecbd9a4 test: Fix tests on Windows (MarcoFalke)

Pull request description:

  Only a cherry-picked list. `--extended` can be enabled in a follow-up.

ACKs for top commit:
  hebasto:
    ACK fa0c194db3, tested locally on Windows 10 Pro 20H2 (build 19042.1165):

Tree-SHA512: 47cfbcef7ce5fe0c62b77a1e45ace513c4f0109b1fcfaec94faf9e488fe9430d6ba0e852230021d432847eb1389a4e4b7cf39bf17f7b09bae36af3079e0d7399
2021-09-09 08:24:14 +02:00
MarcoFalke 896649996b
Merge bitcoin/bitcoin#22915: Remove confusing CAddrDB
fade9a1a4d Remove confusing CAddrDB (MarcoFalke)
fa7f77b7d1 Fix addrdb includes (MarcoFalke)
fa3f5d0dae Move addrman includes from .h to .cpp (MarcoFalke)

Pull request description:

  Split out from #22762 to avoid having to carry it around in (an)other rebase(s)

ACKs for top commit:
  ryanofsky:
    Code review ACK fade9a1a4d
  lsilva01:
    Code Review ACK fade9a1a4d

Tree-SHA512: 7615fb0b6235d0c1e6f8cd6263dd18c4d95890567c2b797fe6fce6cb12cc85ce6eacbe07dbb6d81b05d179ef03b42edfd61c940e35a1044ce6d363b54c2dae5c
2021-09-09 08:09:39 +02:00
fanquake 8805e06663
Merge bitcoin/bitcoin#22390: system: skip trying to set the locale on NetBSD
fdd71448e7 system: skip trying to set the locale on NetBSD (fanquake)

Pull request description:

  Just treat it the same as the other BSDs.

  Fixes #17379.

ACKs for top commit:
  laanwj:
    Code review ACK fdd71448e7
  practicalswift:
    cr ACK fdd71448e7

Tree-SHA512: 5fe0a66f014279ad2683b548692a36af493377fb92d1f28b15dc4feef871190fe08ef40dcc4f5ba21a525fe365c42fb429fe4be0673a1e96db163af587c23204
2021-09-09 13:51:02 +08:00
fanquake da67b75c5c
Merge bitcoin/bitcoin#22903: Enable clang-tidy bugprone-argument-comment and fix violations
fa57fa1a2e Enable clang-tidy bugprone-argument-comment and fix violations (MarcoFalke)

Pull request description:

  Named arguments can be dangerous when they are wrong, because they are not enforced by the compiler. Currently there are only minor typos, no actual bugs.

  Fix the typos and add the `.clang-tidy` file to make it easier to find them in the future.

ACKs for top commit:
  practicalswift:
    cr ACK fa57fa1a2e
  fanquake:
    ACK fa57fa1a2e

Tree-SHA512: b66f01e0a1e77e56ed8454002176df660cc2cc0947a90785aa33cc5b8003a1f99fd8b2f8f89f2a0bf180ff2c42c031d69e669d127bb557b879c17975275a220b
2021-09-09 11:33:58 +08:00
MarcoFalke fa0c194db3
cirrus: Enable tests on windows 2021-09-08 20:43:23 +02:00
MarcoFalke facb534c37
test: Add missing suppression signed-integer-overflow:addrman.cpp 2021-09-08 19:43:42 +02:00
MarcoFalke fadecbd9a4
test: Fix tests on Windows 2021-09-08 18:58:31 +02:00
MarcoFalke 5e3380b9f5
Merge bitcoin/bitcoin#22916: doc: add missing copyright header to getuniquepath.cpp
69a439b880 doc: add missing copyright header to getuniquepath.cpp (fanquake)

Pull request description:

  This was missed in #21052.

ACKs for top commit:
  hebasto:
    ACK 69a439b880, but a scripted-diff using `copyright_header.py insert` looks preferable.

Tree-SHA512: 1a75ffd93fa8e5e83821e1fe984353422740ebf9e203dc873debf4dffec0e23f55a1e31f806dd2d66087d3620f6dc447af69f9124f0bcc6676ef91ee35374832
2021-09-08 10:57:47 +02:00
fanquake 69a439b880
doc: add missing copyright header to getuniquepath.cpp
This was missed in #21052.
2021-09-08 16:28:21 +08:00
fanquake 7d7d5e8efd
Merge bitcoin/bitcoin#22879: addrman: Fix format string in deserialize error
fab0b55cf0 addrman: Fix format string in deserialize error (MarcoFalke)
facce4ca44 test: Remove useless overwrite (MarcoFalke)

Pull request description:

  The format string is evaluated differently on modern compilers (clang 10 and later, as well as gcc 10 and later).

  Work around the behaviour change in compilers by pinning the underlying type of the format arguments.

  Can be tested by observing a failing test when running against master compiled with clang 10 or gcc 10 (or later).

ACKs for top commit:
  jonatack:
    ACK fab0b55cf0 verified the test fails on master as expected only at line 61 (assertion fixed by the code change); the last two test additions pass as expected
  mzumsande:
    ACK fab0b55cf0

Tree-SHA512: 07462901435107f3bc79098fd7d06446bfe8fe065fffdd35adfcba8f1dd3c499575006557afe7bc74b79d690c5ef7b58e3e031e908161be5529cf237e3b30609
2021-09-08 15:17:42 +08:00
Hennadii Stepanov f78cc90524
ci: Fix merge_script in MSVC task 2021-09-07 20:30:54 +03:00
MarcoFalke ecf580e40f
Merge bitcoin/bitcoin#22899: ci: Build and cache static Qt instead of downloading a pre-built one
3a68546fd0 ci: Build and cache static Qt instead of downloading a pre-built one (Hennadii Stepanov)

Pull request description:

  This PR makes the MSVC build CI task free of [pre-built static Qt binaries](https://github.com/sipsorcery/qt_win_binary/releases). It uses the approach which is documented in #22890.

  It takes about 13 minutes to build a static Qt dependency (for 8 CPUs):

  ![Screenshot from 2021-09-06 08-59-08](https://user-images.githubusercontent.com/32963518/132167857-bce49c74-f258-4468-b45b-75d0cf3c670c.png)

  with the maximum total time:

  ![Screenshot from 2021-09-06 08-59-26](https://user-images.githubusercontent.com/32963518/132167881-b84bd4de-38cc-4cb1-b9f7-35642cbea8cc.png)

  There is an additional benefit of this PR. It is no longer required to build a new static Qt package when a CI Windows image upgrades its building tools, and breaks the compatibility with the recent Qt package.

ACKs for top commit:
  sipsorcery:
    utACK 3a68546fd0.

Tree-SHA512: 2cf358ccecb26293b52c04158d6d3366ae6257cc3c04262e02234f7d7a03086885c67f0aad5702fcaa6f035fe4a09967a81245c561614875ecd2e90e2e00bbaa
2021-09-07 17:48:01 +02:00
Hennadii Stepanov 3a68546fd0
ci: Build and cache static Qt instead of downloading a pre-built one 2021-09-07 16:49:35 +03:00
MarcoFalke e0ca5d0513
Merge bitcoin/bitcoin#22909: ci: Add missed comments and test_bitcoin.exe command line option
64015eb014 ci: Add missed comments and test_bitcoin.exe command line option (Hennadii Stepanov)

Pull request description:

  This PR is a #21551 follow up, and it:
  - adds missed comments, see https://github.com/bitcoin/bitcoin/pull/21551#discussion_r703342550
  - restores missed `-l test_suite` command line option for `test_bitcoin.exe`, see https://github.com/bitcoin/bitcoin/pull/21551#discussion_r703348955

ACKs for top commit:
  MarcoFalke:
    cr ACK 64015eb014

Tree-SHA512: ad1c91544da39a94f033bc55ae5fdaf5774475702edd026635389e68d20e2608cb599dd51f3c1412e0287beef073352e48d9ec005c94df38cfe4fe2d21a94fe3
2021-09-07 13:21:33 +02:00
Hennadii Stepanov 64015eb014
ci: Add missed comments and test_bitcoin.exe command line option 2021-09-07 13:31:28 +03:00
MarcoFalke e7c6ed605c
Merge bitcoin/bitcoin#21551: ci: Move Windows MSVC build from AppVeyor to Cirrus
97292b1914 ci: Drop AppVeyor CI integration (Hennadii Stepanov)
1fb70793b2 ci: Add Windows task to Cirrus CI (Hennadii Stepanov)

Pull request description:

  This PR:
  - gets rid off unreliable AppVeyor CI
  - places all CI configs in one place
  - allows to enable functional tests in the future (using a persistent worker)

  | no populated `vcpkg` cache | populated `vcpkg` cache |
  |---|---|
  | ![Screenshot from 2021-09-02 15-47-04](https://user-images.githubusercontent.com/32963518/131846156-9367bffc-9093-40ca-98c3-15db74e24113.png) | ![Screenshot from 2021-09-02 14-06-26](https://user-images.githubusercontent.com/32963518/131833053-a501454d-eecf-463c-a3a4-b89d2a494058.png) |

  Currently, AppVeyor builds take about 44..48 minutes.

ACKs for top commit:
  sipsorcery:
    re-ACK 97292b1914.

Tree-SHA512: 3af50d9fd68eb12f39724810dacf948e4068573b5dfd0dbaeb05d19d4bd6f10bd9a432656dcc32b742684b438d31305eace85c602296d7a1bf84b2f1fcc06f02
2021-09-07 11:20:42 +02:00
MarcoFalke fade9a1a4d
Remove confusing CAddrDB
The class only stores the file path, reading it from a global. Globals
are confusing and make testing harder.

The method reading from a stream does not even use any class members, so
putting it in a class is also confusing.
2021-09-07 11:05:16 +02:00
MarcoFalke fa7f77b7d1
Fix addrdb includes 2021-09-07 10:44:48 +02:00
MarcoFalke fa3f5d0dae
Move addrman includes from .h to .cpp
This is a follow-up to the code move in commit a820e79512
2021-09-07 10:44:43 +02:00
MarcoFalke 9393666e78
Merge bitcoin/bitcoin#19833: wallet: Avoid locking cs_wallet recursively
5fabde6fad wallet: AddWalletDescriptor requires cs_wallet lock (João Barbosa)
32d036e8da wallet: GetLabelAddresses requires cs_wallet lock (João Barbosa)

Pull request description:

  This is another small change towards non recursive wallet lock.

ACKs for top commit:
  hebasto:
    ACK 5fabde6fad, I have reviewed the code and it looks OK, I agree it can be merged.

Tree-SHA512: 00506f0159c56854a171e58a451db8dd9b9f735039697b1cf2ca7f54de61fb51cc1e5eff42265233e041b4b1bfd29c2247496dc4456578e1a23c323bdec2901b
2021-09-07 10:34:44 +02:00
MarcoFalke fa57fa1a2e
Enable clang-tidy bugprone-argument-comment and fix violations 2021-09-07 09:11:10 +02:00
Hennadii Stepanov 503194d2ee
Merge bitcoin-core/gui#398: refactor: Pass WalletModel object to the WalletView constructor
d319c4dae9 qt, refactor: Replace WalletFrame::addWallet with WalletFrame::addView (Hennadii Stepanov)
92ddc02a16 qt, refactor: Declare getWalletModel with const and noexcept qualifiers (Hennadii Stepanov)
ca0e680bdc qt, refactor: Drop redundant checks of walletModel (Hennadii Stepanov)
404373bc6a qt, refactor: Pass WalletModel object to WalletView constructor (Hennadii Stepanov)

Pull request description:

  An instance of the `WalletView` class without the `walletModel` data member being set is invalid. So, it is better to set it in the constructor.

  Establishing one more `WalletView` class's invariant in constructor:
  - allows to drop all of checks of the`walletModel` in member functions
  - makes reasoning about the code that uses instances of the `WalletView` class  easier

  Possible follow ups could extend this approach to other classes, e.g., `OverviewPage`, `TransactionView`, `ReceiveCoinsDialog`, `SendCoinsDialog`, `AddressBookPage`.

ACKs for top commit:
  ShaMan239:
    Code review ACK d319c4dae9
  promag:
    Code review ACK d319c4dae9.
  jarolrod:
    ACK d319c4dae9

Tree-SHA512: b0c61f82811bb5aba2738067b53dc9ea4439230d547ce5c8fd85c480d8d70ea15f9942dbf13842383acbce467fba1ab4e132e37c56b654b46ba897301a41066e
2021-09-07 08:48:52 +03:00
Hennadii Stepanov 97292b1914
ci: Drop AppVeyor CI integration 2021-09-07 06:12:53 +03:00
Hennadii Stepanov 1fb70793b2
ci: Add Windows task to Cirrus CI 2021-09-07 06:12:51 +03:00
W. J. van der Laan 6718fbe90a
Merge bitcoin/bitcoin#22397: build: Fix macOS Apple Silicon build with miniupnpc and libnatpmp
2445df4eb3 build: Fix macOS Apple Silicon build with miniupnpc and libnatpmp (Hennadii Stepanov)

Pull request description:

  On master (7a49fdc581) the `configure` script does not pick up Homebrew's `miniupnpc` and `libnatpmp` packages on macOS Apple Silicon:

  ```
  % ./configure --with-miniupnpc
  ...
  checking for miniupnpc/miniupnpc.h... no
  checking for miniupnpc/upnpcommands.h... no
  checking for miniupnpc/upnperrors.h... no
  ...
  checking whether to build with support for UPnP... configure: error: "UPnP requested but cannot be built. Use --without-miniupnpc."
  ```

  ```
  % ./configure --with-natpmp
  ...
  checking for natpmp.h... no
  ...
  checking whether to build with support for NAT-PMP... configure: error: NAT-PMP requested but cannot be built. Use --without-natpmp
  ```

  The preferred Homebrew [prefix for Apple Silicon](https://docs.brew.sh/Installation) is `/opt/homebrew`. Therefore, if we do not use `pkg-config` to detect packages, we should set the `CPPFLAGS` and `LDFLAGS` variables for them explicitly.

ACKs for top commit:
  Zero-1729:
    re-tACK 2445df4eb3 (re-tested on an M1 Machine running macOS 11.4).
  jarolrod:
    re-ACK 2445df4eb3

Tree-SHA512: d623d26492f463812bf66ca519847ff4b23d517466b6c51c3caf3642a582d02e5f03ce57915742b29f01bf9bceb731a3978ef9a5fdc82e568bcb62548eda758a
2021-09-06 17:55:34 +02:00
MarcoFalke 92aad5303b
Merge bitcoin/bitcoin#21930: doc: update enumerator naming in developer notes
77f37f58ad doc: update enum naming in developer notes (Jon Atack)

Pull request description:

  Per our current doc, the general rule is we follow the C++ Core Guidelines, which for enumerator naming stipulate:

  https://isocpp.github.io/CppCoreGuidelines/CppCoreGuidelines#Renum-caps
  ```
  Don’t use ALL_CAPS for enumerators
  Reason: Avoid clashes with macros.
  ```

  but our examples (and often, codebase) are contradictory to it (and perhaps to common usage), which can be confusing when a contributor needs to choose a style to use. This patch:

  - updates the enumerator examples to snake_case per CPP Core Guidelines
  - clarifies for contributors that in this project enumerators may be snake_case, PascalCase or ALL_CAPS, and to use what seems appropriate.

ACKs for top commit:
  practicalswift:
    cr ACK 77f37f58ad
  ryanofsky:
    ACK 77f37f58ad. I think this is good because it modernizes the example and clarifies current conventions.
  promag:
    ACK 77f37f58ad.

Tree-SHA512: 7facc607fe5e1abab0f635864340143f13c2e4bb074eb17eac7d829dcd0cf244c5c617fc49d35e8774e8af1fa1205eeebe0cca81f538a2a61f6a7ba200878bc6
2021-09-06 14:14:22 +02:00
MarcoFalke a8fdfea77b
Merge bitcoin/bitcoin#22791: init: Fix asmap/addrman initialization order bug
724c497562 [fuzz] Add ConsumeAsmap() function (John Newbery)
5840476714 [addrman] Make m_asmap private (John Newbery)
f9002cb5db [net] Rename the copyStats arg from m_asmap to asmap (John Newbery)
f572f2b204 [addrman] Set m_asmap in CAddrMan initializer list (John Newbery)
593247872d [net] Remove CConnMan::SetAsmap() (John Newbery)
50fd77045e [init] Read/decode asmap before constructing addrman (John Newbery)

Pull request description:

  Commit 181a1207 introduced an initialization order bug: CAddrMan's m_asmap must be set before deserializing peers.dat.

  The first commit restores the correct initialization order. The remaining commits make `CAddrMan::m_asmap` usage safer:

  - don't reach into `CAddrMan`'s internal data from `CConnMan`
  - set `m_asmap` in the initializer list and make it const
  - make `m_asmap` private, and access it (as a reference to const) from a getter.

  This ensures that peers.dat deserialization must happen after setting m_asmap, since m_asmap is set during CAddrMan construction.

ACKs for top commit:
  mzumsande:
    Tested ACK 724c497562
  amitiuttarwar:
    code review but utACK 724c497562
  naumenkogs:
    utACK 724c497562
  vasild:
    ACK 724c497562
  MarcoFalke:
    review ACK 724c497562 👫

Tree-SHA512: 684a4cf9e3d4496c9997fb2bc4ec874809987055c157ec3fad1d2143b8223df52b5a0af787d028930b27388c8efeba0aeb2446cb35c337a5552ae76112ade726
2021-09-06 12:41:36 +02:00
MarcoFalke 2c6707be8b
Merge bitcoin/bitcoin#22848: MOVEONLY: Expose BanMapToJson / BanMapFromJson
6919c823cb MOVEONLY: Expose BanMapToJson / BanMapFromJson (Russell Yanofsky)

Pull request description:

  This PR is part of the [process separation project](https://github.com/bitcoin/bitcoin/projects/10).

  ---

  CSubNet serialization code that was removed in #22570 fa4e6afdae was needed by multiprocess code to share ban map between gui and node processes.

  Rather than adding it back, use suggestion from MarcoFalke https://github.com/bitcoin/bitcoin/pull/10102#discussion_r690922929 to use JSON serialization. This requires making BanMapToJson / BanMapFromJson functions public.

ACKs for top commit:
  promag:
    reACK 6919c823cb.

Tree-SHA512: ce909a61b7869d16cf2e9f91b643dd9d2604efc5777703d3b77a4c40cb0ccdd20396ba87b1ec85aade142e12ff9ea4c95c7155840354873579565471779f5a33
2021-09-06 10:35:30 +02:00
MarcoFalke fa92777448
Merge bitcoin/bitcoin#22736: log, sync: change lock contention from preprocessor directive to log category
7e69873283 sync: remove DEBUG_LOCKCONTENTION preprocessor directives (Jon Atack)
9b08006bc5 log, sync: improve lock contention logging and add time duration (Jon Atack)
3f4c6b87f1 log, timer: add timing macro in usec LOG_TIME_MICROS_WITH_CATEGORY (Jon Atack)
b7a17444e0 log, sync: add LOCK logging category, apply it to lock contention (Jon Atack)

Pull request description:

  To enable lock contention logging, `DEBUG_LOCKCONTENTION` has to be defined at compilation. Once built, the logging is not limited to a category and is high frequency, verbose and in all-caps. With these factors combined, it seems likely to be rarely used.

  This patch:
  - adds a `lock` logging category
  - adds a timing macro in microseconds, `LOG_TIME_MICROS_WITH_CATEGORY`
  - updates `BCLog::LogMsg()` to omit irrelevant decimals for microseconds and skip unneeded code and math
  - improves the lock contention logging, drops the all-caps, and displays the duration in microseconds
  - removes the conditional compilation directives
  - allows lock contentions to be logged on startup with `-debug=lock` or at run time with `bitcoin-cli logging '["lock"]'`

  ```
  $ bitcoind -signet -debug=lock
  2021-09-01T12:40:01Z LockContention: cs_vNodes, net.cpp:1920 started
  2021-09-01T12:40:01Z LockContention: cs_vNodes, net.cpp:1920 completed (4μs)
  2021-09-01T12:40:01Z LockContention: cs_vNodes, net.cpp:1302 started
  2021-09-01T12:40:01Z LockContention: cs_vNodes, net.cpp:1302 completed (4μs)
  2021-09-01T12:40:02Z LockContention: cs_vNodes, net.cpp:2242 started
  2021-09-01T12:40:02Z LockContention: cs_vNodes, net.cpp:2242 completed (20μs)
  2021-09-01T12:43:04Z LockContention: ::cs_main, validation.cpp:4980 started
  2021-09-01T12:43:04Z LockContention: ::cs_main, validation.cpp:4980 completed (3μs)

  $ bitcoin-cli -signet logging
    "lock": true,

  $ bitcoin-cli -signet logging [] '["lock"]'
    "lock": false,

  $ bitcoin-cli -signet logging '["lock"]'
    "lock": true,
  ```

  I've tested this with Clang 13 and GCC 10.2.1, on Debian, with and without `--enable-debug`.

ACKs for top commit:
  hebasto:
    re-ACK 7e69873283, added a contention duration to the log message since my [previous](https://github.com/bitcoin/bitcoin/pull/22736#pullrequestreview-743764606) review.
  theStack:
    re-ACK 7e69873283 🔏 ⏲️

Tree-SHA512: c4b5eb88d3a2c051acaa842b3055ce30efde1f114f61da6e55fcaa27476c1c33a60bc419f7f5ccda532e1bdbe70815222ec2b2b6d9226f29c8e94e598aacfee7
2021-09-06 10:31:12 +02:00
MarcoFalke e567dd53d1
Merge bitcoin/bitcoin#22841: ci: Fuzz with -ftrivial-auto-var-init=pattern
fa0a5fa744 ci: Fuzz with -ftrivial-auto-var-init=pattern (MarcoFalke)

Pull request description:

  This makes memory bugs deterministic. `-ftrivial-auto-var-init=pattern` is incompatible with other memory sanitizers (like valgrind and msan), but that is irrelevant here, because the address sanitizer in this fuzz CI config is already incompatible with them.

  `-ftrivial-auto-var-init=pattern` goes well with `-fsanitize=bool` and `-fsanitize=enum`, but those are already enabled via `-fsanitize=undefined`. See  https://clang.llvm.org/docs/UndefinedBehaviorSanitizer.html#available-checks

ACKs for top commit:
  practicalswift:
    cr ACK fa0a5fa744

Tree-SHA512: ed6be953cd99eadb1ba245ba30170747eff66be54d2773c8d26a3a6aee0fdcd6967c596f4f4ab1d238de6a6526623dac5211f0ba77f1986639395d7921bdc19f
2021-09-06 09:59:50 +02:00
MarcoFalke 4bd56bc291
Merge bitcoin/bitcoin#22894: netinfo: clarify client and server versions in header
e952d7557e netinfo: clarify client and server versions in header (Jon Atack)

Pull request description:

  Clarify in -netinfo output that both the client and the server versions are provided.

  before
  ```
  Bitcoin Core v22.0.0rc3 - 70016/Satoshi:22.99.0/
  ```

  after
  ```
  Bitcoin Core client v22.0.0rc3 - server 70016/Satoshi:22.99.0/
  ```

  Closes #22873.

ACKs for top commit:
  benthecarman:
    utACK e952d7557e
  prayank23:
    ACK e952d7557e
  Zero-1729:
    tACK e952d7557e

Tree-SHA512: 3e817892d398aabacb1401fd5b1816c4d4f563b4f8cf1096bdb8b53f7c4ef82d4caee09f5c7724f1fe292f837434a332acefba735152ed24a238bb6f006df909
2021-09-06 09:16:32 +02:00
fanquake 78d39f8438
Merge bitcoin/bitcoin#22861: test: Update test README and lint script
fa0937de35 test: Rename bitcoin-util-test.py to util/test_runner.py (MarcoFalke)
fa050bbc0a test: Update test README and lint script (MarcoFalke)

Pull request description:

  * Remove unused `yq`
  * Update fuzzing docs

ACKs for top commit:
  Saviour1001:
    ACK <code>[fa0937d](fa0937de35)</code>
  practicalswift:
    cr ACK fa0937de35
  fanquake:
    ACK fa0937de35

Tree-SHA512: 6b148d838e1fcf219ab92e579948e34ea7ce8b4692a3d28bb2a51aaa34cbc7cdbd79e72ce787b485fdf524e5b3521b033692583602d4e379bd160e0e41d66e28
2021-09-06 09:53:41 +08:00
MarcoFalke 0ebd88fe0b
Merge bitcoin/bitcoin#22888: build: Update default platform toolset in msvc-autogen.py
d1267fdbb0 build: Update default platform toolset in msvc-autogen.py (Hennadii Stepanov)

Pull request description:

  The platform toolset was updated from v141 to v142 in #17364.

ACKs for top commit:
  sipsorcery:
    ACK d1267fdbb0.

Tree-SHA512: 390dc4876948af7f6b9f26eb1e64262f6386c2541a4647a6cb7abd8f1283c63ffbf5efba5e67a8075f0085a0557fc3f1b41e70f3ede0e8cef60d0fe2d6bf3be8
2021-09-05 18:05:02 +02:00
MarcoFalke 91e07cc50d
Merge bitcoin/bitcoin#22591: Util: error if settings json exists, but is unreadable
2b071265c3 error if settings.json exists, but is unreadable (Tyler Chambers)

Pull request description:

  If settings.json exists, but is unreadable, we should error instead of overwriting.

  Fixes #22571

ACKs for top commit:
  Zero-1729:
    tACK 2b071265c3
  ShaMan239:
    tACK 2b071265c3
  prayank23:
    tACK 2b071265c3
  ryanofsky:
    Code review ACK 2b071265c3. Thanks for the fix! Note that PR   https://github.com/bitcoin-core/gui/pull/379 will change the appearance of dialogs shown in screenshots above. So it could be interesting to test the two PRs together (but current testing seems more than sufficient)
  theStack:
    ACK 2b071265c3 📁

Tree-SHA512: 6f7f96ce8a13213d0335198a2245d127264495c877105058d1503252435915b332a6e55068ac21088f4c0c017d564689f4956213328d5bdee81d73711efc5511
2021-09-05 17:12:37 +02:00
Jon Atack e952d7557e
netinfo: clarify client and server versions in header 2021-09-05 12:44:16 +02:00
MarcoFalke fab0b55cf0
addrman: Fix format string in deserialize error
Also add a regression test.
2021-09-05 10:26:03 +02:00
fanquake 6490a3ef6c
Merge bitcoin/bitcoin#22859: Replace uses of boost::trim* with locale-independent alternatives (#18130 rebased)
696c76d660 tests: Add TrimString(...) tests (practicalswift)
4bf18b089e Replace use of boost::trim_right with locale-independent TrimString (Ben Woosley)
93551862a1 Replace use of boost::trim use with locale-independent TrimString (Ben Woosley)

Pull request description:

  This is [#18130 rebased](https://github.com/bitcoin/bitcoin/pull/18130#issuecomment-900158759).

  > `TrimString` is an existing alternative.

  > Note `TrimString` uses `" \f\n\r\t\v"` as the pattern, which is consistent with the default behavior of `std::isspace`. See: https://en.cppreference.com/w/cpp/string/byte/isspace

ACKs for top commit:
  jb55:
    utACK 696c76d660
  practicalswift:
    ACK 696c76d660
  jonatack:
    ACK 696c76d660
  theStack:
    Code-review ACK 696c76d660

Tree-SHA512: 6a70e3777602dfa65a60353e5c6874eb951e4a806844cd4bdaa4237cad980a4f61ec205defc05a29f9707776835975838f6cc635259c42adfe37ceb02ba9358d
2021-09-05 11:13:36 +08:00
Hennadii Stepanov d1267fdbb0
build: Update default platform toolset in msvc-autogen.py
The platform toolset was updated from v141 to v142 in #17364.
2021-09-04 15:34:58 +03:00
fanquake f4e12fd50c
Merge bitcoin/bitcoin#22278: Add LIFETIMEBOUND to CScript where needed
fa7e6c56f5 Add LIFETIMEBOUND to InitializeChainstate (MarcoFalke)
fa5c896724 Add LIFETIMEBOUND to CScript where needed (MarcoFalke)

Pull request description:

  Without this, stack-use-after-scope can only be detected at runtime with ASan or code review, both of which are expensive.

  Use `LIFETIMEBOUND` to turn this error into a compile warning.

  See https://releases.llvm.org/12.0.0/tools/clang/docs/AttributeReference.html#lifetimebound

  Example:

  ```cpp
  const CScript a{WITH_LOCK(::cs_main, return CScript{} << OP_0 << OP_1)};
  ```

  Before: (no warning)
  After:

  ```
  warning: returning reference to local temporary object [-Wreturn-stack-address]
      const CScript a{WITH_LOCK(::cs_main, return CScript{} << OP_0 << OP_1)};
                                                  ^~~~~~~~~
  ./sync.h:276:65: note: expanded from macro 'WITH_LOCK'
  #define WITH_LOCK(cs, code) [&]() -> decltype(auto) { LOCK(cs); code; }()
                                                                  ^~~~

ACKs for top commit:
  theuni:
    utACK fa7e6c56f5.
  jonatack:
    Light ACK fa7e6c56f5 debug build with clang 13, reproduced the example compiler warning in the pull description, and briefly looked at `clang::lifetimebound` support in earlier versions of clang; it is in clang 7 (https://releases.llvm.org/7.0.0/tools/clang/docs/AttributeReference.html#lifetimebound-clang-lifetimebound), did not see references to it in earlier docs

Tree-SHA512: e915acdc4532445205b7703fab61a5d682231ace78ecfb274cb8523ca2bddefd85828f50ac047cfb1afaff92a331f5f7b5a1472539f999e30f7cf8ac8c3222f3
2021-09-04 10:51:36 +08:00
João Barbosa 5fabde6fad wallet: AddWalletDescriptor requires cs_wallet lock
No change in behavior, the lock is already held at call sites.
2021-09-03 18:30:01 +01:00
João Barbosa 32d036e8da wallet: GetLabelAddresses requires cs_wallet lock
No change in behavior, the lock is already held at call sites.
2021-09-03 18:28:12 +01:00
MarcoFalke 5fb6701bdb
Merge bitcoin/bitcoin#22860: test: Always clear reject reason in IsStandard tx test
fa1b08eb14 test: Always clear reject reason in IsStandard tx test (MarcoFalke)

Pull request description:

  For some tests the reject reason wasn't cleared between runs and thus subsequent tests might (theoretically) fail to verify the correct reject reason.

ACKs for top commit:
  benthecarman:
    ACK fa1b08eb14
  theStack:
    Code-review ACK fa1b08eb14

Tree-SHA512: fcb727a690f92a4cf06127c302ba464f1e8cb997498e4f7fd9e210d193559b07e6efdb9d5c8a0bef3fe643bdfd5fedd431aaace20978dd49e56b8e770cb9f930
2021-09-03 17:49:09 +02:00
MarcoFalke facce4ca44
test: Remove useless overwrite 2021-09-03 16:14:57 +02:00
MarcoFalke fa7e6c56f5
Add LIFETIMEBOUND to InitializeChainstate 2021-09-03 13:42:59 +02:00
MarcoFalke fa5c896724
Add LIFETIMEBOUND to CScript where needed 2021-09-03 13:42:03 +02:00
Russell Yanofsky 6919c823cb MOVEONLY: Expose BanMapToJson / BanMapFromJson
CSubNet serialization code that was removed in
fa4e6afdae was needed by multiprocess code
to share ban map between gui and node processes.

Rather than adding it back, use suggestion from MarcoFalke
<falke.marco@gmail.com>
https://github.com/bitcoin/bitcoin/pull/10102#discussion_r690922929 to
use JSON serialization. This requires making BanMapToJson /
BanMapFromJson functions public.
2021-09-03 05:21:58 -04:00