BIP-352: add test vectors for skipped inputs and label edge cases #2330

pull fametrano wants to merge 2 commits into bitcoin:master from fametrano:bip352-vectors changing 2 files +686 −1
  1. fametrano commented at 11:28 PM on October 10, 2026: contributor

    This adds five test vectors for BIP352 cases the file does not cover; the changelog entry names them. reference.py computes every expected value and passes on the whole file, and btclib-wallet, which I maintain, agrees on all five (run). The version is 1.1.3, as in #2323; I will rebase whichever lands second and move it to 1.1.4.

    Under the scope #2339 set, I removed three cases that cannot be consensus-valid: a P2PKH input whose pubkey hash matches 33 bytes that are not a valid key, a P2TR input with an empty witness, and a P2TR input whose output key is not on the curve. reference.py keeps code for all three, and no vector reaches it now.

  2. jonatack added the label Proposed BIP modification on Oct 18, 2026
  3. jonatack added the label Pending acceptance on Oct 18, 2026
  4. fametrano force-pushed on Nov 1, 2026
  5. fametrano force-pushed on Nov 4, 2026
  6. Yudis-bit commented at 12:10 AM on November 6, 2026: contributor

    ACK d85c71c574d263eaf2c5c0ecd0f8a3ab07985243

    Tested against reference.py and all 34 vectors pass.

    Removing the three consensus-invalid cases is correct: an empty witness on P2TR, an off-curve output key, and an unspendable P2PKH hash cannot be mined into valid blocks, so a wallet scanner will never encounter them in confirmed transactions.

    Vector 33 reuses the placeholder scriptSig on a1075db5 which lacks the sighash byte. Rebasing on #2348 once it lands will clean up that encoding across the new vectors too.

  7. fametrano force-pushed on Nov 6, 2026
  8. fametrano commented at 11:33 PM on November 6, 2026: contributor

    Rebased on #2348 and appended SIGHASH_ALL to the 15 ECDSA signatures in the new vectors that lacked it, as #2348 did; the P2PKH scriptSigs now match the file's own. Expected values are unchanged.

  9. jonatack removed the label Proposed BIP modification on Nov 9, 2026
  10. jonatack added the label Tests on Nov 9, 2026
  11. in bip-0352.mediawiki:16 in 17cff4ae0b
      12 | @@ -13,7 +13,7 @@
      13 |                2022-03-28: https://gnusha.org/pi/bitcoindev/CAPv7TjbXm953U2h+-12MfJ24YqOM5Kcq77_xFTjVK+R2nf-nYg@mail.gmail.com/ [bitcoin-dev] Silent Payments – Non-interactive private payments with no on-chain overhead
      14 |                2022-10-11: https://gnusha.org/pi/bitcoindev/P_21MLHGJicZ-hkbC4DGu86c5BtNKiH8spY4TOw5FJsfimdi_6VyHzU_y-s1mZsOcC2FA3EW_6w6W5qfV9dRK_7AvTAxDlwVfU-yhWZPEuo=@protonmail.com/ [bitcoin-dev] Silent Payment v4 (coinjoin support added)
      15 |                2023-08-04: https://gnusha.org/pi/bitcoindev/ZM03twumu88V2NFH@petertodd.org/ [bitcoin-dev] BIP-352 Silent Payments addresses should have an expiration time
      16 | -  Version: 1.1.2
      17 | +  Version: 1.1.4
    


    jonatack commented at 4:23 PM on November 9, 2026:

    Why the bump from 1.1.2 to 1.1.4?


    fametrano commented at 8:42 PM on November 10, 2026:

    It is now 1.1.3, the same as my #2323. The two conflict anyway, so I'll rebase whichever lands second and move it to 1.1.4.

  12. jonatack commented at 4:23 PM on November 9, 2026: member

    ACK

  13. jonatack commented at 4:24 PM on November 9, 2026: member

    Test-only changes but prefer to ask BIP authors @theStack @josibake @RubenSomsen for sign-off.

  14. fametrano force-pushed on Nov 10, 2026
  15. BIP-352: add test vectors for skipped inputs and label edge cases
    Five send and receive vectors for cases the file does not cover yet:
    - inputs of ineligible types (P2WSH, P2MS, P2PK, empty scriptPubKey)
      beside an eligible one;
    - a P2SH-P2WSH input beside an eligible one, which is skipped;
    - a P2TR script path spend whose internal key is not NUMS, which counts;
    - the largest label, 0xFFFFFFFF;
    - two recipients, one with a labeled address listed after the other
      recipient, with a taproot and a non-taproot input.
    
    The P2WSH and P2SH-P2WSH witness script is also a valid compressed key,
    so an implementation that reads the last witness item as a key fails.
    
    reference.py computed the expected values and passes on the whole file.
    e44aa4921e
  16. BIP-352: add version 1.1.3 to the changelog
    Bump the version to 1.1.3 and list the five new test vectors.
    0e79339a00
  17. fametrano force-pushed on Nov 12, 2026

github-metadata-mirror

This is a metadata mirror of the GitHub repository bitcoin/bips. This site is not affiliated with GitHub. Content is generated from a GitHub metadata backup.
generated: 2026-11-24 00:10 UTC

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