tests: Add fuzzing harness for CheckTransaction(…), IsStandardTx(…) and other CTransaction related functions #17076

pull practicalswift wants to merge 2 commits into bitcoin:master from practicalswift:fuzzers-transaction changing 3 files +89 −12
  1. practicalswift commented at 1:28 pm on October 8, 2019: contributor

    Add fuzzing harness for CheckTransaction(...), IsStandardTx(...) and other CTransaction related functions.

    Testing this PR

    Run:

    0$ CC=clang CXX=clang++ ./configure --enable-fuzz --with-sanitizers=address,fuzzer,undefined
    1$ make
    2$ src/test/fuzz/transaction
    3
    4# And to to quickly verify that the relevant code regions are triggered, that the
    5# fuzzing throughput seems reasonable, etc.
    6$ contrib/devtools/test_fuzzing_harnesses.sh '^transaction$'
    

    test_fuzzing_harnesses.sh can be found in PR #17000.

  2. fanquake added the label Tests on Oct 8, 2019
  3. DrahtBot commented at 2:05 pm on October 8, 2019: member

    The following sections might be updated with supplementary metadata relevant to reviewers and maintainers.

    Conflicts

    Reviewers, this pull request conflicts with the following ones:

    • #17093 (tests: Add fuzzing harness for various CTx{In,Out} related functions by practicalswift)
    • #17083 (tests: Add fuzzing harness for various CScript related functions by practicalswift)
    • #17071 (tests: Add fuzzing harness for CheckBlock(…) and other CBlock related functions by practicalswift)
    • #17051 (tests: Add deserialization fuzzing harnesses by practicalswift)
    • #17050 (tests: Add fuzzing harnesses for functions parsing scripts, numbers, JSON and HD keypaths (bip32) by practicalswift)
    • #17018 (tests: Add Parse(…) (descriptor) fuzzing harness by practicalswift)
    • #17009 (tests: Add EvalScript(…) fuzzing harness by practicalswift)

    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.

  4. in src/test/fuzz/transaction.cpp:38 in 72db5d2392 outdated
    31+    }
    32+    const CTransaction tx = [&] {
    33+        try {
    34+            return CTransaction(deserialize, ds);
    35+        } catch (const std::ios_base::failure& e) {
    36+            return CTransaction();
    


    MarcoFalke commented at 6:03 pm on October 8, 2019:

    why not return early here. Seems wasteful to map all deserialization failures to an default constructed tx and then run all the checks with that.

    Also, TRANSACTION_DESERIALIZE can be removed from the existing fuzzer now, as the new fuzz test includes this dumb code path now?


    practicalswift commented at 9:00 pm on October 8, 2019:
    Good points. Feedback addressed. Please re-review :)
  5. practicalswift force-pushed on Oct 8, 2019
  6. in test/fuzz/test_runner.py:17 in fad17fc3a1 outdated
    11@@ -12,6 +12,10 @@
    12 import subprocess
    13 import logging
    14 
    15+# Fuzzers known to lack a seed corpus in https://github.com/bitcoin-core/qa-assets/tree/master/fuzz_seed_corpus
    16+FUZZERS_MISSING_CORPORA = [
    17+    "transaction",
    


    MarcoFalke commented at 9:03 pm on October 8, 2019:
    Can remove all of this?

    practicalswift commented at 1:54 pm on October 9, 2019:
    Fixed!
  7. tests: Add fuzzing harness for CheckTransaction(...), IsStandardTx(...) and other CTransaction related functions 0a573682f2
  8. tests: Remove TRANSACTION_DESERIALIZE (replaced by transaction fuzzer) 5c2987636f
  9. in src/Makefile.test.include:319 in fad17fc3a1 outdated
    314@@ -321,6 +315,12 @@ test_fuzz_blocktransactionsrequest_deserialize_CPPFLAGS = $(AM_CPPFLAGS) $(BITCO
    315 test_fuzz_blocktransactionsrequest_deserialize_CXXFLAGS = $(AM_CXXFLAGS) $(PIE_FLAGS)
    316 test_fuzz_blocktransactionsrequest_deserialize_LDFLAGS = $(RELDFLAGS) $(AM_LDFLAGS) $(LIBTOOL_APP_LDFLAGS)
    317 test_fuzz_blocktransactionsrequest_deserialize_LDADD = $(FUZZ_SUITE_LD_COMMON)
    318+test_fuzz_transaction_SOURCES = $(FUZZ_SUITE) test/fuzz/transaction.cpp
    


    MarcoFalke commented at 1:47 pm on October 9, 2019:
    style-nit: new line?

    practicalswift commented at 1:54 pm on October 9, 2019:
    Fixed!
  10. practicalswift force-pushed on Oct 9, 2019
  11. MarcoFalke commented at 2:11 pm on October 9, 2019: member
    ACK 5c2987636faa5bc175b37b81fd98ab48e576da0b
  12. MarcoFalke referenced this in commit 2352aec9fc on Oct 10, 2019
  13. MarcoFalke merged this on Oct 10, 2019
  14. MarcoFalke closed this on Oct 10, 2019

  15. jasonbcox referenced this in commit 9e0128d086 on Jul 1, 2020
  16. practicalswift deleted the branch on Apr 10, 2021
  17. random-zebra referenced this in commit 44b5327e61 on May 28, 2021
  18. kittywhiskers referenced this in commit 14c9dfae5d on Aug 2, 2021
  19. kittywhiskers referenced this in commit 54c67774ea on Aug 5, 2021
  20. kittywhiskers referenced this in commit 1fc41b57c6 on Aug 5, 2021
  21. kittywhiskers referenced this in commit 00bd32844f on Aug 5, 2021
  22. PastaPastaPasta referenced this in commit 515640b35f on Aug 6, 2021
  23. kittywhiskers referenced this in commit af0ec26170 on Aug 8, 2021
  24. kittywhiskers referenced this in commit 19b94c6dfa on Aug 11, 2021
  25. PastaPastaPasta referenced this in commit 90e7119a8b on Aug 11, 2021
  26. 5tefan referenced this in commit fdb3ad7532 on Aug 12, 2021
  27. gades referenced this in commit de468fed94 on May 6, 2022
  28. DrahtBot locked this on Aug 18, 2022

github-metadata-mirror

This is a metadata mirror of the GitHub repository bitcoin/bitcoin. This site is not affiliated with GitHub. Content is generated from a GitHub metadata backup.
generated: 2024-12-04 06:12 UTC

This site is hosted by @0xB10C
More mirrored repositories can be found on mirror.b10c.me