ApplyTweak multiplies gacc by g, which is -1 if an x-only tweak negates
the aggregate public key. In every previous tweak sequence, the product
of all values of g equals the last one. Add a test vector with two
x-only tweaks, of which only the first negates the aggregate public key.
It detects implementations that set gacc to g instead of multiplying it
by g.
PartialSigAgg adds e*g*tacc, where g is -1 if the aggregate public key Q
has an odd Y coordinate. In the previous PartialSigAgg test vectors,
tacc is 0 whenever Q has an odd Y coordinate. Add a test vector with a
plain tweak and an odd Q, generated by gen_vectors_helper.py. It detects
implementations that omit g.
The PartialSigVerify test vector with the partial signature n fails the
verification equation even without the range check. So it does not
detect implementations that omit the range check or that check s > n
instead of s >= n. Change the pubnonces of the test vector such that the
partial signature 0 is valid, keeping the aggregate nonce. Since
n*G = 0*G, the partial signature n then satisfies the verification
equation, and only the range check rejects it. The previous version of
the test vector detects no mistake that the new version does not detect,
so it is replaced rather than kept.
gen_vectors_helper.py computes the new pubnonces.
In the previous NonceGen test vectors, every rand_ consists of the byte
0F repeated 32 times, every present sk of the byte 02 repeated 32 times,
and every pk has an even Y coordinate. Add a test vector whose rand_ and
sk are not a repeated byte and whose pk has an odd Y coordinate. It
detects implementations that reverse the byte order of rand_ or sk, that
replace the first byte of pk with 02, or that use only the first byte of
rand_.
With the last mistake, two NonceGen invocations with the same other
arguments return the same secnonce with probability 1/256, although the
BIP requires that Sign is never executed twice with the same secnonce.
A public key and its negation have the same X coordinate, and their
compressed encodings differ only in the first byte. Add a Sign test
vector with a secnonce generated for the negation of the signer's public
key, and a KeyAgg test vector with a public key and its negation. They
detect implementations that compare public keys only by their X
coordinates, in the public key check of Sign, in GetSecondKey, or in
KeyAggCoeffInternal. Distinct public keys in the previous test vectors
also have distinct X coordinates.
The public key check in Sign ensures that the secret key provided to
Sign is determined when NonceGen is invoked. Comparing only X
coordinates determines the secret key only up to negation.
Add Sign test vectors with k2' = n and k2' = n + 1. Together they
detect implementations that check the secret nonce values only for
zero, that check k2' <= n instead of k2' < n, or that reduce k2' mod n
before checking it for zero. No single value detects the last two:
among values of at least n, checking k2' <= n accepts only n, while
reducing first rejects only n. For k2' = n, the optional correctness
check at the end of Sign also fails, because k2'*G is infinity, so this
vector detects the k2' <= n mistake only in implementations that omit
that check.
Add NonceGen and DeterministicSign test vectors with a 256-byte
message. They detect implementations that encode only the low byte of
len(m); the longest message in the previous test vectors has 38 bytes.
DeterministicSign needs its own vector because it encodes len(m)
separately.
Add Sign test vectors for a secnonce with k2' = 0 and for a secnonce
generated for a different public key. No previous test vector detected
an implementation that checks only k1', or one that omits the public
key check added in 1.0.0-rc.2.
Add test vectors for a single signer, a 4-byte extra_in, and plain and
x-only tweaks in DeterministicSign. They detect implementations that
reject a single signer, encode the length of extra_in as 32 whenever
extra_in is present, or treat every tweak in DeterministicSign as
x-only.
Add a README to the vectors directory. It states that the test vectors
only contain inputs whose length and number meet the specification of
BIP327, and that a test vector should only be added if it detects a
plausible implementation mistake that the other test vectors do not
detect. Name that mistake in the comment of each added test vector.
Co-authored-by: Ferdinando Ametrano <ferdinando@ametrano.net>
All vectors were tested against libsecp256k1, and
all verification vectors were checked against OpenSSL.
A check was also added to the `verify` specification
to reject pubkeys with x or y coordinates greater than
or equal to `p`.
Add a vendored copy of the secp256k1lab library (master branch, commit
a265da139aea27386085a2a8760f8698e1bda64e) that the full-aggregation
reference implementation and test vector scripts depend on.
Add a BIP-352 test vector where a taproot input is spent via the key path with an annex (2-item witness). The annex must be stripped before deciding between key-path and script-path spends, so the input is still eligible and all expected values match the plain key-path case.
The annex is 0x50 followed by the BIP341 NUMS point H, so an implementation that fails to strip it reads it as a control block with the NUMS internal key and wrongly skips the input.
* bip139: wallet metadata format
* bip139: add the Version header to the preamble
* bip139: keep a single psbts field and fix the spend status link
* bip139: fold the version section and bip field into the version value
* bip139: capitalize Bitcoin Core and clarify the change_descriptor note
* bip139: replace the three account birth time fields with birth_block
* bip139: drop descriptor_id and change_descriptor_id
* bip139: drop field aliases, keeping name and labels
* bip139: restrict descriptor and change_descriptor to a string
* bip139: make version, type, descriptor, key, txid, outpoint and tweak mandatory
* bip139: move field definitions to a companion registry
* bip139: add the wallet survey behind these decisions
* bip139: replace the wallet description field with a backup note
* bip139: add the backup date field
* bip139: add the account gap_limit field
* bip139: add the multi_bip380 account type
* bip139: give the bip352_labels range an explicit encoding
* bip139: add a general coin object
* bip139: move signers above the account
* bip139: add signer modality and device records
* bip139: add bip85 application and index
* bip139: add Bitkey to the wallet survey
* bip139: state how to derive birth_block from a creation date
* bip139: define the timestamp format once
* bip139: rename the transaction time field to block_time
* bip139: keep last_height on the account only
* bip139: state that type names the descriptor language
* bip139: drop output_type, the descriptor already states it
* bip139: replace the account active flag with a status enum
* bip139: add mutinynet and scope a backup to one network
* bip139: record that the label gap belongs to BIP-329
* bip139: record that proprietary needs no change
* bip139: make the survey annex-ready
* bip139: record that mainnet mnemonics stay out of scope
* bip139: reword the mnemonic evidence heading
* bip139: correct the birth_block evidence, Sparrow stores a height
* bip139: type and descriptor fit every surveyed wallet
* bip139: correct the addr descriptor solvability note
* bip139: re-assess every partial score against fillability
* bip139: store psbts once at wallet level, reference them per account
* bip139: store transactions once at wallet level, reference them per account
* bip139: txid is the transaction map key, not a field
* bip139: refresh the matrix after the fillability re-assessment
* bip139: electrum holds no bip39 mnemonic at all
* bip139: sp_output.label has no constituency
* bip139: collapse the survey to a two-value scale
* bip139: drop the obsolete partial-score analysis
* bip139: size the matrix field column from the data
* bip139: cut the survey down to the table and its results
* bip139: recompute liana compat against the current draft
* bip139: correct the liana breaking-change count
* bip139: make network mandatory
* bip139: network no longer breaks liana on import
* bip139: render wallet fields as a wrapped table
* bip139: render account fields as a wrapped table
* bip139: render every field section as a wrapped table
* bip139: the registry is part of the bip, not a reference to it
* bip139: drop the registration process from the registry intro
* bip139: put field rationale in the cell, not below the table
* bip139: keep code spans whole when wrapping cells
* bip139: render field tables as preformatted blocks
* bip139: drop link definitions the tables no longer use
* bip139: use a bordered grid for the field tables
* bip139: give birth_block an estimation formula and drop the enum underscore
* bip139: merge silent payment outputs into the coin object
* bip139: restore spend_status and give the sp label scalar a home
* bip139: register the transaction fee field
* bip139: rebuild the survey matrix against the current field set
* bip139: drop survey findings the draft now addresses
* bip139: bar passphrase-protected seeds from bip39_mnemonic
* bip139: record the missing-field decisions in the survey
* bip139: cut the survey down to its revision list and matrix
* bip139: reword the survey as a wallet to field mapping
* bip139: reference the wallet support annex from the spec
* bip139: list the mandatory fields in the registry tables
* bip139: point the spec at the registry as the complete field list
* bip139: spell out mandatory and optional in the registry req column
* bip139: mark only the optional fields in the registry tables
* bip139: retitle and reframe the BIP around moving between wallets
* bip139: call the artefact an export throughout
* bip139: scope the mnemonic advice to exports kept as backups
* bip139: say that most metadata cannot be recovered from the chain
* bip139: clarify account and signer metadata fields
* bip139: cut the registry cells back to the field description
* bip139: reword the registry field descriptions
* bip139: give the device record its own registry table
* bip139: keep an unknown enum value from failing the import
* bip139: define the device transports field
* bip139: point the devices row at the device object
* bip139: backup -> export in README
* bip139: clarify export fields and remove survey annex
* bip139: Drop Version header in absence of Changelog
The upgradeable rules list the to_sign version, NOPs reserved for
upgrades and segwit versions above 1. BIP341 and BIP342 also reserve
unknown leaf versions, OP_SUCCESSx, unknown public key types and the
annex for upgrades. A verifier that follows the BIP322 text calls a
signature using any of them valid. Name them, so that these give the
inconclusive state like the other upgrade mechanisms.
Bump the version to 2.1.0 and add a changelog entry.
Add 342 to Requires.
Add a vendored copy of the secp256k1lab library (master branch, commit
a265da139aea27386085a2a8760f8698e1bda64e) that the half-aggregation
reference implementation and test vector scripts depend on.
Since 977300d timestamps.json is a single JSON object whose children are
nested recursively in extensions arrays, with valid and comment only on the
leaves, but the README still described a flat array of objects with a
header_chain entry.