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

pull fametrano wants to merge 2 commits into bitcoin:master from fametrano:bip375-validator-malformed-inputs changing 4 files +151 −6
  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 927b6de9 by mutating one valid vector at a time.

    The first commit raises ValueError there and lets validate_bip375_psbt report it as a failed check; test_runner.py still passes 43 of 43. The second adds one invalid vector per case, listed in the BIP table under ECDH Coverage, the check that rejects them: 46 of 46 with the fix, and each vector alone crashes the master validator.

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

  2. 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.
    76fd19cb1e
  3. 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.
    7763a19e44
Contributors

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