Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Merged

Conversation

theStack
Copy link
Contributor

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'

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
```
@murchandamus murchandamus added Proposed BIP modification Pending acceptance This BIP modification requires sign-off by the champion of the BIP being modified Bug fix labels Dec 20, 2024
@murchandamus
Copy link
Contributor

cc: @real-or-random, @jonasnick, @sipa

Copy link
Contributor

@real-or-random real-or-random left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

utACK 7d921e3 This was apparently overlooked in
3998dbb

Thanks!

Copy link
Contributor

@jonasnick jonasnick left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ACK 7d921e3

Thanks @theStack

@murchandamus murchandamus merged commit 665712c into bitcoin:master Dec 23, 2024
4 checks passed
@murchandamus murchandamus added Bug fix and removed Pending acceptance This BIP modification requires sign-off by the champion of the BIP being modified Bug fix labels Dec 23, 2024
@theStack theStack deleted the fix-bip0340-test-vector-gen_lift_x branch December 23, 2024 21:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants