script: Add a separate ScriptError for empty pubkeys encountered in Tapscript #33961

pull billymcbip wants to merge 1 commits into bitcoin:master from billymcbip:pubkey-error changing 6 files +29 −12
  1. billymcbip commented at 3:30 pm on November 27, 2025: contributor

    We currently have two callsites for SCRIPT_ERR_PUBKEYTYPE:

    It would be good for readability and testability to have separate errors for both cases, as they are quite distinct (policy vs. consensus, format vs. emptiness).

    This PR adds SCRIPT_ERR_TAPSCRIPT_EMPTY_PUBKEY for the consensus error path.

    This change would make our error handling more consistent. We have more granular errors for other pubkey error paths already: SCRIPT_ERR_WITNESS_PUBKEYTYPE, SCRIPT_ERR_DISCOURAGE_UPGRADABLE_PUBKEYTYPE. We also have separate errors for MINIMAL_IF: SCRIPT_ERR_MINIMALIF for the policy error pre-tapscript, and SCRIPT_ERR_TAPSCRIPT_MINIMALIF for the consensus error post-tapscript.

    Tests:

    Added a test case to script_tests and ran build/bin/test_bitcoin --run_test=script_tests --log_level=success.

    0test/script_tests.cpp:144: info: check '[["aa","#SCRIPT# 0 CHECKSIG","#CONTROLBLOCK#",0.00000001],"","0x51 0x20 #TAPROOTOUTPUT#","P2SH,WITNESS,TAPROOT","TAPSCRIPT_EMPTY_PUBKEY","TAPSCRIPT: OP_CHECKSIG with empty pubkey must fail"] (with flags 165d5d)' has passed
    1...
    

    Ran DIR_UNIT_TEST_DATA="$(pwd)/../qa-assets/unit_test_data" build/bin/test_bitcoin --run_test=script_assets_tests --log_level=success.

    Updated feature_taproot.py and ran build/test/functional/feature_taproot.py.

    Looking forward to your feedback.

  2. DrahtBot commented at 3:30 pm on November 27, 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/33961.

    Reviews

    See the guideline for information on the review process.

    Type Reviewers
    ACK sedited, darosior, sipa

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

  3. script: add SCRIPT_ERR_TAPSCRIPT_EMPTY_PUBKEY
    Empty public keys in tapscript are rejected by consensus rules, independent of SCRIPT_VERIFY_STRICTENC. Add SCRIPT_ERR_TAPSCRIPT_EMPTY_PUBKEY to distinguish this from STRICTENC policy failures currently reported as SCRIPT_ERR_PUBKEYTYPE.
    9d5021a05b
  4. billymcbip force-pushed on Nov 27, 2025
  5. billymcbip commented at 4:29 pm on November 27, 2025: contributor
    Also updatedfeature_taproot.py and ran build/test/functional/feature_taproot.py. Can we re-run CI?
  6. DrahtBot added the label CI failed on Nov 27, 2025
  7. DrahtBot removed the label CI failed on Nov 28, 2025
  8. billymcbip renamed this:
    Add a separate ScriptError for empty pubkeys encountered in Tapscript
    script: Add a separate ScriptError for empty pubkeys encountered in Tapscript
    on Dec 1, 2025
  9. DrahtBot added the label Consensus on Dec 1, 2025
  10. darosior commented at 8:00 pm on December 4, 2025: member
    Concept/Approach ACK.
  11. sedited approved
  12. sedited commented at 10:32 pm on December 4, 2025: contributor
    ACK 9d5021a05bd33c73276909eec961777867ddb412
  13. DrahtBot requested review from darosior on Dec 4, 2025
  14. darosior approved
  15. darosior commented at 2:49 pm on December 5, 2025: member
    utACK 9d5021a05bd33c73276909eec961777867ddb412
  16. sipa commented at 2:53 pm on December 5, 2025: member
    ACK 9d5021a05bd33c73276909eec961777867ddb412
  17. billymcbip closed this on Dec 7, 2025

  18. billymcbip deleted the branch on Dec 7, 2025
  19. darosior commented at 3:40 pm on December 7, 2025: member
    Force-push gone wrong @billymcbip? Or is this intentional?
  20. billymcbip restored the branch on Dec 7, 2025
  21. billymcbip commented at 3:51 pm on December 7, 2025: contributor
    @darosior that was unintentional, sorry! I still intend to ship 9d5021a.
  22. billymcbip reopened this on Dec 7, 2025

  23. glozow merged this on Dec 9, 2025
  24. glozow closed this on Dec 9, 2025

  25. billymcbip deleted the branch on Dec 10, 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: 2026-01-07 03:13 UTC

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