bip375: sync vendored DLEQ code with BIP-374 #2304

pull Bruce039 wants to merge 1 commits into bitcoin:master from Bruce039:bip375-sync-dleq changing 1 files +3 −1
  1. Bruce039 commented at 11:55 AM on September 25, 2026: contributor

    bip-0375/deps/dleq.py is a copy of the BIP-374 reference code, used by the BIP-375 validator to check PSBT_GLOBAL_SP_DLEQ / PSBT_IN_SP_DLEQ proofs. It was taken before #2262, so it still uses the raw challenge hash as e and doesn't reject proofs with e >= n.

    This applies the same two changes to the copy. After this the functions match bip-0374/reference.py line for line (apart from the unit tests). A challenge hash >= n has negligible probability, so nothing changes in practice: test_runner.py still passes all 42 vectors, and the 17 BIP-374 verify vectors give the same results before and after. It just keeps the copy from drifting from the spec.

  2. bip375: sync vendored DLEQ code with BIP-374
    bip-0375/deps/dleq.py is adapted from the BIP-374 reference code but
    predates the change that treats the challenge e as a scalar (#2262).
    Reduce the challenge hash mod n and reject proofs with e >= n, so the
    copy used by the BIP-375 validator matches the current BIP-374
    reference.
    7999f8aa1c
  3. jonatack added the label Fixups on Sep 25, 2026
  4. jonatack commented at 6:06 PM on September 25, 2026: member

    ACK

    These may go out of sync again. Out of scope for this PR, but better long-term options might be:

    • import from bip-0374/reference.py to have one source of truth, or
    • comment in dleq.py to keep in lockstep with bip-0374/reference.py
  5. jonatack merged this on Sep 25, 2026
  6. jonatack closed this on Sep 25, 2026

  7. jonatack commented at 6:38 PM on September 25, 2026: member

    import from bip-0374/reference.py to have one source of truth

    Done in #2309.


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-09-30 16:10 UTC

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