test: add Taproot support to script_builder #34473

pull kannapoix wants to merge 1 commits into bitcoin:master from kannapoix:taproot-tests changing 2 files +100 −3
  1. kannapoix commented at 6:30 am on February 2, 2026: none

    Make the script_builder used in unit tests compatible with Taproot by adding a PushSchnorrSig helper. Add a few tests that cover boundary values for Taproot SIGHASH flags in SignatureHashSchnorr (including values at and above 84, which were not covered by existing unit tests). This slightly improves unit test coverage of SignatureHashSchnorr, as suggested in issue #23279. Current unit test coverage for src/script/interpreter.cpp can be seen here: https://maflcko.github.io/b-c-cov/test_bitcoin.coverage/src/script/interpreter.cpp.gcov.html

    We also have Taproot tests in bip341_keypath_test_vectors, but extending those tests would require preparing a test data. Making script_builder Taproot-compatible is a simpler way to add edge-case tests for SignatureHashSchnorr and to add more Taproot unit tests later.

  2. DrahtBot added the label Tests on Feb 2, 2026
  3. DrahtBot commented at 6:31 am on February 2, 2026: contributor

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

    Reviews

    See the guideline for information on the review process. A summary of reviews will appear here.

    LLM Linter (✨ experimental)

    Possible places where named args for integral literals may be used (e.g. func(x, /*named_arg=*/0) in C++, and func(x, named_arg=0) in Python):

    • TestBuilder(CScript() « ToByteVector(keys.outputPubkey0.first), “Taproot key path spending”, SCRIPT_VERIFY_WITNESS | SCRIPT_VERIFY_P2SH | SCRIPT_VERIFY_TAPROOT, false, WitnessMode::TAPROOT, 1, 1) in src/test/script_tests.cpp
    • TestBuilder(CScript() « ToByteVector(keys.outputPubkey0.first), “Taproot key path spending with unknown sighash 0x04”, SCRIPT_VERIFY_WITNESS | SCRIPT_VERIFY_P2SH | SCRIPT_VERIFY_TAPROOT, false, WitnessMode::TAPROOT, 1, 1) in src/test/script_tests.cpp
    • TestBuilder(CScript() « ToByteVector(keys.outputPubkey0.first), “Taproot key path spending with unknown sighash 0x80”, SCRIPT_VERIFY_WITNESS | SCRIPT_VERIFY_P2SH | SCRIPT_VERIFY_TAPROOT, false, WitnessMode::TAPROOT, 1, 1) in src/test/script_tests.cpp
    • TestBuilder(CScript() « ToByteVector(keys.outputPubkey0.first), “Taproot key path spending with unknown sighash 0x84”, SCRIPT_VERIFY_WITNESS | SCRIPT_VERIFY_P2SH | SCRIPT_VERIFY_TAPROOT, false, WitnessMode::TAPROOT, 1, 1) in src/test/script_tests.cpp

    2026-02-17 01:02:43

  4. DrahtBot added the label Needs rebase on Feb 2, 2026
  5. test: add Taproot support to script_builder
    Make the script_builder used in unit tests compatible with Taproot by
    adding a PushSchnorrSig helper. This is a simpler way to add edge-case
    tests than extending bip341_keypath_test_vectors, which would require
    preparing additional test data.
    
    Add tests for boundary values of Taproot SIGHASH flags in
    SignatureHashSchnorr, including cases where the SIGHASH value is
    greater than or equal to 84 that were not previously tested in unit tests.
    
    Addresses #23279.
    b7371682a4
  6. kannapoix force-pushed on Feb 17, 2026
  7. DrahtBot removed the label Needs rebase on Feb 17, 2026
  8. DrahtBot added the label CI failed on Feb 22, 2026
  9. DrahtBot commented at 5:11 pm on February 22, 2026: contributor

    🚧 At least one of the CI tasks failed. Task 32 bit ARM: https://github.com/bitcoin/bitcoin/actions/runs/22082297279/job/64449968706 LLM reason (✨ experimental): Compilation failed due to a syntax error in src/test/script_tests.cpp (malformed ScriptErrorDesc initializer: missing } before {).

    Try to run the tests locally, according to the documentation. However, a CI failure may still happen due to a number of reasons, for example:

    • Possibly due to a silent merge conflict (the changes in this pull request being incompatible with the current code in the target branch). If so, make sure to rebase on the latest commit of the target branch.

    • A sanitizer issue, which can only be found by compiling with the sanitizer and running the affected test.

    • An intermittent issue.

    Leave a comment here, if you need help tracking down a confusing failure.


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-22 18:12 UTC

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