Commit graph

2278 commits

Author SHA1 Message Date
pierrenn
9ab14e4d21 Limit decimal range of numbers ParseScript accepts 2020-03-27 15:51:05 +09:00
MarcoFalke
d478a737db
Merge #18392: ci: Run feature_block in valgrind
fa92af5af3 ci: Run feature_block and feature_abortnode in valgrind (MarcoFalke)
fa01febeaf test: Remove ci timeout restriction in test_runner (MarcoFalke)

Pull request description:

  Also revert commit 0a4912e46a, because some tests take too long for this to be useful anymore.

Top commit has no ACKs.

Tree-SHA512: 363f14766e1f4a5860ab668a516b41acebc6fbdf11d8defb3a95a772dbf82304ca1f5f14b1dbad97f2029503e03d92e8c69df0466a8872409c20665838f617ed
2020-03-23 07:38:07 -04:00
Sebastian Falbesoner
f0dfac7da3 test: add executable flag for rpc_estimatefee.py 2020-03-22 23:20:35 +01:00
MarcoFalke
fa92af5af3
ci: Run feature_block and feature_abortnode in valgrind 2020-03-22 10:12:40 -04:00
MarcoFalke
fa01febeaf
test: Remove ci timeout restriction in test_runner 2020-03-20 20:58:13 -04:00
Pieter Wuille
a733ad514a Add bn2vch test to functional tests 2020-03-18 13:54:01 -07:00
Pieter Wuille
a3ad6459b7 Simplify bn2vch using int.to_bytes 2020-03-18 13:54:01 -07:00
MarcoFalke
5c9d408b2d
Merge #18300: fuzz: Add option to merge input dir to test runner
fa3fa27c45 fuzz: Remove option --export_coverage from test_runner (MarcoFalke)
aaaa055ff7 fuzz: Add option to merge input dir to test runner (MarcoFalke)
fa4fa88d76 doc: Remove --disable-ccache from docs (MarcoFalke)

Pull request description:

  This is mainly useful for myself to merge pull requests like https://github.com/bitcoin-core/qa-assets/pull/4

  I thought it wouldn't hurt to share the code.

  Also remove the `--disable-ccache` from the docs to speed up builds when developing fuzzers.

Top commit has no ACKs.

Tree-SHA512: 818d85a90db86a7f4e8b001cc88342e5b28b02029d2bd4174440b28a8c4cc29b5406bd6348f72ddf909bb3d0f9bf7b1011976f6480e4418c8b7da5ecccae93e8
2020-03-18 15:51:44 -04:00
MarcoFalke
ad04f0d8a5
Merge #17319: Tests: remove bignum module
3ed772d221 [tests] remove bignum.py (John Newbery)
f950ec2520 [tests] remove bn2bin() (John Newbery)
3b9b38579c [tests] remove bn_bytes() function (John Newbery)
a760aa14a9 [tests] remove mpi2vch() function (John Newbery)
9a60bef50d [tests] don't encode the integer size in bignum (John Newbery)
1dc68aee66 [tests] add function comments to bignum (John Newbery)
f31fc0e92e [tests] fix flake8 warnings in script.py and bignum.py (John Newbery)

Pull request description:

  Only one function is imported in script.py. Just move that function to script.py and remove the bignum.py module.

  Remove unused functionality and fix some flake8 warnings along the way.

Top commit has no ACKs.

Tree-SHA512: 015f543ab545b5d5451896e2751d9c19334d9155b03faacd2023781e89833a2440f7f28741e9a8ac49badd9cdc012cbb6e038cdcdebeefaf9cb9d461c0689157
2020-03-17 13:38:00 -04:00
John Newbery
612a931d1a tests: simplify next_block() function in feature_block
The solve parameter is unnecessary. Remove it and add
comments.
2020-03-17 09:45:00 -04:00
MarcoFalke
7060d2d97a
Merge #18350: test: Fix mining to an invalid target + ensure that a new block has the correct hash internally
7a6627ae87 Fix mining to an invalid target + ensure that a new block has the correct hash internally in Python tests (Samer Afach)

Pull request description:

  Test with block 47 in the `feature_block.py` creates a block with a hash higher than the target, which is supposed to fail. Now two issues exist there, and both have low probability of showing up:

  1. The creation is done with `while (hash < target)`, which is wrong, because hash = target is a valid mined value based on the code in the function `CheckProofOfWork()` that validates the mining target:
  ```
      if (UintToArith256(hash) > bnTarget)
          return false;
  ```
  2. As we know the hash stored in CBlock class in Python is stateful, unlike how it's in C++, where calling `CBlock::GetHash()` will actively calculate the hash and not cache it anywhere. With this, blocks that come out of the method `next_block` can have incorrect hash value when `solve=False`. This is because the `next_block` is mostly used with `solve=True`, and solving does call the function `rehash()` which calculates the hash of the block, but with `solve=False`, nothing calls that method. And since the work to be done in regtests is very low, the probably of this problem showing up is very low, but it practically happens (well, with much higher probability compared to issue No. 1 above).

  This PR fixes both these issues.

Top commit has no ACKs.

Tree-SHA512: f3b54d18f5073d6f1c26eab89bfec78620dda4ac1e4dde4f1d69543f1b85a7989d64c907e091db63f3f062408f5ed1e111018b842819ba1a5f8348c7b01ade96
2020-03-16 16:31:42 -04:00
MarcoFalke
fa19295250
test: Bump timeouts to avoid valgrind failures 2020-03-14 22:15:52 -04:00
Samer Afach
7a6627ae87 Fix mining to an invalid target + ensure that a new block has the
correct hash internally in Python tests
2020-03-14 14:44:56 +01:00
MarcoFalke
e2d36639ca
Merge #18228: test: Add missing syncwithvalidationinterfacequeue
faf6f156ff test: Add missing syncwithvalidationinterfacequeue (MarcoFalke)

Pull request description:

  The wallet rebroadcast functionality learns about new blocks via the validation interface queue. To avoid test failures such as https://ci.appveyor.com/project/DrahtBot/bitcoin/builds/31119387#L466 , we can sync with the queue before advancing the test.

ACKs for top commit:
  jonatack:
    ACK faf6f156 this makes sense; the fix was previously added to mempool_persist.py and wallet_zapwallettxes.py in #12217 and to wallet_balance.py in #16302. It is also used in src/test/validation_block_tests.cpp (processnewblock_signals_ordering) and src/bench/wallet_balance.cpp.

Tree-SHA512: d72fd4b597b669d8111007902b523e946712913cd6eea6f9a695b0f04ecbe2321d05019873af999a95b9e0aa0f5c140a17109b37503723e40c9eab24ec358eb7
2020-03-12 09:20:50 -04:00
MarcoFalke
2737197ff3
Merge #18213: test: Fix race in p2p_segwit
fa2cf85e6f test: Fix race in p2p_segwit (MarcoFalke)

Pull request description:

  Fixes #11696

Top commit has no ACKs.

Tree-SHA512: 09de07ea26236547586f5c373a0df2b68d84af5cfa8f40bd2ca9f951fc083c5f4b8a472a60668d99118bbd9f3942ec3d6a34f05944d47345acca41c95475bb27
2020-03-12 09:15:43 -04:00
MarcoFalke
9cc7eba1b5
Merge #18318: test: Bump rpc timeout in feature_assumevalid to avoid valgrind timeouts
fa9b3040e7 test: Bump rpc timeout in feature_assumevalid to avoid valgrind timeouts (MarcoFalke)
fa72d270ad test: Bump walletpassphrase timeouts in wallet_createwallet to avoid valgrind timeouts (MarcoFalke)

Pull request description:

  Fixes:

  * https://travis-ci.org/github/bitcoin/bitcoin/jobs/661135188#L3137
  * https://travis-ci.org/github/bitcoin/bitcoin/jobs/661066901#L3137
  * https://travis-ci.org/github/bitcoin/bitcoin/jobs/661121674#L3828

ACKs for top commit:
  practicalswift:
    ACK fa9b3040e7

Tree-SHA512: 9c9f844da28c08d335145cd28da84bfd6dd81285eee7410fcf8e4b3707ff6f9bd8f4c60afaa0389dbebe4b1f3a4ad209d58d0d5b8739799cc25acd920ffb2404
2020-03-11 16:17:15 -04:00
MarcoFalke
309b0c4c19
Merge #13693: [test] Add coverage to estimaterawfee and estimatesmartfee
111880aaf7 [test] Add coverage to estimaterawfee and estimatesmartfee (Ben Woosley)

Pull request description:

  This adds light functional coverage to estimaterawfee - a subset of
  the testing applied to estimatesmartfee, and argument validation
  testing to both estimaterawfee and estimatesmartfee.

  One valid estimatesmartfee signature test is commented out because it
  fails currently.

  Extracted from #12940

Top commit has no ACKs.

Tree-SHA512: 361a883457b28b2dc75081666e49d6dc6b5d76eed40d858abe2dd4f35ece152cf1f99c94480a91f42a896aa2a73cf55f57921316fe66970b2d7ba691a3b17e2d
2020-03-11 15:55:28 -04:00
MarcoFalke
fa9b3040e7
test: Bump rpc timeout in feature_assumevalid to avoid valgrind timeouts 2020-03-11 13:37:17 -04:00
MarcoFalke
fa72d270ad
test: Bump walletpassphrase timeouts in wallet_createwallet to avoid valgrind timeouts 2020-03-11 13:23:59 -04:00
Wladimir J. van der Laan
24a727e23e
Merge #18255: test: Add bad-txns-*-toolarge test cases to invalid_txs
faae5a9a35 test: Add bad-txns-*-toolarge test cases to invalid_txs (MarcoFalke)

Pull request description:

ACKs for top commit:
  laanwj:
    ACK faae5a9a35

Tree-SHA512: 93962de02104de220cc76f3759e7276423668bbd7f2b5c32e256ece2daf55501d72804bb9eb009a5d7b3a6631c88859cf6cc3e51da19dddf73b4e7df6e8c4ce4
2020-03-11 16:45:47 +01: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
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
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
ffff9dcdc3
test: Explain why test logging should be used 2020-03-10 08:24:49 -04:00
João Barbosa
cbf2d75d8f qa: Add getdescriptorinfo functional test 2020-03-10 08:14:04 +00:00
Jon Atack
d484279a46
test: add logging to wallet_listsinceblock.py 2020-03-09 21:12:03 +01:00
practicalswift
6590395f60 tests: Remove FUZZERS_MISSING_CORPORA 2020-03-09 17:20:52 +00:00
practicalswift
815c7a6793 tests: Add basic fuzzing harness for CNetAddr/CService/CSubNet related functions (netaddress.h) 2020-03-09 15:16:36 +00:00
MarcoFalke
aaaa055ff7
fuzz: Add option to merge input dir to test runner 2020-03-09 11:13:57 -04:00
practicalswift
bf06641819 tests: Reset FUZZERS_MISSING_CORPORA to enable regression fuzzing for more harnesses 2020-03-09 14:30:18 +00:00
practicalswift
c7ea12d098 tests: Add key_io fuzzing harness 2020-03-07 13:39:25 +00:00
practicalswift
0d0bc3b5c1 build: Add locale fuzzer to FUZZERS_MISSING_CORPORA 2020-03-06 23:29:23 +00:00
Wladimir J. van der Laan
3516a31eaa
Merge #18234: refactor: Replace boost::mutex,condition_var,chrono with std equivalents in scheduler
70a6b529f3 lint-cppcheck: Remove -DHAVE_WORKING_BOOST_SLEEP_FOR (Anthony Towns)
294937b39d scheduler_tests: re-enable mockforward test (Anthony Towns)
cea19f6859 Drop unused reverselock.h (Anthony Towns)
d0ebd93270 scheduler: switch from boost to std (Anthony Towns)
b9c4260127 sync.h: add REVERSE_LOCK (Anthony Towns)
306f71b4eb scheduler: don't rely on boost interrupt on shutdown (Anthony Towns)

Pull request description:

  Replacing boost functionality with C++11 stuff.

  Motivated by #18227, but should stand alone. Changing from `boost::condition_var` to `std::condition_var` means `threadGroup.interrupt_all` isn't enough to interrupt `serviceQueue` anymore, so that means calling `stop()` before `join_all()` is needed. And the existing reverselock.h code doesn't work with sync.h's DebugLock code (because the reversed lock won't be removed from `g_lockstack` which then leads to incorrect potential deadlock warnings), so I've replaced that with a dedicated class and macro that's aware of our debug lock behaviour.

  Fixes #16027, Fixes #14200, Fixes #18227

ACKs for top commit:
  laanwj:
    ACK 70a6b529f3

Tree-SHA512: d1da13adeabcf9186d114e2dad9a4fdbe2e440f7afbccde0c13dfbaf464efcd850b69d3371c5bf8b179d7ceb9d81f4af3cc22960b90834e41eaaf6d52ef7d331
2020-03-06 20:51:56 +01:00
Anthony Towns
70a6b529f3 lint-cppcheck: Remove -DHAVE_WORKING_BOOST_SLEEP_FOR 2020-03-07 04:20:41 +10:00
practicalswift
259e290db8 tests: Add fuzzing harness for locale independence testing 2020-03-06 13:29:21 +00:00
Anthony Towns
d0ebd93270 scheduler: switch from boost to std
Changes from boost::chrono to std::chrono, boost::condition_var to
std::condition_var, boost::mutex to sync.h Mutex, and reverselock.h to
sync.h REVERSE_LOCK. Also adds threadsafety annotations to CScheduler
members.
2020-03-06 23:14:08 +10:00
MarcoFalke
3f826598a4
Merge #17972: tests: Add fuzzing harness for CKey and key related functions
f4691b6c21 tests: Add fuzzing harness for CKey related functions (practicalswift)

Pull request description:

  Add fuzzing harness for `CKey` and key related functions.

  **How to test this PR**

  ```
  $ make distclean
  $ ./autogen.sh
  $ CC=clang CXX=clang++ ./configure --enable-fuzz \
        --with-sanitizers=address,fuzzer,undefined
  $ make
  $ src/test/fuzz/key
  …
  #4096   pulse  cov: 5736 ft: 6960 corp: 27/833b lim: 67 exec/s: 2048 rss: 122Mb
  #8192   pulse  cov: 5736 ft: 6960 corp: 27/833b lim: 103 exec/s: 2048 rss: 143Mb
  #13067  NEW    cov: 5736 ft: 6965 corp: 28/865b lim: 154 exec/s: 2177 rss: 166Mb L: 32/32 MS: 1 ChangeBit-
  #16384  pulse  cov: 5736 ft: 6965 corp: 28/865b lim: 182 exec/s: 2048 rss: 181Mb
  #32768  pulse  cov: 5736 ft: 6965 corp: 28/865b lim: 347 exec/s: 2184 rss: 258Mb
  …
  ```

Top commit has no ACKs.

Tree-SHA512: 5b17ffb70c31966d3eac06d2258c127ae671d28d6cdf4e6ac20b45cd59ad32f80952c9c749930b97d317c72d5f840a3b75d466fd28fb6c351424a72c3e41bcbc
2020-03-05 16:43:16 -05:00
practicalswift
f4691b6c21 tests: Add fuzzing harness for CKey related functions 2020-03-05 21:11:10 +00:00
MarcoFalke
a2b5aae9f3
Merge #17996: tests: Add fuzzing harness for serialization/deserialization of floating-points and integrals
9ff41f6419 tests: Add float to FUZZERS_MISSING_CORPORA (temporarily) (practicalswift)
8f6fb0a85a tests: Add serialization/deserialization fuzzing for integral types (practicalswift)
3c82b92d2e tests: Add fuzzing harness for functions taking floating-point types as input (practicalswift)
c2bd588860 Add missing includes (practicalswift)

Pull request description:

  Add simple fuzzing harness for functions with floating-point parameters (such as `ser_double_to_uint64(double)`, etc.).

  Add serialization/deserialization fuzzing for integral types.

  Add missing includes.

  To test this PR:

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

Top commit has no ACKs.

Tree-SHA512: 9b5a0c4838ad18d715c7398e557d2a6d0fcc03aa842f76d7a8ed716170a28f17f249eaede4256998aa3417afe2935e0ffdfaa883727d71ae2d2d18a41ced24b5
2020-03-05 15:41:30 -05:00
practicalswift
9ff41f6419 tests: Add float to FUZZERS_MISSING_CORPORA (temporarily) 2020-03-05 20:35:26 +00:00
Wladimir J. van der Laan
a2a77ba34f
Merge #18056: ci: Check for submodules
2a95c7c956 ci: Check for submodules (Emil Engler)

Pull request description:

  See #18019.
  The current solution looks like this (I also tested with multiple submodules):
  ```
  These submodules were found, delete them:
   355a5a310019659d9bf6818d2fd66fbb214dfed7 curl (curl-7_68_0-108-g355a5a310)
  ```
  The submodule example command was `git submodule add https://github.com/curl/curl.git curl`

ACKs for top commit:
  laanwj:
    ACK 2a95c7c956

Tree-SHA512: 64bf388123f0a88d12e3e41ff29bc190339377a0615c35dc3f2700bb7773470a8fa426e0ff57188a60ed88bded39f75082ff0b73118651ff403b163422395005
2020-03-05 16:33:54 +01:00
fanquake
d0601e67f1
Merge #17812: config, net, test: asmap feature refinements and functional tests
1ba3e1cc21 init: move asmap code earlier in init process (Jon Atack)
5ba829e12e rpc: fix getpeerinfo RPCResult `mapped_as` type (Jon Atack)
c90b9a2399 net: extract conditional to bool CNetAddr::IsHeNet (Jon Atack)
819fb5549b logging: asmap logging and #include fixups (Jon Atack)
dcaf543ba0 test: add functional test for an empty, unparsable asmap (Jon Atack)
b8d0412b21 config: separate the asmap finding and parsing checks (Jon Atack)
81c38a2497 config: enable passing -asmap an absolute file path (Jon Atack)
fbe9b024f0 config: use default value in -asmap config (Jon Atack)
08b992675c test: add feature_asmap functional tests (Jon Atack)

Pull request description:

  This PR builds on PR #16702 to add functional tests / sanity checks and user-facing refinements for passing `-asmap` to configure ASN-based IP bucketing in addrman. As per our review discussion in that PR, the idea here is to handle aspects like functional tests and config arg handling that can help the PR be merged while enabling the author to focus on the bucketing itself.

  - [x] add feature functional tests to verify node behaviour and debug log output when launching

    - `bitcoind` with no `-asmap` arg

    - `bitcoind -asmap=RELATIVE_FILENAME` to the unit test data skeleton asmap

    - `bitcoind -asmap` with no filename specified using the default asmap file

    - `bitcoind -asmap` with no filename specified and a missing default asmap file

  - [x] add the ability to pass absolute path filenames to the `-asmap` config arg in addition to datadir-relative path filenames as per https://github.com/bitcoin/bitcoin/pull/16702#discussion_r361300447, and add test coverage

  - [x] separate the asmap file finding and parsing checks, which allows adding tests for the case of a found but unparseable or empty asmap

  - [x] add test for an empty asmap

  - [x] various asmap fixups

  - [x] move the asmap init code earlier in the init process to provide immediate feedback when passing an  `-asmap` config arg. This speeds up the `feature_asmap` functional test from 60 to 5 seconds! Credit to Wladimir J. van der Laan for the suggestion.

ACKs for top commit:
  practicalswift:
    ACK 1ba3e1cc21 -- diff looks correct
  fanquake:
    ACK 1ba3e1cc21

Tree-SHA512: e9094460a597ac5597449acfe631c87b71d3ede6a12c7ae61b26d1161b3eefed8e7e25c4fb0505864cebd89300b7c4cf9378060aa9155441029315df15fa3283
2020-03-05 20:13:33 +08:00
fanquake
cbc32d67dc
Merge #18249: test: Bump timeouts to accomodate really slow disks
fa6df0de53 test: Bump timeouts to accomodate really slow disks (MarcoFalke)

Pull request description:

  Needed these patches locally for some arm machines with slow storage

ACKs for top commit:
  practicalswift:
    ACK fa6df0de53
  fanquake:
    ACK fa6df0de53

Tree-SHA512: 22f2f6f7ed05f26013431126bb179b029dbc931f02d0e58f8970c6d477f43e3106d76c9732942034cb2cfcb827191e338a082f953ccb69531a19ee6dab9a7e1a
2020-03-05 15:06:52 +08:00
Jon Atack
1ba3e1cc21
init: move asmap code earlier in init process
and update feature_asmap.py and test_runner.py

This commit moves the asmap init.cpp code from the end of "Step 12: start node"
to "Step 6: network initialization" to provide feedback on passing an -asmap
config arg much more quickly. This change speeds up the feature_asmap.py
functional test file from 60 to 5 seconds by accelerating the 2 tests that use
`assert_start_raises_init_error`.

Credit to Wladimir J. van der Laan for the suggestion.
2020-03-04 14:54:30 +01:00
Jon Atack
819fb5549b
logging: asmap logging and #include fixups
- move asmap #includes to sorted positions in addrman and init (move-only)

- remove redundant quotes in asmap InitError, update test

- remove full stops from asmap logging to be consistent with debug logging,
  update tests
2020-03-04 14:24:19 +01:00
Jon Atack
dcaf543ba0
test: add functional test for an empty, unparsable asmap
This is now testable after separating the asmap finding and parsing checks in
the previous commit.
2020-03-04 14:24:17 +01:00