ElementsProject / elements-miniscript

Creative Commons Zero v1.0 Universal
11 stars 14 forks source link

Simplicity descriptors #50

Closed uncomputable closed 1 year ago

uncomputable commented 1 year ago

Takes ideas from https://github.com/BlockstreamResearch/rust-simplicity/pull/154 and implements Simplicity descriptors as a special kind of script-spend inside a Taproot descriptor. Simplicity and Miniscript can be mixed in the same tree. TapLeafScript is an interface that unifies both worlds. All methods use this interface to work as normal.

apoelstra commented 1 year ago

Some high-level comments:

uncomputable commented 1 year ago

I generalized Simplicity descriptors to multiple leaves which might be mixed with Miniscript.

What is left to do is test the code with the wallet and to implement the max weight calculations. I will also open a PR on rust-simplicity for the "policy fixes", which we have to merge first.

uncomputable commented 1 year ago

Rebased, bumped the MSRV to fix CI, and fixed the sub crates that silently broke.

https://github.com/BlockstreamResearch/rust-simplicity/pull/170 adds the required changes on the Simplicity side. We need to merge that first, but the Miniscript side dictates what we need on the Simplicity side. So we need to look at both PRs.

Right now the control block is broken somehow. I cannot spend UTXOs with my wallet. I will investigate.

apoelstra commented 1 year ago

I don't think we need to merge rust-simplicity 170 first -- we should merge that, update the vendored copy of simplicity, and cut a new release, but for now here we can just keep pointing to your branch in our Cargo.toml. We can fix that in a later PR.

uncomputable commented 1 year ago

Added the FIXME and squashed. I can also confirm that the descriptors work inside the Simplicity wallet if one uses the Simplicity version that is compatible with Elements. Let's merge this and update Cargo.toml later.

apoelstra commented 1 year ago

72fde205f45b2ee050e7309b893f92c749aa7173 does not compile.

00862f06547dfeeb915ac96d700fd5853d0e832f is good otherwise.

uncomputable commented 1 year ago

Now everything should compile. Sorry for that. I should have checked.