rust-bitcoin / rust-bitcoin/rust-miniscript
thresh(N, n subs) is not optimized to And() if N == 1
Nobody has claimed this yet.
- Dominant language
- Rust
- Stars
- 426
- Forks
- 200
- Avg merge
- 7d 17h
- Merged PRs (30d)
- 8
Description
thresh(1, pk) will be compiled to pk OP_CHECKSIG 1 OP_EQUAL. It seems strange at first sight but i believe it'd actually make us panic:
https://github.com/rust-bitcoin/rust-miniscript/blob/42367cf75b0db6c82cabd1343613a5457404aa07/src/policy/compiler.rs#L1003
So maybe it was on purpose (i can't recall, though i introduced this code). Will take a look soon ™️
[self-assignment]
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
Inspect src/policy/compiler.rs around line 1003 and trace how thresh(1, pk) is compiled. Confirm whether the generated script can panic and determine the intended handling for this case. Done means the behavior is understood and the issue's safety or optimization concern has a decided resolution.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- rust
- Domain
- compilers
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 25/100