Commit Graph

29073 Commits

Author SHA1 Message Date
fanquake
1ef34ee25e
Merge bitcoin/bitcoin#21947: doc: Fix OSS-Fuzz links
fadd98d02f doc: Fix OSS-Fuzz links (MarcoFalke)

Pull request description:

  * Add missing link to the coverage report
  * Replace unqualified link with qualified one

ACKs for top commit:
  practicalswift:
    ACK fadd98d02f
  jarolrod:
    ACK fadd98d02f

Tree-SHA512: 5d5138288ae75d6a9ae536f307a63813ffe60c628a8c9a74b33f0d1be1a34fac2ff5eca9c9fe64be3139f2251736ba088c5f3731f0b3f50c70c5a5f1a89f0ea4
2021-05-16 19:59:27 +10:00
MarcoFalke
c857148636
Merge bitcoin/bitcoin#21948: test: Fix off-by-one in mockscheduler test RPC
fa2e614d16 test: Fix off-by-one in mockscheduler test RPC (MarcoFalke)

Pull request description:

  Fixes:

  ```
  fuzz: scheduler.cpp:83: void CScheduler::MockForward(std::chrono::seconds): Assertion `delta_seconds.count() > 0 && delta_seconds < std::chrono::hours{1}' failed.
  ==1059066== ERROR: libFuzzer: deadly signal
      #0 0x558f75449c10 in __sanitizer_print_stack_trace (/root/fuzz_dir/scratch/fuzz_gen/code/src/test/fuzz/fuzz+0x5fec10)
      #1 0x558f753f32b8 in fuzzer::PrintStackTrace() fuzzer.o
      #2 0x558f753d68d3 in fuzzer::Fuzzer::CrashCallback() fuzzer.o
      #3 0x7f4a3cbbb3bf  (/lib/x86_64-linux-gnu/libpthread.so.0+0x153bf)
      #4 0x7f4a3c7ff18a in raise (/lib/x86_64-linux-gnu/libc.so.6+0x4618a)
      #5 0x7f4a3c7de858 in abort (/lib/x86_64-linux-gnu/libc.so.6+0x25858)
      #6 0x7f4a3c7de728  (/lib/x86_64-linux-gnu/libc.so.6+0x25728)
      #7 0x7f4a3c7eff35 in __assert_fail (/lib/x86_64-linux-gnu/libc.so.6+0x36f35)
      #8 0x558f7588a913 in CScheduler::MockForward(std::chrono::duration<long, std::ratio<1l, 1l> >) scheduler.cpp:83:5
      #9 0x558f75b0e5b1 in mockscheduler()::$_7::operator()(RPCHelpMan const&, JSONRPCRequest const&) const rpc/misc.cpp:435:30
      #10 0x558f75b0e5b1 in std::_Function_handler<UniValue (RPCHelpMan const&, JSONRPCRequest const&), mockscheduler()::$_7>::_M_invoke(std::_Any_data const&, RPCHelpMan const&, JSONRPCRequest const&) /usr/bin/../lib/gcc/x86_64-linux-gnu/9/../../../../include/c++/9/bits/std_function.h:285:9
      #11 0x558f7587a141 in std::function<UniValue (RPCHelpMan const&, JSONRPCRequest const&)>::operator()(RPCHelpMan const&, JSONRPCRequest const&) const /usr/bin/../lib/gcc/x86_64-linux-gnu/9/../../../../include/c++/9/bits/std_function.h:688:14
      #12 0x558f7587a141 in RPCHelpMan::HandleRequest(JSONRPCRequest const&) const rpc/util.cpp:565:26
      #13 0x558f756c0086 in CRPCCommand::CRPCCommand(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, RPCHelpMan (*)())::'lambda'(JSONRPCRequest const&, UniValue&, bool)::operator()(JSONRPCRequest const&, UniValue&, bool) const ./rpc/server.h:110:91
      #14 0x558f756c0086 in std::_Function_handler<bool (JSONRPCRequest const&, UniValue&, bool), CRPCCommand::CRPCCommand(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, RPCHelpMan (*)())::'lambda'(JSONRPCRequest const&, UniValue&, bool)>::_M_invoke(std::_Any_data const&, JSONRPCRequest const&, UniValue&, bool&&) /usr/bin/../lib/gcc/x86_64-linux-gnu/9/../../../../include/c++/9/bits/std_function.h:285:9
      #15 0x558f756b8592 in std::function<bool (JSONRPCRequest const&, UniValue&, bool)>::operator()(JSONRPCRequest const&, UniValue&, bool) const /usr/bin/../lib/gcc/x86_64-linux-gnu/9/../../../../include/c++/9/bits/std_function.h:688:14
      #16 0x558f756b8592 in ExecuteCommand(CRPCCommand const&, JSONRPCRequest const&, UniValue&, bool) rpc/server.cpp:480:20
      #17 0x558f756b8592 in ExecuteCommands(std::vector<CRPCCommand const*, std::allocator<CRPCCommand const*> > const&, JSONRPCRequest const&, UniValue&) rpc/server.cpp:444:13
      #18 0x558f756b8017 in CRPCTable::execute(JSONRPCRequest const&) const rpc/server.cpp:464:13
      #19 0x558f7552457a in (anonymous namespace)::RPCFuzzTestingSetup::CallRPC(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, std::vector<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::allocator<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > > > const&) test/fuzz/rpc.cpp:50:25
      #20 0x558f7552457a in rpc_fuzz_target(Span<unsigned char const>) test/fuzz/rpc.cpp:354:28
      #21 0x558f7544cf0f in std::_Function_handler<void (Span<unsigned char const>), void (*)(Span<unsigned char const>)>::_M_invoke(std::_Any_data const&, Span<unsigned char const>&&) /usr/bin/../lib/gcc/x86_64-linux-gnu/9/../../../../include/c++/9/bits/std_function.h:300:2
      #22 0x558f75c05197 in std::function<void (Span<unsigned char const>)>::operator()(Span<unsigned char const>) const /usr/bin/../lib/gcc/x86_64-linux-gnu/9/../../../../include/c++/9/bits/std_function.h:688:14
      #23 0x558f75c05197 in LLVMFuzzerTestOneInput test/fuzz/fuzz.cpp:74:5
      #24 0x558f753d8073 in fuzzer::Fuzzer::ExecuteCallback(unsigned char const*, unsigned long) fuzzer.o
      #25 0x558f753c1f72 in fuzzer::RunOneTest(fuzzer::Fuzzer*, char const*, unsigned long) fuzzer.o
      #26 0x558f753c7d6a in fuzzer::FuzzerDriver(int*, char***, int (*)(unsigned char const*, unsigned long)) fuzzer.o
      #27 0x558f753f3a92 in main (/root/fuzz_dir/scratch/fuzz_gen/code/src/test/fuzz/fuzz+0x5a8a92)
      #28 0x7f4a3c7e00b2 in __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x270b2)
      #29 0x558f7539cc9d in _start (/root/fuzz_dir/scratch/fuzz_gen/code/src/test/fuzz/fuzz+0x551c9d)

ACKs for top commit:
  practicalswift:
    cr ACK fa2e614d16

Tree-SHA512: cfa120265261f0ad019b46c426b915c1c007806b37aecb27016ce780a0ddea5e6fc9b09065fd40684b11183dcd3bf543558d7a655e604695021653540266baf7
2021-05-15 09:55:02 +02:00
MarcoFalke
fa2e614d16
test: Fix off-by-one in mockscheduler test RPC 2021-05-14 12:49:16 +02:00
W. J. van der Laan
ecf5f2c1a0
Merge bitcoin/bitcoin#21889: macho: check for control flow instrumentation
42b589d18f scripts: test for MACHO control flow instrumentation (fanquake)
469a5bc4fa build: build Boost with -fcf-protection when targeting Darwin (fanquake)

Pull request description:

  Addresses the macOS portion of #21888.

  Build Boost with `-fcf-protection` when targeting Darwin. This should be ok, because our cross-compiler (Clang 10) supports the option, and I'd expect all versions of Apple Clang being used to compile Core would also support it. Building Boost with this option is required so that the `main` provided to `test_bitcoin` has instrumentation.

  Note that the presence of instrumentation does not mean it will be used, as that is determined at runtime by the CPU.
  From the Intel control flow enforcement documentation:

  > The ENDBR32 and ENDBR64 instructions will have the same effect as the NOP instruction on Intel 64 processors that do not support CET. On processors supporting CET, these instructions do not change register or flag state. This allows CET instrumented programs to execute on processors that do not support CET. Even when CET is supported and enabled, these NOP–like instructions do not affect the execution state of the program, do not cause any additional register pressure, and are minimally intrusive from power and performance perspectives.

  Follow up from #21135.

  Guix builds:
  ```bash
  663df8471400f06d4da739e39a886aa17f56a36d66e0ff7cc290686294ef39c9  guix-build-42b589d18fed/output/dist-archive/bitcoin-42b589d18fed.tar.gz
  45e841661e1659a634468b6f8c9fb0a7956c31ba296f1fd0c02cd880736d6127  guix-build-42b589d18fed/output/x86_64-apple-darwin18/bitcoin-42b589d18fed-osx-unsigned.dmg
  0ea85c99fef35429a5048fa14850bce6b900eaa887aeea419b019852f8d2be78  guix-build-42b589d18fed/output/x86_64-apple-darwin18/bitcoin-42b589d18fed-osx-unsigned.tar.gz
  85857a5a4a5d4d3a172d6c361c12c4a94f6505fc12b527ea63b75bfe54ee1001  guix-build-42b589d18fed/output/x86_64-apple-darwin18/bitcoin-42b589d18fed-osx64.tar.gz
  ```

  Gitian builds:
  ```bash
  # macOS:
  bdfd677a6b88273a741b433e1e7f554af50cc76b3342d44ab0c441e2b40efc96  bitcoin-42b589d18fed-osx-unsigned.dmg
  f3b2d09f3bea7a5cc489b02e8e53dd76a9922338500fae79cad0506655af56f9  bitcoin-42b589d18fed-osx-unsigned.tar.gz
  29d5ad5e46bc9fb0056922a8b47c026e5e9f71e6cf447203b74644587d6fb6f7  bitcoin-42b589d18fed-osx64.tar.gz
  663df8471400f06d4da739e39a886aa17f56a36d66e0ff7cc290686294ef39c9  src/bitcoin-42b589d18fed.tar.gz
  366f8d7a2fc1f3e22cb1018043099126a71ce65380cc27b1c3280cce42d06c98  bitcoin-core-osx-22-res.yml
  ```

ACKs for top commit:
  laanwj:
    Code review ACK 42b589d18f

Tree-SHA512: 12cb8d462d64d845b9fe48c5c6978892adff8bf5b5572bb29f35df1f6176e47b32a68bcb6e4883c7d9454e76e8868851005a7325916852a2d0d32659ac7dae3f
2021-05-14 12:26:38 +02:00
W. J. van der Laan
b82c3a0075
Merge bitcoin/bitcoin#21929: fuzz: Remove incorrect float round-trip serialization test
fae814c9a6 fuzz: Remove incorrect float round-trip serialization test (MarcoFalke)

Pull request description:

  It tests the wrong way of the round-trip: `int -> float -> int`, but only `float -> int -> float` is allowed and used. See also `src/test/fuzz/float.cpp`.

  Hopefully fixes https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=34118

ACKs for top commit:
  laanwj:
    Anyhow, ACK fae814c9a6

Tree-SHA512: 8412a7985be2225109f382b7c7ea6d6fcfbea15711671fdf2f41dd1a9adbb3b4489592863751d78bedaff98e9b0b13571d9cae06ffd92db8fbf7ce0f47874a41
2021-05-14 12:14:30 +02:00
MarcoFalke
61fea52171
Merge bitcoin/bitcoin#21942: docs: improve make with parallel jobs description.
07bc22ef10 docs: improve make with parallel jobs description. (Klement Tan)

Pull request description:

  Changed `use -jX here for parallelism` to `use "-j N" for N parallel jobs`

  **Rationale**: In my opinion `use -jX here for parallelism` is quite ambiguous as it could be perceived as a single option without any argument. Ie running:
  ```sh
  make -jX
  ```

  Embarrassingly this caused me to be stuck for quite a long time until I opened the help menu for `make` but if I am the only one who faced this issue I would be happy to close this PR.

ACKs for top commit:
  jarolrod:
    ACK 07bc22ef10

Tree-SHA512: 2d119b6a461668906c63184b865d2cc9fb2f75abeba34e2e44bc1ef3bcb4adec4a49896ddaf3cc6a20c0095ad20d0de0908401b351eaca9443161d24d6b20d0b
2021-05-14 08:22:02 +02:00
MarcoFalke
fadd98d02f
doc: Fix OSS-Fuzz links 2021-05-14 08:15:03 +02:00
Hennadii Stepanov
4ee9ee7236 qt: Use native presentation of shortcut 2021-05-14 02:01:23 -04:00
Klement Tan
07bc22ef10
docs: improve make with parallel jobs description. 2021-05-14 08:45:27 +08:00
W. J. van der Laan
b34bf2b42c
Merge bitcoin/bitcoin#21939: refactor: Replace memset calls with array initialization
1c9255c7dd refactor: Replace memset calls with array initialization (João Barbosa)

Pull request description:

  Follow up to https://github.com/bitcoin/bitcoin/pull/21905#pullrequestreview-657045699.

ACKs for top commit:
  laanwj:
    re-ACK 1c9255c7dd
  Crypt-iQ:
    Code review ACK 1c9255c7dd

Tree-SHA512: 4b61dec2094f4781ef1c0427ee3bda3cfea12111274eebc7bc40a84f261d9c1681dd0860c57200bea2456588e44e8e0aecd18545c25f1f1250dd331ab7d05f28
2021-05-13 19:25:21 +02:00
W. J. van der Laan
4741aec1dd
Merge bitcoin/bitcoin#21914: net: use stronger AddLocal() for our I2P address
105941b726 net: use stronger AddLocal() for our I2P address (Vasil Dimov)

Pull request description:

  There are two issues:

  ### 1. Our I2P address not added to local addresses.

  * `externalip=` is used with an IPv4 address (this sets automatically `discover=0`)
  * No `discover=1` is used
  * `i2psam=` is used
  * No `externalip=` is used for our I2P address
  * `listenonion=1 torcontrol=` are used

  In this case `AddLocal(LOCAL_MANUAL)` [is used](94f83534e4/src/torcontrol.cpp (L354)) for our `.onion` address and `AddLocal(LOCAL_BIND)` [for our](94f83534e4/src/net.cpp (L2247)) `.b32.i2p` address, the latter being [ignored](94f83534e4/src/net.cpp (L232-L233)) due to `discover=0`.

  ### 2. Our I2P address removed from local addresses even if specified with `externalip=` on I2P proxy restart.

  * `externalip=` is used with our I2P address (this sets automatically `discover=0`)
  * No `discover=1` is used
  * `i2psam=` is used

  In this case, initially `externalip=` causes our I2P address to be [added](94f83534e4/src/init.cpp (L1266)) with `AddLocal(LOCAL_MANUAL)` which overrides `discover=0` and works as expected. However, if later the I2P proxy is shut down [we do](94f83534e4/src/net.cpp (L2234)) `RemoveLocal()` in order to stop advertising our I2P address (since we have lost I2P connectivity). When the I2P proxy is started and we reconnect to it, restoring the I2P connectivity, [we do](94f83534e4/src/net.cpp (L2247)) `AddLocal(LOCAL_BIND)` which does nothing due to `discover=0`.

  To resolve those two issues, use `AddLocal(LOCAL_MANUAL)` for I2P which is also what we do with Tor.

ACKs for top commit:
  laanwj:
    Code review ACK 105941b726

Tree-SHA512: 0c9daf6116b8d9c34ad7e6e9bbff6e8106e94e4394a815d7ae19287aea22a8c7c4e093c8dd8c58a4a1b1412b2575a9b42b8a93672c8d17f11c24508c534506c7
2021-05-13 15:36:44 +02:00
João Barbosa
1c9255c7dd refactor: Replace memset calls with array initialization 2021-05-13 12:42:21 +01:00
Samuel Dobson
a31a1ceec7
Merge bitcoin/bitcoin#21907: wallet: Do not iterate a directory if having an error while accessing it
29c9e2c2d2 wallet: Do not iterate a directory if having an error while accessing it (Hennadii Stepanov)

Pull request description:

  On Windows when `ListDatabases` tries to iterate any system folder, e.g., "System Volume Information", it falls into an infinite loop.

  This PR fixes this bug. Now the `debug.log` contains:
  ```
  2021-05-12T09:07:53Z ListDatabases: Access is denied D:/System Volume Information -- skipping.
  ```

  An easy way to reproduce the bug and test this PR is to pass the `-walletdir=D:\` command-line option, and run the `listwalletdir` RPC, or File -> Open Wallet in the GUI menu.

  Fixes #20081.
  Fixes #21136.
  Fixes #21904.

  Also https://bitcoin.stackexchange.com/questions/99243/listwalletdir-access-is-denied-d-system-volume-information

ACKs for top commit:
  prayank23:
    ACK 29c9e2c2d2
  promag:
    Code review ACK 29c9e2c2d2.
  meshcollider:
    Code review ACK 29c9e2c2d2

Tree-SHA512: b851c88e6d09626f4cb81acc2fa59a563b2aee64582963285715bf785c64b872e8bf738aa6b27bdbaf4c3e5c8565c2dc2c802135f9aa1f48b4b913435bc5d793
2021-05-13 21:09:32 +12:00
Samuel Dobson
386ba92e83
Merge bitcoin/bitcoin#21910: refactor: remove redundant fOnlySafe argument
c30dd02cd8 refactor: remove redundant fOnlySafe argument (t-bast)

Pull request description:

  The `fOnlySafe` argument to `AvailableCoins` is now redundant, since #21359 added a similar field inside the `CCoinControl` struct (see https://github.com/bitcoin/bitcoin/pull/21359#discussion_r591578684).

  Not all code paths create a `CCoinControl` instance, but when it's missing we can default to using only safe inputs which is backwards-compatible.

ACKs for top commit:
  instagibbs:
    utACK c30dd02cd8
  promag:
    Code review ACK c30dd02cd8.
  achow101:
    ACK c30dd02cd8
  meshcollider:
    Code review + test run ACK c30dd02cd8

Tree-SHA512: af3cb598d06f233fc48a7c9c45bb14da92b5cf4168b8dbd4f134dc3e0c2b615c6590238ddb1eaf380aea5bbdd3386d2ac8ecd7d22dfc93579adc39248542839b
2021-05-13 21:05:55 +12:00
MarcoFalke
db2990d01f
Merge bitcoin/bitcoin#21925: doc: Update bips.md for 0.21.1
faf30f2ae0 doc: Update bips.md for 0.21.1 (MarcoFalke)

Pull request description:

ACKs for top commit:
  kristapsk:
    ACK faf30f2ae0
  jarolrod:
    ACK faf30f2ae0
  prayank23:
    ACK faf30f2ae0

Tree-SHA512: b09e8782306fe990d4eba871627cb7aa97a521a5aa08b7c7369fbfc24e49c3c9386cd06c590af076dff9b95ade207cc470911aa4b97cd5f366630974e71e1348
2021-05-13 09:15:15 +02:00
MarcoFalke
0ab6ff5e37
Merge bitcoin/bitcoin#21931: ci: Bump cirrus fuzz CPUs to avoid timeout
fa397a6a9c ci: Bump cirrus fuzz CPUs to avoid timeout (MarcoFalke)

Pull request description:

ACKs for top commit:
  hebasto:
    ACK fa397a6a9c, let's try it.

Tree-SHA512: 7e06dda66c71d76e5fd144f6b5bb10f0bcac72feb15bd0f400ef08ba4dcb92558319401ef5f9d3822376affceb2192df1903b3a79c0ab2d7283ca21454054dea
2021-05-12 21:25:34 +02:00
W. J. van der Laan
ee9befe8b4
Merge bitcoin/bitcoin#21584: Fix assumeutxo crash due to invalid base_blockhash
fa340b8794 refactor: Avoid magic value of all-zeros in assumeutxo base_blockhash (MarcoFalke)
fae33f98e6 Fix assumeutxo crash due to invalid base_blockhash (MarcoFalke)
fa5668bfb3 refactor: Use type-safe assumeutxo hash (MarcoFalke)
0000007709 refactor: Remove unused code (MarcoFalke)
faa921f787 move-only: Add util/hash_type (MarcoFalke)

Pull request description:

  Starting with commit d6af06d68a, a block hash of all-zeros is invalid and will lead to a crash of the node. Can be tested by cherry-picking the test changes without the other changes.

  Stack trace (copied from https://github.com/bitcoin/bitcoin/pull/21584#discussion_r612673879):

  ```
  #0  __GI_raise (sig=sig@entry=6) at ../sysdeps/unix/sysv/linux/raise.c:51
  #1  0x00007ffff583c8b1 in __GI_abort () at abort.c:79
  #2  0x00007ffff582c42a in __assert_fail_base (fmt=0x7ffff59b3a38 "%s%s%s:%u: %s%sAssertion `%s' failed.\n%n",
      assertion=assertion@entry=0x555556c8b450 "!hashBlock.IsNull()", file=file@entry=0x555556c8b464 "txdb.cpp", line=line@entry=89,
      function=function@entry=0x555556c8b46d "virtual bool CCoinsViewDB::BatchWrite(CCoinsMap &, const uint256 &)") at assert.c:92
  #3  0x00007ffff582c4a2 in __GI___assert_fail (assertion=0x555556c8b450 "!hashBlock.IsNull()", file=0x555556c8b464 "txdb.cpp", line=89,
      function=0x555556c8b46d "virtual bool CCoinsViewDB::BatchWrite(CCoinsMap &, const uint256 &)") at assert.c:101
  #4  0x000055555636738b in CCoinsViewDB::BatchWrite (this=0x5555577975c0, mapCoins=std::unordered_map with 110 elements = {...}, hashBlock=...) at txdb.cpp:89
  #5  0x00005555564a2e80 in CCoinsViewBacked::BatchWrite (this=0x5555577975f8, mapCoins=std::unordered_map with 110 elements = {...}, hashBlock=...) at coins.cpp:30
  #6  0x00005555564a43de in CCoinsViewCache::Flush (this=0x55555778eaf0) at coins.cpp:223
  #7  0x00005555563fc11d in ChainstateManager::PopulateAndValidateSnapshot (this=0x55555740b038 <g_chainman>, snapshot_chainstate=..., coins_file=..., metadata=...)
      at validation.cpp:5422
  #8  0x00005555563fab3d in ChainstateManager::ActivateSnapshot (this=0x55555740b038 <g_chainman>, coins_file=..., metadata=..., in_memory=true) at validation.cpp:5299
  #9  0x0000555555e8c893 in validation_chainstatemanager_tests::CreateAndActivateUTXOSnapshot<validation_chainstatemanager_tests::chainstatemanager_activate_snapshot::test_method()::$_12>(NodeContext&, boost::filesystem::path, validation_chainstatemanager_tests::chainstatemanager_activate_snapshot::test_method()::$_12) (node=...,
      root=..., malleation=...) at test/validation_chainstatemanager_tests.cpp:199
  #10 0x0000555555e8877a in validation_chainstatemanager_tests::chainstatemanager_activate_snapshot::test_method (this=0x7fffffffc8d0)
      at test/validation_chainstatemanager_tests.cpp:262

ACKs for top commit:
  laanwj:
    Code review re-ACK fa340b8794
  jamesob:
    ACK fa340b8794 ([`jamesob/ackr/21584.1.MarcoFalke.fix_assumeutxo_crash_due`](https://github.com/jamesob/bitcoin/tree/ackr/21584.1.MarcoFalke.fix_assumeutxo_crash_due))

Tree-SHA512: c2c4e66c1abfd400ef18a04f22fec1f302f1ff4d27a18050f492f688319deb4ccdd165ff792eee0a1f816e7b69fb64080662b79517ab669e3d26b9eb77802851
2021-05-12 21:00:12 +02:00
W. J. van der Laan
79da18a9eb
Merge bitcoin/bitcoin#21911: build: add configure~ to .gitignore
bc4538806e build: add *~ to .gitignore (Sjors Provoost)

Pull request description:

  The file `configure~` recently started appearing for me on macOS (11.3.1) whenever configure is (re)run.

ACKs for top commit:
  hebasto:
    ACK bc4538806e, tested on Linux Mint 20.1 with different build scenarios including cross-compiling for Windows and macOS.

Tree-SHA512: 830c7baf392ff6d66250a79c6ed0a98dac3daaace54a6d2e7940b9a72e3bac79ab44bbecd7642c931fde8a446654e2260d6afdecc679a1743fae6ec5eeda79f1
2021-05-12 19:45:10 +02:00
MarcoFalke
fa397a6a9c
ci: Bump cirrus fuzz CPUs to avoid timeout 2021-05-12 18:26:37 +02:00
Sjors Provoost
bc4538806e
build: add *~ to .gitignore
Homebrew autoconf version 2.7.1 introduces configure~ as a build artifact.

Co-authored-by: Hennadii Stepanov <32963518+hebasto@users.noreply.github.com>
2021-05-12 18:10:47 +02:00
W. J. van der Laan
6b49d88a5d
Merge bitcoin/bitcoin#21905: net: initialize nMessageSize to uint32_t max
9c891b64ff net: initialize nMessageSize to max uint32_t instead of -1 (eugene)

Pull request description:

  nMessageSize is uint32_t and is set to -1. This will warn with `-fsanitize=implicit-integer-sign-change` when V1TransportDeserializer calls into the ctor.  This pull initializes nMessageSize to `numeric_limits<uint32_t>::max()` instead and removes the ubsan suppression.

ACKs for top commit:
  laanwj:
    Code review ACK 9c891b64ff
  promag:
    Code review ACK 9c891b64ff.

Tree-SHA512: f05173d9553a01d207a5a7f8ff113d9e11354c50b494a67d44d3931c151581599a9da4e28f40edd113f4698ea9115e6092b2a5b7329c841426726772076c1493
2021-05-12 17:39:39 +02:00
Jon Atack
7075f604e8
scripted-diff: update noban documentation in net_processing.cpp
-BEGIN VERIFY SCRIPT-
s() { git grep -l "$1" src/net_processing.cpp | xargs sed -i "s/$1/$2/g"; }
s 'the noban permission'      'NetPermissionFlags::NoBan permission'
s 'the NOBAN permission flag' 'NetPermissionFlags::NoBan permission'
s 'noban permission'          'NetPermissionFlags::NoBan permission'
-END VERIFY SCRIPT-
2021-05-12 16:13:32 +02:00
Jon Atack
a95540cf43
scripted-diff: rename NetPermissionFlags enumerators
- drop redundant PF_ permission flags prefixes
- drop ALL_CAPS naming per https://isocpp.github.io/CppCoreGuidelines/CppCoreGuidelines#Renum-caps
- rename IsImplicit to Implicit

-BEGIN VERIFY SCRIPT-
s() { git grep -l "$1" src | xargs sed -i "s/$1/$2/g"; }

s 'PF_NONE'        'None'
s 'PF_BLOOMFILTER' 'BloomFilter'
s 'PF_RELAY'       'Relay'
s 'PF_FORCERELAY'  'ForceRelay'
s 'PF_DOWNLOAD'    'Download'
s 'PF_NOBAN'       'NoBan'
s 'PF_MEMPOOL'     'Mempool'
s 'PF_ADDR'        'Addr'
s 'PF_ISIMPLICIT'  'Implicit'
s 'PF_ALL'         'All'
-END VERIFY SCRIPT-
2021-05-12 16:13:30 +02:00
Jon Atack
810d0929c1
p2p, refactor: make NetPermissionFlags a uint32 enum class
and define/update operation methods to handle type conversions explicitly. See
https://isocpp.github.io/CppCoreGuidelines/CppCoreGuidelines#Renum-oper
for more info.
2021-05-12 16:13:23 +02:00
W. J. van der Laan
d2ec37221a
Merge bitcoin/bitcoin#21796: index: Avoid async shutdown on init error
faad68fcd4 index: Avoid async shutdown on init error (MarcoFalke)

Pull request description:

  An async shutdown during init is confusing when a simple boolean return value can be used for a synchronous shutdown.

  This also changes the error message on stderr from:

  ```
  Error: A fatal internal error occurred, see debug.log for details
  Error: A fatal internal error occurred, see debug.log for details
  ```

  To:

  ```
  Error: basic block filter index best block of the index goes beyond pruned data. Please disable the index or reindex (which will download the whole blockchain again)

ACKs for top commit:
  laanwj:
    Code review ACK faad68fcd4

Tree-SHA512: 92dd895266d6d15a6b1a5c081c9b83f83d5c82e9bfceb3ea0664f48540812239e274c829ff0271c4a0afb6d6a8f67d89c5af20d719982ad62999a41ca0623274
2021-05-12 14:58:47 +02:00
MarcoFalke
91db985bc9
Merge bitcoin/bitcoin#21927: fuzz: Run const CScript member functions only once
fa74bfc860 fuzz: Run const CScript member functions only once (MarcoFalke)

Pull request description:

  Those functions should be O(N) in the input size (or maybe worse, I didn't check), so if the fuzz input dictates to run them N times, the complexity is N^2.

  Fix this by calling them only once.

  Can be reviewed with: `--ignore-all-space  --word-diff-regex=.`

  Input: https://github.com/bitcoin/bitcoin/files/6464685/clusterfuzz-testcase-minimized-input.log

  Hopefully fixes https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=34101

ACKs for top commit:
  practicalswift:
    cr ACK fa74bfc860: patch looks correct, rationale makes sense and patch touches only `src/test/fuzz/`

Tree-SHA512: d579f7a2103ec154bf482a872142e55a1d9e7673d33a22a4c4230186fdd1b6618846463f4e25941031cc8c4bd1ea8d06cb49ae1bb1ec4af115497f5e5de1e19c
2021-05-12 14:48:25 +02:00
MarcoFalke
fae814c9a6
fuzz: Remove incorrect float round-trip serialization test 2021-05-12 14:42:41 +02:00
W. J. van der Laan
176842daa8
Merge bitcoin/bitcoin#21912: doc: Remove mention of priority estimation
fa0ad7b9fe doc: Remove mention of priority estimation (MarcoFalke)

Pull request description:

ACKs for top commit:
  laanwj:
    Documentation review ACK fa0ad7b9fe

Tree-SHA512: 1be856efc0a25c6bec31e6e58879bbccce18f69cc4f180b285a24362b032f1abeaabc55f9bb064c4c30d3217c38b3f96f52bdf80e13c6069c86cdc4d21f57ef3
2021-05-12 14:15:40 +02:00
W. J. van der Laan
01624a7db3
Merge bitcoin/bitcoin#21462: guix: Add guix-{attest,verify} scripts
d420e5c1c0 guix-attest: Avoid incomplete sigdirs with ERR traps (Carl Dong)
feda2c8e31 guix: Skip attesting to dist-archive (Carl Dong)
d522d8006b guix: Attest to inputs in inputs.SHA256SUMS (Carl Dong)
f9e2960c01 guix: Construct $OUTDIR in ${DISTSRC}/output (Carl Dong)
022abc85fc guix: Minor quoting fix in libexec/build.sh (Carl Dong)
c83c4fa5b7 guix-attest: Allow skipping GPG signing with NO_SIGN (Carl Dong)
0e1c2e448c guix-attest: Use ascii-armor signatures (Carl Dong)
b5fd89c4c8 guix-attest: Only use cross-platform flags for find+xargs (Carl Dong)
5926432ba6 guix: Add guix-verify script (Carl Dong)
30daf76a97 guix: Add guix-attest script (Carl Dong)

Pull request description:

  Adds replacements for `gsign` and `gverify`.

  Personally I'm not a big fan of using the word "sign" as it's been used to refer to both codesigning and GPG signing.

ACKs for top commit:
  laanwj:
    Code review and tested ACK d420e5c1c0

Tree-SHA512: 93d82d201f4596eaea0e3825aa55b013dfb91790e6ccee79893833d37921513d7b4e735f0641103e1e2ea8308abe4cb6218b73160924708802f2e0e3f7f6caf1
2021-05-12 13:51:38 +02:00
Hennadii Stepanov
29c9e2c2d2
wallet: Do not iterate a directory if having an error while accessing it
This change prevents infinite looping for, for example, system folders
on Windows.
2021-05-12 12:11:47 +03:00
Jon Atack
7b55a94497
p2p: NetPermissions::HasFlag() pass flags param by value 2021-05-12 11:04:34 +02:00
Jon Atack
91f6e6e6d1
scripted-diff: add NetPermissionFlags scopes where not already present
-BEGIN VERIFY SCRIPT-
s() { git grep -l "$1" -- 'src' ':!src/net_permissions.h' | xargs sed -i -E "s/([^:])$1/\1NetPermissionFlags::$1/"; }

s 'PF_NONE'
s 'PF_BLOOMFILTER'
s 'PF_RELAY'
s 'PF_FORCERELAY'
s 'PF_DOWNLOAD'
s 'PF_NOBAN'
s 'PF_MEMPOOL'
s 'PF_ADDR'
s 'PF_ISIMPLICIT'
s 'PF_ALL'
-END VERIFY SCRIPT-

Co-authored-by: Hennadii Stepanov <32963518+hebasto@users.noreply.github.com>
2021-05-12 10:50:58 +02:00
MarcoFalke
faad68fcd4
index: Avoid async shutdown on init error 2021-05-12 10:47:35 +02:00
MarcoFalke
fa74bfc860
fuzz: Run const CScript member functions only once 2021-05-12 10:20:59 +02:00
MarcoFalke
faf30f2ae0
doc: Update bips.md for 0.21.1 2021-05-12 10:06:37 +02:00
MarcoFalke
2e30e328a7
Merge bitcoin/bitcoin#19064: refactor: Cleanup thread ctor calls
792be53d3e refactor: Replace std::bind with lambdas (Hennadii Stepanov)
a508f718f3 refactor: Use appropriate thread constructor (Hennadii Stepanov)
30e4448215 refactor: Make TraceThread a non-template free function (Hennadii Stepanov)

Pull request description:

  This PR does not change behavior.
  Its goal is to improve readability and maintainability of the code.

ACKs for top commit:
  jnewbery:
    utACK 792be53d3e
  jonatack:
    tACK 792be53d3e
  MarcoFalke:
    cr ACK 792be53d3e

Tree-SHA512: a03142f04f370f6bc02bd3ddfa870819b51740fcd028772241d68c84087f95a2d78207cbd5edb3f7c636fcf2d76192d9c59873f8f0af451d3b05c0cf9cf234df
2021-05-12 08:51:32 +02:00
fanquake
03e16cb027
Merge bitcoin/bitcoin#21593: build, qt, refactor: Get rid of some sed command instances
b95f7f8ac0 build, qt, refactor: Drop sed commands for win32-g++/qmake.conf (Hennadii Stepanov)

Pull request description:

  Such possibility is [available](https://codereview.qt-project.org/c/qt/qtbase/+/165348) since Qt 5.8.0.

ACKs for top commit:
  fanquake:
    ACK b95f7f8ac0

Tree-SHA512: e56a3d208a6bd5d42c722f8b344010fe7d1b6f7a28486613dfcb03f0403a47cee8476e2366eeaac401a19836cd09f782e8741a1e781ab4d78f72c500a30e4929
2021-05-12 14:24:47 +10:00
fanquake
6754e1928b
Merge bitcoin/bitcoin#21922: fuzz: Avoid timeout in EncodeBase58
faa0d94a7d fuzz: Avoid timeout in EncodeBase58 (MarcoFalke)

Pull request description:

  The complexity is O(N^2), so limit the size.

  Hopefully fixes https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=34126

  Oss-Fuzz testcase for `rpc` fuzzer: https://github.com/bitcoin/bitcoin/files/6461382/clusterfuzz-testcase-minimized-rpc-4831734974775296.log

ACKs for top commit:
  practicalswift:
    cr ACK faa0d94a7d: patch looks correct
  sipa:
    utACK faa0d94a7d

Tree-SHA512: 57ad9de8d811b828982d09a586782fc8a62fa3685590301d58120e2249caa30a9dccd3abe0b47e00ea8482de705fe0edbed298ab8761ea0d29496b50ed2db5d7
2021-05-12 11:03:04 +10:00
MarcoFalke
faa0d94a7d
fuzz: Avoid timeout in EncodeBase58 2021-05-11 21:24:49 +02:00
MarcoFalke
f0a76b3dbc
Merge bitcoin/bitcoin#21892: fuzz: Avoid excessively large min fee rate in tx_pool
99993f0664 fuzz: Avoid excessively large min fee rate in tx_pool (MarcoFalke)

Pull request description:

  Any fee rate above 1 BTC / kvB is clearly nonsense, so no need to fuzz this.

  Hopefully fixes https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=34078

ACKs for top commit:
  practicalswift:
    cr ACK 99993f0664: patch looks correct despite no `fa` prefix in commit hash

Tree-SHA512: bd3651d354b13d889ad1708d2b385ad0479de036de74a237346eefad5dbfb1df76ec02b55ec00487ec598657ef6102f992302b14c4e47f913a9962f81f4157e6
2021-05-11 20:35:20 +02:00
MarcoFalke
88dc09d759
Merge bitcoin/bitcoin#21909: fuzz: Limit max insertions in timedata fuzz test
fa95555a49 fuzz: Limit max insertions in timedata fuzz test (MarcoFalke)

Pull request description:

  It is debatable whether a size of the median filter other than `200` (the only size used in production) should be fuzzed. For now add a minimal patch to cap the max insertions. Otherwise the complexity is N^2 log(N), where N is the size of the fuzz input.

  Hopefully fixes https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=34167

ACKs for top commit:
  practicalswift:
    cr ACK fa95555a49: patch looks correct

Tree-SHA512: be7737e9f4c906053e355641de84dde31fed37ed6be4c5e92e602ca7675dffdaf06b7063b9235ef541b05d3d5fd689c99479317473bb15cb5271b8baabffd0f2
2021-05-11 20:32:20 +02:00
MarcoFalke
fa25ce45e9
build: improve macro for testing -latomic requirement 2021-05-11 20:07:20 +02:00
Karl-Johan Alm
6e2eb0d63b
rpc/wallet: use OMITTED_NAMED_ARG instead of Default(VNULL) 2021-05-12 00:49:49 +09: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
Karl-Johan Alm
4983f4cba4
rpc/createwallet: omitted named arguments
The current output for passphrase results in a non-optional passphrase which is incorrect.
2021-05-11 21:04:24 +09:00
W. J. van der Laan
e175a20769
Merge bitcoin/bitcoin#21644: p2p, bugfix: use NetPermissions::HasFlag() in CConnman::Bind()
36fb036d25 p2p: allow NetPermissions::ClearFlag() only with PF_ISIMPLICIT (Jon Atack)
4e0d5788ba test: add net permissions noban/download unit test coverage (Jon Atack)
dde69f20a0 p2p, bugfix: use NetPermissions::HasFlag() in CConnman::Bind() (Jon Atack)

Pull request description:

  This is a bugfix follow-up to #16248 and #19191 that was noticed in #21506. Both v0.21 and master are affected.

  Since #19191, noban is a multi-flag that implies download, so the conditional in `CConnman::Bind()` using a bitwise AND on noban will return the same result for both the noban status and the download status. This means that download peers are incorrectly not being added to local addresses because they are mistakenly seen as noban peers.

  The second commit adds unit test coverage to illustrate and test the noban/download relationship and the `NetPermissions` operations involving them.

  The final commit adds documentation and disallows calling `NetPermissions::ClearFlag()` with any second param other than `NetPermissionFlags` "implicit" -- per current usage in the codebase -- because `ClearFlag()` should not be called with any second param that is a subflag of a multiflag, e.g. "relay" or "download," as that would leave the result in an invalid state corresponding to none of the existing NetPermissionFlags. Thanks to Vasil Dimov for noticing this.

ACKs for top commit:
  theStack:
    re-ACK 36fb036d25 
  vasild:
    ACK 36fb036d25
  hebasto:
    ACK 36fb036d25, I have reviewed the code and it looks OK, I agree it can be merged.
  kallewoof:
    Code review ACK 36fb036d25

Tree-SHA512: 5fbc7ddbf31d06b35bf238f4d77ef311e6b6ef2e1bb9893f32f889c1a0f65774a3710dcb21d94317fe6166df9334a9f2d42630809e7fe8cbd797dd6f6fc49491
2021-05-11 13:08:45 +02:00
Vasil Dimov
105941b726
net: use stronger AddLocal() for our I2P address
There are two issues:

1. Our I2P address not added to local addresses.

* `externalip=` is used with an IPv4 address (this sets automatically
  `discover=0`)
* No `discover=1` is used
* `i2psam=` is used
* No `externalip=` is used for our I2P address
* `listenonion=1 torcontrol=` are used

In this case `AddLocal(LOCAL_MANUAL)` is used for our `.onion` address
and `AddLocal(LOCAL_BIND)` for our `.b32.i2p` address, the latter being
ignored due to `discover=0`.

2. Our I2P address removed from local addresses even if specified
with `externalip=` on I2P proxy restart.

* `externalip=` is used with our I2P address (this sets automatically
  `discover=0`)
* No `discover=1` is used
* `i2psam=` is used

In this case, initially `externalip=` causes our I2P address to be added
with `AddLocal(LOCAL_MANUAL)` which overrides `discover=0` and works as
expected. However, if later the I2P proxy is shut down we do
`RemoveLocal()` in order to stop advertising our I2P address (since we
have lost I2P connectivity). When the I2P proxy is started and we
reconnect to it, restoring the I2P connectivity, we do
`AddLocal(LOCAL_BIND)` which does nothing due to `discover=0`.

To resolve those two issues, use `AddLocal(LOCAL_MANUAL)` for I2P which
is also what we do with Tor.
2021-05-11 12:46:45 +02:00
Karl-Johan Alm
dc4db23b30
rpc: address:amount dictionaries are OBJ_USER_KEYS 2021-05-11 19:07:08 +09:00
Karl-Johan Alm
c8cf0a3d51
rpc/getpeerinfo: bytesrecv_per_msg is a dynamic dictionary
It is not a dictionary with the single key 'msg'.
2021-05-11 19:00:52 +09:00
Karl-Johan Alm
eb4fb7e507
rpc/gettxoutsetinfo: hash_or_height is a named argument 2021-05-11 18:58:42 +09:00