Add fuzzing harness for DecodeHexTx(…).
To test this PR:
$ make distclean
$ ./autogen.sh
$ CC=clang CXX=clang++ ./configure --enable-fuzz \
--with-sanitizers=address,fuzzer,undefined
$ make
$ src/test/fuzz/decode_tx
…
Add fuzzing harness for DecodeHexTx(…).
To test this PR:
$ make distclean
$ ./autogen.sh
$ CC=clang CXX=clang++ ./configure --enable-fuzz \
--with-sanitizers=address,fuzzer,undefined
$ make
$ src/test/fuzz/decode_tx
…
<!--e57a25ab6845829454e8d69fc972939a-->
The following sections might be updated with supplementary metadata relevant to reviewers and maintainers.
<!--174a7506f384e20aa4161008e828411d-->
Reviewers, this pull request conflicts with the following ones:
If you consider this pull request important, please also help to review the conflicting pull requests. Ideally, start with the one that should be merged first.
241 | 242 | -test_fuzz_block_deserialize_SOURCES = $(FUZZ_SUITE) test/fuzz/deserialize.cpp 243 | -test_fuzz_block_deserialize_CPPFLAGS = $(AM_CPPFLAGS) $(BITCOIN_INCLUDES) -DBLOCK_DESERIALIZE=1 244 | -test_fuzz_block_deserialize_CXXFLAGS = $(AM_CXXFLAGS) $(PIE_FLAGS) 245 | -test_fuzz_block_deserialize_LDFLAGS = $(RELDFLAGS) $(AM_LDFLAGS) $(LIBTOOL_APP_LDFLAGS) 246 | -test_fuzz_block_deserialize_LDADD = $(FUZZ_SUITE_LD_COMMON)
not sure if it makes sense to reorder the whole file to "reduce merge conflicts". This causes a merge conflict ...
That is intentional: it introduces one merge conflict now but avoids more or less all future merge conflicts by making it clear where to add new fuzzing harnesses (and thus minimises the risk of merge conflicts). It makes sense given that clarification?
Commit message:
build: Sort fuzzing harnesses to avoid future merge conflicts
Should sorting these be done in a separate MR to keep this one more focused?
@paymog It is discouraged to submit this kind of change as separate PR. Changes like these should if possible made when touching the files for other purposes like in this case :)
@paymog it's true that the refactor section of CONTRIBUTING.md seems to encourage making separate PRs, but in practice it seems to me that when the change is not really worth making its own PR and is trivial/non-controversial or made/requested by an regular contributor, making the change in a separate commit when touching relevant code can be a good option. That doesn't mean there won't be pushback on it ;)
I guess there's a deeper philosphical question of what makes a change worth a separate PR. When I work professionally I try to keep changes as focused as possible - though of course I'm not perfect.
Regarding non-controversiality, it seems that @MarcoFalke and @promag find this a bit controversial 😉. I don't want to push any ideas here since I'm still new to the community and I'm not sure there's much to gain either way in this instance - this change is pretty small. Making a new PR has overhead but might slightly reduce the review load.
@jonatack I realize that my comment may not come across as I meant it. I didn't think you were trying to bikeshed and I'm not either - like I say I'm still new and learning how this community operates. I appreciate you trying to bring clarity. Hopefully I didn't offend you and if I did, I'm sorry. It wasn't my intention.
No worries, I'm trying to grok things too and I make a lot of mistakes while doing it.
Concept ACK
Is 3f95fb085e73b5537dda6d7258bfdab72d695fa9 really necessary?
@promag I'm scratching my own itch with that commit: the current sort order is a mess which makes it unclear where to add a new fuzzer which in turn leads to unnecessary merge conflicts. 3f95fb0 solves that issue once and for all :)
ACK bcad0144eff3192cb54f65fa7737be53e03f8b0f
bitcoin (pr/17777)$ src/test/fuzz/decode_tx
INFO: Seed: 2616529759
INFO: Loaded 1 modules (17312 inline 8-bit counters): 17312 [0x55dc3e14ce40, 0x55dc3e1511e0),
INFO: Loaded 1 PC tables (17312 PCs): 17312 [0x55dc3e1511e0,0x55dc3e194be0),
INFO: -max_len is not provided; libFuzzer will not generate inputs larger than 4096 bytes
INFO: A corpus is not provided, starting from an empty corpus
[#2](/bitcoin-bitcoin/2/) INITED cov: 536 ft: 537 corp: 1/1b lim: 4 exec/s: 0 rss: 41Mb
[#4](/bitcoin-bitcoin/4/) NEW cov: 542 ft: 714 corp: 2/3b lim: 4 exec/s: 0 rss: 41Mb L: 2/2 MS: 2 ChangeByte-InsertByte-
NEW_FUNC[1/18]: 0x55dc3dfabdc0 in prevector<28u, unsigned char, unsigned int, int>::~prevector() /home/jon/projects/bitcoin/bitcoin/src/./prevector.h:456
I did not review 3f95fb085e73b5537dda6d7258bfdab72d695fa9
These commands can be useful to quickly verify that the commit 3f95fb085e73b5537dda6d7258bfdab72d695fa9 is just sorting lines:
# ignore all added lines which have a matching identical removed line
$ git diff 3f95fb085e73b5537dda6d7258bfdab72d695fa9~1..3f95fb085e73b5537dda6d7258bfdab72d695fa9 \
| grep -E '^[+-][^+-]' | cut -b2- | sort | uniq -c | grep -v '^ *2 '
$
ACK 3f95fb0
No diff is returned by git diff 3f95fb0~1..3f95fb0 | grep -E '^[+-][^+-]' | cut -b2- | sort | uniq -c | grep -v '^ *2' and the change appears to place all the harnesses in alphabetical order.