psbt: MuSig2 Fields #31247

pull achow101 wants to merge 3 commits into bitcoin:master from achow101:musig2-psbt changing 3 files +263 −2
  1. achow101 commented at 6:22 pm on November 7, 2024: member

    Implements un/serialization of MuSig2 PSBT fields and prepares PSBT to be able to sign for MuSig2 inputs.

    Split from #29675

  2. psbt: Implement un/ser of musig2 fields 925fdfd67f
  3. rpc: Include MuSig2 fields in decodepsbt abb8228944
  4. psbt: Use specified sighash or SIGHASH_DEFAULT when dummy signing
    When dummy signing for finalizing, use either the specificed sighash, or
    SIGHASH_DEFAULT, rather than always SIGHASH_ALL.
    
    For outputs, just use SIGHASH_DEFAULT.
    8da5ab60b5
  5. DrahtBot commented at 6:22 pm on November 7, 2024: contributor

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

    Code Coverage & Benchmarks

    For details see: https://corecheck.dev/bitcoin/bitcoin/pulls/31247.

    Reviews

    See the guideline for information on the review process.

    Type Reviewers
    ACK theStack

    If your review is incorrectly listed, please react with 👎 to this comment and the bot will ignore it on the next update.

    Conflicts

    Reviewers, this pull request conflicts with the following ones:

    • #21283 (Implement BIP 370 PSBTv2 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.

  6. achow101 marked this as ready for review on Nov 7, 2024
  7. DrahtBot added the label PSBT on Nov 7, 2024
  8. in src/psbt.h:726 in 925fdfd67f outdated
    717@@ -672,6 +718,80 @@ struct PSBTInput
    718                     UnserializeFromVector(s, m_tap_merkle_root);
    719                     break;
    720                 }
    721+                case PSBT_IN_MUSIG2_PARTICIPANT_PUBKEYS:
    722+                {
    723+                    if (!key_lookup.emplace(key).second) {
    724+                        throw std::ios_base::failure("Duplicate Key, input participant pubkeys for an aggregate key already provided");
    725+                    } else if (key.size() != 34) {
    726+                        throw std::ios_base::failure("Input musig2 participants pubkeys aggregate key is more than 33 bytes");
    


    theStack commented at 5:35 pm on November 11, 2024:

    error message nit:

    0                        throw std::ios_base::failure("Input musig2 participants pubkeys aggregate key is not 34 bytes");
    

    (assuming we are refering to the complete size of the key here, including the compact-size type prefix; we seem to do so on other key types like PSBT_IN_TAP_SCRIPT_SIG)


    achow101 commented at 9:13 pm on November 14, 2024:
    If i need to retouch.
  9. theStack approved
  10. theStack commented at 6:09 pm on November 11, 2024: contributor

    Code-review ACK 8da5ab60b58b808d693d251c8605d53ae54ba617

    I’ve prepared a branch for adding the MuSig2 key types to the test framework and adding a functional test that verifies the decodepsbt results on these, feel free to either pull in or ignore (will just open a separate PR after this one is merged then): https://github.com/theStack/bitcoin/tree/202411-test-add_musig2_decodepsbt_test

  11. Sjors commented at 2:21 pm on November 26, 2024: member
    Maybe add https://github.com/bitcoin/bips/blob/master/bip-0373.mediawiki to description (also in the tracking issue, for easier review).
  12. theStack commented at 0:55 am on November 29, 2024: contributor
    Opened a PR for BIP-373 which aims to improve the clarity of some PSBT fields containing pubkeys, which should hopefully also make reviewing this PR a bit easier: https://github.com/bitcoin/bips/pull/1705 (I sometimes had to look at the code first to find out how the specification is really to be interpreted…)
  13. Sdawg84 approved

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-12-30 15:12 UTC

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