Skip to content

Conversation

@macgyver13
Copy link
Contributor

@macgyver13 macgyver13 commented Nov 26, 2025

This PR adds the test runner test_runner.py and test_vectors.json for demonstrating BIP 375 behavior.
Care was taken to minimize dependencies required to evaluate the test vectors.

Dependencies are referenced at runtime from bip-0374 instead of cloning locally.

Test generation tools moved to external repo

Feedback welcome @andrewtoth @achow101 @josibake

Test runner output

Invalid test cases: 13
=== Running Invalid Test Cases ===
Test 1: Missing DLEQ proof for ECDH share
Test 2: Invalid DLEQ proof
Test 3: Non-SIGHASH_ALL signature with silent payments
Test 4: Mixed segwit versions with silent payments
Test 5: Silent payment outputs but no ECDH shares
Test 6: Global ECDH share without DLEQ proof
Test 7: Wrong SP_V0_INFO field size
Test 8: Mixed eligible and ineligible input types
Test 9: Wrong ECDH share size
Test 10: Wrong DLEQ proof size
Test 11: Label without SP_V0_INFO
Test 12: Address mismatch
Test 13: Both global and per-input ECDH shares

Valid test cases: 4
=== Running Valid Test Cases ===
Test 14: Single signer with global ECDH share
Test 15: Multi-party with per-input ECDH shares
Test 16: Silent payment with change detection
Test 17: Multiple silent payment outputs to same scan key

@jonatack jonatack added Proposed BIP modification Pending acceptance This BIP modification requires sign-off by the champion of the BIP being modified labels Nov 27, 2025
@macgyver13 macgyver13 force-pushed the bip375-reference-testvectors-pr branch 2 times, most recently from 0018e4f to d540a48 Compare December 3, 2025 17:11
- Add constants.py with BIP 375 PSBT field type definitions
- Add parser.py with PSBT v2 structure parsing functions
- Add minimal test_runner.py for basic structure validation
- Validates PSBT magic bytes and parse-ability
- All 17 test vectors pass basic structure checks
- - Basic structure validation complete: 4 passed, 13 failed
- Add inputs.py with input type validation helpers
- Add dependencies from previous work
- - deps/bip352_utils.py
- - deps/secp256k1_374.py
- Validate eligible input types (P2PKH, P2WPKH, P2TR, P2SH-P2WPKH)
- Check segwit version restrictions (v0-v1 only)
- Verify P2SH inputs are P2SH-P2WPKH
- Update test_runner.py to validate inputs
Input validation complete: 6 passed, 11 failed
- Add dleq.py with DLEQ proof validation functions
- Extract public keys from BIP32 derivation fields
- Validate global and per-input DLEQ proofs using BIP-374
- Verify scan key consistency between ECDH and DLEQ fields
- Prevent conflicting global/per-input ECDH for same scan key
- Check ECDH shares exist for silent payment outputs
- Update test_runner.py with comprehensive DLEQ validation
DLEQ validation complete: 14 passed, 3 failed
- Add validator.py with comprehensive BIP-375 validation
- Validate output field requirements (SCRIPT or SP_V0_INFO)
- Check SP_V0_INFO field size (66 bytes)
- Validate SP_V0_LABEL requires SP_V0_INFO
- Enforce SIGHASH_ALL requirement for silent payments
- Integrate all previous validation (inputs, DLEQ, ECDH)
- Simplify test_runner.py to use validator module
- Validation complete: 16 passed, 1 failed
- Add validate_bip352_outputs() for output script verification
- Support both global and per-input ECDH share modes
- Update test_runner.py to pass test material to validator
- Details core files and dependencies
- Link to test_generator.py for vector generation
- Provide usage instructions for test_runner.py
@macgyver13 macgyver13 force-pushed the bip375-reference-testvectors-pr branch from d540a48 to 88dec03 Compare December 5, 2025 19:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Pending acceptance This BIP modification requires sign-off by the champion of the BIP being modified Proposed BIP modification

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants