BIP375: validate scan-key keydata lengths #2318

pull myetcd wants to merge 1 commits into bitcoin:master from myetcd:master changing 3 files +107 −6
  1. myetcd commented at 3:37 AM on September 30, 2026: none

    BIP375 requires 33-byte scan-key keydata for PSBT_GLOBAL_SP_ECDH_SHARE, PSBT_GLOBAL_SP_DLEQ, PSBT_IN_SP_ECDH_SHARE, and PSBT_IN_SP_DLEQ.

    The reference structure validator currently checks the value lengths of these fields but ignores their keydata lengths. This change enforces the 33-byte keydata requirement for all four fields, with errors identifying the field and, for per-input fields, the input index.

    Add unit tests covering missing, short, and oversized keydata, accepted 33-byte keydata, and the existing value-length checks. Document the unit test command in the validation reference README.

  2. BIP375: validate scan-key keydata lengths
    Signed-off-by: myetcd <mytech@139.com>
    4ab0b00599
  3. fametrano commented at 7:56 PM on October 3, 2026: contributor

    ACK 4ab0b005991b16e9ee641f2d11b4562df1e43511

    Ran test_runner.py (43 passed) and test_structure.py (3 tests OK). On master (927b6de) an ECDH share whose keydata is 32 bytes is silently ignored: with the per-input share of the "can finalize: one input / one sp output with both global and per-input ECDH shares" vector re-keyed that way, the PSBT still passes because the global share covers the output; here it is rejected with "Input 0 ECDH share scan key has wrong length (32 bytes, expected 33)", and the same holds for the global share. The 33-byte requirement is what the field tables specify for all four keydata.

  4. jonatack added the label Fixups on Oct 18, 2026
  5. jonatack commented at 9:32 PM on October 18, 2026: member

    Labeled as fixups, pending more review to determine if this needs BIP author approval.

Labels

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

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