Skip to content

feat: output descriptors in contract params#272

Closed
Kukks wants to merge 6 commits intonextfrom
descriptor-contract-params
Closed

feat: output descriptors in contract params#272
Kukks wants to merge 6 commits intonextfrom
descriptor-contract-params

Conversation

@Kukks
Copy link
Copy Markdown
Contributor

@Kukks Kukks commented Jan 31, 2026

Summary

This PR introduces output descriptors as the storage format for public keys in contract parameters, laying the groundwork for HD wallet support.

Key changes:

  • Add descriptor utility functions (isDescriptor, normalizeToDescriptor, extractPubKey, parseHDDescriptor)
  • Add DescriptorProvider interface for abstracting HD vs static key implementations
  • Add StaticDescriptorProvider class to wrap legacy Identity implementations
  • Update DefaultContractHandler to use string descriptors instead of Uint8Array for pubkeys
  • Add walletDescriptor field to PathContext (deprecating walletPubKey)

Backwards compatibility:

  • Legacy hex pubkeys are auto-normalized to tr(pubkey) format on read
  • walletPubKey field still works but is marked deprecated
  • All existing tests pass without modification

Test plan

  • All 296 unit tests pass
  • Build succeeds with no type errors
  • Descriptor serialization/deserialization round-trips correctly
  • Legacy hex pubkeys auto-upgrade to descriptor format

Kukks added 6 commits January 31, 2026 12:12
- isDescriptor(): checks if string is tr(...) format
- normalizeToDescriptor(): wraps hex pubkey as tr(pubkey)
- extractPubKey(): extracts pubkey from simple descriptor
- parseHDDescriptor(): parses HD descriptor components

Enables backwards compatibility for legacy hex pubkeys.
Interface for signing with output descriptors, abstracting
HD vs static key implementations.
Wraps existing Identity implementations to provide DescriptorProvider
interface with static tr(pubkey) descriptors.
- Change DefaultContractParams to use string descriptors instead of Uint8Array
- Add normalizeToDescriptor() for backwards compatibility with hex pubkeys
- Update serializeParams/deserializeParams for descriptor format
- Update test helpers to use valid secp256k1 public keys
- All existing tests pass with the new format
- Add walletDescriptor field to PathContext (preferred over walletPubKey)
- Mark walletPubKey as @deprecated with migration note
- Update resolveRole to use walletDescriptor with fallback to walletPubKey
- Handle descriptor-to-pubkey extraction for role matching
@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai bot commented Jan 31, 2026

Important

Review skipped

Auto reviews are disabled on base/target branches other than the default branch.

🗂️ Base branches to auto review (1)
  • next-version

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

  • 🔍 Trigger a full review
✨ Finishing touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch descriptor-contract-params

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@Kukks
Copy link
Copy Markdown
Contributor Author

Kukks commented Jan 31, 2026

Closing - PR #271 now contains these changes and is properly based on #270 (hd-wallet-support).

@Kukks Kukks closed this Jan 31, 2026
@Kukks Kukks reopened this Jan 31, 2026
@Kukks Kukks closed this Jan 31, 2026
@Kukks Kukks deleted the descriptor-contract-params branch January 31, 2026 13:07
@Kukks Kukks restored the descriptor-contract-params branch January 31, 2026 19:35
@Kukks Kukks deleted the descriptor-contract-params branch February 1, 2026 21:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant