1
0
mirror of https://github.com/bitcoin/bips.git synced 2026-02-09 15:23:09 +00:00

BIP-374: avoid using sys.path[0] to find current working directory

This approach is incompatible with the sys.path extension approach
in the next commit which is used to to find the vendored copy of
secp256k1lab, so use __file__ instead which works as well.
This commit is contained in:
Sebastian Falbesoner 2025-05-20 21:49:11 +02:00
parent d2ceae1dd6
commit 4e18ee641b
2 changed files with 6 additions and 6 deletions

View File

@ -1,7 +1,7 @@
#!/usr/bin/env python3 #!/usr/bin/env python3
"""Generate the BIP-0374 test vectors.""" """Generate the BIP-0374 test vectors."""
import csv import csv
import os from pathlib import Path
import sys import sys
from reference import ( from reference import (
TaggedHash, TaggedHash,
@ -14,8 +14,8 @@ from secp256k1 import G as GENERATOR, GE
NUM_SUCCESS_TEST_VECTORS = 8 NUM_SUCCESS_TEST_VECTORS = 8
DLEQ_TAG_TESTVECTORS_RNG = "BIP0374/testvectors_rng" DLEQ_TAG_TESTVECTORS_RNG = "BIP0374/testvectors_rng"
FILENAME_GENERATE_PROOF_TEST = os.path.join(sys.path[0], 'test_vectors_generate_proof.csv') FILENAME_GENERATE_PROOF_TEST = Path(__file__).parent / 'test_vectors_generate_proof.csv'
FILENAME_VERIFY_PROOF_TEST = os.path.join(sys.path[0], 'test_vectors_verify_proof.csv') FILENAME_VERIFY_PROOF_TEST = Path(__file__).parent / 'test_vectors_verify_proof.csv'
def random_scalar_int(vector_i, purpose): def random_scalar_int(vector_i, purpose):

View File

@ -1,7 +1,7 @@
#!/usr/bin/env python3 #!/usr/bin/env python3
"""Run the BIP-DLEQ test vectors.""" """Run the BIP-DLEQ test vectors."""
import csv import csv
import os from pathlib import Path
import sys import sys
from reference import ( from reference import (
dleq_generate_proof, dleq_generate_proof,
@ -10,8 +10,8 @@ from reference import (
from secp256k1 import GE from secp256k1 import GE
FILENAME_GENERATE_PROOF_TEST = os.path.join(sys.path[0], 'test_vectors_generate_proof.csv') FILENAME_GENERATE_PROOF_TEST = Path(__file__).parent / 'test_vectors_generate_proof.csv'
FILENAME_VERIFY_PROOF_TEST = os.path.join(sys.path[0], 'test_vectors_verify_proof.csv') FILENAME_VERIFY_PROOF_TEST = Path(__file__).parent / 'test_vectors_verify_proof.csv'
all_passed = True all_passed = True