-
Notifications
You must be signed in to change notification settings - Fork 37.7k
Taproot wallet test vectors (generation+tests) #23394
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
Conversation
514db62
to
7b225a5
Compare
7b225a5
to
b9de4f1
Compare
The following sections might be updated with supplementary metadata relevant to reviewers and maintainers. ConflictsNo conflicts as of last run. |
I'm going to convert this to construct tests in JSON format rather than Mediawiki, and also actually run it in that form directly. |
c7465b9
to
41f002d
Compare
41f002d
to
b9770ac
Compare
22d1f3f
to
5c4550c
Compare
Updated to address bitcoin/bips#1225 (review) |
b9de4f1
to
c35c276
Compare
c35c276
to
19dd87c
Compare
Rebased. |
libsecp256k1's secp256k1_schnorrsig_sign only follows BIP340 exactly if an aux_rand32 argument is passed. When no randomness is used (as is the case in the current codebase here), there is no impact on security between not providing aux_rand32 at all, or providing an empty one. Yet, for repeatability/testability it is simpler to always use an all-zero one.
This does the following: * Adds a rfc6979 argument to test_framework/key.py's sign_ecdsa to select (deterministic) RFC6979-based nonce generation. * Add a flag in feature_taproot.py's framework called "deterministic". * Make the Schnorr signing in feature_taproot.py randomized by default, reverting to the old deterministic (aux_rnd=0x0000...00) behavior if the deterministic context flag is set. * Make the ECDSA signing in feature_taproot.py use RFC6979-based nonces when the deterministic context flag is set (keeping the old randomized behavior otherwise).
19dd87c
to
f1c33ee
Compare
Updated to address bitcoin/bips#1225 (comment). |
Corresponding BIP change was merged: bitcoin/bips#1225 |
Code review ACK f1c33ee |
…tests) f1c33ee tests: implement BIP341 test vectors (Pieter Wuille) ac3037d tests: BIP341 test vector generation (Pieter Wuille) ca83ffc tests: add deterministic signing mode to ECDSA (Pieter Wuille) c98c53f tests: abstract out precomputed BIP341 signature hash elements (Pieter Wuille) a5bde01 tests: give feature_taproot access to sighash preimages (Pieter Wuille) 5140825 tests: add more fields to TaprootInfo (Pieter Wuille) 2478c67 Make signing follow BIP340 exactly w.r.t. aux randomness (Pieter Wuille) Pull request description: This PR adds code to `test/functional/feature_taproot.py` which runs through a (deterministic) scenario covering several aspects of the wallet side of BIP341 (scriptPubKey computation from keys/scripts, control block computation, key path spending), with the ability to output test vectors in mediawiki format based on this scenario. The generated tests are then also included directly in `src/test/script_tests.cpp` and `src/test/script_standard_tests.cpp`. I intend to add these test vectors to BIP341 itself: bitcoin/bips#1225 ACKs for top commit: laanwj: Code review ACK f1c33ee Tree-SHA512: fcf7109539cb214d3190516b205cd32d2b1b452f14aa66f4107acfaa8bfc7d368f626857f1935665a4342eabc0b9ee8aba608a7c0a2494bec0b498e723439c9d
Closing: PR was merged, github didn't detect it |
This PR adds code to
test/functional/feature_taproot.py
which runs through a (deterministic) scenario covering several aspects of the wallet side of BIP341 (scriptPubKey computation from keys/scripts, control block computation, key path spending), with the ability to output test vectors in mediawiki format based on this scenario. The generated tests are then also included directly insrc/test/script_tests.cpp
andsrc/test/script_standard_tests.cpp
.The test vectors generated here were added to BIP341 in bitcoin/bips#1225