A few follow-ups for taproot signing #22275

pull sipa wants to merge 4 commits into bitcoin:master from sipa:202106_taproot_sign_followup changing 8 files +34 −21
  1. sipa commented at 0:47 am on June 18, 2021: member

    This addresses a few review comments from #21365 that were left at the time of merge (as well as some from #22166 applying to the commit it shared with #21365).

    I do not think any are blockers for a 22.0 release.

  2. sipa force-pushed on Jun 18, 2021
  3. DrahtBot added the label Consensus on Jun 18, 2021
  4. theStack commented at 1:58 pm on June 18, 2021: member
    Concept ACK
  5. achow101 commented at 7:26 pm on June 18, 2021: member
    aCK 38844bc18492a847a6a3aff000eb0e85571070dd
  6. sipa force-pushed on Jun 18, 2021
  7. sipa commented at 8:28 pm on June 18, 2021: member
    Improved the comment in CKey::SignSchnorr to elaborate on the 3 variants of tweaking (pointed out here).
  8. Sjors commented at 3:46 pm on June 21, 2021: member
    utACK 9336670
  9. theStack approved
  10. theStack commented at 4:53 pm on June 22, 2021: member

    ACK 9336670df5e0b8baa4169f13ba1d242ecae85d26

    Checked that the introduced comments match the logic, verified by review that the code-changes are refactor-only (+ an added sanity check in TaprootBuilder::GetSpendData), built locally, ran unit tests and the functional test feature_taproot.py.

  11. in src/script/sign.cpp:648 in 9336670df5 outdated
    642         CTxIn& txin = mtx.vin[i];
    643         auto coin = coins.find(txin.prevout);
    644         if (coin == coins.end() || coin->second.IsSpent()) {
    645-            have_all_spent_outputs = false;
    646+            txdata.Init(txConst, {}, true);
    647+            break;
    


    jonatack commented at 10:34 am on June 27, 2021:

    2b19345 suggestion

     0@@ -636,11 +636,11 @@ bool SignTransaction(CMutableTransaction& mtx, const SigningProvider* keystore,
     1 
     2     PrecomputedTransactionData txdata;
     3     std::vector<CTxOut> spent_outputs;
     4-    for (unsigned int i = 0; i < mtx.vin.size(); i++) {
     5+    for (unsigned int i = 0; i < mtx.vin.size(); ++i) {
     6         CTxIn& txin = mtx.vin[i];
     7         auto coin = coins.find(txin.prevout);
     8         if (coin == coins.end() || coin->second.IsSpent()) {
     9-            txdata.Init(txConst, {}, true);
    10+            txdata.Init(txConst, /* spent_outputs */ {}, /* force */ true);
    11             break;
    12         } else {
    13             spent_outputs.emplace_back(coin->second.out.nValue, coin->second.out.scriptPubKey);
    14@@ -651,7 +651,7 @@ bool SignTransaction(CMutableTransaction& mtx, const SigningProvider* keystore,
    15     }
    16 
    17     // Sign what we can:
    18-    for (unsigned int i = 0; i < mtx.vin.size(); i++) {
    19+    for (unsigned int i = 0; i < mtx.vin.size(); ++i) {
    20         CTxIn& txin = mtx.vin[i];
    

    sipa commented at 11:42 pm on July 2, 2021:
    Done.
  12. in src/script/interpreter.h:176 in 9336670df5 outdated
    171+     *
    172+     * @param[in]   tx             The transaction for which data is being precomputed.
    173+     * @param[in]   spent_outputs  The CTxOuts being spent, one for each tx.vin, in order
    174+     * @param[in]   force          Precompute data for all optional features, regardless of
    175+     *                             what is in the inputs (used at signing time, when the inputs
    176+     *                             aren't filled in yet). */
    


    jonatack commented at 10:36 am on June 27, 2021:

    8b1d3db suggestion

     0@@ -170,10 +170,10 @@ struct PrecomputedTransactionData
     1     /** Initialize this PrecomputedTransactionData with transaction data.
     2      *
     3      * [@param](/bitcoin-bitcoin/contributor/param/)[in]   tx             The transaction for which data is being precomputed.
     4-     * [@param](/bitcoin-bitcoin/contributor/param/)[in]   spent_outputs  The CTxOuts being spent, one for each tx.vin, in order
     5-     * [@param](/bitcoin-bitcoin/contributor/param/)[in]   force          Precompute data for all optional features, regardless of
     6-     *                             what is in the inputs (used at signing time, when the inputs
     7-     *                             aren't filled in yet). */
     8+     * [@param](/bitcoin-bitcoin/contributor/param/)[in]   spent_outputs  The CTxOuts being spent, one for each tx.vin, in order.
     9+     * [@param](/bitcoin-bitcoin/contributor/param/)[in]   force          Whether to precompute data for all optional features,
    10+     *                             regardless of what is in the inputs (used at signing
    11+     *                             time, when the inputs aren't filled in yet). */
    

    sipa commented at 11:42 pm on July 2, 2021:
    Done.
  13. jonatack commented at 10:41 am on June 27, 2021: member
    ACK 9336670df5e0b8baa4169f13ba1d242ecae85d26
  14. DrahtBot commented at 12:23 pm on June 29, 2021: member

    The following sections might be updated with supplementary metadata relevant to reviewers and maintainers.

    Conflicts

    Reviewers, this pull request conflicts with the following ones:

    • #22558 (psbt: Taproot fields for PSBT by achow101)
    • #22512 (Consolidate XOnlyPubKey lookup hack by achow101)
    • #22440 (Eliminate Signature Checker/Creator Ambiguity w/ LIFETIMEBOUND References by JeremyRubin)
    • #22364 (wallet: Make a tr() descriptor by default by achow101)

    If you consider this pull request important, please also help to review the conflicting pull requests. Ideally, start with the one that should be merged first.

  15. sipa force-pushed on Jul 2, 2021
  16. theStack commented at 9:38 am on July 3, 2021: member
    It seems like after rebasing, the CKey::SignSchnorr comment improvement (previously done in commit https://github.com/bitcoin/bitcoin/commit/8b1d3dbfac899c19ab92e3591157d9f4a8c3ca49) is missing now?
  17. jonatack commented at 9:47 pm on July 4, 2021: member
    ACK per git range-diff 7a49fdc 9336670 f0fb5f8 modulo the missing CKey::SignSchnorr() doxygen improvement as mentioned in #22275#pullrequestreview-698581320
  18. Improve comments in taproot signing logic addb9b5a71
  19. Simplify SignTransaction precomputation loop c7048aae95
  20. Remove default nHashTypeIn arguments to MutableTransactionSignatureCreator
    These were unused except in tests, and were also overlooked when changing
    SIGHASH_ALL -> SIGHASH_DEFAULT.
    d8f4b976d5
  21. Assert that IsComplete() in GetSpendData() 08f57a0057
  22. sipa force-pushed on Aug 20, 2021
  23. sipa commented at 6:30 pm on August 20, 2021: member
    @theStack @jonatack Restored the accidentally deleted comment improvement.
  24. theStack approved
  25. theStack commented at 9:17 pm on August 21, 2021: member

    re-ACK 08f57a0057c58f19cd8ae3de89548d014980478a 🌴

    Checked via git range-diff 9336670d...08f57a00 that since my last ACK, the only changes were jonatack’s suggestions w.r.t. to doxygen comments wording and code style (https://github.com/bitcoin/bitcoin/pull/22275#discussion_r659299734, #22275 (review)) plus the rebase on master.

  26. Zero-1729 commented at 2:02 am on August 22, 2021: contributor

    crACK 08f57a0 🧉

    LGTM, changes check out and taproot tests passed locally.

  27. jonatack commented at 3:39 pm on August 22, 2021: member
    Code review ACK 08f57a0057c58f19cd8ae3de89548d014980478a per git range-diff e9d6eb1 9336670 08f57a0 followed by re-code review per commit to swap context back into memory and debug build/run unit tests + feature_taproot.py as a sanity check
  28. fanquake merged this on Aug 23, 2021
  29. fanquake closed this on Aug 23, 2021

  30. sidhujag referenced this in commit a77514a7e9 on Aug 23, 2021
  31. uvhw commented at 3:44 pm on October 31, 2021: none
  32. DrahtBot locked this on Oct 31, 2022

github-metadata-mirror

This is a metadata mirror of the GitHub repository bitcoin/bitcoin. This site is not affiliated with GitHub. Content is generated from a GitHub metadata backup.
generated: 2024-11-23 09:12 UTC

This site is hosted by @0xB10C
More mirrored repositories can be found on mirror.b10c.me