rust-bitcoin / rust-bitcoin/rust-miniscript
Optimize 1-of-N thresholds to or()s
Nobody has claimed this yet.
- Dominant language
- Rust
- Stars
- 426
- Forks
- 200
- Avg merge
- 7d 17h
- Merged PRs (30d)
- 8
Description
https://github.com/rust-bitcoin/rust-miniscript/pull/113 left out a FIXME that we are unsure to fix at all, opening this to clarify if we want it or not.
We now optimize N-of-N thresholds to and(), and i propose to do the same for 1-of-N thresholds (using or()s). After discussing this with sipa (who implemented this in C++) and @sanket1729 the main issue with the latter seems to be the exponential complexity with the number of or()s.
I personally think (user point of view) that if the complexity growth is only applied on the policy compilation it's fine, as we only ever compile once to miniscript per user and then store the Miniscript Descriptor while the Script size is felt onchain For Ever (™️).
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 this issue and pull request #113, then trace the policy compilation path for N-of-N threshold optimization. Determine whether 1-of-N thresholds should compile to or()s, assess the exponential complexity discussed in the issue, and define a decision or implementation scope with appropriate validation.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- rust
- Domain
- blockchain, compilers
- Issue type
- Refactor
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100