rust-bitcoin / rust-bitcoin/rust-miniscript

Tap context: restore d: as unit under MINIMALIF?

Open
#894 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

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

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 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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.