test: strengthen the tapscript CHECKMULTISIG asset tests and dump the expected error #36699

pull azuchi wants to merge 1 commits into bitcoin:master from azuchi:taproot-test-disabled-checkmultisig changing 2 files +19 −1
  1. azuchi commented at 8:59 AM on October 30, 2026: contributor

    The tapscript/disabled_checkmultisig and tapscript/disabled_checkmultisigverify spenders in feature_taproot.py run OP_CHECKMULTISIG(VERIFY) on a Schnorr signature (0 OP_SWAP 1 <pubkey> 1 OP_CHECKMULTISIG). An implementation which forgets to disable these opcodes in tapscript still fails the case, because a 64 byte Schnorr signature is not a valid DER signature. So the asset tests generated from these spenders cannot tell whether the opcodes are disabled. This came up while running script_assets_test.json against a third-party implementation which executed OP_CHECKMULTISIG in tapscript and passed every case.

    This PR does two things:

    1. Adds a 0-of-0 variant for both opcodes (OP_DROP 0 0 0 OP_CHECKMULTISIG and OP_DROP 0 0 0 OP_CHECKMULTISIGVERIFY 1). It needs no signature and leaves a single 1 on the stack, so it succeeds when the opcode is executed and fails only because of the tapscript rule. Checked against the implementation above: it accepts the new failure case while its fixed version rejects it with SCRIPT_ERR_TAPSCRIPT_CHECKMULTISIG.

    2. Writes the expected script error of a failure case into the JSON dump ("error"), taken from the err_msg the spender already declares and which block_submit already checks against the node. script_assets_test then checks the error under exactly the listed flags. Until now a failure case could only be checked for failing, not for failing for the stated reason. A superset of the flags may fail earlier for another reason, so the check is limited to the exact flag set. Consumers which do not know the field are unaffected, and spenders without err_msg get no field.

    Verified by running feature_taproot.py --dumptests and test_bitcoin --run_test=script_assets_tests on the regenerated dump (2897 vectors, 2410 of them with an error field).

  2. test: strengthen the tapscript CHECKMULTISIG asset tests and dump the expected error
    The tapscript/disabled_checkmultisig(verify) failure cases run
    OP_CHECKMULTISIG(VERIFY) on a Schnorr signature. An implementation which
    does not disable the opcodes in tapscript still fails them, because a
    Schnorr signature is not a valid DER signature, so these cases cannot
    tell whether the opcodes are disabled. Add a 0-of-0 variant, which
    succeeds when the opcode is executed, so that only the tapscript rule can
    make it fail.
    
    Also write the expected script error of a failure case to the JSON dump
    when the spender declares one, and check it in script_assets_test under
    exactly the listed flags. The failure cases could so far only be checked
    for failing, not for failing for the right reason. Consumers which do not
    know the new field are unaffected.
    420decb170
  3. DrahtBot added the label Tests on Oct 30, 2026
  4. DrahtBot commented at 8:59 AM on October 30, 2026: contributor

    <!--e57a25ab6845829454e8d69fc972939a-->

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

    <!--006a51241073e994b41acfe9ec718e94-->

    External sites

    <!--021abf342d371248e50ceaed478a90ca-->

    Reviews

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

    <!--5faf32d7da4f0f540f40219e4f7537a3-->

  5. fanquake commented at 9:25 AM on October 30, 2026: member
Labels

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-10-30 15:51 UTC

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