rust-bitcoin / rust-bitcoin/rust-miniscript

Descriptor::Bare(PkH) string encoding doesn't roundtrip, parsed as Descriptor::Pkh

Open
#890 3 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Rust
Stars
426
Forks
200
Avg merge
7d 17h
Merged PRs (30d)
8

Description

Since Bare descriptors are encoded as just the inner miniscript with no explicit bare() wrapper, Bare descriptors over a PkH miniscript fragment and Pkh descriptors are both encoded as "pkh(KEY)", which always decodes back to a Pkh descriptor.

This isn't terrible because both are semantically equivalent, refer to the same scriptPubKey and can be satisfied using the same assets, but it is surprising and unexpected if you treat descriptor strings as a stable serialization format.

It seems that this conflict is inherent due to the reuse of pkh() for miniscripts/descriptors and the lack of an explicit bare() wrapper so I don’t really have a concrete suggestion, just thought it was worth bringing up.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

No file or test is named. Start by tracing descriptor encoding and parsing for Bare(PkH), Pkh, and the shared pkh() representation; determine where the ambiguity is introduced. Done requires an agreed serialization behavior that round-trips without ambiguity, with the resulting behavior documented or covered by tests.

Written by the indexing model from the issue text.

Assessment

Tech stack
rust
Domain
cryptography
Issue type
Bug
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.