bip-0375: reject inputs with missing UTXO or redeem script instead of crashing #2324

pull fametrano wants to merge 3 commits into bitcoin:master from fametrano:bip375-validator-malformed-inputs changing 4 files +154 −7
  1. fametrano commented at 7:35 PM on October 3, 2026: contributor

    The BIP-375 reference validator crashes with an AssertionError, instead of rejecting the PSBT, on three malformed inputs: no PSBT_IN_WITNESS_UTXO and no PSBT_IN_NON_WITNESS_UTXO; PSBT_IN_OUTPUT_INDEX past the end of the non-witness UTXO; a P2SH scriptPubKey without PSBT_IN_REDEEM_SCRIPT. All three reach the asserts in validator/inputs.py from is_input_eligible. Measured on master b34d9f75.

    The first commit raises ValueError there and lets validate_bip375_psbt report it as a failed check; test_runner.py still passes master's 44 of 44. The second adds one invalid vector per case, listed in the BIP table under ECDH Coverage, the check that rejects them: 47 of 47 with the fix, and each vector alone fails the master validator with an AssertionError. A separate commit sets Version 0.1.6 with its changelog entry: 0.1.5 is #2316's, and whichever of the two lands second rebases its version if needed.

    Made with my usual tools: a computer, the Internet and an LLM. The mistakes, as usual, are all mine.

  2. jonatack added the label Fixups on Oct 18, 2026
  3. fametrano force-pushed on Oct 27, 2026
  4. fametrano force-pushed on Nov 4, 2026
  5. murchandamus commented at 6:41 PM on November 5, 2026: member
  6. fametrano force-pushed on Nov 6, 2026
  7. jonatack added the label Pending acceptance on Nov 9, 2026
  8. jonatack added the label Tests on Nov 9, 2026
  9. jonatack commented at 4:53 PM on November 9, 2026: member

    ACK, awaiting feedback from a BIP owner

    Edit: perhaps a patch version bump with a changelog entry would be good.

  10. fametrano force-pushed on Nov 10, 2026
  11. fametrano commented at 10:25 PM on November 10, 2026: contributor

    Added 0.1.6 with a changelog entry.

  12. BIP375: reject inputs with missing UTXO or redeem script
    The reference validator hit an assert, and crashed, on an input with no
    UTXO, a PSBT_IN_OUTPUT_INDEX past the end of its non-witness UTXO, or a
    P2SH scriptPubKey without PSBT_IN_REDEEM_SCRIPT. Raise ValueError
    instead and report it from validate_bip375_psbt as a failed check.
    4fa8ed256b
  13. fametrano force-pushed on Nov 11, 2026
  14. BIP375: add invalid vectors for missing UTXO and redeem script
    One vector per case the reference validator now rejects: no UTXO field,
    PSBT_IN_OUTPUT_INDEX past the end of the non-witness UTXO, and a P2SH
    input without PSBT_IN_REDEEM_SCRIPT. The ECDH coverage check rejects
    each. List them in the BIP table.
    bde8920ff4
  15. BIP375: set Version 0.1.6 with changelog for missing UTXO and redeem script a0f6470641
  16. fametrano force-pushed on Nov 11, 2026
  17. fametrano commented at 10:59 AM on November 13, 2026: contributor

    Beyond what this PR fixes, on master b34d9f75 the validator crashes on three more kinds of invalid PSBT, and accepts a hybrid PSBT_IN_BIP32_DERIVATION key with the wrong parity prefix.

    A fix with test vectors is on my fork, free to use: https://github.com/fametrano/bips/pull/6. @macgyver13 @jonatack, would you rather someone take it as a separate PR, or have me fold it into this PR or #2316? Folding keeps one version bump but grows a reviewed PR.


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

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