feat(utxo-lib): improve test coverage for p2tr and p2trMusig#7264
Merged
feat(utxo-lib): improve test coverage for p2tr and p2trMusig#7264
Conversation
0d2d2f5 to
38a3d69
Compare
38a3d69 to
d55c540
Compare
Add the BIP-327 reference implementation for MuSig2 multi-signature protocol including Python code and test vectors. Issue: BTC-2652 1: https://github.com/bitcoin/bips/blob/ab9d5b8/bip-0327/reference.py Co-authored-by: llm-git <llm-git@ttll.de>
This adds a helper to verify that a fixture matches an expected value. Issue: BTC-2652 Co-authored-by: llm-git <llm-git@ttll.de>
This adds a modified version of BIP-0327 reference implementation to support BitGo's legacy p2tr aggregation method. The implementation adds: 1. Support for x-only pubkeys in key aggregation 2. Legacy p2tr aggregation function that converts to x-only format before sorting 3. Enhanced sign and verify functions to handle both pubkey formats 4. Comprehensive test cases to verify both standard MuSig2 (p2trMusig2) and legacy p2tr behavior Issue: BTC-2652 Co-authored-by: llm-git <llm-git@ttll.de>
This commit adds comprehensive documentation to explain the differences between BitGo's legacy p2tr (chains 30, 31) and standard p2trMusig2 (chains 40, 41) address types. It clarifies how their key aggregation algorithms differ, particularly regarding when x-only conversion happens. Additionally, it adds thorough tests with fixtures for both address types to demonstrate their behavior and ensure compatibility. Issue: BTC-2652 Co-authored-by: llm-git <llm-git@ttll.de>
d55c540 to
cb5bed1
Compare
davidkaplanbitgo
approved these changes
Oct 17, 2025
Contributor
davidkaplanbitgo
left a comment
There was a problem hiding this comment.
I dont know how useful having the python fixture generation documentation in here is. Maybe just a link to it is fine
Contributor
Author
The |
lcovar
approved these changes
Oct 20, 2025
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This PR improves test coverage of the p2tr and p2trMusig2 script types.
The implementation ensures consistent behavior across both variants and
includes detailed tests to validate key aggregation, tree structure,
output script generation, and proper key ordering.
Issue: BTC-2652