Skip to content

Bug: sortedmulti and sortedmulti_a descriptor variants are rejected #57

Description

@Nuhiat-Arefin

Summary

tinyminiscript rejects valid sorted multisig descriptor fragments in both the classic and tapscript families:

  • sortedmulti(...)
  • sortedmulti_a(...)

The current parser has branches for multi and multi_a, but no matching branches for the sorted variants.

Repro 1: classic sortedmulti(...)

wsh(sortedmulti(2,0279be667ef9dcbbac55a06295ce870b07029bfcdb2dce28d959f2815b16f81798,02c6047f9441ed7d6d3045406e95c07cd85c778e4b8cef3ca7abac09b95c709ee5,02f9308a019258c31049344f85f89d5229b531c845836f99b08601f113bce036f9))

Observed rejection:

UnexpectedToken { expected: "0 or 1", found: ("sortedmulti", 5) }

Repro 2: tapscript sortedmulti_a(...)

tr(02a34b99f22c790c4e36b2b3c2c35a36db06226e41c692fc82b8b56ac1c540c5bd,sortedmulti_a(2,50929b74c1a04954b78b4b6035e97a5e078a5a0f28ec96d547bfee9ace803ac0,6db06226e41c692fc82b8b56ac1c540c5bd50929b74c1a04954b78b4b6035e97,442e8300a13cfc307ffaad450d79fd434b05ee7f7a2ea03c0cb5dd7ad4a82e89))

Observed rejection:

UnexpectedToken { expected: "0 or 1", found: ("sortedmulti_a", 71) }

Control

The closely related multi_a(...) form is accepted by the same parser:

tr(02a34b99f22c790c4e36b2b3c2c35a36db06226e41c692fc82b8b56ac1c540c5bd,multi_a(2,50929b74c1a04954b78b4b6035e97a5e078a5a0f28ec96d547bfee9ace803ac0,6db06226e41c692fc82b8b56ac1c540c5bd50929b74c1a04954b78b4b6035e97,442e8300a13cfc307ffaad450d79fd434b05ee7f7a2ea03c0cb5dd7ad4a82e89))

Cross-check

The repros above are parse-accepted and compiled by maintained peers including:

  • rust-miniscript
  • bitcoin/bitcoin
  • embit

and for the classic sortedmulti(...) form also:

  • bitcoinerlab/descriptors
  • NBitcoin
  • elements-miniscript

Why this looks like one bug family

In src/parser/mod.rs, the parser implements explicit branches for multi and multi_a, but there is no corresponding branch for sortedmulti or sortedmulti_a.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions