Skip to content
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

Spend to Taproot #91

Merged
merged 56 commits into from
Jun 6, 2024
Merged

Spend to Taproot #91

merged 56 commits into from
Jun 6, 2024

Conversation

bucko13
Copy link
Contributor

@bucko13 bucko13 commented May 3, 2024

Includes a few fixes:

  • don't polyfill process env for trezor environment variables in @caravan/wallets
  • cleanup some dependencies in @caravan/wallets
  • remove unexported PSBTv0 modules from @caravan/psbt
  • work to support bitcoinjs-lib v6 in @caravan/psbt
  • Adding support to @caravan/psbt for taproot address outputs

TODO:

  • use new tx creation from @caravan/psbt to support paying tr addresses
  • new tooling for validateMultisigSignature which extracts the matching public key (?)
  • Fix failing tests
  • More changesets documenting the changes
  • Coordinator should have regtest support
  • Might need more robust address validation

NOTE: the diff looks a little bigger than it is because the tiny-secp256k1 library was vendor-ized. See updated readme in @caravan/psbt for more details

@bucko13 bucko13 self-assigned this May 3, 2024
Copy link

changeset-bot bot commented May 3, 2024

🦋 Changeset detected

Latest commit: 24c5c5b

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 6 packages
Name Type
@caravan/psbt Minor
@caravan/bitcoin Minor
@caravan/wallets Minor
@caravan/multisig Major
caravan-coordinator Minor
@caravan/eslint-config Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

Copy link

vercel bot commented May 3, 2024

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
caravan-coordinator ✅ Ready (Inspect) Visit Preview 💬 Add feedback Jun 6, 2024 7:13pm

Copy link
Contributor

@Shadouts Shadouts left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code looks good. Comments here are mostly nits. I'm still concerned with the major version increment I commented about on my previous review. Ideally, more changes (many) should be collected and released together as a major increment, or we consider changes to the serialized psbt (a v0-compatible psbt) as not being a breaking change.

packages/caravan-bitcoin/src/psbtv2.test.ts Outdated Show resolved Hide resolved
packages/caravan-psbt/src/functions.test.ts Show resolved Hide resolved
import { bufferize } from "../functions";
import BigNumber from "bignumber.js";

bitcoin.initEccLib(ecc);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

How long does this take? This line here will initialize ecc when any script runs which imports this module. Is that appropriate? Would it be better to only initialize this inside of a function or class initialization which would be using it?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

that's a good question. I haven't noticed any performance impact and this is the way it's demoed in the bitcoinjs-lib docs. Let me see if initializing in the functions works. It feels clunkier having to do that every time but maybe worth it (and at least in our libs we can abstract that complexity from consumers of caravan).

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd like to punt on this now if that's ok. given this is how it's done in the examples it should be ok. But when they hopefully fix some of the other issues with this initialization method, that might be a good opportunity to clean this up, maybe with a singleton factory that can check if it's already initialized.

packages/caravan-psbt/src/psbtv2/psbtv2.test.ts Outdated Show resolved Hide resolved
packages/caravan-psbt/src/psbtv2/psbtv2.ts Show resolved Hide resolved
packages/multisig/src/types.ts Show resolved Hide resolved
@bucko13
Copy link
Contributor Author

bucko13 commented Jun 3, 2024

I'm still concerned with the major version increment I commented about on my previous review.

@Shadouts version change to caravan/bitcoin converted to minor: 37d46d6

@bucko13 bucko13 requested a review from Shadouts June 3, 2024 21:06
Shadouts
Shadouts previously approved these changes Jun 3, 2024
dylan-thompson
dylan-thompson previously approved these changes Jun 6, 2024
Copy link
Contributor

@dylan-thompson dylan-thompson left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Spend to taproot works and I haven't found any regressions. Nice work!

A spend to taproot test for the test suite would be nice but not a blocker.

@bucko13 bucko13 dismissed stale reviews from dylan-thompson and Shadouts via 24c5c5b June 6, 2024 19:09
@bucko13 bucko13 merged commit 0d81717 into main Jun 6, 2024
4 checks passed
@github-actions github-actions bot mentioned this pull request Jun 6, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants