Commit graph

31654 commits

Author SHA1 Message Date
Dimitris Apostolou
2de1ceb2e9
depends, wallet: fix typos 2021-11-13 20:05:56 +02:00
Hennadii Stepanov
fe0ff569ea
test: Enable SC2046 shellcheck rule 2021-11-13 18:05:26 +02:00
Hennadii Stepanov
9a1ad7bc0d
test: Enable SC2086 shellcheck rule 2021-11-13 16:54:56 +02:00
MarcoFalke
fafa66e424
ci: Replace soon EOL hirsute with jammy 2021-11-13 11:19:36 +01:00
Sebastian Falbesoner
f1ed30451f test: refactor: simplify block_submit in feature_nulldummy.py
The `create_block` helper accepts a list of txs that it includes in the
created block, hence we don't have to do that manually. Also, rehashing
before solving the block is not needed and can be removed.
2021-11-13 00:21:57 +01:00
Sebastian Falbesoner
5ba9f1ff59 test: refactor: rename NULLDUMMY-invalidation helper
The name is changed to match the coding guidelines (snake case) and to
be more descriptive.
2021-11-13 00:21:57 +01:00
Sebastian Falbesoner
e1d4a128e8 test: simplify and document NULLDUMMY-invalidation helper
The function `trueDummy` in feature_nulldummy.py is currently more
complicated than it needs to be. Rather than converting the scriptSig to
a CScript and looping through it to build a new scriptSig with the
modified push, simply directly replace the push of null (OP_0) with a
push of one (OP_TRUE/OP_1).

Note that on master, actually an element with the value of 0x51 is
pushed (0x0151...) -- this was very likely not intended, as 0x51 is the
script op-code for OP_TRUE, and also the function's name suggests that
the "true" value shall be pushed.
2021-11-13 00:21:37 +01:00
fanquake
5cc083cd46
Merge bitcoin/bitcoin#23473: build: boring autotools cleanup
34094aff13 build: consistently quote AC_CHECK_LIB() arguments (fanquake)
efd4fe156a build: consistently quote AC_MSG_* arguments (fanquake)
c39732694d build: consistently quote AC_CHECK_PROG() arguments (fanquake)
80762dfc45 build: consistently quote arguments in AC_ARG_VAR() (fanquake)
e6749a4f99 build: consistently quote arguments in AM_CONDITIONAL() (fanquake)
cdb47e18b7 build: consistently quote AC_DEFINE() arguments (fanquake)
a17a3f9d62 build: consistently quote AC_MSG_CHECKING() arguments (fanquake)
50d99f202d build: consistently quote AC_PATH_TOOL arguments (fanquake)
05923e7c62 build: AC_PATH_PROG(S) consistently quote arguments (fanquake)
407f3a495b build: cleanup AX_CHECK_PREPROC_FLAG() usage (fanquake)
b4dba0c6c7 build: AX_CHECK_PREPROC_FLAG() serial 6 (fanquake)
5ced925283 build: cleanup AX_CHECK_COMPILE_FLAG() usage (fanquake)
b3dd6c1d0f build: AX_CHECK_COMPILE_FLAG() serial 6 (fanquake)
5e6bc437c5 build: cleanup AX_CHECK_LINK_FLAG() usage (fanquake)
a874637bf9 build: AX_CHECK_LINK_FLAG serial 6 (fanquake)

Pull request description:

  This is mostly just being consistent with how we do things, and migrating towards a style (we have already been doing so ad-hoc) that is clearer for anyone who cares to read `.m4`. For example:

  `master`:
  ```m4
    AX_CHECK_COMPILE_FLAG(
      [-g3],
      [[DEBUG_CXXFLAGS="$DEBUG_CXXFLAGS -g3"]],
      [AX_CHECK_COMPILE_FLAG([-g],[[DEBUG_CXXFLAGS="$DEBUG_CXXFLAGS -g"]],,[[$CXXFLAG_WERROR]])],
      [[$CXXFLAG_WERROR]])
  ```

  This PR:
  ```m4
    AX_CHECK_COMPILE_FLAG(
      [-g3],
      [DEBUG_CXXFLAGS="$DEBUG_CXXFLAGS -g3"],
      [AX_CHECK_COMPILE_FLAG([-g], [DEBUG_CXXFLAGS="$DEBUG_CXXFLAGS -g"], [], [$CXXFLAG_WERROR])],
      [$CXXFLAG_WERROR])
  ```

  Drop unneeded double-quoting (which we use inconsistently), use `[]` for empty arguments, space things out.

  There should be no functional change, before & after binaries identical. Very boring.

  Guix build:
  ```bash
  bash-5.1# find guix-build-$(git rev-parse --short=12 HEAD)/output/ -type f -print0 | env LC_ALL=C sort -z | xargs -r0 sha256sum
  22097cd621cd88348f827b916f4b4b120b40c3515a3752595347e36d57dc9158  guix-build-34094aff1348/output/aarch64-linux-gnu/SHA256SUMS.part
  43f10bb857afa7ea52a8ed9beed36ff0e3ee02dba31100fc04c8e0b2443d94eb  guix-build-34094aff1348/output/aarch64-linux-gnu/bitcoin-34094aff1348-aarch64-linux-gnu-debug.tar.gz
  9095a8228376094065103f4adc9cdcb8189111fb9536ad88e4f8cecc3df6fc75  guix-build-34094aff1348/output/aarch64-linux-gnu/bitcoin-34094aff1348-aarch64-linux-gnu.tar.gz
  9c73179059c6fe1f7643445ec5a530003fc41187aa0a94cb1f5c106097161e5b  guix-build-34094aff1348/output/arm-linux-gnueabihf/SHA256SUMS.part
  70ddd4dd0a06c7491937084125f690c1d62fa2647c16048fc1a4a9a09d8b10b4  guix-build-34094aff1348/output/arm-linux-gnueabihf/bitcoin-34094aff1348-arm-linux-gnueabihf-debug.tar.gz
  0a338fdc9788c33a0d519b6c09fdf6271e3bd68846ee61eef0a06a2df6bab419  guix-build-34094aff1348/output/arm-linux-gnueabihf/bitcoin-34094aff1348-arm-linux-gnueabihf.tar.gz
  25eda7fae2984b9dadf47420d1dc09b0224d425144233482602bd9e6d348255c  guix-build-34094aff1348/output/dist-archive/bitcoin-34094aff1348.tar.gz
  d70d84e43ffa2d809063cda868f708539e9114b2d14edb6ddcf05fdf73f3187b  guix-build-34094aff1348/output/powerpc64-linux-gnu/SHA256SUMS.part
  8d1291e576d2b5f8f7120fe6e6ed4b23415249e22a657a350ccce68ff261e088  guix-build-34094aff1348/output/powerpc64-linux-gnu/bitcoin-34094aff1348-powerpc64-linux-gnu-debug.tar.gz
  eab448186aee18ac33c39eed4d24501208d10d257fe6e2739adf589b1d4b693a  guix-build-34094aff1348/output/powerpc64-linux-gnu/bitcoin-34094aff1348-powerpc64-linux-gnu.tar.gz
  4d28617b4d0ddb88c8b20d06ca21314ee40814043f92cabcd9ea3e3d8ee39183  guix-build-34094aff1348/output/powerpc64le-linux-gnu/SHA256SUMS.part
  dea02168e170e92600012f5806ec8b39209282c2270669f2040682f74bc3f320  guix-build-34094aff1348/output/powerpc64le-linux-gnu/bitcoin-34094aff1348-powerpc64le-linux-gnu-debug.tar.gz
  c7122e89d3186a183ac08e7f3020654722c98bf8acc8b790bb292b39f5ba8225  guix-build-34094aff1348/output/powerpc64le-linux-gnu/bitcoin-34094aff1348-powerpc64le-linux-gnu.tar.gz
  0802a52720d2bec1264dc13f6554a9da347baa3d096242b29bb524f4b121eb10  guix-build-34094aff1348/output/riscv64-linux-gnu/SHA256SUMS.part
  4aee9fc41f35d2adb2d0562902dd8584a8413a73c015ddcdcef00586779f63a7  guix-build-34094aff1348/output/riscv64-linux-gnu/bitcoin-34094aff1348-riscv64-linux-gnu-debug.tar.gz
  3f0c4d6096ac7e08389e851c2d252632c044a700ce0174473ac4d7f66290e8cc  guix-build-34094aff1348/output/riscv64-linux-gnu/bitcoin-34094aff1348-riscv64-linux-gnu.tar.gz
  c5149c46b9b7081d5715daf3e22fd30ffca23d333f664da1fabc8143ff8bf76c  guix-build-34094aff1348/output/x86_64-apple-darwin19/SHA256SUMS.part
  81848355751e55a8a60636e3ea2f03ca6abb78736a5431715cd51cebd46bb961  guix-build-34094aff1348/output/x86_64-apple-darwin19/bitcoin-34094aff1348-osx-unsigned.dmg
  d2f6f689cbedddd865f90dba9ddf21479c71c61b0350fda62804b2f233116a43  guix-build-34094aff1348/output/x86_64-apple-darwin19/bitcoin-34094aff1348-osx-unsigned.tar.gz
  99d8fe428fcb67f9975e6b8d9a63d84946215a0a6b8f94967ce96cc3af4b7772  guix-build-34094aff1348/output/x86_64-apple-darwin19/bitcoin-34094aff1348-osx64.tar.gz
  3dac13c7556d9a25ff5513bbb2638fe4fa74d8a88304bbdce52364df7832a3ab  guix-build-34094aff1348/output/x86_64-linux-gnu/SHA256SUMS.part
  e4baa7da80fdabbb50953efaaa7b4867c7e575a7a156b728e8e197142df55697  guix-build-34094aff1348/output/x86_64-linux-gnu/bitcoin-34094aff1348-x86_64-linux-gnu-debug.tar.gz
  f82f5bcc7197c1741b106f62be7b468aadbdf5b3198091582026cd450bf13b3a  guix-build-34094aff1348/output/x86_64-linux-gnu/bitcoin-34094aff1348-x86_64-linux-gnu.tar.gz
  db22b5f48783917f985920ddb26aa170b4d6cc65112406548847a883099505b8  guix-build-34094aff1348/output/x86_64-w64-mingw32/SHA256SUMS.part
  ead0809193ca1d462553a6f3f233cdbff7a3f8419100d825abfc10835508e485  guix-build-34094aff1348/output/x86_64-w64-mingw32/bitcoin-34094aff1348-win-unsigned.tar.gz
  e1006b6c114eaf33274144d8e9a20abc0cee01e26a4594063ee615bf09c1b344  guix-build-34094aff1348/output/x86_64-w64-mingw32/bitcoin-34094aff1348-win64-debug.zip
  2d3fbc593b58d353a6859e02c0dd096d453cf5f1e3150c2a1c234bdfc97b4f24  guix-build-34094aff1348/output/x86_64-w64-mingw32/bitcoin-34094aff1348-win64-setup-unsigned.exe
  25cfa8a3655727572593f100b7a70c1061fa6f3b017014ad7444059611c3ddda  guix-build-34094aff1348/output/x86_64-w64-mingw32/bitcoin-34094aff1348-win64.zip
  ```

ACKs for top commit:
  hebasto:
    re-ACK 34094aff13

Tree-SHA512: 7515e85b4dedddf430ddf0bf31f25fca8f73898cf2ba4b6a66b9f21feeaff4c2600fe24efdd2e81822f059827b5b35341b183ea8342fd689248d8c355bf5cb42
2021-11-13 07:12:30 +08:00
Russell Yanofsky
0e0f4fdd89 multiprocess: Add interfaces::Node::broadCastTransaction method
This fixes a null pointer crash in the bitcoin-gui PSBT dialog. The
bitcoin-gui interfaces::Node object has a null NodeContext pointer, and
can't broadcast transactions directly. It needs to broadcast
transactions through the bitcoin-node process instead.
2021-11-12 15:20:53 -05:00
Andrew Poelstra
214d9055ac fuzz: replace every fuzzer-controlled loop with a LIMITED_WHILE loop
Blindly chose a cap of 10000 iterations for every loop, except for
the two in script_ops.cpp and scriptnum_ops.cpp which appeared to
(sometimes) be deserializing individual bytes; capped those to one
million to ensure that sometimes we try working with massive scripts.

There was also one fuzzer-controlled loop in timedata.cpp which was
already capped, so I left that alone.

git grep 'while (fuzz' should now run clean except for timedata.cpp
2021-11-12 19:51:55 +00:00
Sebastian Falbesoner
a9872e1478 test: remove unnecessary block rehashing prior to solving
Solving a block involves continously rehashing it, i.e. any extra
calls to rehash it before are not necessary and can be dropped.
2021-11-12 18:29:43 +01:00
Pieter Wuille
f1c33ee4ac tests: implement BIP341 test vectors 2021-11-12 12:05:00 -05:00
Pieter Wuille
ac3037df11 tests: BIP341 test vector generation 2021-11-12 12:04:57 -05:00
Pieter Wuille
ca83ffc2ea tests: add deterministic signing mode to ECDSA
This does the following:
* Adds a rfc6979 argument to test_framework/key.py's sign_ecdsa to
  select (deterministic) RFC6979-based nonce generation.
* Add a flag in feature_taproot.py's framework called "deterministic".
* Make the Schnorr signing in feature_taproot.py randomized by default,
  reverting to the old deterministic (aux_rnd=0x0000...00) behavior
  if the deterministic context flag is set.
* Make the ECDSA signing in feature_taproot.py use RFC6979-based nonces
  when the deterministic context flag is set (keeping the old randomized
  behavior otherwise).
2021-11-12 12:04:20 -05:00
Pieter Wuille
c98c53f20c tests: abstract out precomputed BIP341 signature hash elements 2021-11-12 12:04:20 -05:00
Pieter Wuille
a5bde018b4 tests: give feature_taproot access to sighash preimages 2021-11-12 12:04:20 -05:00
Pieter Wuille
5140825096 tests: add more fields to TaprootInfo 2021-11-12 12:04:20 -05:00
Pieter Wuille
2478c6730a Make signing follow BIP340 exactly w.r.t. aux randomness
libsecp256k1's secp256k1_schnorrsig_sign only follows BIP340 exactly
if an aux_rand32 argument is passed. When no randomness is used
(as is the case in the current codebase here), there is no impact
on security between not providing aux_rand32 at all, or providing
an empty one. Yet, for repeatability/testability it is simpler
to always use an all-zero one.
2021-11-12 12:04:20 -05:00
MarcoFalke
c9dd5c8d6e
Merge bitcoin/bitcoin#23492: test: tidy up addrman unit tests
0000edaba3 style: Use 4 spaces for indentation, not 5 (MarcoFalke)
fab9264be5 test: Remove unused CDataStream copy (MarcoFalke)

Pull request description:

  Fix two issues:

  * Remove unneeded code, which makes test harder to read and write
  * Fix wrong indentation, which breaks some editors

ACKs for top commit:
  jnewbery:
    Code review ACK 0000edaba3
  brunoerg:
    cr/tACK 0000edaba3
  shaavan:
    ACK 0000edaba3

Tree-SHA512: babec1dfb840bd11ec89ec3d0e2529f826f5775fc7625e987480fac5251f6a6cdcf9a1051c8364d6ca2f66ce9934dcb8447a8cf7376b3952920faf2afd02be99
2021-11-12 16:06:23 +01:00
fanquake
e734847c1f
build: remove duplicate -fvisibility=hidden from Boost build
Boost already sets this by default.
2021-11-12 19:04:35 +08:00
fanquake
32659e5897
build: don't install Boost cmake config files 2021-11-12 19:04:22 +08:00
MarcoFalke
faeb748f5b
Use c++17 in clang-format 2021-11-12 11:46:34 +01:00
MarcoFalke
0000edaba3
style: Use 4 spaces for indentation, not 5
The wrong indentation breaks editor workflows.

Can be reviewed with --ignore-all-space
2021-11-12 11:41:55 +01:00
MarcoFalke
fab9264be5
test: Remove unused CDataStream copy 2021-11-12 11:40:39 +01:00
MarcoFalke
faba1abe46
Sort file list after rename 2021-11-12 10:56:27 +01:00
MarcoFalke
fa8f60e311
scripted-diff: Move minisketchwrapper to src/node
-BEGIN VERIFY SCRIPT-
 # Move module
 git mv src/minisketchwrapper.cpp src/node/
 git mv src/minisketchwrapper.h   src/node/
 # Replacements
 sed -i 's:minisketchwrapper:node/minisketchwrapper:g'     $(git grep -l minisketchwrapper)
 sed -i 's:MINISKETCHWRAPPER_H:NODE_MINISKETCHWRAPPER_H:g' $(git grep -l MINISKETCHWRAPPER_H)
 sed -i 's:DBWRAPPER_H:NODE_MINISKETCHWRAPPER_H:g'         ./src/node/minisketchwrapper.h
-END VERIFY SCRIPT-
2021-11-12 10:56:08 +01:00
MarcoFalke
1ff265a20c
Merge bitcoin/bitcoin#23477: addrman: tidy up unit tests
36d3510303 [addrman] [tests] Remove AddrManUncorrupted subclass (John Newbery)
dfbd3a6d71 [addrman] [tests] Remove AddrManCorrupted subclass (John Newbery)
d02098d1f0 [addrman] [tests] Tidy up unused arguments in addrman test functions (John Newbery)
7784a9a374 [addrman] [tests] Remove deterministic argument and member from AddrManTest (John Newbery)
a749fa539a [addrman] Remove AddrMan friends (John Newbery)

Pull request description:

  Various tidy-ups to the addrman tests.

ACKs for top commit:
  shaavan:
    crACK 36d3510303
  promag:
    Code review ACK 36d3510303.
  theStack:
    Code-review ACK 36d3510303

Tree-SHA512: bbdb9d70863c15b023714ba3c73e816c635204f949c39678dd932a6e9a2e57b51b5d50332ec6843cf1b98a2fcbbdd5e6779f2e9c7e9cf90f4a6b3b4a7a1abe2f
2021-11-12 09:47:14 +01:00
fanquake
34094aff13
build: consistently quote AC_CHECK_LIB() arguments 2021-11-12 14:32:00 +08:00
fanquake
efd4fe156a
build: consistently quote AC_MSG_* arguments 2021-11-12 14:31:59 +08:00
fanquake
c39732694d
build: consistently quote AC_CHECK_PROG() arguments 2021-11-12 14:31:59 +08:00
fanquake
80762dfc45
build: consistently quote arguments in AC_ARG_VAR() 2021-11-12 14:31:59 +08:00
fanquake
e6749a4f99
build: consistently quote arguments in AM_CONDITIONAL() 2021-11-12 14:31:59 +08:00
fanquake
cdb47e18b7
build: consistently quote AC_DEFINE() arguments 2021-11-12 14:31:55 +08:00
fanquake
a17a3f9d62
build: consistently quote AC_MSG_CHECKING() arguments 2021-11-12 10:05:36 +08:00
fanquake
50d99f202d
build: consistently quote AC_PATH_TOOL arguments 2021-11-12 10:02:00 +08:00
fanquake
05923e7c62
build: AC_PATH_PROG(S) consistently quote arguments 2021-11-12 10:02:00 +08:00
fanquake
407f3a495b
build: cleanup AX_CHECK_PREPROC_FLAG() usage
There should be no functional change.
2021-11-12 10:02:00 +08:00
fanquake
b4dba0c6c7
build: AX_CHECK_PREPROC_FLAG() serial 6 2021-11-12 10:01:59 +08:00
fanquake
5ced925283
build: cleanup AX_CHECK_COMPILE_FLAG() usage
There should be no functional change.
2021-11-12 10:01:59 +08:00
fanquake
b3dd6c1d0f
build: AX_CHECK_COMPILE_FLAG() serial 6 2021-11-12 10:01:59 +08:00
fanquake
5e6bc437c5
build: cleanup AX_CHECK_LINK_FLAG() usage
There should be no functional change.
2021-11-12 10:01:59 +08:00
fanquake
a874637bf9
build: AX_CHECK_LINK_FLAG serial 6 2021-11-12 10:01:59 +08:00
fanquake
c1fb30633b
Merge bitcoin/bitcoin#23114: Add minisketch subtree and integrate into build/test
29173d6c6c ubsan: add minisketch exceptions (Cory Fields)
54b5e1aeab Add thin Minisketch wrapper to pick best implementation (Pieter Wuille)
ee9dc71c1b Add basic minisketch tests (Pieter Wuille)
0659f12b13 Add minisketch dependency (Gleb Naumenko)
0eb7928ab8 Add MSVC build configuration for libminisketch (Pieter Wuille)
8bc166d5b1 build: add minisketch build file and include it (Cory Fields)
b2904ceb85 build: add configure checks for minisketch (Cory Fields)
b6487dc4ef Squashed 'src/minisketch/' content from commit 89629eb2c7 (fanquake)

Pull request description:

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

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

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

ACKs for top commit:
  naumenkogs:
    ACK 29173d6c6c

Tree-SHA512: 1217d3228db1dd0de12c2919314e1c3626c18a416cf6291fec99d37e34fb6eec8e28d9e9fb935f8590273b8836cbadac313a15f05b4fd9f9d3024c8ce2c80d02
2021-11-12 10:00:49 +08:00
MarcoFalke
bc03823e26
Merge bitcoin/bitcoin#23482: doc: Add a brief overview of fuzzing/Bitcoin Core fuzzing
6cac99ac07 Add a brief overview of fuzzing/Bitcoin Core fuzzing (Alex Groce)

Pull request description:

  - Google's repo
  - Our report
  - John's advice on fuzz-friendly development

ACKs for top commit:
  MarcoFalke:
    ACK 6cac99ac07
  shaavan:
    ACK 6cac99ac07

Tree-SHA512: 45d1f2f49d068ddd40c3e60cb4a3ede079276e0e09328eec04e391637e9225e195dd7ee1573aa962a2cae93a7e432f9e1d5d0b97660b879ab37ce453cc43c275
2021-11-11 14:26:46 +01:00
fanquake
d217ee25a3
Merge bitcoin/bitcoin#23420: test: Correct MyPy typing for subtest decorator
467fe5779c test: Correct MyPy typing for subtest decorator (Pavel Safronov)

Pull request description:

  This is the part of the effort to make python typing correct https://github.com/bitcoin/bitcoin/issues/19389

  The typing of the `subtest` decorator within `p2p_segwit.py` test file was incorrect.

  Since `subtest` function is defined as a member of the class, it expects `self` as a first argument, and it is not provided. Hence the typing errors (that are currently suppressed by `type: ignore`).

  ```
  (venv) vagrant@ubuntu-focal:/vagrant/test/functional$ mypy p2p_segwit.py
  p2p_segwit.py:298: error: Argument 1 to "subtest" has incompatible type "Callable[[SegWitTest], Any]"; expected "SegWitTest"
  p2p_segwit.py:327: error: Argument 1 to "subtest" has incompatible type "Callable[[SegWitTest], Any]"; expected "SegWitTest"
  p2p_segwit.py:358: error: Argument 1 to "subtest" has incompatible type "Callable[[SegWitTest], Any]"; expected "SegWitTest"
  p2p_segwit.py:447: error: Argument 1 to "subtest" has incompatible type "Callable[[SegWitTest], Any]"; expected "SegWitTest"
  p2p_segwit.py:519: error: Argument 1 to "subtest" has incompatible type "Callable[[SegWitTest], Any]"; expected "SegWitTest"
  p2p_segwit.py:561: error: Argument 1 to "subtest" has incompatible type "Callable[[SegWitTest], Any]"; expected "SegWitTest"
  p2p_segwit.py:659: error: Argument 1 to "subtest" has incompatible type "Callable[[SegWitTest], Any]"; expected "SegWitTest"
  p2p_segwit.py:670: error: Argument 1 to "subtest" has incompatible type "Callable[[SegWitTest], Any]"; expected "SegWitTest"
  p2p_segwit.py:737: error: Argument 1 to "subtest" has incompatible type "Callable[[SegWitTest], Any]"; expected "SegWitTest"
  p2p_segwit.py:826: error: Argument 1 to "subtest" has incompatible type "Callable[[SegWitTest], Any]"; expected "SegWitTest"
  p2p_segwit.py:866: error: Argument 1 to "subtest" has incompatible type "Callable[[SegWitTest], Any]"; expected "SegWitTest"
  p2p_segwit.py:941: error: Argument 1 to "subtest" has incompatible type "Callable[[SegWitTest], Any]"; expected "SegWitTest"
  p2p_segwit.py:977: error: Argument 1 to "subtest" has incompatible type "Callable[[SegWitTest], Any]"; expected "SegWitTest"
  p2p_segwit.py:1052: error: Argument 1 to "subtest" has incompatible type "Callable[[SegWitTest], Any]"; expected "SegWitTest"
  p2p_segwit.py:1089: error: Argument 1 to "subtest" has incompatible type "Callable[[SegWitTest], Any]"; expected "SegWitTest"
  p2p_segwit.py:1136: error: Argument 1 to "subtest" has incompatible type "Callable[[SegWitTest], Any]"; expected "SegWitTest"
  p2p_segwit.py:1220: error: Argument 1 to "subtest" has incompatible type "Callable[[SegWitTest], Any]"; expected "SegWitTest"
  p2p_segwit.py:1312: error: Argument 1 to "subtest" has incompatible type "Callable[[SegWitTest], Any]"; expected "SegWitTest"
  p2p_segwit.py:1406: error: Argument 1 to "subtest" has incompatible type "Callable[[SegWitTest], Any]"; expected "SegWitTest"
  p2p_segwit.py:1440: error: Argument 1 to "subtest" has incompatible type "Callable[[SegWitTest], Any]"; expected "SegWitTest"
  p2p_segwit.py:1543: error: Argument 1 to "subtest" has incompatible type "Callable[[SegWitTest], Any]"; expected "SegWitTest"
  p2p_segwit.py:1729: error: Argument 1 to "subtest" has incompatible type "Callable[[SegWitTest], Any]"; expected "SegWitTest"
  p2p_segwit.py:1782: error: Argument 1 to "subtest" has incompatible type "Callable[[SegWitTest], Any]"; expected "SegWitTest"
  p2p_segwit.py:1881: error: Argument 1 to "subtest" has incompatible type "Callable[[SegWitTest], Any]"; expected "SegWitTest"
  p2p_segwit.py:1983: error: Argument 1 to "subtest" has incompatible type "Callable[[SegWitTest], Any]"; expected "SegWitTest"
  p2p_segwit.py:2027: error: Argument 1 to "subtest" has incompatible type "Callable[[SegWitTest], Any]"; expected "SegWitTest"
  Found 26 errors in 1 file (checked 1 source file)
  ```

  However, the tests are passing, because there is no `self` argument passed when it is called as a decorator.

  There is also suppressed pylint error `# noqa: N805` pointing to the same issue.
  ```
  N805 first argument of a method should be named 'self'
  ```

  So the solution is to move the `subtest` definition outside the class, so the `self` argument is no longer required.

  After doing so, both mypy and unittests are successfully passing:

  ```
  (venv) vagrant@ubuntu-focal:/vagrant/test/functional$ mypy p2p_segwit.py
  Success: no issues found in 1 source file
  ```

  ```
  (venv) vagrant@ubuntu-focal:/vagrant/test/functional$ ./test_runner.py p2p_segwit
  Temporary test directory at /tmp/test_runner__🏃_20211103_011449
  Running Unit Tests for Test Framework Modules
  ..........
  ----------------------------------------------------------------------
  Ran 10 tests in 0.546s

  OK
  Remaining jobs: [p2p_segwit.py]
  1/1 - p2p_segwit.py passed, Duration: 81 s

  TEST          | STATUS    | DURATION

  p2p_segwit.py | ✓ Passed  | 81 s

  ALL           | ✓ Passed  | 81 s (accumulated)
  Runtime: 81 s
  ```
  ```

ACKs for top commit:
  fanquake:
    ACK 467fe5779c

Tree-SHA512: e4c3e2d284f47a6bfbf4af22d4021123cdd9c2ea16ec90a91b466ad1a5af615bb4e15959e6cf56c788701d7e7cbda91a8ffc4347965095c3384eae3d28f261af
2021-11-11 20:33:02 +08:00
Jon Atack
7b6528746a
cli: hoist networks class data members to a constant 2021-11-11 13:14:01 +01:00
Jon Atack
5bd40a3e84
cli: add cjdns network to -addrinfo and -netinfo 2021-11-11 13:13:59 +01:00
Pavel Safronov
467fe5779c test: Correct MyPy typing for subtest decorator 2021-11-11 08:06:38 +00:00
MarcoFalke
f63bf05e73
Merge bitcoin/bitcoin#22928: refactor: Remove gArgs from wallet.h and wallet.cpp (2)
2ec38bdebb Remove `gArgs` from `wallet.h` and `wallet.cpp` (Kiminuo)

Pull request description:

  This is a follow-up PR to #22183 and is related to #21005 issue.

ACKs for top commit:
  ryanofsky:
    Code review ACK 2ec38bdebb. No changes since last review, just rebase

Tree-SHA512: ae7fa1927b0a268f25697928ccaf1b3cf10ee1ccef3f9d2344001fbd7e11fe8ce768745c65e76bd7d1632c6c7650612b5b54eaf2be61093854f75a4c4dcb1784
2021-11-10 19:42:35 +01:00
Alex Groce
6cac99ac07
Add a brief overview of fuzzing/Bitcoin Core fuzzing
- Google's repo
- Our report
- John's advice on fuzz-friendly development
2021-11-10 11:10:04 -07:00