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>
The self-test reads time.clock_gettime_ns(time.CLOCK_MONOTONIC) for
extra_in on even iterations. CPython documents both symbols
"Availability: Unix", so the attribute lookup raises AttributeError on
Windows and python3 reference.py does not run there.
Take extra_in from secrets instead, at a random length, so the self-test
also exercises extra_in of varying length. time has no other use in the
file, so its import goes too.
- An error test vector doesn’t specify the InvalidContributionError type
- In *DeterministicSign*, use GetXonlyPubkey instead of GetPubkey
- The key_agg_and_tweak fn doesn’t specify the return type
- In partial_sig_verify_internal, the pubkey arg should be PlainPk
- Remove unused enumerate() fn calls
- In test_sign_verify, add an additional assert statement