rust-bitcoin / rust-bitcoin/rust-miniscript
Errors running miniscript on real mainnet transactions
Nobody has claimed this yet.
- Dominant language
- Rust
- Stars
- 426
- Forks
- 200
- Avg merge
- 7d 17h
- Merged PRs (30d)
- 8
Description
We ran miniscript on all p2(w)sh and p2tr script-path inputs from 20 recent mainnet blocks (about 60,000 tx inputs). The program tried to create a miniscript interpreter miniscript::Interpreter::from_txdata() and then print an inferred descriptor string interpreter.inferred_descriptor().
It successfully printed inferred descriptor string in 28820 cases and errored in 31463 cases.
-
During
miniscript::Interpreter::from_txdata(():
Format:
'error message' - transaction tx input no: ScriptPubKey type (tr, wsh, sh) asm of the script (tapscript, witnesscript, etc):The majority (29029 or 92% of all errors) are related to Ordinals/Inscriptions
1.1'parse error: non-minimal datapush': cannot create miniscript::Interpreter - tx 5d414380bb14a0e8980a704f8549ca9106217bcafcdf619dfb1bb2ca7252f226 inp 0: spk_type tr asm OP_PUSHBYTES_32 94ee234a17604d0638a85d586be9205e1edf35d0f00b6eedde1b511a3fd18f27 OP_CHECKSIG OP_0 OP_IF OP_PUSHBYTES_3 6f7264 OP_PUSHBYTES_1 01 OP_PUSHBYTES_24 746578742f706c61696e3b636861727365743d7574662d38 OP_0 OP_PUSHDATA1 7b200d0a20202270223a20226272632d3230222c0d0a2020226f70223a20227472616e73666572222c0d0a2020227469636b223a20226f726469222c0d0a202022616d74223a202231303030220d0a7d OP_ENDIF1.2
'parse error: numeric overflow (number on stack larger than 4 bytes)': cannot create miniscript::Interpreter - tx 58868891a559c5971a9575a18ea5712dfca148700d1cda2a96da55ec2aedad73 inp 0: spk_type tr asm OP_PUSHBYTES_32 117f692257b2331233b5705ce9c682be8719ff1b2b64cbca290bd6faeb54423e OP_CHECKSIG OP_PUSHBYTES_6 0c99fddc8701 OP_DROP OP_0 OP_IF OP_PUSHBYTES_3 6f7264 OP_PUSHBYTES_1 01 OP_PUSHBYTES_24 746578742f706c61696e3b636861727365743d7574662d38 OP_0 OP_PUSHBYTES_53 7b2270223a226272632d3230222c226f70223a226d696e74222c227469636b223a22676d676e222c22616d74223a2231303030227d OP_ENDIFOf the rest, here are the reprepresentative errors and tx inputs for each error type:
1.3
'parse error: invalid opcode OP_ROT': cannot create miniscript::Interpreter - tx 52a63e45de2e037abdbb37a2968e1ab5c9dc4ed9b9cd7e9f36a8f17c442a98ca inp 0: spk_type sh asm OP_DUP 1 OP_EQUAL OP_IF OP_DROP e8e77ff0f0209eff11d5003378980a876c446201 3b47cde0ec9cb66c31b50f6fb243b5ce5a1bdeac OP_ELSE OP_DUP 2 OP_EQUAL OP_IF OP_DROP e8e77ff0f0209eff11d5003378980a876c446201 b32c58ebe49f457cbf97e2920aeaaf28fcd64f72 OP_ELSE OP_DUP 3 OP_EQUAL OP_IF OP_DROP bfa898bb050932e1c536f120ffed8a61d6e7081a 1d7ff464a97d6ea55436cae306ba2ced6e69cc56 OP_ELSE 4 OP_EQUALVERIFY bfa898bb050932e1c536f120ffed8a61d6e7081a f8bebd776c7540c8c44ec409c8e51bd9cf4ee08b OP_ENDIF OP_ENDIF OP_ENDIF OP_ROT OP_HASH160 OP_EQUALVERIFY OP_OVER OP_HASH160 OP_EQUALVERIFY OP_CHECKSIG
(note that for the referenced outpount txid52a63e45de2e037abdbb37a2968e1ab5c9dc4ed9b9cd7e9f36a8f17c442a98ca:0the scriptPubKey type is P2SH, but the input has witness data)1.4
'parse error: unexpected «Drop»': cannot create miniscript::Interpreter - tx 078abba516075253eaab7704b6355bfb8c3360840199c91d088bac60b0566b19 inp 0: spk_type wsh asm OP_DUP OP_HASH160 OP_PUSHBYTES_20 4ba823708e25439e47d6224ed0a09ddb417a4dfc OP_EQUAL OP_IF OP_CHECKSIG OP_ELSE OP_PUSHBYTES_33 02cf43bc4345df3558b458e0a6a8ade949fbfd594a376b45340c02d1e0d2cc3d4d OP_SWAP OP_SIZE OP_PUSHBYTES_1 20 OP_EQUAL OP_NOTIF OP_DROP OP_PUSHNUM_2 OP_SWAP OP_PUSHBYTES_33 036950b4c0ba75eceee919531c2375cc802673b0f1f9d7a813ea070536f3a2cbe2 OP_PUSHNUM_2 OP_CHECKMULTISIG OP_ELSE OP_HASH160 OP_PUSHBYTES_20 edd66bd68d09f36084fe94894f2df982a0da9595 OP_EQUALVERIFY OP_CHECKSIG OP_ENDIF OP_PUSHNUM_1 OP_CSV OP_DROP OP_ENDIF1.5
'parse error: unexpected «Drop»': cannot create miniscript::Interpreter - tx 0214b83c07325f0e9a4f2132f02b1555571b07b2aabd305c93ac01e0e9d70bc7 inp 2: spk_type sh asm OP_DUP 3 OP_EQUAL OP_IF OP_DROP OP_HASH160 a9a9b1ed750f5486fc826df113ed7477a3d87791 OP_EQUALVERIFY OP_DUP OP_HASH160 d3c569451e908ab94539ffbd86e0742f73475d12 OP_EQUALVERIFY OP_CHECKSIG OP_ELSE OP_DUP 4 OP_EQUAL OP_IF OP_DROP OP_HASH160 6e819578707ff98f010795a8e2071eedb7fd5300 OP_EQUALVERIFY OP_DUP OP_HASH160 d3c569451e908ab94539ffbd86e0742f73475d12 OP_EQUALVERIFY OP_CHECKSIG OP_ELSE OP_DUP OP_HASH160 fe720e279e73a145c1b27a9284c644efda435b58 OP_EQUALVERIFY OP_CHECKSIG OP_ENDIF OP_ENDIF
(note that for the referenced outpount txid5e9ad44cc05e33053674eb1f1221d88088362b85b810e9051fa4fcca0d060058:1the scriptPubKey type is P2SH, but the input has witness data)1.6
'parse error: unexpected «Else»': cannot create miniscript::Interpreter - tx b6f7b0b6561c0a7f5f5563c9b257efff0c25ee5b3bf0122c2947e20e713d1fcc inp 0: spk_type wsh asm OP_DUP OP_HASH160 OP_PUSHBYTES_20 56f2c7661463ea13646ba92892d63436301ed5b5 OP_EQUAL OP_IF OP_CHECKSIG OP_ELSE OP_PUSHBYTES_33 0349a7db1b1fe5485c1ae893c23b093178ef1ebe6309b6a6fa2dd3d944d3a24dda OP_SWAP OP_SIZE OP_PUSHBYTES_1 20 OP_EQUAL OP_NOTIF OP_DROP OP_PUSHNUM_2 OP_SWAP OP_PUSHBYTES_33 024dc66c3d3f31447e29e67ba2b0a06f0d47d4622bd69ca07ed2d9e70b014d0866 OP_PUSHNUM_2 OP_CHECKMULTISIG OP_ELSE OP_HASH160 OP_PUSHBYTES_20 c044924e2bca55b66fdf8fad5de34b7c736d34da OP_EQUALVERIFY OP_CHECKSIG OP_ENDIF OP_ENDIF1.7
'parse error: unexpected «EndIf»': cannot create miniscript::Interpreter - tx d165bf83721cb29ce050547d449e85bbf302be4f50339d76115d089f6d290968 inp 0: spk_type wsh asm OP_IF OP_SIZE OP_PUSHBYTES_1 20 OP_EQUALVERIFY OP_SHA256 OP_PUSHBYTES_32 f6bcd6c4978b195bc56cb2db73598a41fce053cc4813581c4dadd096694c43dd OP_EQUALVERIFY OP_DUP OP_HASH160 OP_PUSHBYTES_20 12ef1ccb960ed6443eadc443ad933068099d1ce7 OP_ELSE OP_PUSHBYTES_4 e0b85264 OP_CLTV OP_DROP OP_DUP OP_HASH160 OP_PUSHBYTES_20 f0dda5268cc05e6d46d2bf29af41a5004f682583 OP_ENDIF OP_EQUALVERIFY OP_CHECKSIG1.8
'parse error: invalid opcode OP_DEPTH': cannot create miniscript::Interpreter - tx ac8c783fd4177b7634092d508568d232c71e3762fdf3f68e2f1b0ce2c6f3346d inp 0: spk_type sh asm OP_DEPTH 12 OP_EQUAL OP_IF 11 020e0338c96a8870479f2396c373cc7696ba124e8635d41b0ea581112b67817261 02675333a4e4b8fb51d9d4e22fa5a8eaced3fdac8a8cbf9be8c030f75712e6af99 02896807d54bc55c24981f24a453c60ad3e8993d693732288068a23df3d9f50d48 029e51a5ef5db3137051de8323b001749932f2ff0d34c82e96a2c2461de96ae56c 02a4e1a9638d46923272c266631d94d36bdb03a64ee0e14c7518e49d2f29bc4010 02f8a00b269f8c5e59c67d36db3cdc11b11b21f64b4bffb2815e9100d9aa8daf07 03079e252e85abffd3c401a69b087e590a9b86f33f574f08129ccbd3521ecf516b 03111cf405b627e22135b3b3733a4a34aa5723fb0f58379a16d32861bf576b0ec2 0318f331b3e5d38156da6633b31929c5b220349859cc9ca3d33fb4e68aa0840174 03230dae6b4ac93480aeab26d000841298e3b8f6157028e47b0897c1e025165de1 035abff4281ff00660f99ab27bb53e6b33689c2cd8dcd364bc3c90ca5aea0d71a6 03bd45cddfacf2083b14310ae4a84e25de61e451637346325222747b157446614c 03cc297026b06c71cbfa52089149157b5ff23de027ac5ab781800a578192d17546 03d3bde5d63bdb3a6379b461be64dad45eabff42f758543a9645afd42f6d424828 03ed1e8d5109c9ed66f7941bc53cc71137baa76d50d274bda8d5e8ffbd6e61fe9a 15 OP_ELSE 2016 OP_CHECKSEQUENCEVERIFY OP_DROP 2 03aab896d53a8e7d6433137bbba940f9c521e085dd07e60994579b64a6d992cf79 0291b7d0b1b692f8f524516ed950872e5da10fb1b808b5a526dedc6fed1cf29807 0386aa9372fbab374593466bc5451dc59954e90787f08060964d95c87ef34ca5bb 3 OP_ENDIF OP_CHECKMULTISIG -
During
interpreter.inferred_descriptor():Format:
'error message' - 'sample transaction' 'tx input number':2.1
'non-T miniscript: [K/nduesm]expr_raw_pk_h(0x1f9014a6b82d29068bf4dfc4e4d091af40367475)': failed getting inferred_descriptor - tx 9708697709667c381a3beac59b426a17a46f6ed19069b2ea95e434ddd38ac700 inp 1
(note that the referred output is of theshtype, but the input has witness of 3 elements, with witnesScript beingOP_DUP OP_HASH160 1f9014a6b82d29068bf4dfc4e4d091af40367475 OP_EQUALVERIFY OP_CHECKSIG)2.2
'typecheck: fragment «v:expr_raw_pk_h(f63253ceefdfc04aef4f60e5e6d8f27e883157f5)» cannot wrap a fragment of type K': failed getting inferred_descriptor - tx 7f4f0d92de63d86a868e01b826ea5194ff8eb40cb917f2e04a5e6c78669aa9d1 inp 0
(witnesScript02c2e615c92493ffe61614bf2f01aa2cce1479384d6b934c58b08291d778493bc5 OP_CHECKSIG OP_NOTIF OP_DUP OP_HASH160 f63253ceefdfc04aef4f60e5e6d8f27e883157f5 OP_EQUALVERIFY OP_CHECKSIGVERIFY 788076 OP_CHECKLOCKTIMEVERIFY OP_ELSE 03c3212f10b0a370671d2a6c512e12efcaca377269496f9c2b5b2db517a6006e64 OP_CHECKSIGVERIFY OP_SIZE 32 OP_EQUALVERIFY OP_HASH160 f5394b993627eac914537acdc0cb269eed1db075 OP_EQUAL OP_ENDIF)
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 with the miniscript::Interpreter::from_txdata() and interpreter.inferred_descriptor() entry points named in the report, then reproduce the listed transaction inputs and parse errors. Compare the reported Ordinals, non-minimal push, opcode, and descriptor-inference cases; done should mean the expected handling for these real mainnet scripts is defined and verified by regression coverage.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- rust
- Domain
- blockchain
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 25/100