0
0
Fork 0
mirror of https://github.com/bitcoin/bitcoin.git synced 2025-02-10 10:52:31 -05:00
bitcoin-bitcoin-core/src/test/fuzz
fanquake f436bfd126
Merge bitcoin/bitcoin#22953: refactor: introduce single-separator split helper (boost::split replacement)
a62e84438d fuzz: add `SplitString` fuzz target (MarcoFalke)
4fad7e46d9 test: add unit tests for `SplitString` helper (Kiminuo)
9cc8e876e4 refactor: introduce single-separator split helper `SplitString` (Sebastian Falbesoner)

Pull request description:

  This PR adds a simple string split helper `SplitString` that takes use of the spanparsing `Split` function that was first introduced in #13697 (commit fe8a7dcd78). This enables to replace most calls to `boost::split`, in the cases where only a single separator character is used. Note that while previous attempts to replace `boost::split` were controversial (e.g. #13751), this one has a trivial implementation: it merely uses an internal helper (that is unit tested and in regular use with output descriptiors) and converts its result from spans to strings. As a drawback though, not all `boost::split` instances can be tackled.

  As a possible optimization, one could return a vector of `std::string_view`s (available since C++17) instead of strings, to avoid copies. This would need more carefulness on the caller sites though, to avoid potential lifetime issues, and it's probably not worth it, considering that none of the places where strings are split are really performance-critical.

ACKs for top commit:
  martinus:
    Code review ACK a62e84438d. Ran all tests. I also like that with `boost::split` it was not obvious that the resulting container was cleared, and with `SplitString` API that's obvious.

Tree-SHA512: 10cb22619ebe46831b1f8e83584a89381a036b54c88701484ac00743e2a62cfe52c9f3ecdbb2d0815e536c99034558277cc263600ec3f3588b291c07eef8ed24
2022-04-26 09:54:49 +01:00
..
addition_overflow.cpp util: Add SaturatingAdd helper 2022-02-21 14:32:53 +01:00
addrman.cpp [net] Move asmap into NetGroupManager 2022-04-20 14:29:29 +01: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 spans of std::byte in serialize 2022-01-02 11:40:31 +01: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 scripted-diff: Bump copyright headers 2021-12-30 19:36:57 +02:00
bech32.cpp scripted-diff: Bump copyright headers 2021-12-30 19:36:57 +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 Require CBlockIndex::RaiseValidity() to hold cs_main 2022-01-25 20:43:28 +01:00
checkqueue.cpp fuzz: Link all targets once 2020-12-10 07:15:42 +01:00
coins_view.cpp test: Avoid testing negative block heights 2022-02-02 15:32:06 +01: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 Refactor the chacha20 differential fuzz test 2021-12-17 23:04:04 +05:30
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 fuzz: execute each file in dir without fuzz engine 2022-03-17 07:27:00 +10: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 fuzz: Link all targets once 2020-12-10 07:15:42 +01:00
http_request.cpp refactor: account for requiring libevent 2.1.8+ 2022-03-30 14:00:12 +02:00
i2p.cpp scripted-diff: Replace GetDataDir() calls with gArgs.GetDataDirNet() calls 2021-05-24 10:29:58 +02:00
integer.cpp Merge bitcoin/bitcoin#23438: refactor: Use spans of std::byte in serialize 2022-01-27 19:19:12 +01:00
key.cpp scripted-diff: Bump copyright headers 2021-12-30 19:36:57 +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: Remove chainparams arg from CChainState member functions 2021-06-13 09:43:54 +02: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_decode.cpp fuzz: add a fuzz target for Miniscript decoding from Script 2022-03-17 14:09:09 +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] Move tx relay data to Peer 2022-03-18 11:35:56 +00: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 scripted-diff: rename TxRelay members 2022-03-18 11:35:58 +00: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_iso8601.cpp scripted-diff: Bump copyright headers 2021-12-30 19:36:57 +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 scripted-diff: Bump copyright headers 2021-12-30 19:36:57 +02:00
policy_estimator.cpp scripted-diff: Use clang-tidy syntax for C++ named arguments 2021-11-19 12:41:47 +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 Move AdditionOverflow to util, Add CheckedAdd with unit tests 2021-12-17 10:46:39 +01:00
prevector.cpp scripted-diff: Bump copyright headers 2021-12-30 19:36:57 +02:00
primitives_transaction.cpp fuzz: Link all targets once 2020-12-10 07:15:42 +01:00
process_message.cpp refactor: Set fSuccessfullyConnected in FillNode 2021-12-01 12:15:01 +01:00
process_messages.cpp refactor: Set fSuccessfullyConnected in FillNode 2021-12-01 12:15:01 +01:00
protocol.cpp fuzz: Link all targets once 2020-12-10 07:15:42 +01:00
psbt.cpp Add src/node/* code to node:: namespace 2022-01-06 22:14:16 -05:00
random.cpp fuzz: Link all targets once 2020-12-10 07:15:42 +01:00
rbf.cpp scripted-diff: Bump copyright headers 2021-12-30 19:36:57 +02: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#23508: Add getdeploymentinfo RPC 2022-01-28 08:46:03 +01:00
script.cpp fuzz: Split script formatting from script fuzz target 2022-02-15 12:19:34 +01:00
script_assets_test_minimizer.cpp refactor: introduce single-separator split helper SplitString 2022-04-11 22:19:46 +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 Merge #20560: fuzz: Link all targets once 2020-12-15 19:00:36 +01:00
script_sign.cpp scripted-diff: Bump copyright headers 2021-12-30 19:36:57 +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 fuzz: Link all targets once 2020-12-10 07:15:42 +01:00
signature_checker.cpp Optimize CHECKSIGADD Script Validation 2022-01-19 15:21:52 -08: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 fuzz: add SplitString fuzz target 2022-04-11 22:19:50 +02: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 refactor: use named args when ScriptToUniv or TxToUniv are invoked 2022-03-30 20:00:27 +01: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 [packages/policy] use package feerate in package validation 2022-04-05 18:51:37 -04:00
txrequest.cpp scripted-diff: Bump copyright headers 2021-12-30 19:36:57 +02:00
util.cpp net: add new method Sock::SetSockOpt() that wraps setsockopt() 2022-04-15 09:14:49 +02:00
util.h net: add new method Sock::SetSockOpt() that wraps setsockopt() 2022-04-15 09:14:49 +02:00
utxo_snapshot.cpp refactor: replace boost::filesystem with std::filesystem 2022-02-03 18:35:52 +08:00
validation_load_mempool.cpp fuzz: Initialize a TestingSetup for test_one_input 2021-06-10 15:04:39 -04:00
versionbits.cpp rpc: getdeploymentinfo: include signalling info 2022-01-15 04:37:56 +10:00