rust-bitcoin / rust-bitcoin/rust-miniscript

Should remove `Display` impl for `semantic::Policy`

Open
#885 5 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

The Display impl for semantic policies is misleading to users because it resembles a compileable policy (and the objects have very similar names). This, combined with the fact that there's no way to go from a Miniscript back to a compileable policy except by abusing lift, encourages people to do this.

Apparently Miniscript Studio has exposed a "lift" button that produces a semantic policy and then stringifies it into a box labeled "policy" that users can attempt to compile from. This will appear to successfully round-trip in many cases but not others, leading to the impression of bugs.

It may be that people want to present the semantic policies to their users in some way, such as a graphical representation. But presenting it as a flat string that resembless a policy is bound to lead to confusion, and we shouldn't support that.


EDIT: To close this issue do bullet points 1-3 from comment below: https://github.com/rust-bitcoin/rust-miniscript/issues/885#issuecomment-3665732418

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

Start by locating the Display implementation for semantic::Policy in the rust-miniscript repository, then read bullets 1–3 in the linked follow-up comment. Done means removing that implementation and completing all three requested points; the issue does not name a specific test to run.

Written by the indexing model from the issue text.

Assessment

Tech stack
rust
Domain
compilers
Issue type
Refactor
Difficulty
3/5
Estimated time
1-2 days
Activity status
Active
Clarity
Mostly clear
Newbie friendliness
55/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.