Skip to content

BIP459: Add test vectors for cases the current files miss - #8

Closed
fametrano wants to merge 7 commits into
fjahr:fullaggfrom
fametrano:bip459-vectors
Closed

fametrano wants to merge 7 commits into
fjahr:fullaggfrom
fametrano:bip459-vectors

Conversation

@fametrano

@fametrano fametrano commented Oct 25, 2026 •

Copy link
Copy Markdown

This adds BIP459 test vectors for cases the current files miss, without changing the specification. Your rewrite of fullagg already covers NonceAgg, the 31- and 33-byte Verify rows and every NonceGen row but one, so only the rest remains here.

A new file covers SigAgg, and new rows cover NonceGen with a 38-byte extra_in, Sign, PartialSigVerify, tweaking and Sign errors, whose inputs the runner now decodes inside its try. Every new row passes run_test_vectors.py and matches an implementation I maintain, and the bitcoin-core/secp256k1#1754 module wherever its API accepts the input; for bitcoin#1754 I adapted its vector tests to expect a failure at parsing and added a SigAgg test (harnesses and output). The rows for a secnonce value or secret key equal to n are in their own commit, so you can drop it: against a parser that reduces modulo n they add nothing over the zero rows, since n becomes 0 and the zero checks reject it.

Add a vendored copy of the secp256k1lab library (master branch, commit
a265da139aea27386085a2a8760f8698e1bda64e) that the full-aggregation
reference implementation and test vector scripts depend on.
The NonceGen vectors so far use an extra_in of 0 or 32 bytes. Add one
whose extra_in is 38 bytes long.

The SigAgg vectors cover two signers, and a partial signature that is n
or 2^256 - 1, which is not less than n.
run_sign_error_tests decoded the secret key, secnonce, public keys and
public nonces before its try, so a vector whose failure is a decoding
failure stopped the runner instead of passing.

Add a vector in which another signer's R2 is not on the curve, which
makes GetSessionValues fail.
Sign fails if r1, r2 or d is not less than n. The vectors so far covered
only zero values.
Sign: a signer whose untweaked key has odd y. So far only a tweaked key
exercised d' = n - d.

PartialSigVerify: invalid encodings of the signer's R1 and R2 and of
another signer's R1, and a public key that is not on the curve.

Tweak: a tweak of zero, plain and X-only, and an X-only tweak equal to n.
@fametrano

Copy link
Copy Markdown
Author

Rebased on the new fullagg (70d35f8) and cut to what your rewrite does not cover; the description now says what remains.

@fametrano

Copy link
Copy Markdown
Author

Closing: bitcoin#2210 merged BIP459 with the NonceGen and NonceAgg vectors you took from here, and you left the rest out in bitcoin#2210 (comment).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants