bitcoin/src/test/fuzz
Antoine Poinsot 17e3547241
qa: add a fuzz target generating random nodes from a binary encoding
This is a "dumb" way of randomly generating a Miniscript node from
fuzzer input. It defines a strict binary encoding and will always generate
a node defined from the encoding without "helping" to create valid nodes.
It will cut through as soon as it encounters an invalid fragment so
hopefully the fuzzer can tend to learn the encoding and generate valid
nodes with a higher probability.

On a valid generated node a number of invariants are checked, especially
around the satisfactions and testing them against the Script
interpreter.

The node generation and testing is modular in order to later introduce
other ways to generate nodes from fuzzer inputs with minimal code.

Co-Authored-By: Pieter Wuille <pieter@wuille.net>
2023-02-11 16:51:17 +01:00
..
util refactor: Move CTxMemPoolEntry class to its own module 2022-11-16 20:16:07 +00:00
addition_overflow.cpp util: Add SaturatingAdd helper 2022-02-21 14:32:53 +01:00
addrman.cpp refactor: Use type-safe std::chrono for addrman time 2022-07-26 11:06:10 +02:00
asmap.cpp [netgroupman] Add GetMappedAS() and GetGroup() 2022-04-20 14:35:52 +01:00
asmap_direct.cpp scripted-diff: Bump copyright headers 2021-12-30 19:36:57 +02:00
autofile.cpp Use AutoFile where possible 2022-06-29 10:33:13 +02:00
banman.cpp scripted-diff: Use clang-tidy syntax for C++ named arguments 2021-11-19 12:41:47 +01:00
base_encode_decode.cpp Use std::string_view throughout util strencodings/string 2022-04-27 14:13:39 +02:00
bech32.cpp scripted-diff: Bump copyright headers 2021-12-30 19:36:57 +02:00
bitdeque.cpp fuzz: Avoid timeout in bitdeque fuzz target 2022-09-05 15:38:33 +02:00
block.cpp scripted-diff: Bump copyright headers 2021-12-30 19:36:57 +02:00
block_header.cpp fuzz: Link all targets once 2020-12-10 07:15:42 +01:00
blockfilter.cpp scripted-diff: Bump copyright headers 2021-12-30 19:36:57 +02:00
bloom_filter.cpp fuzz: replace every fuzzer-controlled loop with a LIMITED_WHILE loop 2021-11-12 19:51:55 +00:00
buffered_file.cpp Use spans of std::byte in serialize 2022-01-02 11:40:31 +01:00
chain.cpp CDiskBlockIndex: rename GetBlockHash() to ConstructBlockHash() 2022-07-22 12:45:07 +02:00
checkqueue.cpp test, bench: make prevector and checkqueue swap member functions noexcept 2022-04-28 20:34:43 +02:00
coins_view.cpp fuzz: Remove useless GetUTXOStats fuzz case 2022-05-20 16:33:24 -04:00
connman.cpp [net] Move asmap into NetGroupManager 2022-04-20 14:29:29 +01:00
crypto.cpp fuzz: Use LIMITED_WHILE instead of limit_max_ops 2021-08-21 19:25:33 +02:00
crypto_aes256.cpp scripted-diff: Bump copyright headers 2021-12-30 19:36:57 +02:00
crypto_aes256cbc.cpp scripted-diff: Bump copyright headers 2021-12-30 19:36:57 +02:00
crypto_chacha20.cpp fuzz: replace every fuzzer-controlled loop with a LIMITED_WHILE loop 2021-11-12 19:51:55 +00:00
crypto_chacha20_poly1305_aead.cpp Move AdditionOverflow to util, Add CheckedAdd with unit tests 2021-12-17 10:46:39 +01:00
crypto_common.cpp fuzz: Link all targets once 2020-12-10 07:15:42 +01:00
crypto_diff_fuzz_chacha20.cpp Don't use zero as null pointer constant (-Wzero-as-null-pointer-constant) 2022-04-26 10:41:45 +01:00
crypto_hkdf_hmac_sha256_l32.cpp scripted-diff: Bump copyright headers 2021-12-30 19:36:57 +02:00
crypto_poly1305.cpp fuzz: Link all targets once 2020-12-10 07:15:42 +01:00
cuckoocache.cpp scripted-diff: Bump copyright headers 2021-12-30 19:36:57 +02:00
decode_tx.cpp scripted-diff: Bump copyright headers 2020-12-31 09:45:41 +01:00
descriptor_parse.cpp scripted-diff: Bump copyright headers 2021-12-30 19:36:57 +02:00
deserialize.cpp [net] Move asmap into NetGroupManager 2022-04-20 14:29:29 +01:00
eval_script.cpp scripted-diff: Bump copyright headers 2021-12-30 19:36:57 +02:00
fee_rate.cpp scripted-diff: Bump copyright headers 2021-12-30 19:36:57 +02:00
fees.cpp scripted-diff: Bump copyright headers 2021-12-30 19:36:57 +02:00
flatfile.cpp fuzz: Link all targets once 2020-12-10 07:15:42 +01:00
float.cpp scripted-diff: Bump copyright headers 2021-12-30 19:36:57 +02:00
fuzz.cpp Remove unused GetTimeSeconds 2022-05-11 16:39:23 +02:00
fuzz.h fuzz: Use LIMITED_WHILE instead of limit_max_ops 2021-08-21 19:25:33 +02:00
FuzzedDataProvider.h fuzz: Bump FuzzedDataProvider.h 2021-03-09 12:56:44 +01:00
golomb_rice.cpp scripted-diff: rename MapIntoRange to FastRange64 2022-01-06 11:29:55 -05:00
hex.cpp util: Add ParseHex<std::byte>() helper 2022-04-27 19:53:17 +02:00
http_request.cpp Use std::string_view throughout util strencodings/string 2022-04-27 14:13:39 +02:00
i2p.cpp scripted-diff: Replace GetDataDir() calls with gArgs.GetDataDirNet() calls 2021-05-24 10:29:58 +02:00
integer.cpp fuzz: add util/mempool/h.cpp 2022-10-04 21:12:50 +01:00
key.cpp script/sign: remove needless IsSolvable() utility 2022-08-11 15:43:40 +02:00
key_io.cpp scripted-diff: Bump copyright headers 2021-12-30 19:36:57 +02:00
kitchen_sink.cpp make ParseOutputType return a std::optional<OutputType> 2021-08-04 19:20:32 +08:00
load_external_block_file.cpp refactor: Make mapBlocksUnknownParent local, and rename it 2022-07-18 12:06:14 -06:00
locale.cpp scripted-diff: Bump copyright headers 2021-12-30 19:36:57 +02:00
merkleblock.cpp fuzz: replace every fuzzer-controlled loop with a LIMITED_WHILE loop 2021-11-12 19:51:55 +00:00
message.cpp fuzz: Link all targets once 2020-12-10 07:15:42 +01:00
miniscript.cpp qa: add a fuzz target generating random nodes from a binary encoding 2023-02-11 16:51:17 +01:00
minisketch.cpp Add src/node/* code to node:: namespace 2022-01-06 22:14:16 -05:00
muhash.cpp fuzz: Cleanup muhash fuzz target 2021-09-22 10:39:08 +02:00
multiplication_overflow.cpp scripted-diff: Bump copyright headers 2021-12-30 19:36:57 +02:00
net.cpp [net processing] Remove CNode::nLocalServices 2022-07-14 15:25:15 +02:00
net_permissions.cpp scripted-diff: Bump copyright headers 2021-12-30 19:36:57 +02:00
netaddress.cpp net: remove unused CNetAddr::GetHash() 2022-02-11 15:21:52 +01:00
netbase_dns_lookup.cpp p2p, refactor: drop unused DNSLookupFn param in LookupSubnet() 2021-12-07 13:13:18 +01:00
node_eviction.cpp [net] Add connection type to NodeEvictionCandidate 2022-07-04 14:58:43 +02:00
p2p_transport_serialization.cpp scripted-diff: Rename CNetMessage::m_command with CNetMessage::m_type 2022-01-15 20:59:19 +02:00
parse_hd_keypath.cpp scripted-diff: Bump copyright headers 2020-12-31 09:45:41 +01:00
parse_numbers.cpp scripted-diff: Bump copyright headers 2021-12-30 19:36:57 +02:00
parse_script.cpp scripted-diff: Bump copyright headers 2020-12-31 09:45:41 +01:00
parse_univalue.cpp fuzz: refactor: Replace NullUniValue with UniValue{} 2022-07-25 17:20:56 +02:00
policy_estimator.cpp refactor: Move CTxMemPoolEntry class to its own module 2022-11-16 20:16:07 +00:00
policy_estimator_io.cpp Use AutoFile where possible 2022-06-29 10:33:13 +02:00
pow.cpp fuzz: Remove no-op call to get() 2022-09-06 14:38:19 +02:00
prevector.cpp test, bench: make prevector and checkqueue swap member functions noexcept 2022-04-28 20:34:43 +02:00
primitives_transaction.cpp fuzz: Link all targets once 2020-12-10 07:15:42 +01:00
process_message.cpp p2p: Announce reconciliation support 2022-10-17 12:35:43 +03:00
process_messages.cpp net: drop cs_sendProcessing 2022-09-15 14:44:42 +10:00
protocol.cpp fuzz: Link all targets once 2020-12-10 07:15:42 +01:00
psbt.cpp Make DecodeBase{32,64} always return vector, not string 2022-04-27 14:12:55 +02:00
random.cpp fuzz: Link all targets once 2020-12-10 07:15:42 +01:00
rbf.cpp test: Remove unused txmempool include from tests 2022-10-18 14:02:09 +02:00
rolling_bloom_filter.cpp scripted-diff: Move bloom to src/common 2021-10-05 11:10:37 +02:00
rpc.cpp fuzz: add scanblocks as safe for fuzzing 2022-10-04 13:51:35 -04:00
script.cpp script/sign: remove needless IsSolvable() utility 2022-08-11 15:43:40 +02:00
script_assets_test_minimizer.cpp scripted-diff: Use getInt<T> over get_int/get_int64 2022-05-18 19:15:03 +02:00
script_bitcoin_consensus.cpp fuzz: Link all targets once 2020-12-10 07:15:42 +01:00
script_descriptor_cache.cpp scripted-diff: Bump copyright headers 2021-12-30 19:36:57 +02:00
script_flags.cpp scripted-diff: Bump copyright headers 2021-12-30 19:36:57 +02:00
script_format.cpp refactor: merge ScriptPubKeyToUniv & ScriptToUniv into one function 2022-03-30 20:00:23 +01:00
script_interpreter.cpp fuzz: Link all targets once 2020-12-10 07:15:42 +01:00
script_ops.cpp fuzz: replace every fuzzer-controlled loop with a LIMITED_WHILE loop 2021-11-12 19:51:55 +00:00
script_sigcache.cpp tests: Reduce calls to InitS*Cache() 2022-08-03 12:02:31 -04:00
script_sign.cpp script/sign: signing support for Miniscripts with hash preimage challenges 2023-02-11 14:12:12 +01:00
scriptnum_ops.cpp fuzz: replace every fuzzer-controlled loop with a LIMITED_WHILE loop 2021-11-12 19:51:55 +00: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 refactor: use C++11 default initializers 2022-05-17 17:18:58 +01: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 refactor: move url.h/cpp from lib util to lib common 2022-10-31 10:17:04 +00:00
strprintf.cpp fuzz: Remove strprintf test cases that are known to fail 2021-05-09 10:25:21 +02:00
system.cpp fuzz: Fix memory leak in system fuzz target 2021-09-29 13:24:14 +02:00
timedata.cpp scripted-diff: Bump copyright headers 2021-12-30 19:36:57 +02:00
torcontrol.cpp fuzz: replace every fuzzer-controlled loop with a LIMITED_WHILE loop 2021-11-12 19:51:55 +00:00
transaction.cpp Remove ::g_max_datacarrier_bytes global 2022-08-02 15:29:16 +02:00
tx_in.cpp scripted-diff: Bump copyright headers 2020-12-31 09:45:41 +01:00
tx_out.cpp Move minRelayTxFee to policy/settings 2022-05-31 15:05:57 +02:00
tx_pool.cpp test: Remove unused txmempool include from tests 2022-10-18 14:02:09 +02:00
txorphan.cpp fuzz: Limit outpoints.size in txorphan target to avoid OOM 2022-09-30 16:52:01 +02:00
txrequest.cpp scripted-diff: Bump copyright headers 2021-12-30 19:36:57 +02:00
util.cpp Merge bitcoin/bitcoin#25421: net: convert standalone IsSelectableSocket() and SetSocketNonBlocking() to Sock methods 2022-10-12 15:49:02 -04:00
util.h Merge bitcoin/bitcoin#25421: net: convert standalone IsSelectableSocket() and SetSocketNonBlocking() to Sock methods 2022-10-12 15:49:02 -04:00
utxo_snapshot.cpp Require callers of AcceptBlockHeader() to perform anti-dos checks 2022-08-29 08:10:35 -04:00
validation_load_mempool.cpp test: Remove unused txmempool include from tests 2022-10-18 14:02:09 +02:00
versionbits.cpp rpc: getdeploymentinfo: include signalling info 2022-01-15 04:37:56 +10:00