← Back to Bitcoin Improvement Proposals
BIPinformationalkey-managementscriptp2p

BIP-340: fix `lift_x` calls in test vector generation script

The `lift_x` function in the BIP and the reference implementation expect an integer to be passed rather than a byte array. Can be tested with: ``` $ python3 test-vectors.py > expected.csv $ diff test-vectors.csv expected.csv ``` On master, the first call fails with ``` Traceback (most recent call last): File "/home/thestack/bips/bip-0340/test-vectors.py", line 267, in <module> vector0(), ^^^^^^^^^ File "/home/thestack/bips/bip-0340/test-vectors.py", line 30, in vector0 pubkey_po

No reviews
theStack·Updated Dec 27, 2024·0 reviews·0 attestations·View source
Collections:BIPs — Merged

Specification

The lift_x function in the BIP and the reference implementation expect an integer to be passed rather than a byte array.

Can be tested with:

$ python3 test-vectors.py > expected.csv
$ diff test-vectors.csv expected.csv

On master, the first call fails with

Traceback (most recent call last):
  File "/home/thestack/bips/bip-0340/test-vectors.py", line 267, in <module>
    vector0(),
    ^^^^^^^^^
  File "/home/thestack/bips/bip-0340/test-vectors.py", line 30, in vector0
    pubkey_point = lift_x(pubkey)
                   ^^^^^^^^^^^^^^
  File "/home/thestack/bips/bip-0340/reference.py", line 72, in lift_x
    if x >= p:
       ^^^^^^
TypeError: '>=' not supported between instances of 'bytes' and 'int'

Discussion (0 threads)

Loading discussions...