Skip to content

Conversation

darosior
Copy link
Member

Initial corpus for the miniscript_decode target added in bitcoin/bitcoin#24147.

Copy link

@Loveu17 Loveu17 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

> `~~~~`

@darosior darosior force-pushed the miniscript_decode_corpus branch from 1404ef1 to 3c2e319 Compare January 31, 2022 11:31
@darosior darosior force-pushed the miniscript_decode_corpus branch from 3c2e319 to 4342f17 Compare February 17, 2022 13:42
laanwj added a commit to bitcoin-core/gui that referenced this pull request Apr 5, 2022
2da94a4 fuzz: add a fuzz target for Miniscript decoding from Script (Antoine Poinsot)
f836999 Miniscript: ops limit and stack size computation (Pieter Wuille)
2e55e88 Miniscript: conversion from script (Pieter Wuille)
1ddaa66 Miniscript: type system, script creation, text notation, tests (Pieter Wuille)
4fe2936 script: expose getter for CScriptNum, add a BuildScript helper (Antoine Poinsot)
f4e289f script: move CheckMinimalPush from interpreter to script.h (Antoine Poinsot)
31ec6ae script: make IsPushdataOp non-static (Antoine Poinsot)

Pull request description:

  Miniscript is a language for writing (a subset of) Bitcoin Scripts in a structured way.

  Miniscript permits:
  - To safely extend the Output Descriptor language to many more scripting features thanks to the typing system (composition).
  - Statical analysis of spending conditions, maximum spending cost of each branch, security properties, third-party malleability.
  - General satisfaction of any correctly typed ("valid" [0]) Miniscript. The satisfaction itself is also analyzable.
  - To extend the possibilities of external signers, because of all of the above and since it carries enough metadata.

  Miniscript guarantees:
  - That for any statically-analyzed as "safe" [0] Script, a witness can be constructed in the bounds of the consensus and standardness rules (standardness complete).
  - That unless the conditions of the Miniscript are met, no witness can be created for the Script (consensus sound).
  - Third-party malleability protection for the satisfaction of a sane Miniscript, which is too complex to summarize here.

  For more details around Miniscript (including the specifications), please refer to the [website](https://bitcoin.sipa.be/miniscript/).

  Miniscript was designed by Pieter Wuille, Andrew Poelstra and Sanket Kanjalkar.
  This PR is an updated and rebased version of #16800. See [the commit history of the Miniscript repository](https://github.com/sipa/miniscript/commits/master) for details about the changes made since September 2019 (TL;DR: bugfixes, introduction of timelock conflicts in the type system, `pk()` and `pkh()` aliases, `thresh_m` renamed to `multi`, all recursive algorithms were made non-recursive).

  This PR is also the first in a series of 3:
  - The first one (here) integrates the backbone of Miniscript.
  - The second one (#24148) introduces support for Miniscript in Output Descriptors, allowing for watch-only support of Miniscript Descriptors in the wallet.
  - The third one (#24149) implements signing for these Miniscript Descriptors, using Miniscript's satisfaction algorithm.

  Note to reviewers:
  - Miniscript is currently defined only for P2WSH. No Taproot yet.
  - Miniscript is different from the policy language (a high-level logical representation of a spending policy). A policy->Miniscript compiler is not included here.
  - The fuzz target included here is more interestingly extended in the 3rd PR to check a script's satisfaction against `VerifyScript`. I think it could be further improved by having custom mutators as we now have for multisig (see bitcoin/bitcoin#23105). A minified corpus of Miniscript Scripts is available at bitcoin-core/qa-assets#85.

  [0] We call "valid" any correctly-typed Miniscript. And "safe" any sane Miniscript, ie one whose satisfaction isn't malleable, which requires a key for any spending path, etc..

ACKs for top commit:
  jb55:
    ACK 2da94a4
  laanwj:
    Light code review ACK 2da94a4 (mostly reviewed the changes to the existing code and build system)

Tree-SHA512: d3ef558436cfcc699a50ad13caf1e776f7d0addddb433ee28ef38f66ea5c3e581382d8c748ccac9b51768e4b95712ed7a6112b0e3281a6551e0f325331de9167
@maflcko maflcko merged commit 9af18a9 into bitcoin-core:main Apr 5, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants