test: Improve STRICTENC/DERSIG unit tests #34295

pull billymcbip wants to merge 3 commits into bitcoin:master from billymcbip:der changing 1 files +29 −8
  1. billymcbip commented at 10:46 pm on January 14, 2026: contributor
    1. Remove a comment referencing a file that no longer exists in the codebase: script_invalid.json.

    2. Fix a test that isn’t implemented as intended. The idea is to test execution order by providing a signature that would cause script failure when parsed. An empty signature does not cause script failure in CHECKMULTISIG. Use OP_1 for the second signature instead of OP_0.

    3. Copy existing STRICTENC tests and change the flag to DERSIG. DERSIG is a consensus flag (unlike STRICTENC), so it’d be good to have dedicated test cases.

    script_tests pass on my end.

  2. DrahtBot added the label Tests on Jan 14, 2026
  3. DrahtBot commented at 10:46 pm on January 14, 2026: 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/34295.

    Reviews

    See the guideline for information on the review process.

    Type Reviewers
    ACK darosior

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

    LLM Linter (✨ experimental)

    Possible typos and grammar issues:

    • “to provide a compact way to provide” -> “to provide a compact way to present” [duplicate “provide” makes the phrase ungrammatical/awkward and hinders comprehension]

    2026-01-30 14:34:16

  4. in src/test/data/script_tests.json:703 in 488550a74f outdated
    698     "STRICTENC", "OK",
    699     "2-of-2 CHECKMULTISIG NOT with the second pubkey invalid, and both signatures validly encoded. Valid pubkey fails, and CHECKMULTISIG exits early, prior to evaluation of second invalid pubkey."
    700 ],
    701 [
    702-    "0 0 0x47 0x3044022044dc17b0887c161bb67ba9635bf758735bdde503e4b0a0987f587f14a4e1143d022009a215772d49a85dae40d8ca03955af26ad3978a0ff965faa12915e9586249a501",
    703+    "0 1 0x47 0x3044022044dc17b0887c161bb67ba9635bf758735bdde503e4b0a0987f587f14a4e1143d022009a215772d49a85dae40d8ca03955af26ad3978a0ff965faa12915e9586249a501",
    


    darosior commented at 7:38 pm on January 29, 2026:
    Great catch.

    billymcbip commented at 2:35 pm on January 30, 2026:
    Thanks!
  5. in src/test/data/script_tests.json:694 in 488550a74f outdated
    690@@ -691,15 +691,14 @@
    691 ["to test the exact order in which signatures and pubkeys are evaluated by"],
    692 ["distinguishing CHECKMULTISIG returning false on the stack and the script as a"],
    693 ["whole failing."],
    694-["See also the corresponding inverted versions of these tests in script_invalid.json"],
    


    darosior commented at 7:38 pm on January 29, 2026:
    This could have been its own commit since it’s unrelated to the test fix.

    billymcbip commented at 2:34 pm on January 30, 2026:
    Agree, done.
  6. darosior approved
  7. darosior commented at 7:40 pm on January 29, 2026: member

    ACK 63ff7c4158a46ff5d726a576e3ac1f384e6cc2b7

    Could you add the context given in OP to the commit messages? It’s useful to be able to have the context for a change (especially one that isn’t immediate such as this one) when git blaming or searching through the git history, without having to rely on Github.

  8. test: Remove outdated comment in script_tests
    script_invalid.json no longer exists.
    527e8ca7b5
  9. test: Fix a STRICTENC test in script_tests
    Fix a test that isn't implemented as intended. The idea is to test execution order by providing a signature that would cause script failure when parsed. An empty signature does not cause script failure in CHECKMULTISIG. Use OP_1 for the second signature instead of OP_0.
    884978f389
  10. test: Add DERSIG tests to script_tests
    Copy existing STRICTENC tests and change the flag to DERSIG.
    4dfb6eef70
  11. billymcbip force-pushed on Jan 30, 2026
  12. darosior approved
  13. darosior commented at 2:44 pm on January 30, 2026: member
    reACK 4dfb6eef70d719a79904cabc4519d7a725de130a
  14. fanquake requested review from sipa on Jan 30, 2026


billymcbip DrahtBot darosior


sipa

Labels
Tests


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