test: Improve STRICTENC/DERSIG unit tests in script_tests.json #33973

pull billymcbip wants to merge 1 commits into bitcoin:master from billymcbip:script-tests changing 1 files +23 −12
  1. billymcbip commented at 2:51 pm on November 30, 2025: none

    I’d like to add a few DERSIG variants of existing STRICTENC tests, since DERSIG is a consensus flag.

    I ran:

    0cmake -B build -DENABLE_WALLET=OFF
    1cmake --build build --parallel 8
    2ctest --test-dir build --parallel 8
    
    0  6/133 Test  [#93](/bitcoin-bitcoin/93/): script_tests .........................   Passed    1.57 sec
    
  2. DrahtBot added the label Tests on Nov 30, 2025
  3. DrahtBot commented at 2:51 pm on November 30, 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/33973.

    Reviews

    See the guideline for information on the review process.

    Type Reviewers
    Approach 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:

    • “DERSIG to provide a compact way to provide a deliberately invalid signature.” -> “DERSIG to provide a compact way to supply a deliberately invalid signature.” [duplicate “provide” makes the phrase awkward; replacement removes redundancy while preserving meaning]

    No other typos were found.

    2025-12-05

  4. darosior commented at 8:08 pm on December 4, 2025: member

    Makes sense to test DERSIG separately from STRICTENC since it’s the only one enabled by consensus. Concept/Approach ACK.

    Maintainers could we get the CI ran here?

  5. DrahtBot added the label CI failed on Dec 4, 2025
  6. fanquake commented at 10:00 am on December 5, 2025: member
    Windows failure is unrelated: #34012.
  7. maflcko closed this on Dec 5, 2025

  8. maflcko reopened this on Dec 5, 2025

  9. DrahtBot removed the label CI failed on Dec 5, 2025
  10. darosior commented at 2:26 pm on December 5, 2025: member
    Thanks!
  11. in src/test/data/script_tests.json:712 in a7e91d8e58
    708+],
    709+[
    710+    "0 0 0x47 0x3044022044dc17b0887c161bb67ba9635bf758735bdde503e4b0a0987f587f14a4e1143d022009a215772d49a85dae40d8ca03955af26ad3978a0ff965faa12915e9586249a501",
    711+    "2 0x21 0x02865c40293a680cb9c020e7b1e106d8c1916d3cef99aa431a56d253e69256dac0 0x21 0x02865c40293a680cb9c020e7b1e106d8c1916d3cef99aa431a56d253e69256dac0 2 CHECKMULTISIG NOT",
    712+    "DERSIG", "OK",
    713+    "2-of-2 CHECKMULTISIG NOT with both pubkeys valid, but second signature invalid. Valid pubkey fails, and CHECKMULTISIG exits early, prior to evaluation of second invalid signature (DERSIG enabled)."
    


    darosior commented at 2:43 pm on December 5, 2025:
    So here the correctly-DER-encoded signature is not a valid signature for the correctly-encoded public key, is that right?

    billymcbip commented at 10:47 pm on December 5, 2025:
    That’s exactly right, but I think there was a mistake in the test. It should use OP_1 for the second signature instead of OP_0, because IsValidSignatureEncoding is not run for empty signatures.
  12. darosior commented at 2:45 pm on December 5, 2025: member
    Looks good to me, just want to confirm my understanding of one of the test cases.
  13. billymcbip force-pushed on Dec 5, 2025
  14. billymcbip commented at 10:55 pm on December 5, 2025: none

    Updated CHECKMULTISIG NOT tests:

    • Removed a comment referencing a test file that no longer exists.
    • Improved test descriptions.
    • Added negative cases to make the tests easier to understand.
    • Changed invalid signature push from OP_0 to OP_1 because IsValidSignatureEncoding isn’t called for empty sigs.
  15. test: Improve STRICTENC/DERSIG unit tests in script_tests.json 6224b272ac
  16. billymcbip force-pushed on Dec 5, 2025
  17. billymcbip commented at 11:06 pm on December 5, 2025: none
    On second thought, I think it’s better to simply replace the STRICTENC flag with DERSIG when applicable instead of creating new tests. It makes the test file easier to parse.
  18. billymcbip renamed this:
    test: Add DERSIG unit tests to script_tests.json
    test: Improve STRICTENC/DERSIG unit tests in script_tests.json
    on Dec 5, 2025

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: 2025-12-06 00:13 UTC

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