Commit graph

23371 commits

Author SHA1 Message Date
practicalswift 7a861a62c1 tests: Fuzz HasAllDesirableServiceFlags(...) and MayHaveUsefulAddressDB(...) 2020-03-11 12:51:26 +00:00
practicalswift 47a263108b tests: Fuzz DecodeBase64PSBT(...) 2020-03-11 12:51:26 +00:00
practicalswift d3d4892ef4 tests: Simplify code by removing unwarranted use of unique_ptr:s 2020-03-11 12:51:26 +00:00
practicalswift e57e67057a tests: Fuzz DecodeHexBlk(...) 2020-03-11 12:51:26 +00:00
practicalswift 117a706fab tests: Fuzz RecursiveDynamicUsage(const std::shared_ptr<X>& p) 2020-03-11 12:51:26 +00:00
practicalswift 81b58a3161 tests: Fuzz operator!= of CService 2020-03-11 12:51:26 +00:00
practicalswift c2c58f6f59 tests: Increase fuzzing coverage of DecompressScript(...) 2020-03-11 12:51:26 +00:00
MarcoFalke f1064c1b0d
Merge #17989: tests: Add fuzzing harness for ProcessMessage(...). Enables high-level fuzzing of the P2P layer.
9220a0fdd0 tests: Add one specialized ProcessMessage(...) fuzzing binary per message type for optimal results when using coverage-guided fuzzing (practicalswift)
fd1dae10b4 tests: Add fuzzing harness for ProcessMessage(...) (practicalswift)

Pull request description:

  Add fuzzing harness for `ProcessMessage(...)`. Enables high-level fuzzing of the P2P layer.

  All code paths reachable from this fuzzer can be assumed to be reachable for an untrusted peer.

  Seeded from thin air (an empty corpus) this fuzzer reaches roughly 20 000 lines of code.

  To test this PR:

  ```
  $ make distclean
  $ ./autogen.sh
  $ CC=clang CXX=clang++ ./configure --enable-fuzz \
        --with-sanitizers=address,fuzzer,undefined
  $ make
  $ src/test/fuzz/process_message
  …
  ```

  Worth noting about this fuzzing harness:
  * To achieve a reasonable number of executions per seconds the state of the fuzzer is unfortunately not entirely reset between `test_one_input` calls. The set-up (`FuzzingSetup` ctor) and tear-down (`~FuzzingSetup`) work is simply too costly to be run on every iteration. There is a trade-off to handle here between a.) achieving high executions/second and b.) giving the fuzzer a totally blank slate for each call. Please let me know if you have any suggestion on how to improve this situation while maintaining >1000 executions/second.
  * To achieve optimal results when using coverage-guided fuzzing I've chosen to create one specialised fuzzing binary per message type (`process_message_addr`, `process_message_block`, `process_message_blocktxn `, etc.) and one general fuzzing binary (`process_message`) which handles all messages types. The latter general fuzzer can be seeded with inputs generated by the former specialised fuzzers.

  Happy fuzzing friends!

ACKs for top commit:
  MarcoFalke:
    ACK 9220a0fdd0 🏊

Tree-SHA512: c314ef12b0db17b53cbf3abfb9ecc10ce420fb45b17c1db0b34cabe7c30e453947b3ae462020b0c9f30e2c67a7ef1df68826238687dc2479cd816f0addb530e5
2020-03-11 08:51:24 -04:00
MarcoFalke 16dfaed1b7
Merge #18304: ci: Enable all functional tests in valgrind
4444edc2e6 ci: Enable all functional tests in valgrind (MarcoFalke)

Pull request description:

  The travis timeout for our repo has been bumped to 2h, so we can run all tests in valgrind now

ACKs for top commit:
  practicalswift:
    ACK 4444edc2e6 -- regarding the three disabled cases (`feature_abortnode`, `feature_block` and `rpc_bind`): not a big deal since MSan will take care of those once #18288 is merged. More is more :)

Tree-SHA512: ea2f798112911b6d1f3d88cfcdf0a7cdb698687248343703d6fe55da144542c961c15d888bffb41672c10aa76765615cb7c7ff93d468bfad3c51f962f24e7abb
2020-03-11 08:39:09 -04:00
practicalswift 9f8d74a8c7 tests: Fuzz currently uncovered code path in TxToUniv(...) 2020-03-11 12:38:10 +00:00
practicalswift 46ef4cfe5f tests: Re-arrange test cases in parse_univalue to increase coverage 2020-03-11 12:37:59 +00:00
MarcoFalke fa1244783c
doc: Explain rebase/squash policy in CONTRIBUTING.md 2020-03-11 07:51:23 -04:00
practicalswift 516cc6fc78 tests: Remove unit test from fuzzing harness 2020-03-11 11:42:27 +00:00
practicalswift 7b169cae20 tests: Add deserialization fuzzing of SnapshotMetadata (utxo_snapshot), uint160 and uint256 2020-03-11 11:42:27 +00:00
practicalswift 9220a0fdd0 tests: Add one specialized ProcessMessage(...) fuzzing binary per message type for optimal results when using coverage-guided fuzzing 2020-03-11 06:57:55 +00:00
practicalswift fd1dae10b4 tests: Add fuzzing harness for ProcessMessage(...) 2020-03-11 06:57:55 +00:00
MarcoFalke 4444edc2e6
ci: Enable all functional tests in valgrind 2020-03-10 18:38:42 -04:00
MarcoFalke b5c7665e30
Merge #18311: Bumpfee test fix
f1b4503114 bumpfee test: exit loop at proper time with new fee value being compared (Gregory Sanders)
2e4edc68f9 Add some test logging to wallet_bumpfee.py (Gregory Sanders)

Pull request description:

  In the loop we accidentally used `origfee` which is not the value to check, and also allowed the loop to exit too early since the new fee must be strictly greater than `0.0005`.

  Also converted/added a bunch of logging from comments.

  Resolves https://github.com/bitcoin/bitcoin/issues/17716

ACKs for top commit:
  MarcoFalke:
    ACK f1b4503114 🏈

Tree-SHA512: eb73297fc82b09b9ec08d85ba3f0bec662119d0ff63ccf5d978a7bad6a674b5915f5ed021ec42f72a732c9ee7af43212d1de87361f50a970df7755caec96f6d8
2020-03-10 14:15:39 -04:00
Gregory Sanders f1b4503114 bumpfee test: exit loop at proper time with new fee value being compared 2020-03-10 13:56:52 -04:00
Gregory Sanders 2e4edc68f9 Add some test logging to wallet_bumpfee.py 2020-03-10 13:56:52 -04:00
MarcoFalke cf4cb28efc
Merge #18305: test: Explain why test logging should be used
ffff9dcdc3 test: Explain why test logging should be used (MarcoFalke)

Pull request description:

  Background is that some tests don't have any `self.log` call at all. Thus there are no "anchor points" and those tests are hard to debug because the logs can't easily be parsed by a human.

ACKs for top commit:
  jonatack:
    ACK ffff9dcdc3
  instagibbs:
    ACK ffff9dcdc3
  fanquake:
    re-ACK ffff9dcdc3

Tree-SHA512: 08d962e85c4892c2a0c58feb5dc697c680a9d68e41a79417da6fcd415e0c5c735c4533a985cf225bb89deb5ca717d9bedf990657958079185804caa512b10f5a
2020-03-10 12:45:38 -04:00
Jon Atack ac73afbcbf
doc: asmap release note 2020-03-10 17:35:01 +01:00
MarcoFalke fa3fa27c45
fuzz: Remove option --export_coverage from test_runner
The coverage statistics are not stable across clang versions
2020-03-10 11:15:11 -04:00
MarcoFalke fa36f3a295
refactor: move DUMP_BANS_INTERVAL to banman.h 2020-03-10 09:52:53 -04:00
MarcoFalke fadafb83cf
scheduler: Make schedule* methods type safe 2020-03-10 09:47:32 -04:00
MarcoFalke ffff9dcdc3
test: Explain why test logging should be used 2020-03-10 08:24:49 -04:00
fanquake 5d92ac26ed
Merge #18264: build: Remove Boost Chrono
ad345909b2 doc: remove Boost Chrono from install docs (fanquake)
e21fa542b1 test: remove Boost Chrono installation from CI (fanquake)
bd37f2bc26 build: remove Boost Chrono detection from build system (fanquake)
1d0a87e712 build: remove chrono package from depends Boost (fanquake)

Pull request description:

  We no longer use Boost Chrono.

ACKs for top commit:
  practicalswift:
    ACK ad345909b2
  MarcoFalke:
    ACK ad345909b2
  kallewoof:
    ACK ad345909b2

Tree-SHA512: d987ab5461c76c982318c65ec8d625094356716b79fd3a462beea75f07db0f82608ace13ec4c4b0233f352508715a4505ac2b4ed1c1e9d9d78f0da936b80f0f3
2020-03-10 20:24:10 +08:00
MarcoFalke 1a97c9a483
Merge #15443: qa: Add getdescriptorinfo functional test
cbf2d75d8f qa: Add getdescriptorinfo functional test (João Barbosa)

Pull request description:

  The `getdescriptorinfo` RPC was added in #15368, this PR adds some tests.

Top commit has no ACKs.

Tree-SHA512: 5bf3fb5842b975089821c7ac52202ecb23df255f655862646eb532e38e335ff963f8973bcf5b8bba386183281dc9bfe7279ba1cf25fd518c9a45fb45a9243e4d
2020-03-10 08:17:23 -04:00
João Barbosa cbf2d75d8f qa: Add getdescriptorinfo functional test 2020-03-10 08:14:04 +00:00
MarcoFalke 6fb4bbfb0e
Merge #18176: tests: Add fuzzing harness for CScript and CScriptNum operations
e37f53648e Make lifetime correctness easier to see (avoid reference lifetime extension) (practicalswift)
e7ddbd9893 tests: Add fuzzing harness for CScriptNum operations (practicalswift)
65a52a0024 tests: Add fuzzing harness for CScript operations (practicalswift)
eb7c50ca1f tests: Add common Consume* fuzzing functions (practicalswift)

Pull request description:

  Add fuzzing harness for `CScript` and `CScriptNum` operations.

  Test this PR using:

  ```
  $ make distclean
  $ ./autogen.sh
  $ CC=clang CXX=clang++ ./configure --enable-fuzz \
        --with-sanitizers=address,fuzzer,undefined
  $ make
  $ src/test/fuzz/script_ops
  …
  $ src/test/fuzz/scriptnum_ops
  …
  ```

ACKs for top commit:
  MarcoFalke:
    ACK e37f53648e 🦂

Tree-SHA512: 5165d918ffe3f1e3e85ab0e61d8b05934f682d324cf63ce188da5890899df2b5727aba9ed10c0437260ecff8055250e60c79d81d764bc740a7652d543a7c5fa3
2020-03-09 23:01:31 -04:00
practicalswift e37f53648e Make lifetime correctness easier to see (avoid reference lifetime extension) 2020-03-09 20:39:48 +00:00
practicalswift e7ddbd9893 tests: Add fuzzing harness for CScriptNum operations 2020-03-09 20:39:48 +00:00
MarcoFalke ccb2c9e789
Merge #18306: test: add logging to wallet_listsinceblock.py
d484279a46 test: add logging to wallet_listsinceblock.py (Jon Atack)

Pull request description:

  This is the first commit from #17535.

Top commit has no ACKs.

Tree-SHA512: bb4f527a41bca3ffbf69e910311ce7f85dcc7a2be41350b3c653a27f4044f392b7e528f330e9691f497212469f6b16ce263230bb7a919548dd4e3e21cc72142f
2020-03-09 16:16:21 -04:00
Jon Atack d484279a46
test: add logging to wallet_listsinceblock.py 2020-03-09 21:12:03 +01:00
Samuel Dobson dcf2ccbfde
Merge #18115: wallet: Pass in transactions and messages for signing instead of exporting the private keys
d2774c09cf Clear any input_errors for an input after it is signed (Andrew Chow)
dc174881ad Replace GetSigningProvider with GetSolvingProvider (Andrew Chow)
6a9c429084 Move direct calls to MessageSign into new SignMessage functions in CWallet and ScriptPubKeyMan (Andrew Chow)
82a30fade7 Move key and script filling and signing from CWallet::FillPSBT to ScriptPubKeyMan::FillPSBT (Andrew Chow)
3d70dd99f9 Move FillPSBT to be a member of CWallet (Andrew Chow)
a4af324d15 Use CWallet::SignTransaction in CreateTransaction and signrawtransactionwithwallet (Andrew Chow)
f37de92744 Implement CWallet::SignTransaction using ScriptPubKeyMan::SignTransaction (Andrew Chow)
d999dd588c Add SignTransaction function to ScriptPubKeyMan and LegacyScriptPubKeyMan (Andrew Chow)
2c52b59d0a Refactor rawtransaction's SignTransaction into generic SignTransaction function (Andrew Chow)

Pull request description:

  Following #17261, the way to sign transactions, PSBTs, and messages was to use `GetSigningProvider()` and get a `SigningProvider` containing the private keys. However this may not be feasible for future `ScriptPubKeyMan`s, such as for hardware wallets. Instead of exporting a `SigningProvider` containing private keys, we need to pass these things into the `ScriptPubKeyMan` (via `CWallet`) so that they can do whatever is needed internally to sign them. This is largely a refactor as the logic of processing transactions, PSBTs, and messages for is moved into `LegacyScriptPubKeyMan` and `CWallet` instead of being handled by the caller (e.g. `signrawtransaction`).

  To help with this, I've refactored the 3(!) implementations of a `SignTransaction()` function into one generic one. This function will be called by `signrawtransactionwithkey` and `LegacyScriptPubKeyMan::SignTransaction()`. `CWallet::CreateTransaction()` is changed to call `CWallet::SignTransaction()` which in turn, calls `LegacyScriptPubKeyMan::SignTransaction()`. Other `ScriptPubKeyMan`s may implement `SignTransaction()` differently.

  `FillPSBT()` is moved to be a member function of `CWallet` and the `psbtwallet.cpp/h` files removed. It is further split so that `CWallet` handles filling the UTXOs while the `ScriptPubKeyMan` handles adding keys, derivation paths, scripts, and signatures. In the end `LegacyScriptPubKeyMan::FillPSBT` still calls `SignPSBTInput`, but the `SigningProvider` is internal to `LegacyScriptPubKeyMan`. Other `ScriptPubKeyMan`s may do something different.

  A new `SignMessage()` function is added to both `CWallet` and `ScriptPubKeyMan`. Instead of having the caller (i.e. `signmessage` or the sign message dialog) get the private key, hash the message, and sign, `ScriptPubKeyMan` will now handle that (`CWallet` passes through to the `ScriptPubKeyMan`s as it does for many functions). This signing code is thus consolidated into `LegacyScriptPubKeyMan::SignMessage()`, though other `ScriptPubKeyMan`s may implement it differently. Additionally, a `SigningError` enum is introduced for the different errors that we expect to see from `SignMessage()`.

  Lastly, `GetSigningProvider()` is renamed to `GetPublicSigningProvider()`. It will now only provide pubkeys, key origins, and scripts. `LegacySigningProvider` has it's `GetKey` and `HaveKey` functions changed to only return false. Future implementations should return `HidingSigningProvider`s where private keys are hidden.

  Other things like `dumpprivkey` and `dumpwallet` are not changed because they directly need and access the `LegacyScriptPubKeyMan` so are not relevant to future changes.

ACKs for top commit:
  instagibbs:
    reACK d2774c09cf
  Sjors:
    re-utACK d2774c09cf
  meshcollider:
    re-utACK d2774c09cf

Tree-SHA512: 89c83e7e7e9315e283fae145a2264648a9d7f7ace8f3281cb3f44f0b013c988d67ba4fa9726e50c643c0ed921bdd269adaec984840d11acf4a681f3e8a582cc1
2020-03-10 09:02:12 +13:00
Wladimir J. van der Laan ffdde475b0
Merge #18303: doc: Add historical release notes for 0.19.1
46a1ee7732 doc: Add historical release notes for 0.19.1 (Wladimir J. van der Laan)

Pull request description:

Top commit has no ACKs.

Tree-SHA512: 9ff578fbaec5694d63256d65cbe7e9d0ba99ac50803c8192f9b5e90a614dc89778bdb17b03f5f7725397f820e085e7d704deb1d6a58b18cd4e4fc91ea413b6ae
2020-03-09 20:54:19 +01:00
practicalswift 65a52a0024 tests: Add fuzzing harness for CScript operations 2020-03-09 19:24:50 +00:00
practicalswift eb7c50ca1f tests: Add common Consume* fuzzing functions 2020-03-09 19:24:50 +00:00
MarcoFalke 5518eeec27
Merge #18047: tests: Add basic fuzzing harness for CNetAddr/CService/CSubNet related functions (netaddress.h)
6590395f60 tests: Remove FUZZERS_MISSING_CORPORA (practicalswift)
815c7a6793 tests: Add basic fuzzing harness for CNetAddr/CService/CSubNet related functions (netaddress.h) (practicalswift)

Pull request description:

  Add basic fuzzing harness for `CNetAddr`/`CService`/`CSubNet` related functions (`netaddress.h`).

  To test this PR:

  ```
  $ make distclean
  $ ./autogen.sh
  $ CC=clang CXX=clang++ ./configure --enable-fuzz \
        --with-sanitizers=address,fuzzer,undefined
  $ make
  $ src/test/fuzz/netaddress
  …
  ```

Top commit has no ACKs.

Tree-SHA512: 69dc0e391d56d5e9cdb818ac0ac4b69445d0195f714442a06cf662998e38b6e0bbaa635dce78df37ba797feed633e94abba4764b946c1716d392756e7809112d
2020-03-09 13:53:46 -04:00
Albert c1e0742308 doc: Warn about wallet.dat re-use and backups
See discussion in #18205 and https://github.com/bitcoin/bitcoin/pull/18219#issuecomment-594871230.
2020-03-10 01:51:03 +08:00
Wladimir J. van der Laan 46a1ee7732 doc: Add historical release notes for 0.19.1 2020-03-09 18:41:39 +01:00
practicalswift 6590395f60 tests: Remove FUZZERS_MISSING_CORPORA 2020-03-09 17:20:52 +00:00
MarcoFalke be00ef2aca
Merge #18292: fuzz: Add assert(script == decompressed_script)
fab0e5ba7f fuzz: Add assert(script == decompressed_script) (MarcoFalke)

Pull request description:

  Presumably an oversight in https://github.com/bitcoin/bitcoin/pull/17926#discussion_r389262151

ACKs for top commit:
  practicalswift:
    Tested ACK fab0e5ba7f

Tree-SHA512: 6dcec06169df497a540fd6ebbcd89f5db22257241b2bbe756de868742f9bc324b80d38dbababfa07e5f3a830aaae9fc6d168dcc2ca5d75da437bdf4dc4e0f370
2020-03-09 11:19:29 -04:00
practicalswift 815c7a6793 tests: Add basic fuzzing harness for CNetAddr/CService/CSubNet related functions (netaddress.h) 2020-03-09 15:16:36 +00:00
Andrew Chow d2774c09cf Clear any input_errors for an input after it is signed
Make sure that there are no errors set for an input after it is signed.
This is useful for when there are multiple ScriptPubKeyMans. Some may
fail to sign, but one may be able to sign, and after it does, we don't
want there to be any more errors there.
2020-03-09 11:16:20 -04:00
Andrew Chow dc174881ad Replace GetSigningProvider with GetSolvingProvider
Not all ScriptPubKeyMans will be able to provide private keys,
but pubkeys and scripts should be. So only provide public-only
SigningProviders, i.e. ones that can help with Solving.
2020-03-09 11:16:20 -04:00
Andrew Chow 6a9c429084 Move direct calls to MessageSign into new SignMessage functions in CWallet and ScriptPubKeyMan
Instead of getting a SigningProvider and then going to MessageSign,
have ScriptPubKeyMan handle the message signing internally.
2020-03-09 11:16:20 -04:00
Andrew Chow 82a30fade7 Move key and script filling and signing from CWallet::FillPSBT to ScriptPubKeyMan::FillPSBT
Instead of fetching a SigningProvider from ScriptPubKeyMan in order
to fill and sign the keys and scripts for a PSBT, just pass that
PSBT to a new FillPSBT function that does all that for us.
2020-03-09 11:16:20 -04:00
Andrew Chow 3d70dd99f9 Move FillPSBT to be a member of CWallet 2020-03-09 11:16:17 -04:00
MarcoFalke aaaa055ff7
fuzz: Add option to merge input dir to test runner 2020-03-09 11:13:57 -04:00