rust-bitcoin / rust-bitcoin/rust-miniscript
Tap context: restore d: as unit under MINIMALIF?
Nobody has claimed this yet.
- Dominant language
- Rust
- Stars
- 426
- Forks
- 200
- Avg merge
- 7d 17h
- Merged PRs (30d)
- 8
Description
Hey!
While working on Taproot support for bitcoinerlab and comparing other implementations, I noticed a typing difference.
In tapscript, MINIMALIF is consensus (BIP342), so d: can be unit.
I know you removed the u property from d globally in 2022 as the safe fix. Now that MINIMALIF is consensus in Tap, would you be open to restoring unit only for Tap?
I think this could be a small change: add a minimal_if() flag on ScriptContext (default false, Tap true) and a cast_dupif_minimal_if that sets corr.unit = true, used when minimal_if().
Drafted changes here: https://github.com/rust-bitcoin/rust-miniscript/compare/master...landabaso:rust-miniscript:tap-dupif-unit
Happy to open a PR if this is the right direction. Don't want to churn if the current behavior is intentional and I don't know your codebase very well.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by reading the ScriptContext handling for Taproot and the existing d: typing behavior, then compare the linked tap-dupif-unit draft. Trace how cast_dupif behavior is selected by context and confirm the expected distinction between tapscript MINIMALIF and non-Tap contexts. Done means d: is unit in Tap while existing non-Tap behavior remains unchanged.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- rust
- Domain
- cryptography
- Issue type
- Feature
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 45/100