test: Add unit test for OP_NUMEQUALVERIFY #34145

pull billymcbip wants to merge 1 commits into bitcoin:master from billymcbip:num changing 1 files +1 −0
  1. billymcbip commented at 10:47 am on December 24, 2025: contributor

    Add coverage for the error branch of OP_NUMEQUALVERIFY: https://github.com/bitcoin/bitcoin/blob/d861c3820528fad2e17a45549bec70b6ba434dcc/src/script/interpreter.cpp#L997

    Note the code coverage miss: https://maflcko.github.io/b-c-cov/total.coverage/src/script/interpreter.cpp.gcov.html (around line 997)

    I ran: cmake -B build -DENABLE_WALLET=OFF && cmake --build build -j 8 && ctest --test-dir build -j 8

  2. DrahtBot added the label Tests on Dec 24, 2025
  3. DrahtBot commented at 10:48 am on December 24, 2025: contributor

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

    Code Coverage & Benchmarks

    For details see: https://corecheck.dev/bitcoin/bitcoin/pulls/34145.

    Reviews

    See the guideline for information on the review process.

    Type Reviewers
    ACK yashbhutwala, darosior, sedited
    Stale ACK rkrux, bensig

    If your review is incorrectly listed, please copy-paste <!–meta-tag:bot-skip–> into the comment that the bot should ignore.

  4. DrahtBot added the label CI failed on Dec 24, 2025
  5. billymcbip renamed this:
    test: Add unit test for SCRIPT_ERR_NUMEQUALVERIFY
    test: Add unit tests for OP_NUMEQUALVERIFY and OP_CHECKMULTISIG (easy)
    on Dec 24, 2025
  6. test: Add unit test for SCRIPT_ERR_NUMEQUALVERIFY b762538756
  7. billymcbip force-pushed on Dec 24, 2025
  8. rkrux approved
  9. rkrux commented at 9:56 am on December 26, 2025: contributor

    lgtm crACK 8dd3db347fc199cc819cf9729688faaddbfc441f

    Can mention line 1200 in the PR description that didn’t have coverage until this PR instead of adding the other test case that was referred: https://github.com/bitcoin/bitcoin/blob/d861c3820528fad2e17a45549bec70b6ba434dcc/src/script/interpreter.cpp#L1200

  10. DrahtBot removed the label CI failed on Dec 26, 2025
  11. billymcbip commented at 9:58 am on December 27, 2025: contributor
    @rkrux thanks for the ACK, but that line is dead code, see #33977. The OP_CHECKMULTISIG test case does not improve code coverage, but I think a “missing dummy” test case is good to have.
  12. bensig commented at 9:13 pm on December 31, 2025: contributor

    ACK 8dd3db3

    Built and ran script_tests on macOS - all pass. Both test cases work as expected.

  13. billymcbip commented at 7:40 pm on January 2, 2026: contributor
    Side note: I have another PR out for script_tests: #34099. Thought I’d mention it since it’s within the same context (improving interpreter coverage).
  14. fanquake renamed this:
    test: Add unit tests for OP_NUMEQUALVERIFY and OP_CHECKMULTISIG (easy)
    test: Add unit tests for OP_NUMEQUALVERIFY and OP_CHECKMULTISIG
    on Jan 6, 2026
  15. darosior commented at 8:51 pm on January 13, 2026: member
    Concept ACK, ACK b7625387569af059adb359af4cff18dd7850f213. For the second commit, i think it would be nice if you could correct the existing test case that intends to cover this check, or possibly remove it in favour of the one you introduce after understanding why it does not currently cover the intended line: https://github.com/bitcoin/bitcoin/blob/62557c95298d88be8920c1b3b952d07d0aedb1af/src/test/data/tx_invalid.json#L83-L86
  16. billymcbip force-pushed on Jan 14, 2026
  17. billymcbip commented at 1:00 pm on January 14, 2026: contributor

    @darosior thank you, I did not notice that test case in tx_invalid.json. I’ve removed the second commit (https://github.com/bitcoin/bitcoin/commit/8dd3db347fc199cc819cf9729688faaddbfc441f) from this PR.

    To be clear, the test case for OP_CHECKMULTISIG that I wanted to add in https://github.com/bitcoin/bitcoin/commit/8dd3db347fc199cc819cf9729688faaddbfc441f did not improve code coverage.

    cc @glozow

  18. billymcbip renamed this:
    test: Add unit tests for OP_NUMEQUALVERIFY and OP_CHECKMULTISIG
    test: Add unit tests for OP_NUMEQUALVERIFY
    on Jan 14, 2026
  19. billymcbip renamed this:
    test: Add unit tests for OP_NUMEQUALVERIFY
    test: Add unit test for OP_NUMEQUALVERIFY
    on Jan 14, 2026
  20. yashbhutwala commented at 2:54 pm on January 14, 2026: none

    ACK b7625387569af059adb359af4cff18dd7850f213

    Built and tested on macOS (Apple Silicon). Ran the full test suite with:

    0cmake -B build -DENABLE_WALLET=OFF -DENABLE_IPC=OFF
    1cmake --build build -j 8
    2ctest --test-dir build -j 8
    

    All 132 tests pass. Also ran test_bitcoin --run_test=script_tests separately to confirm the new test case exercises the SCRIPT_ERR_NUMEQUALVERIFY error path at src/script/interpreter.cpp:997.

    Nice little coverage improvement - straightforward and correct.

  21. DrahtBot requested review from rkrux on Jan 14, 2026
  22. DrahtBot requested review from darosior on Jan 14, 2026
  23. darosior commented at 3:00 pm on January 14, 2026: member

    To be clear, the test case for OP_CHECKMULTISIG that I wanted to add in 8dd3db3 did not improve code coverage.

    How comes? I think you were correct in OP that the line that check for a missing dummy element is currently not covered.

  24. darosior approved
  25. darosior commented at 3:02 pm on January 14, 2026: member

    ACK b7625387569af059adb359af4cff18dd7850f213

    It’s an improvement so i’m fine if it’s merged but i think the other commit is still worth pursuing as per my comment above.

  26. sedited approved
  27. sedited commented at 3:06 pm on January 14, 2026: contributor
    ACK b7625387569af059adb359af4cff18dd7850f213
  28. fanquake merged this on Jan 14, 2026
  29. fanquake closed this on Jan 14, 2026

  30. billymcbip commented at 5:23 pm on January 14, 2026: contributor

    @darosior:

    How comes? I think you were correct in OP that the line that check for a missing dummy element is currently not covered.

    It’s impossible to cover that line - it’s dead code. Have a look at #33977.

    The test case that I added in 8dd3db3 is just as good as the one you cited in bitcoin/src/test/data/tx_invalid.json. It wouldn’t hurt to merge 8dd3db3, but it wouldn’t improve code coverage.

  31. billymcbip deleted the branch on Jan 14, 2026

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: 2026-02-02 06:13 UTC

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