bitcoin/src/test/fuzz
fanquake 2a786ea349
Merge bitcoin/bitcoin#27780: fuzz: Avoid timeout in utxo_total_supply
fafb4da121 fuzz: Avoid timeout in utxo_total_supply (MarcoFalke)

Pull request description:

  Looks like for high block counts it may be better to mock the chain, otherwise a high limit will lead to fuzz input bloat and timeouts, see https://github.com/bitcoin/bitcoin/pull/17860#issuecomment-1538252773.

  It can be checked that the fuzz target can still find the CVE, see https://github.com/bitcoin/bitcoin/pull/17860#pullrequestreview-1410594057 with a diff of:

  ```diff
  diff --git a/src/consensus/tx_check.cpp b/src/consensus/tx_check.cpp
  index f949655909..6f4cfb5f51 100644
  --- a/src/consensus/tx_check.cpp
  +++ b/src/consensus/tx_check.cpp
  @@ -39,8 +39,6 @@ bool CheckTransaction(const CTransaction& tx, TxValidationState& state)
       // the underlying coins database.
       std::set<COutPoint> vInOutPoints;
       for (const auto& txin : tx.vin) {
  -        if (!vInOutPoints.insert(txin.prevout).second)
  -            return state.Invalid(TxValidationResult::TX_CONSENSUS, "bad-txns-inputs-duplicate");
       }

       if (tx.IsCoinBase())
  ```

  Also, fix a nit, see https://github.com/bitcoin/bitcoin/pull/17860#discussion_r1186451948

ACKs for top commit:
  dergoegge:
    ACK fafb4da121

Tree-SHA512: a28fe9cd6ebb4c9bed5a5b35be76c1c436a87586c8fc3b3c4c8559a4a77ac08098324370da421d794c99579882c0872b6b29415de47ade6a05a08504a3d494c4
2023-05-31 11:24:57 +01:00
..
util scripted-diff: Bump copyright headers 2022-12-24 23:49:50 +00:00
addition_overflow.cpp scripted-diff: Bump copyright headers 2022-12-24 23:49:50 +00:00
addrman.cpp refactor: Replace string chain name constants with ChainTypes 2023-05-09 15:49:14 +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 scripted-diff: Bump copyright headers 2022-12-24 23:49:50 +00:00
banman.cpp move-only: Extract common/args and common/config.cpp from util/system 2023-04-19 10:48:30 +02:00
base_encode_decode.cpp Merge bitcoin/bitcoin#26691: Update secp256k1 subtree to libsecp256k1 version 0.2.0 2023-01-13 09:40:57 +00: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 refactor: Replace string chain name constants with ChainTypes 2023-05-09 15:49:14 +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 util: improve streams.h:FindByte() performance 2023-05-05 06:03:17 -06:00
chain.cpp scripted-diff: Bump copyright headers 2022-12-24 23:49:50 +00:00
checkqueue.cpp refactor: Use move semantics in CCheckQueue::Loop 2023-03-21 13:04:21 +00:00
coins_view.cpp scripted-diff: Remove unused chainparamsbase includes 2023-05-09 15:49:19 +02:00
coinscache_sim.cpp Exercise non-DIRTY spent coins in caches in fuzz test 2023-02-03 10:33:31 -05:00
connman.cpp scripted-diff: Remove unused chainparamsbase includes 2023-05-09 15:49:19 +02: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 Only support 32-byte keys in ChaCha20{,Aligned} 2023-01-30 18:12:21 -05: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 Inline ChaCha20 32-byte specific constants 2023-01-30 18:12:21 -05: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 refactor: Replace string chain name constants with ChainTypes 2023-05-09 15:49:14 +02:00
deserialize.cpp move-only: Extract common/args and common/config.cpp from util/system 2023-04-19 10:48:30 +02:00
eval_script.cpp Adapt to libsecp256k1 API changes 2022-12-13 15:08:24 -05: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 Refactor: Remove unused FlatFilePos::SetNull 2023-03-21 13:54:11 +01:00
float.cpp scripted-diff: Bump copyright headers 2021-12-30 19:36:57 +02:00
fuzz.cpp fuzz: Print error message when FUZZ is missing 2023-05-22 10:02:29 +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: Bump copyright headers 2022-12-24 23:49:50 +00:00
headerssync.cpp refactor: Replace string chain name constants with ChainTypes 2023-05-09 15:49:14 +02:00
hex.cpp Merge bitcoin/bitcoin#26691: Update secp256k1 subtree to libsecp256k1 version 0.2.0 2023-01-13 09:40:57 +00:00
http_request.cpp Merge bitcoin/bitcoin#25619: net: avoid overriding non-virtual ToString() in CService and use better naming 2023-02-17 13:34:40 -05:00
i2p.cpp move-only: Extract common/args and common/config.cpp from util/system 2023-04-19 10:48:30 +02:00
integer.cpp refactor: Move system from util to common library 2023-05-20 12:08:13 +02:00
key.cpp scripted-diff: Remove unused chainparamsbase includes 2023-05-09 15:49:19 +02:00
key_io.cpp refactor: Replace string chain name constants with ChainTypes 2023-05-09 15:49:14 +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 refactor: Replace string chain name constants with ChainTypes 2023-05-09 15:49:14 +02:00
mini_miner.cpp [fuzz] Add MiniMiner target + diff fuzz against BlockAssembler 2023-04-06 15:15:39 -04:00
miniscript.cpp ci: use clang-16 in tidy task 2023-04-05 11:43:42 +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 scripted-diff: Remove unused chainparamsbase includes 2023-05-09 15:49:19 +02:00
net_permissions.cpp scripted-diff: Bump copyright headers 2022-12-24 23:49:50 +00:00
netaddress.cpp Merge bitcoin/bitcoin#25619: net: avoid overriding non-virtual ToString() in CService and use better naming 2023-02-17 13:34:40 -05:00
netbase_dns_lookup.cpp p2p, refactor: return std::optional<CNetAddr> in LookupHost 2023-05-26 13:41:07 -03:00
node_eviction.cpp scripted-diff: Bump copyright headers 2022-12-24 23:49:50 +00:00
p2p_transport_serialization.cpp refactor: Replace string chain name constants with ChainTypes 2023-05-09 15:49:14 +02:00
parse_hd_keypath.cpp Switch hardened derivation marker to h in descriptors 2023-04-04 18:33:08 +02: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 refactor: Replace string chain name constants with ChainTypes 2023-05-09 15:49:14 +02:00
partially_downloaded_block.cpp [fuzz] Assert that omitting missing transactions always fails block reconstruction 2023-01-23 17:29:41 +01:00
policy_estimator.cpp scripted-diff: Bump copyright headers 2022-12-24 23:49:50 +00:00
policy_estimator_io.cpp scripted-diff: Bump copyright headers 2022-12-24 23:49:50 +00:00
poolresource.cpp Add PoolResource fuzzer 2023-03-23 19:38:38 +01:00
pow.cpp refactor: Replace string chain name constants with ChainTypes 2023-05-09 15:49:14 +02:00
prevector.cpp Use DataStream where possible 2023-01-26 10:44:05 +01:00
primitives_transaction.cpp fuzz: Link all targets once 2020-12-10 07:15:42 +01:00
process_message.cpp fuzz: Change LIMIT_TO_MESSAGE_TYPE from a compile-time to a run-time setting 2023-05-26 17:14:23 +02:00
process_messages.cpp refactor: Replace string chain name constants with ChainTypes 2023-05-09 15:49:14 +02:00
protocol.cpp fuzz: Link all targets once 2020-12-10 07:15:42 +01:00
psbt.cpp Merge bitcoin/bitcoin#26691: Update secp256k1 subtree to libsecp256k1 version 0.2.0 2023-01-13 09:40:57 +00:00
random.cpp fuzz: Link all targets once 2020-12-10 07:15:42 +01:00
rbf.cpp scripted-diff: Bump copyright headers 2022-12-24 23:49:50 +00:00
rolling_bloom_filter.cpp scripted-diff: Move bloom to src/common 2021-10-05 11:10:37 +02:00
rpc.cpp Merge bitcoin/bitcoin#25796: rpc: add descriptorprocesspsbt rpc 2023-05-22 11:28:11 -04:00
script.cpp refactor: Replace string chain name constants with ChainTypes 2023-05-09 15:49:14 +02:00
script_assets_test_minimizer.cpp Merge bitcoin/bitcoin#26691: Update secp256k1 subtree to libsecp256k1 version 0.2.0 2023-01-13 09:40:57 +00: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 Adapt to libsecp256k1 API changes 2022-12-13 15:08:24 -05:00
script_format.cpp refactor: Replace string chain name constants with ChainTypes 2023-05-09 15:49:14 +02: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 scripted-diff: Remove unused chainparamsbase includes 2023-05-09 15:49:19 +02:00
script_sign.cpp scripted-diff: Remove unused chainparamsbase includes 2023-05-09 15:49:19 +02: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 Adapt to libsecp256k1 API changes 2022-12-13 15:08:24 -05:00
signature_checker.cpp Merge bitcoin/bitcoin#26691: Update secp256k1 subtree to libsecp256k1 version 0.2.0 2023-01-13 09:40:57 +00:00
signet.cpp refactor: Replace string chain name constants with ChainTypes 2023-05-09 15:49:14 +02:00
socks5.cpp net: Use steady clock in InterruptibleRecv 2023-04-04 12:33:49 +02: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 system from util to common library 2023-05-20 12:08:13 +02:00
strprintf.cpp fuzz: Remove strprintf test cases that are known to fail 2021-05-09 10:25:21 +02:00
system.cpp refactor: Move system from util to common library 2023-05-20 12:08:13 +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 refactor: Replace string chain name constants with ChainTypes 2023-05-09 15:49:14 +02:00
tx_in.cpp Use DataStream where possible 2023-01-26 10:44:05 +01:00
tx_out.cpp Use DataStream where possible 2023-01-26 10:44:05 +01:00
tx_pool.cpp test: Add util to mine invalid blocks 2023-05-02 17:17:06 +02:00
txorphan.cpp Merge bitcoin/bitcoin#26551: p2p: Track orphans by who provided them 2023-01-26 10:36:18 +00:00
txrequest.cpp scripted-diff: Bump copyright headers 2021-12-30 19:36:57 +02:00
util.cpp scripted-diff: Bump copyright headers 2022-12-24 23:49:50 +00:00
util.h scripted-diff: Remove unused chainparamsbase includes 2023-05-09 15:49:19 +02:00
utxo_snapshot.cpp refactor: Replace string chain name constants with ChainTypes 2023-05-09 15:49:14 +02:00
utxo_total_supply.cpp fuzz: Avoid timeout in utxo_total_supply 2023-05-30 14:17:20 +02:00
validation_load_mempool.cpp scripted-diff: Remove unused chainparamsbase includes 2023-05-09 15:49:19 +02:00
versionbits.cpp refactor: Replace string chain name constants with ChainTypes 2023-05-09 15:49:14 +02:00