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 +842 −1
  1. fametrano commented at 11:28 PM on October 10, 2026: contributor

    I implemented BIP352 independently in btclib-wallet (Python). These six vectors cover cases its tests reach and the file does not. reference.py computes every expected value and passes on the whole file, and btclib-wallet agrees on all six.

    • P2WSH, P2MS, P2PK and empty-scriptPubKey inputs beside one P2PKH input: only the P2PKH key counts.
    • P2SH-P2WSH, P2TR with an empty witness, and P2TR whose output key is not on the curve, beside one P2PKH input: all are skipped.
    • A taproot script path spend with a non-NUMS internal key: its output key counts.
    • A P2PKH input whose pubkey hash matches 33 bytes that are not a valid key: it is skipped.
    • The largest label, 2^32 - 1.
    • An unlabeled and a labeled address of one recipient, with another recipient listed between them.

    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 these vectors.

    The changelog gets version 1.1.2. #2323 adds two other vectors at the same places in both files; I will rebase whichever lands second.

    Assisted-by: my usual tools (LLM, Internet, computer). Mistakes are mine.

  2. BIP-352: add test vectors for skipped inputs and label edge cases
    Six 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;
    - P2SH-P2WSH, P2TR with an empty witness, and a P2TR output key that is
      not on the curve, all skipped;
    - a P2TR script path spend whose internal key is not NUMS, which counts;
    - a P2PKH whose pubkey hash matches 33 bytes that are not a valid key;
    - 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.
    
    Assisted-by: my usual tools (LLM, Internet, computer). Mistakes are mine.
    Signed-off-by: Ferdinando Ametrano <ferdinando@ametrano.net>
    f4c50e3535
  3. BIP-352: add version 1.1.2 to the changelog
    Bump the version to 1.1.2 and list the six new test vectors.
    
    Assisted-by: my usual tools (LLM, Internet, computer). Mistakes are mine.
    Signed-off-by: Ferdinando Ametrano <ferdinando@ametrano.net>
    5f76a1788a

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-10-14 03:10 UTC

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