rust-bitcoin / rust-bitcoin/rust-miniscript

AST Alternative Memory Representations

Open
#286 2 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 types for Policy are kind of annoying because they are "overgeneric". E.g., if I want a a vec of PKs, I have to
first get a vec of keys and then map Policy::Pk over it to convert it to the correct type, and I can't directly cast a Vec to a Vec. And if I did just do a Vec, it's over generic since it could contain a locktime.

It would be really cool if there was a way to be able to compile time limit the polymorphism of the Policy branches so that the
conversions from Pk to Policy::Pk could be done in place.

I'm not sure how to actually solve for this cleanly.

This also applies to miniscript, and there could be some advantages to being able to make homogeneous but cost free vecs in the translation layer.

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 tracing the Policy and miniscript AST type definitions and the translation layer mentioned in the issue. Compare possible compile-time-restricted representations for Policy branches and homogeneous vectors; done requires an agreed design that supports the requested conversions without unnecessary cost.

Written by the indexing model from the issue text.

Assessment

Tech stack
rust
Domain
compilers
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.