0
0
Fork 0
mirror of https://github.com/bitcoin/bitcoin.git synced 2025-02-06 10:18:44 -05:00
bitcoin-bitcoin-core/src/test/fuzz
W. J. van der Laan 07ededa30c
Merge bitcoin/bitcoin#22050: p2p: remove tor v2 support
5d82a57db4 contrib: remove torv2 seed nodes (Jon Atack)
5f7e086dac contrib: update generate-seeds.py to ignore torv2 addresses (Jon Atack)
8be56f0f8e p2p, refactor: extract OnionToString() from CNetAddr::ToStringIp() (Jon Atack)
5f9d3c09b4 p2p: remove torv2 from CNetAddr::ToStringIP() (Jon Atack)
3d39042144 p2p: remove torv2 in SetIP() and ADDR_TORV2_SIZE constant (Jon Atack)
cff5ec477a p2p: remove pre-addrv2 onions from SerializeV1Array() (Jon Atack)
4192a74413 p2p: ignore torv2-in-ipv6 addresses in SetLegacyIPv6() (Jon Atack)
1d631e956f p2p: remove BIP155Network::TORV2 from GetBIP155Network() (Jon Atack)
7d1769bc45 p2p: remove torv2 from SetNetFromBIP155Network() (Jon Atack)
eba9a94b9f fuzz: rename CNetAddr/CService deserialize targets (Jon Atack)
c56a1c9b18 p2p: drop onions from IsAddrV1Compatible(), no longer relay torv2 (Jon Atack)
f8e94002fc p2p: remove torv2/ADDR_TORV2_SIZE from SetTor() (Jon Atack)
0f1c58ae87 test: update feature_proxy to torv3 (Jon Atack)

Pull request description:

  ![image](https://user-images.githubusercontent.com/2415484/120018909-4d425a00-bfd7-11eb-83c9-95a3dac97926.jpeg)

  This patch removes support in Bitcoin Core for Tor v2 onions, which are already removed from the release of Tor 0.4.6.

  - no longer serialize/deserialize and relay Tor v2 addresses
  - ignore incoming Tor v2 addresses
  - remove Tor v2 addresses from the addrman and peers.dat on node launch
  - update generate-seeds.py to ignore Tor v2 addresses
  - remove Tor v2 hard-coded seeds

  Tested with tor-0.4.6.1-alpha (no v2 support) and 0.4.5.7 (v2 support). With the latest Tor (no v2 support), this removes all the warnings like those reported with current master in https://github.com/bitcoin/bitcoin/issues/21351

  ```
  <bitcoind debug log>
  Socks5() connect to […].onion:8333 failed: general failure

  <tor log>
  Invalid hostname [scrubbed]; rejecting
  ```

  and the addrman no longer has Tor v2 addresses on launching bitcoind.
  ```rake
  $ ./src/bitcoin-cli -addrinfo
  {
    "addresses_known": {
      "ipv4": 44483,
      "ipv6": 8467,
      "torv2": 0,
      "torv3": 2296,
      "i2p": 6,
      "total": 55252
    }
  }
  ```
  After recompiling back to current master and restarting with either of the two Tor versions (0.4.5.7 or 0.4.6.1), -addrinfo initially returns 0 Tor v2 addresses and then begins finding them again.

  Ran nodes on this patch over the past week on mainnet/testnet/signet/regtest after building with DEBUG_ADDRMAN.

  Verified that this patch bootstraps an onlynet=onion node from the Tor v3 hardcoded fixed seeds on mainnet and testnet and connects to blocks and v3 onion peers: `rm ~/.bitcoin/testnet3/peers.dat ; ./src/bitcoind -testnet -dnsseed=0 -onlynet=onion`

  ![Screenshot from 2021-05-28 00-26-17](https://user-images.githubusercontent.com/2415484/119905021-ea02ea00-bf3a-11eb-875f-27ef57640c49.png)

  Tested using `addnode`, `getaddednodeinfo`,`addpeeraddress`, `disconnectnode` and `-addrinfo` that a currently valid, connectable Tor v2 peer can no longer be added:

  ![Screenshot from 2021-05-30 11-32-05](https://user-images.githubusercontent.com/2415484/120099282-29435d80-c12a-11eb-81b6-5084244d7d2a.png)

  Thanks to Vasil Dimov, Carl Dong, and Wladimir J. van der Laan for their work on BIP155 and Tor v3 that got us here.

ACKs for top commit:
  laanwj:
    Code review ACK 5d82a57db4

Tree-SHA512: 590ff3d2f6ef682608596facb4b01f44fef69716d2ab3552ae1655aa225f4bf104f9ee08d6769abb9982a8031de93340df553279ce1f5023771f9f2b651178bb
2021-06-03 18:43:55 +02:00
..
addition_overflow.cpp fuzz: Link all targets once 2020-12-10 07:15:42 +01:00
addrdb.cpp fuzz: Link all targets once 2020-12-10 07:15:42 +01:00
addrman.cpp p2p: allow CAddrMan::GetAddr() by network, add doxygen 2021-05-19 13:04:11 +02:00
asmap.cpp fuzz: Link all targets once 2020-12-10 07:15:42 +01:00
asmap_direct.cpp test: add missing netaddress include headers 2021-03-16 19:52:37 +01:00
autofile.cpp scripted-diff: remove Optional & nullopt 2021-03-15 10:41:30 +08:00
banman.cpp Merge bitcoin/bitcoin#22005: fuzz: Speed up banman fuzz target 2021-06-01 11:32:02 +02:00
base_encode_decode.cpp fuzz: Link all targets once 2020-12-10 07:15:42 +01:00
bech32.cpp Implement Bech32m encoding/decoding 2021-03-15 17:26:35 -07:00
block.cpp fuzz: Link all targets once 2020-12-10 07:15:42 +01:00
block_header.cpp fuzz: Link all targets once 2020-12-10 07:15:42 +01:00
blockfilter.cpp fuzz: Link all targets once 2020-12-10 07:15:42 +01:00
bloom_filter.cpp scripted-diff: Rename MakeFuzzingContext to MakeNoLogFileContext 2021-02-22 10:27:22 +01:00
buffered_file.cpp scripted-diff: remove Optional & nullopt 2021-03-15 10:41:30 +08:00
chain.cpp fuzz: Link all targets once 2020-12-10 07:15:42 +01:00
checkqueue.cpp fuzz: Link all targets once 2020-12-10 07:15:42 +01:00
coins_view.cpp Mark CheckTxInputs [[nodiscard]] (out-param txfee only set if call is successful). Avoid UUM in fuzzing harness coins_view. 2021-05-25 21:09:05 +00:00
connman.cpp Merge bitcoin/bitcoin#21186: net/net processing: Move addr data into net_processing 2021-05-24 20:28:31 +08:00
crypto.cpp scripted-diff: Rename MakeFuzzingContext to MakeNoLogFileContext 2021-02-22 10:27:22 +01:00
crypto_aes256.cpp fuzz: Link all targets once 2020-12-10 07:15:42 +01:00
crypto_aes256cbc.cpp fuzz: Link all targets once 2020-12-10 07:15:42 +01:00
crypto_chacha20.cpp scripted-diff: Rename MakeFuzzingContext to MakeNoLogFileContext 2021-02-22 10:27:22 +01:00
crypto_chacha20_poly1305_aead.cpp scripted-diff: Rename MakeFuzzingContext to MakeNoLogFileContext 2021-02-22 10:27:22 +01:00
crypto_common.cpp fuzz: Link all targets once 2020-12-10 07:15:42 +01:00
crypto_hkdf_hmac_sha256_l32.cpp fuzz: Link all targets once 2020-12-10 07:15:42 +01:00
crypto_poly1305.cpp fuzz: Link all targets once 2020-12-10 07:15:42 +01:00
cuckoocache.cpp build: Fix fuzz-cuckoocache cross-compiling for Windows with DEBUG=1 2021-03-03 12:23:41 +02:00
data_stream.cpp Move MakeNoLogFileContext to common libtest_util, and use it in bench 2021-03-03 09:17:37 +01:00
decode_tx.cpp scripted-diff: Bump copyright headers 2020-12-31 09:45:41 +01:00
descriptor_parse.cpp scripted-diff: remove MakeUnique<T>() 2021-03-11 13:45:14 +08:00
deserialize.cpp fuzz: rename CNetAddr/CService deserialize targets 2021-05-28 01:46:18 +02:00
eval_script.cpp scripted-diff: remove MakeUnique<T>() 2021-03-11 13:45:14 +08:00
fee_rate.cpp refactor: Make CFeeRate constructor architecture-independent 2021-05-18 07:13:25 +02:00
fees.cpp fuzz: Link all targets once 2020-12-10 07:15:42 +01:00
flatfile.cpp fuzz: Link all targets once 2020-12-10 07:15:42 +01:00
float.cpp Remove support for double serialization 2021-05-24 16:15:05 -07:00
fuzz.cpp fuzz: Terminate immediately if a fuzzing harness ever tries to create a TCP socket (belt and suspenders) 2021-05-20 19:02:37 +00:00
fuzz.h scripted-diff: Rename MakeFuzzingContext to MakeNoLogFileContext 2021-02-22 10:27:22 +01:00
FuzzedDataProvider.h fuzz: Bump FuzzedDataProvider.h 2021-03-09 12:56:44 +01:00
golomb_rice.cpp fuzz: Link all targets once 2020-12-10 07:15:42 +01:00
hex.cpp fuzz: Link all targets once 2020-12-10 07:15:42 +01:00
http_request.cpp fuzz: Link all targets once 2020-12-10 07:15:42 +01:00
i2p.cpp scripted-diff: Replace GetDataDir() calls with gArgs.GetDataDirNet() calls 2021-05-24 10:29:58 +02:00
integer.cpp fuzz: Remove incorrect float round-trip serialization test 2021-05-12 14:42:41 +02:00
key.cpp scripted-diff: remove MakeUnique<T>() 2021-03-11 13:45:14 +08:00
key_io.cpp fuzz: Link all targets once 2020-12-10 07:15:42 +01:00
kitchen_sink.cpp scripted-diff: Rename MakeFuzzingContext to MakeNoLogFileContext 2021-02-22 10:27:22 +01:00
load_external_block_file.cpp scripted-diff: Rename MakeFuzzingContext to MakeNoLogFileContext 2021-02-22 10:27:22 +01:00
locale.cpp fuzz: Link all targets once 2020-12-10 07:15:42 +01:00
merkleblock.cpp scripted-diff: Rename MakeFuzzingContext to MakeNoLogFileContext 2021-02-22 10:27:22 +01:00
message.cpp fuzz: Link all targets once 2020-12-10 07:15:42 +01:00
muhash.cpp scripted-diff: Rename MakeFuzzingContext to MakeNoLogFileContext 2021-02-22 10:27:22 +01:00
multiplication_overflow.cpp fuzz: Link all targets once 2020-12-10 07:15:42 +01:00
net.cpp [net processing] Move addr relay data and logic into net processing 2021-04-30 11:29:14 +01:00
net_permissions.cpp scripted-diff: rename NetPermissionFlags enumerators 2021-05-12 16:13:30 +02:00
netaddress.cpp scripted-diff: Rename MakeFuzzingContext to MakeNoLogFileContext 2021-02-22 10:27:22 +01:00
netbase_dns_lookup.cpp p2p, refactor: pass and use uint16_t CService::port as uint16_t 2021-03-16 19:52:31 +01:00
node_eviction.cpp Add m_inbound_onion to AttemptToEvictConnection() 2021-03-19 20:11:45 +01:00
p2p_transport_serialization.cpp [fuzz] Occasional valid magic bytes for transport serialization test 2021-05-25 08:20:43 -07:00
parse_hd_keypath.cpp scripted-diff: Bump copyright headers 2020-12-31 09:45:41 +01:00
parse_iso8601.cpp fuzz: Limit ParseISO8601DateTime fuzzing to 32-bit 2021-05-09 10:04:01 +02:00
parse_numbers.cpp test: add ParseUInt16() test coverage 2021-03-19 23:50:36 +01:00
parse_script.cpp scripted-diff: Bump copyright headers 2020-12-31 09:45:41 +01:00
parse_univalue.cpp scripted-diff: remove MakeUnique<T>() 2021-03-11 13:45:14 +08:00
policy_estimator.cpp Move MakeNoLogFileContext to common libtest_util, and use it in bench 2021-03-03 09:17:37 +01:00
policy_estimator_io.cpp Move MakeNoLogFileContext to common libtest_util, and use it in bench 2021-03-03 09:17:37 +01:00
pow.cpp fuzz: [refactor] Use PickValue where possible 2021-03-24 06:57:55 +01:00
prevector.cpp fuzz: Link all targets once 2020-12-10 07:15:42 +01:00
primitives_transaction.cpp fuzz: Link all targets once 2020-12-10 07:15:42 +01:00
process_message.cpp net: Restrict period when cs_vNodes mutex is locked 2021-04-22 17:28:39 +03:00
process_messages.cpp net: Restrict period when cs_vNodes mutex is locked 2021-04-22 17:28:39 +03:00
protocol.cpp fuzz: Link all targets once 2020-12-10 07:15:42 +01:00
psbt.cpp fuzz: Extend psbt fuzz target a bit 2021-04-09 13:17:37 +02:00
random.cpp fuzz: Link all targets once 2020-12-10 07:15:42 +01:00
rbf.cpp Merge #20560: fuzz: Link all targets once 2020-12-15 19:00:36 +01:00
rolling_bloom_filter.cpp scripted-diff: Rename MakeFuzzingContext to MakeNoLogFileContext 2021-02-22 10:27:22 +01:00
rpc.cpp fuzz: Avoid timeout in EncodeBase58 2021-05-11 21:24:49 +02:00
script.cpp Merge bitcoin/bitcoin#18847: compressor: use a prevector in CompressScript serialization [ZAP1] 2021-04-28 21:13:44 +02:00
script_assets_test_minimizer.cpp fuzz: Limit toxic test globals to their respective scope 2021-05-04 09:24:17 +02:00
script_bitcoin_consensus.cpp fuzz: Link all targets once 2020-12-10 07:15:42 +01:00
script_descriptor_cache.cpp refactor: post Optional<> removal cleanups 2021-03-17 14:56:20 +08:00
script_flags.cpp fuzz: Ensure prevout is consensus-valid 2021-04-25 10:36:00 +02:00
script_interpreter.cpp fuzz: Link all targets once 2020-12-10 07:15:42 +01:00
script_ops.cpp fuzz: Run const CScript member functions only once 2021-05-12 10:20:59 +02:00
script_sigcache.cpp Merge #20560: fuzz: Link all targets once 2020-12-15 19:00:36 +01:00
script_sign.cpp fuzz: Link all targets once 2020-12-10 07:15:42 +01:00
scriptnum_ops.cpp scripted-diff: Rename MakeFuzzingContext to MakeNoLogFileContext 2021-02-22 10:27:22 +01:00
secp256k1_ec_seckey_import_export_der.cpp fuzz: Link all targets once 2020-12-10 07:15:42 +01:00
secp256k1_ecdsa_signature_parse_der_lax.cpp fuzz: Link all targets once 2020-12-10 07:15:42 +01:00
signature_checker.cpp fuzz: [refactor] Use IsValidFlagCombination in signature_checker fuzz target 2021-03-30 10:42:45 +02:00
signet.cpp Move MakeNoLogFileContext to common libtest_util, and use it in bench 2021-03-03 09:17:37 +01:00
socks5.cpp test: add missing netaddress include headers 2021-03-16 19:52:37 +01:00
span.cpp fuzz: Link all targets once 2020-12-10 07:15:42 +01:00
spanparsing.cpp scripted-diff: Bump copyright headers 2020-12-31 09:45:41 +01:00
string.cpp test: add missing netaddress include headers 2021-03-16 19:52:37 +01:00
strprintf.cpp fuzz: Remove strprintf test cases that are known to fail 2021-05-09 10:25:21 +02:00
system.cpp scripted-diff: remove Optional & nullopt 2021-03-15 10:41:30 +08:00
timedata.cpp fuzz: Limit max insertions in timedata fuzz test 2021-05-11 08:54:24 +02:00
torcontrol.cpp fuzz: Add missing include (test/util/setup_common.h) 2021-03-04 08:39:27 +01:00
transaction.cpp fuzz: Speed up transaction fuzz target 2021-05-20 17:26:24 +02:00
tx_in.cpp scripted-diff: Bump copyright headers 2020-12-31 09:45:41 +01:00
tx_out.cpp scripted-diff: Bump copyright headers 2020-12-31 09:45:41 +01:00
tx_pool.cpp Merge bitcoin/bitcoin#20833: rpc/validation: enable packages through testmempoolaccept 2021-05-27 22:40:24 +02:00
txrequest.cpp fuzz: Link all targets once 2020-12-10 07:15:42 +01:00
util.cpp fuzz: Avoid excessively large min fee rate in tx_pool 2021-05-09 10:53:24 +02:00
util.h Merge bitcoin/bitcoin#21966: Remove double serialization; use software encoder for fee estimation 2021-05-26 10:16:41 +02:00
utxo_snapshot.cpp scripted-diff: Replace GetDataDir() calls with gArgs.GetDataDirNet() calls 2021-05-24 10:29:58 +02:00
validation_load_mempool.cpp tests: Add fuzzing harness for LoadMempool(...) and DumpMempool(...) 2021-03-15 15:42:15 +00:00
versionbits.cpp versionbits: simplify state transitions 2021-04-12 11:14:49 +10:00