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: none

    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. A summary of reviews will appear here.

  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: none
    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

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-01 21:13 UTC

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