From 9334aa2168425687d9ff9450df2d6f96f1cfd291 Mon Sep 17 00:00:00 2001 From: Oli Date: Thu, 6 Aug 2026 10:26:50 +0200 Subject: [PATCH] bip379: add test vectors from rust-miniscript --- bip-0379.md | 70 +- bip-0379/conflict_from_alloy.txt | 1773 +++ bip-0379/edge_cases.txt | 42 + bip-0379/go.mod | 28 + bip-0379/go.sum | 32 + bip-0379/invalid.txt | 5574 ++++++++ bip-0379/main.go | 863 ++ bip-0379/malleable_from_alloy.txt | 7024 ++++++++++ bip-0379/opcodes.txt | 18185 ++++++++++++++++++++++++++ bip-0379/props_from_rust.tsv | 8199 ++++++++++++ bip-0379/props_from_rust_tap.tsv | 8199 ++++++++++++ bip-0379/redeem.json | 304 + bip-0379/scripts_from_rust.tsv | 8198 ++++++++++++ bip-0379/scripts_from_rust_tap.tsv | 8198 ++++++++++++ bip-0379/valid_8f1e8_from_alloy.txt | 3492 +++++ bip-0379/valid_from_alloy.txt | 5896 +++++++++ 16 files changed, 76076 insertions(+), 1 deletion(-) create mode 100644 bip-0379/conflict_from_alloy.txt create mode 100644 bip-0379/edge_cases.txt create mode 100644 bip-0379/go.mod create mode 100644 bip-0379/go.sum create mode 100644 bip-0379/invalid.txt create mode 100644 bip-0379/main.go create mode 100644 bip-0379/malleable_from_alloy.txt create mode 100644 bip-0379/opcodes.txt create mode 100644 bip-0379/props_from_rust.tsv create mode 100644 bip-0379/props_from_rust_tap.tsv create mode 100644 bip-0379/redeem.json create mode 100644 bip-0379/scripts_from_rust.tsv create mode 100644 bip-0379/scripts_from_rust_tap.tsv create mode 100644 bip-0379/valid_8f1e8_from_alloy.txt create mode 100644 bip-0379/valid_from_alloy.txt diff --git a/bip-0379.md b/bip-0379.md index de48af2ccc..a895928711 100644 --- a/bip-0379.md +++ b/bip-0379.md @@ -393,7 +393,75 @@ paths hit any of the limits. ## Test Vectors -TBD +### Conventions + +One vector per line, no comments. `*.txt` is space separated, `*.tsv` tab +separated. Expressions contain no whitespace. A key argument is a letter +`A`..`Z` standing for the public key of the secret key `0x00…01` … `0x00…1a`, +serialized compressed in P2WSH and x-only in Tapscript. Hash arguments are +literal hex. A type string is the basic type (`B`/`V`/`K`/`W`) plus its +properties (`zondumsfe`) in arbitrary order, so compare sorted. Files with a +`_tap` suffix are Tapscript (`multi_a`, x-only, Schnorr), the others P2WSH. + +### Files + +| File | Lines | Line format | Asserts | +|------|-------|-------------|---------| +| `valid_from_alloy.txt` | 5,896 | ` ` | parses, is a valid top level, has that type | +| `valid_8f1e8_from_alloy.txt` | 3,492 | same | same, corpus of an earlier upstream revision | +| `malleable_from_alloy.txt` | 7,024 | same | parses, but has no `m` property, i.e. is not sane | +| `conflict_from_alloy.txt` | 1,773 | same | parses, but mixes timelock kinds on one path | +| `edge_cases.txt` | 42 | `` | the only hand-written file: `thresh` at `k=1`/`k=n`, `multi` with 1 and 20 keys, all four hash fragments, the timelock boundaries (`499999999`/`500000000`, `4194304`/`4194305`), and the sugar forms | +| `invalid.txt` | 5,574 | `` | must be rejected (mostly type-check failures) | +| `opcodes.txt` | 18,184 | ` ` | as above, plus the max ops of a satisfaction, i.e. the quantity the 201-op limit bounds | +| `props_from_rust[_tap].tsv` | 8,198 + header | `expr script_size op_count sat_witness_elements exec_stack mixed_timelocks non_malleable requires_sig sat_size` | the whole static analysis: type system, timelock mixing, all four resource limits. A two-field row ending in `PARSE_ERR` must be rejected (1,470 of them in the Tapscript file, from the `multi`→`multi_a` substitution) | +| `scripts_from_rust[_tap].tsv` | 8,198 | `\t