bip375: import DLEQ and secp256k1lab from BIP374 instead of vendoring #2309

pull jonatack wants to merge 3 commits into bitcoin:master from jonatack:2026-09-bip375-import-DLEQ-from-BIP374-instead-of-vendoring changing 18 files +40 −762
  1. jonatack commented at 6:37 PM on September 25, 2026: member

    bip-0375/deps/dleq.py copied the dleq_* functions from bip-0374/reference.py, depends on it, and could go out of sync (#2262, #2304). Replace it with a loader so the validator always uses the current bip-0374/reference.py.

    After that change, the local bip-0375/deps/secp256k1lab copy is unused. Drop the vendored tree, remove its README entry, and point test_runner.py at bip-0374/secp256k1lab/src with an existence check.

    This leaves a single source of truth for both the DLEQ functions and the shared secp256k1lab dependency.

    Added a note in BIP 374 to indicate 375 is downstream and should be tested before any functional changes to 374's reference.py or its secp256k1lab subtree.

    To run the tests:

    python bip-0375/test_runner.py
    
  2. jonatack commented at 8:00 PM on September 25, 2026: member

    cc BIP authors @andrewtoth, @achow101, @josibake for feedback

  3. bip375: import DLEQ from BIP-374 instead of vendoring
    bip-0375/deps/dleq.py was a copy of bip-0374/reference.py
    and could go out of sync. Replace the copy with a loader so
    the validator always uses the current BIP-374 reference.py.
    503119db2c
  4. jonatack force-pushed on Sep 27, 2026
  5. jonatack commented at 6:00 PM on September 27, 2026: member

    Rebased following merge of #2286.

  6. macgyver13 commented at 9:01 PM on September 29, 2026: contributor

    tACK 503119d

  7. fametrano commented at 10:08 AM on October 9, 2026: none

    I suggest also dropping bip-0375/deps/secp256k1lab in this PR, with its README entry, and pointing its path in test_runner.py to bip-0374/secp256k1lab/src. I tried this locally and the 43 tests pass. The path change is needed: with the copy dropped and the path unchanged, importing validator.inputs before deps.dleq fails with ModuleNotFoundError: No module named 'secp256k1lab'.

    At 503119d that copy is no longer used. deps/dleq.py loads bip-0374/reference.py, which puts bip-0374/secp256k1lab/src at the front of sys.path. This happens before the validator's first secp256k1lab import. So the validator already runs on BIP-374's copy, as python3 -v bip-0375/test_runner.py shows. The tests pass either way because the two copies are identical today. If they drift apart, no test will notice, and the README will still list the unused copy as a dependency.

  8. murchandamus added the label Proposed BIP modification on Nov 3, 2026
  9. murchandamus added the label Pending acceptance on Nov 3, 2026
  10. bip375: drop unused secp256k1lab copy; use that of BIP374
    After the dleq.py loader, the local secp256k1lab copy is unused.
    Point test_runner.py at bip-0374/secp256k1lab/src (with existence check),
    remove the README entry, and delete the vendored tree. Tests still pass.
    Suggested by fametrano in #2309.
    
    Co-authored-by: Ferdinando Ametrano <ferdinando@ametrano.net>
    ccdb9b68e6
  11. jonatack commented at 1:17 AM on November 4, 2026: member

    @fametrano good suggestion; done.

  12. jonatack renamed this:
    bip375: import DLEQ from BIP-374 instead of vendoring
    bip375: import DLEQ and secp256k1lab from BIP-374 instead of vendoring
    on Nov 4, 2026
  13. jonatack renamed this:
    bip375: import DLEQ and secp256k1lab from BIP-374 instead of vendoring
    bip375: import DLEQ and secp256k1lab from BIP374 instead of vendoring
    on Nov 4, 2026
  14. jonatack assigned macgyver13 on Nov 4, 2026
  15. jonatack assigned fametrano on Nov 4, 2026
  16. bip374: note bip375 downstream dependency on reference.py and secp256k1lab 8f9b1f3df7
  17. jonatack commented at 7:12 PM on November 4, 2026: member

    Per an offline suggestion from @macgyver13, added a note in 374 to indicate 375 is downstream and should be tested before any functional changes to 374's reference.py or its secp256k1lab subtree.

  18. fametrano commented at 11:28 PM on November 4, 2026: none

    ACK 8f9b1f3df7911a6e50c669734621f83af32300be

    The removed bip-0375/deps/secp256k1lab is the same git tree as bip-0374/secp256k1lab on master (f9ecfa0a), and deps/dleq.py already got BIP 374's copy through bip-0374/reference.py, so pointing test_runner.py there leaves the validator on the same code. Nothing else in the repository refers to the removed copy, and the note added to BIP 374 describes the dependency as it now is. On this head all 43 BIP 375 tests pass.


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-12 08:10 UTC

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