fuzz: Minor improvements to tx_package_eval target #28825

pull instagibbs wants to merge 2 commits into bitcoin:master from instagibbs:2023-11-package_fuzz_impr changing 2 files +30 −4
  1. instagibbs commented at 5:11 pm on November 8, 2023: member
    Exercises DIFFERENT_WITNESS by using “blank” WSH() and allowing witness to determine wtxid, and attempts to make invalid/duplicate inputs.
  2. DrahtBot commented at 5:11 pm on November 8, 2023: contributor

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

    Code Coverage

    For detailed information about the code coverage, see the test coverage report.

    Reviews

    See the guideline for information on the review process.

    Type Reviewers
    ACK dergoegge

    If your review is incorrectly listed, please react with 👎 to this comment and the bot will ignore it on the next update.

  3. DrahtBot added the label Tests on Nov 8, 2023
  4. fanquake requested review from dergoegge on Nov 8, 2023
  5. fanquake requested review from glozow on Nov 8, 2023
  6. in src/test/fuzz/package_eval.cpp:48 in de541ea2f7 outdated
    43+           uint256 hash;
    44+           CSHA256().Write(EMPTY.data(), EMPTY.size()).Finalize(hash.begin());
    45+           return hash;
    46+       }())};
    47+static const std::vector<std::vector<uint8_t>> P2WSH_EMPTY_TRUE_STACK{{static_cast<uint8_t>(OP_TRUE)}, {}};
    48+static const std::vector<std::vector<uint8_t>> P2WSH_EMPTY_TWO_STACK{{static_cast<uint8_t>(OP_2)}, {}};
    


    dergoegge commented at 9:20 am on November 9, 2023:
    Maybe put this in test/util/script.h?

    instagibbs commented at 2:07 pm on November 9, 2023:
    done
  7. fuzz: allow reaching MempoolAcceptResult::ResultType::DIFFERENT_WITNESS in tx_package_eval target a0626ccdad
  8. fuzz: allow fake and duplicate inputs in tx_package_eval target 6a917918b7
  9. instagibbs force-pushed on Nov 9, 2023
  10. in src/test/fuzz/package_eval.cpp:217 in 6a917918b7
    212+                    tx_mut.vin.push_back(tx_mut.vin.back());
    213+                }
    214+
    215+                // Refer to a non-existant input
    216+                if (fuzzed_data_provider.ConsumeBool()) {
    217+                    tx_mut.vin.emplace_back();
    


    glozow commented at 2:08 pm on November 10, 2023:
    is this supposed to be empty?

    instagibbs commented at 6:36 pm on November 10, 2023:
    yes, with the idea that the fuzzer won’t be able to generate the preimage to all genuinely create null uint256/prevout
  11. dergoegge approved
  12. dergoegge commented at 10:16 am on November 13, 2023: member

    https://dergoegge.github.io/bitcoin-coverage/pr28825/fuzz.coverage/src/validation.cpp.gcov.html

    Coverage looks good to me ACK 6a917918b76eef154c6757fe9ecf7713d526c3dd

  13. fanquake requested review from maflcko on Nov 13, 2023
  14. in src/test/util/script.h:31 in 6a917918b7
    26+           uint256 hash;
    27+           CSHA256().Write(EMPTY.data(), EMPTY.size()).Finalize(hash.begin());
    28+           return hash;
    29+       }())};
    30+static const std::vector<std::vector<uint8_t>> P2WSH_EMPTY_TRUE_STACK{{static_cast<uint8_t>(OP_TRUE)}, {}};
    31+static const std::vector<std::vector<uint8_t>> P2WSH_EMPTY_TWO_STACK{{static_cast<uint8_t>(OP_2)}, {}};
    


    maflcko commented at 10:34 am on November 13, 2023:
    0static const std::vector<std::vector<uint8_t>> P2WSH_EMPTY_TRUE_STACK{{uint8_t{OP_TRUE}}, {}};
    1static const std::vector<std::vector<uint8_t>> P2WSH_EMPTY_TWO_STACK{{uint8_t{OP_2}}, {}};
    

    nit: Use the safe cast for new code, where possible, over the narrowing one.

    Also, could use EMPTY instead of {}. But anything is fine here.


    instagibbs commented at 2:29 pm on November 13, 2023:
    will do if I touch again
  15. maflcko approved
  16. maflcko commented at 10:35 am on November 13, 2023: member
    Nice
  17. fanquake assigned glozow on Nov 13, 2023
  18. fanquake merged this on Nov 16, 2023
  19. fanquake closed this on Nov 16, 2023


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-07-01 10:13 UTC

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