bip379: add test vectors from rust-miniscript

This commit is contained in:
Oli committed 2026-11-10 13:03:56 +01:00
1 parent 927b6de991
commit 91fdd5d3aa
18 files changed
+76242 -1

No files matched your search

+110 -1
View File
@@ -405,7 +405,116 @@ paths hit any of the limits.
## Test Vectors ## Test Vectors
TBD ### Conventions
Text files have 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. The limit vectors need more
distinct keys than that and write `K` followed by the secret key in decimal instead
(`K1`, `K2`, …). 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 | `<expr> <type>` | 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, has that type, but has no `m` property, i.e. is not sane |
| `conflict_from_alloy.txt` | 1,773 | same | parses and has that type; combines height- and time-based `after()`, on one spending path in 1,586 lines (not sane) and on alternative `andor` branches in the other 187 (sane) |
| `edge_cases.txt` | 42 | `<expr>` | a 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 | `<expr>` | must be rejected (mostly type-check failures) |
| `opcodes.txt` | 18,185 | `<expr> <type> <ops>` | as above, plus the op count of a satisfaction, see `op_count` below |
| `limits.txt`, `limits_tap.txt` | 8, 2 | `<expr> <limit> <verdict>` | hand-written files: each resource limit at its boundary, `limit` being one of `ops`, `script_size`, `witness_elements` and `stack`. A `within` expression is sane; an `over` expression exceeds that limit by one and must be rejected, by the parser or by the sanity checks |
| `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 static analysis, with the columns described below. 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 | `<expr>\t<script hex>` | the translation table byte for byte, incl. `v:` collapsing into the `VERIFY` opcode and minimal number encoding. `ERR` = no encoding in that context |
| `redeem.json` | 46 cases | JSON | optional satisfaction vectors: `{miniscript, valid, can_sign_N, …}` plus an `identifiers` map of keys, preimages and hashes |
### Resource Columns
This document specifies the resource limits, but not how to count the quantities
they bound, and implementations count them differently. The resource columns of
`props_from_rust[_tap].tsv` and `opcodes.txt` count them as rust-miniscript does:
* `script_size`: the size of the script in bytes, which the translation table
determines, so it does not depend on the implementation.
* `op_count` (`<ops>` in `opcodes.txt`): the non-push opcodes of the script plus the
keys of every `CHECKMULTISIG` a satisfaction executes, i.e. the quantity the 201-op
limit bounds. Tapscript has no op limit, so there the column has no meaning; it
counts a `multi_a` as no ops at all.
* `sat_witness_elements`: the number of witness elements of a satisfaction, plus one
in both contexts. The 100-element limit of P2WSH applies to this column minus one.
* `sat_size`: the size in bytes of a satisfaction, each element including its length
prefix, without the element count. Signatures are assumed to be 73 bytes for ECDSA
and 66 bytes for Schnorr, each including its length prefix.
* `exec_stack`: rust-miniscript's estimate of how many elements the script pushes
above its witness. It is not the exact peak: for a `thresh` it depends on the
order of the sub expressions, and for `or_d` and `multi` it falls short.
`op_count`, `sat_witness_elements` and `sat_size` are the maximum over every
satisfaction the fragment rules allow, including malleable ones, such as the
dissatisfaction of a hash fragment with a 32-byte value that is not the preimage.
Bitcoin Core counts only non-malleable satisfactions, which never dissatisfy a hash
fragment, and does not count the witness script as a witness element. An
implementation that counts like Core reproduces every other column, but differs on
`sat_witness_elements` in every row that has a satisfaction, and on roughly one in
ten op counts and one in five `sat_size` values.
The limits themselves do not depend on how these quantities are counted, as this
document says what each of them includes: `limits[_tap].txt` puts each limit at its
boundary, with expressions that contain no hash fragment.
### Execution
There is a Golang based minimal harness available that executes all test vectors against
the [Go implementation](https://github.com/btcsuite/btcd/pull/2568). It compares every
column of every file except `exec_stack`, as the Go implementation computes the exact
peak instead, and the Tapscript `op_count`. The `mixed_timelocks`, `non_malleable` and
`requires_sig` columns are compared through the sanity checks, which must reject an
expression that any of them disqualifies.
With at least `Go 1.25.0` installed, they can be run with:
```shell
$ cd bip-0379
$ go run main.go
```
### Provenance
The `*.txt` corpora, except the limit vectors, come from rust-miniscript's
`src/miniscript/ms_tests.rs` at `698b97f`. The `*.tsv` tables were extracted from
the same, unmodified commit by a program that prints what the crate computes for
each expression, and cross-checked against an
[independent Go implementation](https://github.com/btcsuite/btcd/pull/2568).
`redeem.json` comes from the Go implementation's end-to-end spend tests.
`limits[_tap].txt` were written for this document, and their verdicts checked
against Bitcoin Core, rust-miniscript and the Go implementation. rust-miniscript
counts the witness script towards the 100-element limit, so it rejects the
`within` vector of that limit.
## Gaps
The generated static-analysis corpora are dominated by `multi`, `sha256`, `after`,
`andor` and `or_d`; `older()`, `ripemd160()`, `hash256()`, `hash160()` and `and_n()` occur
only in the 42 hand-written lines, never in composition.
The following cases are still missing from the static-analysis corpora:
1. `older()` alongside `after()` in the positions `after()` appears in, since
the two differ in the relative/absolute timelock analysis, and the generated
corpora only ever use `after()`.
2. The 1,000 stack element limit in P2WSH, and in Tapscript a `multi_a` at that
limit, which needs a script of 33 KB that not every implementation accepts.
3. The four timelock-mixing combinations of the BIP's own wording (absolute
height with absolute time, relative height with relative time, and the two
legal mixes), which `conflict_from_alloy.txt` covers only for `after()`.
## Backwards Compatibility ## Backwards Compatibility
File diff suppressed because it is too large. Load diff
+42
View File
@@ -0,0 +1,42 @@
thresh(1,pk(A))
and_b(pk(A),s:thresh(1,pk(B)))
or_b(pk(A),s:thresh(1,pk(B)))
and_b(pk(A),s:thresh(1,c:pk_k(B)))
and_v(v:thresh(1,pk(A)),pk(B))
and_b(or_i(pk(A),pk(B)),s:thresh(1,pk(C)))
thresh(1,pk(A),s:pk(B))
thresh(2,pk(A),s:pk(B),s:pk(C),s:pk(D),s:pk(E))
thresh(4,pk(A),s:pk(B),s:pk(C),s:pk(D),s:pk(E))
thresh(5,pk(A),s:pk(B),s:pk(C),s:pk(D),s:pk(E))
multi(1,A)
multi(1,A,B,C,D,E,F,G,H,I,J,K,L,M,N,O,P,Q,R,S,T)
multi(20,A,B,C,D,E,F,G,H,I,J,K,L,M,N,O,P,Q,R,S,T)
multi(15,A,B,C,D,E,F,G,H,I,J,K,L,M,N,O,P,Q,R,S,T)
c:pk_k(A)
c:pk_h(A)
pk(A)
pkh(A)
after(1)
after(2147483647)
after(500000000)
after(499999999)
older(1)
older(4194304)
older(4194305)
older(2147483647)
sha256(926a54995ca48600920a19bf7bc502ca5f2f7d07e6f804c4f00ebf0325084dbc)
hash256(926a54995ca48600920a19bf7bc502ca5f2f7d07e6f804c4f00ebf0325084dbc)
ripemd160(4355a46b19d348dc2f57c046f8ef63d4538ebb93)
hash160(4355a46b19d348dc2f57c046f8ef63d4538ebb93)
and_v(v:pk(A),after(500000000))
or_d(pk(A),and_v(v:pk(B),older(52560)))
andor(pk(A),older(4194305),pk(B))
l:pk(A)
u:pk(A)
and_n(pk(A),pk(B))
tv:pk(A)
and_v(vc:pk_k(A),pk(B))
or_i(and_v(v:pk(A),pk(B)),thresh(1,pk(C)))
thresh(1,or_i(multi(2,A,B,C),pk(D)),s:pk(E),s:pk(F))
thresh(2,or_i(multi(2,A,B,C),pk(D)),s:pk(E),s:pk(F),s:pk(G))
thresh(1,or_d(multi(2,A,B,C),pk(D)),s:pk(E),s:pk(F))
+27
View File
@@ -0,0 +1,27 @@
module bip-379
go 1.26.9
// That commit only exists in the pull request it belongs to (btcsuite/btcd#2592), and the module
// proxy cannot resolve a commit that is not on a branch or tag of the repository, so the very same
// commit is taken from the fork it was pushed from. Once it is merged, this line can go.
replace github.com/btcsuite/btcd/descriptors => github.com/guggero/btcd/descriptors v0.0.0-20261014150212-9c290de17c47
require (
github.com/btcsuite/btcd/address/v2 v2.0.0
github.com/btcsuite/btcd/btcec/v2 v2.5.0
github.com/btcsuite/btcd/chaincfg/v2 v2.0.0
github.com/btcsuite/btcd/chainhash/v2 v2.0.0
// The descriptors module isn't in master yet, see replace directive above.
github.com/btcsuite/btcd/descriptors v0.0.0-00000000000000-000000000000
github.com/btcsuite/btcd/txscript/v2 v2.0.0
github.com/btcsuite/btcd/wire/v2 v2.0.1
)
require (
github.com/btcsuite/btclog v1.0.0 // indirect
github.com/decred/dcrd/crypto/blake256 v1.1.0 // indirect
github.com/decred/dcrd/dcrec/secp256k1/v4 v4.4.1 // indirect
golang.org/x/crypto v0.58.0 // indirect
golang.org/x/sys v0.49.0 // indirect
)
+30
View File
@@ -0,0 +1,30 @@
github.com/btcsuite/btcd/address/v2 v2.0.0 h1:UVu8Hal6Siu4XastFe+JX5JkeBYONbDUIY5E+SVTs6I=
github.com/btcsuite/btcd/address/v2 v2.0.0/go.mod h1:htJK1AtaeK3bKNfZY63ep2oN8LbrI6qvmPGe1vekb3I=
github.com/btcsuite/btcd/btcec/v2 v2.5.0 h1:KioMXOWa76b86sTZZOmbzv/ldaQCmB8KFAyn5PbB8E8=
github.com/btcsuite/btcd/btcec/v2 v2.5.0/go.mod h1:+K/MYXcLBtHEQjRbjHuJChuybk4LCgjdjgRwil+e+Kk=
github.com/btcsuite/btcd/chaincfg/v2 v2.0.0 h1:M/RTtXfXA9odC1RUEOyZFXj/NXKVHPYZXVjb60xTOok=
github.com/btcsuite/btcd/chaincfg/v2 v2.0.0/go.mod h1:rHgHIXYYfn70m25a+BJ9f9z7VZAsTiDQGB2XYaippGQ=
github.com/btcsuite/btcd/chainhash/v2 v2.0.0 h1:PMLlSloHJuEeB80XG9EjpXWNEKAZAMLl6YHZ6YsEuoA=
github.com/btcsuite/btcd/chainhash/v2 v2.0.0/go.mod h1:mKxcZ7oGTXE7IRV+sS9hP4EVBwc/SzfNR+52IsOP9j8=
github.com/btcsuite/btcd/txscript/v2 v2.0.0 h1:pEmmHaC8eRx6KSB63zSVJD7qrit9/c9cLSrw++XrYP8=
github.com/btcsuite/btcd/txscript/v2 v2.0.0/go.mod h1:pZXabc11Xr9nz/18kXY3yErdAajYc3gi28Zqb3KqlFo=
github.com/btcsuite/btcd/wire/v2 v2.0.1 h1:edmb35tvRyQpFp331L9PwZFccaTCOQwevSsU6ra4BR4=
github.com/btcsuite/btcd/wire/v2 v2.0.1/go.mod h1:ENBpJL0JYUNlqvajhIFTOcWGNNumjCynDk4PL0OG58I=
github.com/btcsuite/btclog v1.0.0 h1:sEkpKJMmfGiyZjADwEIgB1NSwMyfdD1FB8v6+w1T0Ns=
github.com/btcsuite/btclog v1.0.0/go.mod h1:w7xnGOhwT3lmrS4H3b/D1XAXxvh+tbhUm8xeHN2y3TQ=
github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c=
github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
github.com/decred/dcrd/crypto/blake256 v1.1.0 h1:zPMNGQCm0g4QTY27fOCorQW7EryeQ/U0x++OzVrdms8=
github.com/decred/dcrd/crypto/blake256 v1.1.0/go.mod h1:2OfgNZ5wDpcsFmHmCK5gZTPcCXqlm2ArzUIkw9czNJo=
github.com/decred/dcrd/dcrec/secp256k1/v4 v4.4.1 h1:5RVFMOWjMyRy8cARdy79nAmgYw3hK/4HUq48LQ6Wwqo=
github.com/decred/dcrd/dcrec/secp256k1/v4 v4.4.1/go.mod h1:ZXNYxsqcloTdSy/rNShjYzMhyjf0LaoftYK0p+A3h40=
github.com/guggero/btcd/descriptors v0.0.0-20261014150212-9c290de17c47 h1:sdjzwKad6JcdMfI8WzNlreFwamBExWgji16hb0/eSGU=
github.com/guggero/btcd/descriptors v0.0.0-20261014150212-9c290de17c47/go.mod h1:+NjkX2D8GN0KtIrBoOxCGBP3hfDUjckntMpUacZstj0=
github.com/stretchr/testify v1.12.1 h1:EuwCh5fleGS7H32xRwO3wRGT7DxrDhLAT6FF8MpWDWE=
github.com/stretchr/testify v1.12.1/go.mod h1:MDEgiDPPsNp5cuIrHPPCyornHKgEVbtFUmoNlxoYthg=
go.yaml.in/yaml/v3 v3.0.5 h1:N6y/pJk8buWs9NY5ERU2HSMfm+IuD/OtfdAnq6kESPw=
go.yaml.in/yaml/v3 v3.0.5/go.mod h1:HVTZu1O7/Vkt2N+BFy8Zza+lnLsABggaTM2ZpNIGuKg=
golang.org/x/crypto v0.58.0 h1:COkYLr4k7nDI4r6QtMML2AfzeIswWHAJthLS6K/M/54=
golang.org/x/crypto v0.58.0/go.mod h1:Xh+kl5A+M0gMiWDytH2Hhr5Z7WbNCpv/eB/EFgfSk+w=
golang.org/x/sys v0.49.0 h1:XbzkgYJHdqh/8m2Uu0W/dQv8nktxx4BFHp1M0gROTXA=
golang.org/x/sys v0.49.0/go.mod h1:hNLxWAXmnKAxqDtdwIYC4bM9oQPEecfsnNMuSxOs3og=
+5574
View File
File diff suppressed because it is too large. Load diff
+8
View File
@@ -0,0 +1,8 @@
and_v(v:after(1),and_v(v:after(1),and_v(v:after(1),and_v(v:after(1),and_v(v:after(1),and_v(v:after(1),and_v(v:after(1),and_v(v:after(1),and_v(v:after(1),and_v(v:after(1),and_v(v:after(1),and_v(v:after(1),and_v(v:after(1),and_v(v:after(1),and_v(v:after(1),and_v(v:after(1),and_v(v:after(1),and_v(v:after(1),and_v(v:after(1),and_v(v:after(1),and_v(v:after(1),and_v(v:after(1),and_v(v:after(1),and_v(v:after(1),and_v(v:after(1),and_v(v:after(1),and_v(v:after(1),and_v(v:after(1),and_v(v:after(1),and_v(v:after(1),and_v(v:after(1),and_v(v:after(1),and_v(v:after(1),and_v(v:after(1),and_v(v:after(1),and_v(v:after(1),and_v(v:after(1),and_v(v:after(1),and_v(v:after(1),and_v(v:after(1),and_v(v:after(1),and_v(v:after(1),and_v(v:after(1),and_v(v:after(1),and_v(v:after(1),and_v(v:after(1),and_v(v:after(1),and_v(v:after(1),and_v(v:after(1),and_v(v:after(1),and_v(v:after(1),and_v(v:after(1),and_v(v:after(1),and_v(v:after(1),and_v(v:after(1),and_v(v:after(1),and_v(v:after(1),and_v(v:after(1),and_v(v:after(1),and_v(v:after(1),and_v(v:after(1),and_v(v:after(1),and_v(v:after(1),and_v(v:after(1),and_v(v:after(1),and_v(v:after(1),and_v(v:after(1),and_v(v:after(1),and_v(v:after(1),and_v(v:after(1),and_v(v:after(1),and_v(v:after(1),and_v(v:after(1),and_v(v:after(1),and_v(v:after(1),and_v(v:after(1),and_v(v:after(1),and_v(v:after(1),and_v(v:after(1),and_v(v:after(1),and_v(v:after(1),and_v(v:after(1),and_v(v:after(1),and_v(v:after(1),and_v(v:after(1),and_v(v:after(1),and_v(v:after(1),and_v(v:after(1),and_v(v:after(1),and_v(v:after(1),and_v(v:after(1),and_v(v:after(1),and_v(v:after(1),and_v(v:after(1),and_v(v:after(1),and_v(v:after(1),and_v(v:after(1),and_v(v:after(1),and_v(v:after(1),and_v(v:after(1),pk(K1))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))) ops within
and_v(v:pk(K2),and_v(v:after(1),and_v(v:after(1),and_v(v:after(1),and_v(v:after(1),and_v(v:after(1),and_v(v:after(1),and_v(v:after(1),and_v(v:after(1),and_v(v:after(1),and_v(v:after(1),and_v(v:after(1),and_v(v:after(1),and_v(v:after(1),and_v(v:after(1),and_v(v:after(1),and_v(v:after(1),and_v(v:after(1),and_v(v:after(1),and_v(v:after(1),and_v(v:after(1),and_v(v:after(1),and_v(v:after(1),and_v(v:after(1),and_v(v:after(1),and_v(v:after(1),and_v(v:after(1),and_v(v:after(1),and_v(v:after(1),and_v(v:after(1),and_v(v:after(1),and_v(v:after(1),and_v(v:after(1),and_v(v:after(1),and_v(v:after(1),and_v(v:after(1),and_v(v:after(1),and_v(v:after(1),and_v(v:after(1),and_v(v:after(1),and_v(v:after(1),and_v(v:after(1),and_v(v:after(1),and_v(v:after(1),and_v(v:after(1),and_v(v:after(1),and_v(v:after(1),and_v(v:after(1),and_v(v:after(1),and_v(v:after(1),and_v(v:after(1),and_v(v:after(1),and_v(v:after(1),and_v(v:after(1),and_v(v:after(1),and_v(v:after(1),and_v(v:after(1),and_v(v:after(1),and_v(v:after(1),and_v(v:after(1),and_v(v:after(1),and_v(v:after(1),and_v(v:after(1),and_v(v:after(1),and_v(v:after(1),and_v(v:after(1),and_v(v:after(1),and_v(v:after(1),and_v(v:after(1),and_v(v:after(1),and_v(v:after(1),and_v(v:after(1),and_v(v:after(1),and_v(v:after(1),and_v(v:after(1),and_v(v:after(1),and_v(v:after(1),and_v(v:after(1),and_v(v:after(1),and_v(v:after(1),and_v(v:after(1),and_v(v:after(1),and_v(v:after(1),and_v(v:after(1),and_v(v:after(1),and_v(v:after(1),and_v(v:after(1),and_v(v:after(1),and_v(v:after(1),and_v(v:after(1),and_v(v:after(1),and_v(v:after(1),and_v(v:after(1),and_v(v:after(1),and_v(v:after(1),and_v(v:after(1),and_v(v:after(1),and_v(v:after(1),and_v(v:after(1),and_v(v:after(1),and_v(v:after(1),pk(K1)))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))) ops over
and_v(v:multi(1,K1,K2,K3,K4,K5,K6,K7,K8,K9,K10,K11,K12,K13,K14,K15,K16,K17,K18,K19,K20),and_v(v:pk(K22),and_v(v:after(1),and_v(v:after(1),and_v(v:after(1),and_v(v:after(1),and_v(v:after(1),and_v(v:after(1),and_v(v:after(1),and_v(v:after(1),and_v(v:after(1),and_v(v:after(1),and_v(v:after(1),and_v(v:after(1),and_v(v:after(1),and_v(v:after(1),and_v(v:after(1),and_v(v:after(1),and_v(v:after(1),and_v(v:after(1),and_v(v:after(1),and_v(v:after(1),and_v(v:after(1),and_v(v:after(1),and_v(v:after(1),and_v(v:after(1),and_v(v:after(1),and_v(v:after(1),and_v(v:after(1),and_v(v:after(1),and_v(v:after(1),and_v(v:after(1),and_v(v:after(1),and_v(v:after(1),and_v(v:after(1),and_v(v:after(1),and_v(v:after(1),and_v(v:after(1),and_v(v:after(1),and_v(v:after(1),and_v(v:after(1),and_v(v:after(1),and_v(v:after(1),and_v(v:after(1),and_v(v:after(1),and_v(v:after(1),and_v(v:after(1),and_v(v:after(1),and_v(v:after(1),and_v(v:after(1),and_v(v:after(1),and_v(v:after(1),and_v(v:after(1),and_v(v:after(1),and_v(v:after(1),and_v(v:after(1),and_v(v:after(1),and_v(v:after(1),and_v(v:after(1),and_v(v:after(1),and_v(v:after(1),and_v(v:after(1),and_v(v:after(1),and_v(v:after(1),and_v(v:after(1),and_v(v:after(1),and_v(v:after(1),and_v(v:after(1),and_v(v:after(1),and_v(v:after(1),and_v(v:after(1),and_v(v:after(1),and_v(v:after(1),and_v(v:after(1),and_v(v:after(1),and_v(v:after(1),and_v(v:after(1),and_v(v:after(1),and_v(v:after(1),and_v(v:after(1),and_v(v:after(1),and_v(v:after(1),and_v(v:after(1),and_v(v:after(1),and_v(v:after(1),and_v(v:after(1),and_v(v:after(1),and_v(v:after(1),and_v(v:after(1),and_v(v:after(1),and_v(v:after(1),pk(K21)))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))) ops within
and_v(v:multi(1,K1,K2,K3,K4,K5,K6,K7,K8,K9,K10,K11,K12,K13,K14,K15,K16,K17,K18,K19,K20),and_v(v:after(1),and_v(v:after(1),and_v(v:after(1),and_v(v:after(1),and_v(v:after(1),and_v(v:after(1),and_v(v:after(1),and_v(v:after(1),and_v(v:after(1),and_v(v:after(1),and_v(v:after(1),and_v(v:after(1),and_v(v:after(1),and_v(v:after(1),and_v(v:after(1),and_v(v:after(1),and_v(v:after(1),and_v(v:after(1),and_v(v:after(1),and_v(v:after(1),and_v(v:after(1),and_v(v:after(1),and_v(v:after(1),and_v(v:after(1),and_v(v:after(1),and_v(v:after(1),and_v(v:after(1),and_v(v:after(1),and_v(v:after(1),and_v(v:after(1),and_v(v:after(1),and_v(v:after(1),and_v(v:after(1),and_v(v:after(1),and_v(v:after(1),and_v(v:after(1),and_v(v:after(1),and_v(v:after(1),and_v(v:after(1),and_v(v:after(1),and_v(v:after(1),and_v(v:after(1),and_v(v:after(1),and_v(v:after(1),and_v(v:after(1),and_v(v:after(1),and_v(v:after(1),and_v(v:after(1),and_v(v:after(1),and_v(v:after(1),and_v(v:after(1),and_v(v:after(1),and_v(v:after(1),and_v(v:after(1),and_v(v:after(1),and_v(v:after(1),and_v(v:after(1),and_v(v:after(1),and_v(v:after(1),and_v(v:after(1),and_v(v:after(1),and_v(v:after(1),and_v(v:after(1),and_v(v:after(1),and_v(v:after(1),and_v(v:after(1),and_v(v:after(1),and_v(v:after(1),and_v(v:after(1),and_v(v:after(1),and_v(v:after(1),and_v(v:after(1),and_v(v:after(1),and_v(v:after(1),and_v(v:after(1),and_v(v:after(1),and_v(v:after(1),and_v(v:after(1),and_v(v:after(1),and_v(v:after(1),and_v(v:after(1),and_v(v:after(1),and_v(v:after(1),and_v(v:after(1),and_v(v:after(1),and_v(v:after(1),and_v(v:after(1),and_v(v:after(1),and_v(v:after(1),and_v(v:after(1),pk(K21)))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))) ops over
and_v(v:multi(1,K1,K2,K3,K4,K5,K6,K7,K8,K9,K10,K11,K12,K13,K14,K15,K16,K17,K18,K19,K20),and_v(v:multi(1,K21,K22,K23,K24,K25,K26,K27,K28,K29,K30,K31,K32,K33,K34,K35,K36,K37,K38,K39,K40),and_v(v:multi(1,K41,K42,K43,K44,K45,K46,K47,K48,K49,K50,K51,K52,K53,K54,K55,K56,K57,K58,K59,K60),and_v(v:multi(1,K61,K62,K63,K64,K65,K66,K67,K68,K69,K70,K71,K72,K73,K74,K75,K76,K77,K78,K79,K80),and_v(v:pk(K101),and_v(v:pk(K102),and_v(v:pk(K103),and_v(v:pk(K104),and_v(v:pk(K105),and_v(v:after(1000),multi(1,K81,K82,K83,K84,K85,K86,K87,K88,K89,K90,K91,K92,K93,K94,K95,K96,K97,K98,K99,K100))))))))))) script_size within
and_v(v:multi(1,K1,K2,K3,K4,K5,K6,K7,K8,K9,K10,K11,K12,K13,K14,K15,K16,K17,K18,K19,K20),and_v(v:multi(1,K21,K22,K23,K24,K25,K26,K27,K28,K29,K30,K31,K32,K33,K34,K35,K36,K37,K38,K39,K40),and_v(v:multi(1,K41,K42,K43,K44,K45,K46,K47,K48,K49,K50,K51,K52,K53,K54,K55,K56,K57,K58,K59,K60),and_v(v:multi(1,K61,K62,K63,K64,K65,K66,K67,K68,K69,K70,K71,K72,K73,K74,K75,K76,K77,K78,K79,K80),and_v(v:pk(K101),and_v(v:pk(K102),and_v(v:pk(K103),and_v(v:pk(K104),and_v(v:pk(K105),and_v(v:after(100000),multi(1,K81,K82,K83,K84,K85,K86,K87,K88,K89,K90,K91,K92,K93,K94,K95,K96,K97,K98,K99,K100))))))))))) script_size over
and_v(v:pk(K1),and_v(v:pk(K2),and_v(v:pk(K3),and_v(v:pk(K4),and_v(v:pk(K5),and_v(v:pk(K6),and_v(v:pk(K7),and_v(v:pk(K8),and_v(v:pk(K9),and_v(v:pk(K10),and_v(v:pk(K11),and_v(v:pk(K12),and_v(v:pk(K13),and_v(v:pk(K14),and_v(v:pk(K15),and_v(v:pk(K16),and_v(v:pk(K17),and_v(v:pk(K18),and_v(v:pk(K19),and_v(v:pk(K20),and_v(v:pk(K21),and_v(v:pk(K22),and_v(v:pk(K23),and_v(v:pk(K24),and_v(v:pk(K25),and_v(v:pk(K26),and_v(v:pk(K27),and_v(v:pk(K28),and_v(v:pk(K29),and_v(v:pk(K30),and_v(v:pk(K31),and_v(v:pk(K32),and_v(v:pk(K33),and_v(v:pk(K34),and_v(v:pk(K35),and_v(v:pk(K36),and_v(v:pk(K37),and_v(v:pk(K38),and_v(v:pk(K39),and_v(v:pk(K40),and_v(v:pk(K41),and_v(v:pk(K42),and_v(v:pk(K43),and_v(v:pk(K44),and_v(v:pk(K45),and_v(v:pk(K46),and_v(v:pk(K47),and_v(v:pk(K48),and_v(v:pk(K49),and_v(v:pk(K50),and_v(v:pk(K51),and_v(v:pk(K52),and_v(v:pk(K53),and_v(v:pk(K54),and_v(v:pk(K55),and_v(v:pk(K56),and_v(v:pk(K57),and_v(v:pk(K58),and_v(v:pk(K59),and_v(v:pk(K60),and_v(v:pk(K61),and_v(v:pk(K62),and_v(v:pk(K63),and_v(v:pk(K64),and_v(v:pk(K65),and_v(v:pk(K66),and_v(v:pk(K67),and_v(v:pk(K68),and_v(v:pk(K69),and_v(v:pk(K70),and_v(v:pk(K71),and_v(v:pk(K72),and_v(v:pk(K73),and_v(v:pk(K74),and_v(v:pk(K75),and_v(v:pk(K76),and_v(v:pk(K77),and_v(v:pk(K78),and_v(v:pk(K79),and_v(v:pk(K80),and_v(v:pk(K81),and_v(v:pk(K82),and_v(v:pk(K83),and_v(v:pk(K84),and_v(v:pk(K85),and_v(v:pk(K86),and_v(v:pk(K87),and_v(v:pk(K88),and_v(v:pk(K89),and_v(v:pk(K90),and_v(v:pk(K91),and_v(v:pk(K92),and_v(v:pk(K93),and_v(v:pk(K94),and_v(v:pk(K95),and_v(v:pk(K96),and_v(v:pk(K97),and_v(v:pk(K98),and_v(v:pk(K99),pk(K100)))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))) witness_elements within
and_v(v:pk(K1),and_v(v:pk(K2),and_v(v:pk(K3),and_v(v:pk(K4),and_v(v:pk(K5),and_v(v:pk(K6),and_v(v:pk(K7),and_v(v:pk(K8),and_v(v:pk(K9),and_v(v:pk(K10),and_v(v:pk(K11),and_v(v:pk(K12),and_v(v:pk(K13),and_v(v:pk(K14),and_v(v:pk(K15),and_v(v:pk(K16),and_v(v:pk(K17),and_v(v:pk(K18),and_v(v:pk(K19),and_v(v:pk(K20),and_v(v:pk(K21),and_v(v:pk(K22),and_v(v:pk(K23),and_v(v:pk(K24),and_v(v:pk(K25),and_v(v:pk(K26),and_v(v:pk(K27),and_v(v:pk(K28),and_v(v:pk(K29),and_v(v:pk(K30),and_v(v:pk(K31),and_v(v:pk(K32),and_v(v:pk(K33),and_v(v:pk(K34),and_v(v:pk(K35),and_v(v:pk(K36),and_v(v:pk(K37),and_v(v:pk(K38),and_v(v:pk(K39),and_v(v:pk(K40),and_v(v:pk(K41),and_v(v:pk(K42),and_v(v:pk(K43),and_v(v:pk(K44),and_v(v:pk(K45),and_v(v:pk(K46),and_v(v:pk(K47),and_v(v:pk(K48),and_v(v:pk(K49),and_v(v:pk(K50),and_v(v:pk(K51),and_v(v:pk(K52),and_v(v:pk(K53),and_v(v:pk(K54),and_v(v:pk(K55),and_v(v:pk(K56),and_v(v:pk(K57),and_v(v:pk(K58),and_v(v:pk(K59),and_v(v:pk(K60),and_v(v:pk(K61),and_v(v:pk(K62),and_v(v:pk(K63),and_v(v:pk(K64),and_v(v:pk(K65),and_v(v:pk(K66),and_v(v:pk(K67),and_v(v:pk(K68),and_v(v:pk(K69),and_v(v:pk(K70),and_v(v:pk(K71),and_v(v:pk(K72),and_v(v:pk(K73),and_v(v:pk(K74),and_v(v:pk(K75),and_v(v:pk(K76),and_v(v:pk(K77),and_v(v:pk(K78),and_v(v:pk(K79),and_v(v:pk(K80),and_v(v:pk(K81),and_v(v:pk(K82),and_v(v:pk(K83),and_v(v:pk(K84),and_v(v:pk(K85),and_v(v:pk(K86),and_v(v:pk(K87),and_v(v:pk(K88),and_v(v:pk(K89),and_v(v:pk(K90),and_v(v:pk(K91),and_v(v:pk(K92),and_v(v:pk(K93),and_v(v:pk(K94),and_v(v:pk(K95),and_v(v:pk(K96),and_v(v:pk(K97),and_v(v:pk(K98),and_v(v:pk(K99),and_v(v:pk(K100),pk(K101))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))) witness_elements over
+2
View File
@@ -0,0 +1,2 @@
and_v(and_v(and_v(and_v(and_v(and_v(and_v(and_v(and_v(and_v(vdv:older(1),and_v(vdv:older(1),vdv:older(1))),and_v(and_v(vdv:older(1),vdv:older(1)),and_v(vdv:older(1),vdv:older(1)))),and_v(and_v(and_v(vdv:older(1),vdv:older(1)),and_v(vdv:older(1),vdv:older(1))),and_v(and_v(vdv:older(1),vdv:older(1)),and_v(vdv:older(1),vdv:older(1))))),and_v(and_v(and_v(and_v(vdv:older(1),vdv:older(1)),and_v(vdv:older(1),vdv:older(1))),and_v(and_v(vdv:older(1),vdv:older(1)),and_v(vdv:older(1),vdv:older(1)))),and_v(and_v(and_v(vdv:older(1),vdv:older(1)),and_v(vdv:older(1),vdv:older(1))),and_v(and_v(vdv:older(1),vdv:older(1)),and_v(vdv:older(1),vdv:older(1)))))),and_v(and_v(and_v(and_v(vdv:older(1),and_v(vdv:older(1),vdv:older(1))),and_v(and_v(vdv:older(1),vdv:older(1)),and_v(vdv:older(1),vdv:older(1)))),and_v(and_v(and_v(vdv:older(1),vdv:older(1)),and_v(vdv:older(1),vdv:older(1))),and_v(and_v(vdv:older(1),vdv:older(1)),and_v(vdv:older(1),vdv:older(1))))),and_v(and_v(and_v(and_v(vdv:older(1),vdv:older(1)),and_v(vdv:older(1),vdv:older(1))),and_v(and_v(vdv:older(1),vdv:older(1)),and_v(vdv:older(1),vdv:older(1)))),and_v(and_v(and_v(vdv:older(1),vdv:older(1)),and_v(vdv:older(1),vdv:older(1))),and_v(and_v(vdv:older(1),vdv:older(1)),and_v(vdv:older(1),vdv:older(1))))))),and_v(and_v(and_v(and_v(and_v(vdv:older(1),and_v(vdv:older(1),vdv:older(1))),and_v(and_v(vdv:older(1),vdv:older(1)),and_v(vdv:older(1),vdv:older(1)))),and_v(and_v(and_v(vdv:older(1),vdv:older(1)),and_v(vdv:older(1),vdv:older(1))),and_v(and_v(vdv:older(1),vdv:older(1)),and_v(vdv:older(1),vdv:older(1))))),and_v(and_v(and_v(and_v(vdv:older(1),vdv:older(1)),and_v(vdv:older(1),vdv:older(1))),and_v(and_v(vdv:older(1),vdv:older(1)),and_v(vdv:older(1),vdv:older(1)))),and_v(and_v(and_v(vdv:older(1),vdv:older(1)),and_v(vdv:older(1),vdv:older(1))),and_v(and_v(vdv:older(1),vdv:older(1)),and_v(vdv:older(1),vdv:older(1)))))),and_v(and_v(and_v(and_v(vdv:older(1),and_v(vdv:older(1),vdv:older(1))),and_v(and_v(vdv:older(1),vdv:older(1)),and_v(vdv:older(1),vdv:older(1)))),and_v(and_v(and_v(vdv:older(1),vdv:older(1)),and_v(vdv:older(1),vdv:older(1))),and_v(and_v(vdv:older(1),vdv:older(1)),and_v(vdv:older(1),vdv:older(1))))),and_v(and_v(and_v(and_v(vdv:older(1),vdv:older(1)),and_v(vdv:older(1),vdv:older(1))),and_v(and_v(vdv:older(1),vdv:older(1)),and_v(vdv:older(1),vdv:older(1)))),and_v(and_v(and_v(vdv:older(1),vdv:older(1)),and_v(vdv:older(1),vdv:older(1))),and_v(and_v(vdv:older(1),vdv:older(1)),and_v(vdv:older(1),vdv:older(1)))))))),and_v(and_v(and_v(and_v(and_v(and_v(vdv:older(1),and_v(vdv:older(1),vdv:older(1))),and_v(and_v(vdv:older(1),vdv:older(1)),and_v(vdv:older(1),vdv:older(1)))),and_v(and_v(and_v(vdv:older(1),vdv:older(1)),and_v(vdv:older(1),vdv:older(1))),and_v(and_v(vdv:older(1),vdv:older(1)),and_v(vdv:older(1),vdv:older(1))))),and_v(and_v(and_v(and_v(vdv:older(1),vdv:older(1)),and_v(vdv:older(1),vdv:older(1))),and_v(and_v(vdv:older(1),vdv:older(1)),and_v(vdv:older(1),vdv:older(1)))),and_v(and_v(and_v(vdv:older(1),vdv:older(1)),and_v(vdv:older(1),vdv:older(1))),and_v(and_v(vdv:older(1),vdv:older(1)),and_v(vdv:older(1),vdv:older(1)))))),and_v(and_v(and_v(and_v(vdv:older(1),and_v(vdv:older(1),vdv:older(1))),and_v(and_v(vdv:older(1),vdv:older(1)),and_v(vdv:older(1),vdv:older(1)))),and_v(and_v(and_v(vdv:older(1),vdv:older(1)),and_v(vdv:older(1),vdv:older(1))),and_v(and_v(vdv:older(1),vdv:older(1)),and_v(vdv:older(1),vdv:older(1))))),and_v(and_v(and_v(and_v(vdv:older(1),vdv:older(1)),and_v(vdv:older(1),vdv:older(1))),and_v(and_v(vdv:older(1),vdv:older(1)),and_v(vdv:older(1),vdv:older(1)))),and_v(and_v(and_v(vdv:older(1),vdv:older(1)),and_v(vdv:older(1),vdv:older(1))),and_v(and_v(vdv:older(1),vdv:older(1)),and_v(vdv:older(1),vdv:older(1))))))),and_v(and_v(and_v(and_v(and_v(vdv:older(1),and_v(vdv:older(1),vdv:older(1))),and_v(and_v(vdv:older(1),vdv:older(1)),and_v(vdv:older(1),vdv:older(1)))),and_v(and_v(and_v(vdv:older(1),vdv:older(1)),and_v(vdv:older(1),vdv:older(1))),and_v(and_v(vdv:older(1),vdv:older(1)),and_v(vdv:older(1),vdv:older(1))))),and_v(and_v(and_v(and_v(vdv:older(1),vdv:older(1)),and_v(vdv:older(1),vdv:older(1))),and_v(and_v(vdv:older(1),vdv:older(1)),and_v(vdv:older(1),vdv:older(1)))),and_v(and_v(and_v(vdv:older(1),vdv:older(1)),and_v(vdv:older(1),vdv:older(1))),and_v(and_v(vdv:older(1),vdv:older(1)),and_v(vdv:older(1),vdv:older(1)))))),and_v(and_v(and_v(and_v(and_v(vdv:older(1),vdv:older(1)),and_v(vdv:older(1),vdv:older(1))),and_v(and_v(vdv:older(1),vdv:older(1)),and_v(vdv:older(1),vdv:older(1)))),and_v(and_v(and_v(vdv:older(1),vdv:older(1)),and_v(vdv:older(1),vdv:older(1))),and_v(and_v(vdv:older(1),vdv:older(1)),and_v(vdv:older(1),vdv:older(1))))),and_v(and_v(and_v(and_v(vdv:older(1),vdv:older(1)),and_v(vdv:older(1),vdv:older(1))),and_v(and_v(vdv:older(1),vdv:older(1)),and_v(vdv:older(1),vdv:older(1)))),and_v(and_v(and_v(vdv:older(1),vdv:older(1)),and_v(vdv:older(1),vdv:older(1))),and_v(and_v(vdv:older(1),vdv:older(1)),and_v(vdv:older(1),vdv:older(1))))))))),and_v(anLine truncated
and_v(and_v(and_v(and_v(and_v(and_v(and_v(and_v(and_v(and_v(vdv:older(1),and_v(vdv:older(1),vdv:older(1))),and_v(and_v(vdv:older(1),vdv:older(1)),and_v(vdv:older(1),vdv:older(1)))),and_v(and_v(and_v(vdv:older(1),vdv:older(1)),and_v(vdv:older(1),vdv:older(1))),and_v(and_v(vdv:older(1),vdv:older(1)),and_v(vdv:older(1),vdv:older(1))))),and_v(and_v(and_v(and_v(vdv:older(1),vdv:older(1)),and_v(vdv:older(1),vdv:older(1))),and_v(and_v(vdv:older(1),vdv:older(1)),and_v(vdv:older(1),vdv:older(1)))),and_v(and_v(and_v(vdv:older(1),vdv:older(1)),and_v(vdv:older(1),vdv:older(1))),and_v(and_v(vdv:older(1),vdv:older(1)),and_v(vdv:older(1),vdv:older(1)))))),and_v(and_v(and_v(and_v(vdv:older(1),and_v(vdv:older(1),vdv:older(1))),and_v(and_v(vdv:older(1),vdv:older(1)),and_v(vdv:older(1),vdv:older(1)))),and_v(and_v(and_v(vdv:older(1),vdv:older(1)),and_v(vdv:older(1),vdv:older(1))),and_v(and_v(vdv:older(1),vdv:older(1)),and_v(vdv:older(1),vdv:older(1))))),and_v(and_v(and_v(and_v(vdv:older(1),vdv:older(1)),and_v(vdv:older(1),vdv:older(1))),and_v(and_v(vdv:older(1),vdv:older(1)),and_v(vdv:older(1),vdv:older(1)))),and_v(and_v(and_v(vdv:older(1),vdv:older(1)),and_v(vdv:older(1),vdv:older(1))),and_v(and_v(vdv:older(1),vdv:older(1)),and_v(vdv:older(1),vdv:older(1))))))),and_v(and_v(and_v(and_v(and_v(vdv:older(1),and_v(vdv:older(1),vdv:older(1))),and_v(and_v(vdv:older(1),vdv:older(1)),and_v(vdv:older(1),vdv:older(1)))),and_v(and_v(and_v(vdv:older(1),vdv:older(1)),and_v(vdv:older(1),vdv:older(1))),and_v(and_v(vdv:older(1),vdv:older(1)),and_v(vdv:older(1),vdv:older(1))))),and_v(and_v(and_v(and_v(vdv:older(1),vdv:older(1)),and_v(vdv:older(1),vdv:older(1))),and_v(and_v(vdv:older(1),vdv:older(1)),and_v(vdv:older(1),vdv:older(1)))),and_v(and_v(and_v(vdv:older(1),vdv:older(1)),and_v(vdv:older(1),vdv:older(1))),and_v(and_v(vdv:older(1),vdv:older(1)),and_v(vdv:older(1),vdv:older(1)))))),and_v(and_v(and_v(and_v(vdv:older(1),and_v(vdv:older(1),vdv:older(1))),and_v(and_v(vdv:older(1),vdv:older(1)),and_v(vdv:older(1),vdv:older(1)))),and_v(and_v(and_v(vdv:older(1),vdv:older(1)),and_v(vdv:older(1),vdv:older(1))),and_v(and_v(vdv:older(1),vdv:older(1)),and_v(vdv:older(1),vdv:older(1))))),and_v(and_v(and_v(and_v(vdv:older(1),vdv:older(1)),and_v(vdv:older(1),vdv:older(1))),and_v(and_v(vdv:older(1),vdv:older(1)),and_v(vdv:older(1),vdv:older(1)))),and_v(and_v(and_v(vdv:older(1),vdv:older(1)),and_v(vdv:older(1),vdv:older(1))),and_v(and_v(vdv:older(1),vdv:older(1)),and_v(vdv:older(1),vdv:older(1)))))))),and_v(and_v(and_v(and_v(and_v(and_v(vdv:older(1),and_v(vdv:older(1),vdv:older(1))),and_v(and_v(vdv:older(1),vdv:older(1)),and_v(vdv:older(1),vdv:older(1)))),and_v(and_v(and_v(vdv:older(1),vdv:older(1)),and_v(vdv:older(1),vdv:older(1))),and_v(and_v(vdv:older(1),vdv:older(1)),and_v(vdv:older(1),vdv:older(1))))),and_v(and_v(and_v(and_v(vdv:older(1),vdv:older(1)),and_v(vdv:older(1),vdv:older(1))),and_v(and_v(vdv:older(1),vdv:older(1)),and_v(vdv:older(1),vdv:older(1)))),and_v(and_v(and_v(vdv:older(1),vdv:older(1)),and_v(vdv:older(1),vdv:older(1))),and_v(and_v(vdv:older(1),vdv:older(1)),and_v(vdv:older(1),vdv:older(1)))))),and_v(and_v(and_v(and_v(vdv:older(1),and_v(vdv:older(1),vdv:older(1))),and_v(and_v(vdv:older(1),vdv:older(1)),and_v(vdv:older(1),vdv:older(1)))),and_v(and_v(and_v(vdv:older(1),vdv:older(1)),and_v(vdv:older(1),vdv:older(1))),and_v(and_v(vdv:older(1),vdv:older(1)),and_v(vdv:older(1),vdv:older(1))))),and_v(and_v(and_v(and_v(vdv:older(1),vdv:older(1)),and_v(vdv:older(1),vdv:older(1))),and_v(and_v(vdv:older(1),vdv:older(1)),and_v(vdv:older(1),vdv:older(1)))),and_v(and_v(and_v(vdv:older(1),vdv:older(1)),and_v(vdv:older(1),vdv:older(1))),and_v(and_v(vdv:older(1),vdv:older(1)),and_v(vdv:older(1),vdv:older(1))))))),and_v(and_v(and_v(and_v(and_v(vdv:older(1),and_v(vdv:older(1),vdv:older(1))),and_v(and_v(vdv:older(1),vdv:older(1)),and_v(vdv:older(1),vdv:older(1)))),and_v(and_v(and_v(vdv:older(1),vdv:older(1)),and_v(vdv:older(1),vdv:older(1))),and_v(and_v(vdv:older(1),vdv:older(1)),and_v(vdv:older(1),vdv:older(1))))),and_v(and_v(and_v(and_v(vdv:older(1),vdv:older(1)),and_v(vdv:older(1),vdv:older(1))),and_v(and_v(vdv:older(1),vdv:older(1)),and_v(vdv:older(1),vdv:older(1)))),and_v(and_v(and_v(vdv:older(1),vdv:older(1)),and_v(vdv:older(1),vdv:older(1))),and_v(and_v(vdv:older(1),vdv:older(1)),and_v(vdv:older(1),vdv:older(1)))))),and_v(and_v(and_v(and_v(and_v(vdv:older(1),vdv:older(1)),and_v(vdv:older(1),vdv:older(1))),and_v(and_v(vdv:older(1),vdv:older(1)),and_v(vdv:older(1),vdv:older(1)))),and_v(and_v(and_v(vdv:older(1),vdv:older(1)),and_v(vdv:older(1),vdv:older(1))),and_v(and_v(vdv:older(1),vdv:older(1)),and_v(vdv:older(1),vdv:older(1))))),and_v(and_v(and_v(and_v(vdv:older(1),vdv:older(1)),and_v(vdv:older(1),vdv:older(1))),and_v(and_v(vdv:older(1),vdv:older(1)),and_v(vdv:older(1),vdv:older(1)))),and_v(and_v(and_v(vdv:older(1),vdv:older(1)),and_v(vdv:older(1),vdv:older(1))),and_v(and_v(vdv:older(1),vdv:older(1)),and_v(vdv:older(1),vdv:older(1))))))))),and_v(anLine truncated
+981
View File
@@ -0,0 +1,981 @@
// Command bip-379 runs the BIP379 miniscript test vectors against
// an independent implementation of miniscript, the one in
// github.com/btcsuite/btcd/descriptors and its miniscript package.
//
// It expects the vector files in its own directory (or in the directory given
// as the only argument) and checks every file it finds there, so a subset of
// them works too:
//
// go run .
//
// Positive vectors must be accepted, negative ones must be rejected. The
// program exits non-zero if any vector fails, after reporting the first few
// failures of each file.
package main
import (
"bufio"
"bytes"
"encoding/hex"
"encoding/json"
"fmt"
"os"
"path/filepath"
"slices"
"strconv"
"strings"
"github.com/btcsuite/btcd/address/v2"
"github.com/btcsuite/btcd/btcec/v2"
"github.com/btcsuite/btcd/btcec/v2/ecdsa"
"github.com/btcsuite/btcd/btcec/v2/schnorr"
"github.com/btcsuite/btcd/chaincfg/v2"
"github.com/btcsuite/btcd/chainhash/v2"
"github.com/btcsuite/btcd/descriptors/miniscript"
"github.com/btcsuite/btcd/txscript/v2"
"github.com/btcsuite/btcd/wire/v2"
)
const (
// maxReported is the number of failures printed per file; the rest are
// only counted.
maxReported = 5
// numKeys is the number of key placeholders (A..Z) the generated
// corpora use.
numKeys = 26
// conflictInsane is the number of conflict_from_alloy.txt lines the
// sanity checks must reject: those with a height based and a time based
// after() on one spending path. The other lines put the two on
// alternative andor branches and are sane, so the count catches a time
// lock analysis that is too strict as well as one that is too lax.
conflictInsane = 1586
// utxoAmount is the value of the output the redeem vectors spend, and
// burnFee what the spending transaction pays as a fee.
utxoAmount = int64(999799)
burnFee = int64(200)
)
var (
// vectorFiles lists every known vector file. A file that is not present
// is reported as missing and skipped.
vectorFiles = []vectorFile{{
name: "valid_from_alloy.txt",
ctx: miniscript.P2WSH,
run: expressions(mustParse),
}, {
name: "valid_8f1e8_from_alloy.txt",
ctx: miniscript.P2WSH,
run: expressions(mustParse),
}, {
name: "malleable_from_alloy.txt",
ctx: miniscript.P2WSH,
run: expressions(mustParseButInsane),
}, {
name: "conflict_from_alloy.txt",
ctx: miniscript.P2WSH,
run: expressions(mustParseSomeInsane),
}, {
name: "edge_cases.txt",
ctx: miniscript.P2WSH,
run: expressions(mustParse),
}, {
name: "opcodes.txt",
ctx: miniscript.P2WSH,
run: expressions(mustParse),
}, {
name: "invalid.txt",
ctx: miniscript.P2WSH,
run: expressions(mustFail),
}, {
name: "limits.txt",
ctx: miniscript.P2WSH,
run: limits,
}, {
name: "limits_tap.txt",
ctx: miniscript.P2TR,
run: limits,
}, {
name: "props_from_rust.tsv",
ctx: miniscript.P2WSH,
run: properties,
}, {
name: "props_from_rust_tap.tsv",
ctx: miniscript.P2TR,
run: properties,
}, {
name: "scripts_from_rust.tsv",
ctx: miniscript.P2WSH,
run: scripts,
}, {
name: "scripts_from_rust_tap.tsv",
ctx: miniscript.P2TR,
run: scripts,
}, {
name: "redeem.json",
ctx: miniscript.P2WSH,
run: redeem,
}}
)
// expectation is what a file of bare expressions asserts about each of its
// lines.
type expectation int
const (
// mustParse means the expression is a valid miniscript in the file's
// context.
mustParse expectation = iota
// mustParseButInsane means the expression is a valid miniscript, but
// one the sanity checks reject: it is malleable, mixes time lock kinds
// or needs no signature.
mustParseButInsane
// mustParseSomeInsane means the expression is a valid miniscript that
// the sanity checks may or may not reject. As the file does not say
// which of its lines are which, only the number of rejected lines is
// compared, against conflictInsane.
mustParseSomeInsane
// mustFail means the expression is not a valid miniscript.
mustFail
)
// vectorFile is one test vector file and the check that exercises it.
type vectorFile struct {
// name is the file name, which is also its identity: the _tap files
// are Tapscript vectors, the others P2WSH ones.
name string
// ctx is the script context the expressions are parsed in.
ctx miniscript.Context
// run performs the file's check, filling in the result.
run func(path string, ctx miniscript.Context, res *result) error
}
// result accumulates the outcome of one vector file, counting the vectors that
// must be accepted and those that must be rejected separately.
type result struct {
// positive and positiveTotal count the vectors that must be accepted.
positive, positiveTotal int
// negative and negativeTotal count the vectors that must be rejected.
negative, negativeTotal int
// skipped counts the vectors this implementation cannot compare, with
// the reason recorded in note.
skipped int
// note is an optional remark printed after the counts.
note string
// failures holds the first maxReported failure messages.
failures []string
}
// pass records a vector that behaved as the file says it should.
func (r *result) pass(positive bool) {
if positive {
r.positive++
r.positiveTotal++
return
}
r.negative++
r.negativeTotal++
}
// fail records a vector that did not.
func (r *result) fail(positive bool, format string, args ...any) {
if positive {
r.positiveTotal++
} else {
r.negativeTotal++
}
if len(r.failures) < maxReported {
r.failures = append(r.failures, fmt.Sprintf(format, args...))
}
}
// failed returns whether any vector of the file did not behave as specified.
func (r *result) failed() bool {
return r.positive != r.positiveTotal || r.negative != r.negativeTotal
}
// counts renders the passed/total counts of the classes the file contains.
func (r *result) counts() string {
pos := fmt.Sprintf("%d/%d", r.positive, r.positiveTotal)
neg := fmt.Sprintf("%d/%d", r.negative, r.negativeTotal)
switch {
case r.negativeTotal == 0:
return pos
case r.positiveTotal == 0:
return neg
default:
return pos + " + " + neg
}
}
// label names the vector classes the file contains.
func (r *result) label() string {
switch {
case r.negativeTotal == 0:
return "positive"
case r.positiveTotal == 0:
return "negative"
default:
return "positive/negative"
}
}
func main() {
dir := "."
if len(os.Args) > 1 {
dir = os.Args[1]
}
if err := run(dir); err != nil {
fmt.Fprintf(os.Stderr, "error: %v\n", err)
os.Exit(1)
}
}
// run checks every vector file found in the given directory and prints one
// line per file plus a summary.
func run(dir string) error {
fmt.Printf("Checking the BIP379 test vectors in %s against\n"+
"github.com/btcsuite/btcd/descriptors/miniscript.\n\n", dir)
width := 0
for _, file := range vectorFiles {
width = max(width, len(file.name))
}
var (
passed, total, skipped int
missing []string
failedFiles int
)
for _, file := range vectorFiles {
path := filepath.Join(dir, file.name)
if _, err := os.Stat(path); err != nil {
missing = append(missing, file.name)
continue
}
res := &result{}
if err := file.run(path, file.ctx, res); err != nil {
return fmt.Errorf("%s: %w", file.name, err)
}
note := res.note
if res.skipped > 0 {
note = fmt.Sprintf("%d skipped, %s", res.skipped, note)
}
if note != "" {
note = " (" + note + ")"
}
fmt.Printf("Testing vectors in %-*s [%s]: %s done%s\n", width,
file.name, res.label(), res.counts(), note)
for _, failure := range res.failures {
fmt.Printf(" FAILED: %s\n", failure)
}
passed += res.positive + res.negative
total += res.positiveTotal + res.negativeTotal
skipped += res.skipped
if res.failed() {
failedFiles++
}
}
fmt.Println()
for _, name := range missing {
fmt.Printf("No vectors found for %s, skipping it.\n", name)
}
if failedFiles > 0 {
return fmt.Errorf("%d of %d vectors failed in %d file(s)",
total-passed, total, failedFiles)
}
fmt.Printf("All %d vectors passed (%d skipped).\n", passed, skipped)
return nil
}
// expressions returns a check for a file that holds one expression per line,
// possibly followed by the expected type and, in opcodes.txt, the op count of a
// satisfaction, both of which are compared.
func expressions(expect expectation) func(string, miniscript.Context,
*result) error {
return func(path string, ctx miniscript.Context, res *result) error {
var insane int
err := eachLine(path, func(line string) {
fields := strings.Fields(line)
expr := fields[0]
// A miniscript that does not parse is never usable, so
// the parse is the positive check in all three cases.
node, err := miniscript.ParseInsane(expr, ctx)
if expect == mustFail {
if err == nil {
res.fail(false, "%s parses but must "+
"not", expr)
return
}
res.pass(false)
return
}
if err != nil {
res.fail(true, "%s: %v", expr, err)
return
}
var problems []string
// The sane parse and the dedicated method must agree
// on whether the expression is sane.
saneErr := node.IsSane()
_, parseErr := miniscript.Parse(expr, ctx)
if (saneErr == nil) != (parseErr == nil) {
problems = append(problems, fmt.Sprintf(
"IsSane says %v, but Parse says %v",
saneErr, parseErr,
))
}
if saneErr != nil {
insane++
}
// The property letters of a type are a set, written in
// no particular order.
if len(fields) > 1 &&
sortLetters(node.Type()) != sortLetters(fields[1]) {
problems = append(problems, fmt.Sprintf(
"type is %s, want %s", node.Type(),
fields[1],
))
}
if len(fields) > 2 {
ops, err := node.MaxSatisfactionOps()
switch {
case err != nil:
problems = append(problems, fmt.Sprintf(
"op count: %v", err,
))
case strconv.Itoa(ops) != fields[2]:
problems = append(problems, fmt.Sprintf(
"op count is %d, want %s", ops,
fields[2],
))
}
}
if len(problems) > 0 {
res.fail(true, "%s: %s", expr,
strings.Join(problems, "; "))
} else {
res.pass(true)
}
// The malleable corpus holds no sane expression at all,
// which is a negative vector of its own; the time lock
// corpus mixes the two, so there only their number is
// compared, below.
if expect == mustParseButInsane {
if saneErr == nil {
res.fail(false, "%s is sane but must "+
"not be", expr)
return
}
res.pass(false)
}
})
if err != nil {
return err
}
// The number of insane lines is a negative vector of its own,
// as no single line can be blamed when it is off.
if expect == mustParseSomeInsane {
res.note = fmt.Sprintf("%d of them are rejected by "+
"the sanity checks", insane)
if insane != conflictInsane {
res.fail(false, "%d expressions are rejected by "+
"the sanity checks, want %d", insane,
conflictInsane)
} else {
res.pass(false)
}
}
return nil
}
}
// sortLetters returns the letters of a type string in sorted order, so that
// two types with the same properties compare equal.
func sortLetters(s string) string {
letters := []rune(s)
slices.Sort(letters)
return string(letters)
}
// limits checks the resource limit vectors: every expression is either within
// all limits of its context, or one step over the limit its line names, so the
// sanity checks must accept or reject it accordingly. An expression over a
// limit may also be rejected by the parse itself, as some implementations make
// the script size limit part of validity.
func limits(path string, ctx miniscript.Context, res *result) error {
return eachLine(path, func(line string) {
fields := strings.Fields(line)
if len(fields) != 3 ||
(fields[2] != "within" && fields[2] != "over") {
res.fail(true, "malformed row: %s", abbreviate(line))
return
}
expr, limit, within := fields[0], fields[1], fields[2] == "within"
_, err := miniscript.Parse(expr, ctx)
switch {
case within && err != nil:
res.fail(true, "%s (%s): %v", abbreviate(expr), limit,
err)
case !within && err == nil:
res.fail(false, "%s is accepted, but exceeds the %s "+
"limit", abbreviate(expr), limit)
default:
res.pass(within)
}
})
}
// abbreviate shortens an expression for a failure message, as the limit vectors
// are thousands of characters long.
func abbreviate(expr string) string {
const maxLen = 60
if len(expr) <= maxLen {
return expr
}
return expr[:maxLen] + "..."
}
// properties compares the static analysis of every expression against the
// columns of a props_from_rust file.
//
// The execution stack column is an estimate that this implementation does not
// reproduce, as it computes the exact peak instead, and the op count is only
// compared in P2WSH, as Tapscript has no op limit. The malleability, signature
// and time lock mixing columns are compared through the sanity checks, which
// must reject an expression that any of the three columns disqualifies.
func properties(path string, ctx miniscript.Context, res *result) error {
res.note = "exec_stack column not compared"
if ctx == miniscript.P2TR {
res.note = "op_count and exec_stack columns not compared"
}
header := true
return eachLine(path, func(line string) {
if header {
header = false
return
}
fields := strings.Split(line, "\t")
expr := fields[0]
// Rows that rust could not parse are a negative vector: this
// implementation must reject them as well.
if len(fields) == 2 && fields[1] == "PARSE_ERR" {
if _, err := miniscript.ParseInsane(expr, ctx); err ==
nil {
res.fail(false, "%s parses but must not", expr)
return
}
res.pass(false)
return
}
if len(fields) != 9 {
res.fail(true, "%s: malformed row with %d fields",
expr, len(fields))
return
}
node, err := miniscript.ParseInsane(expr, ctx)
if err != nil {
res.fail(true, "%s: %v", expr, err)
return
}
var problems []string
compare := func(name string, got int, wantField string) {
want, err := strconv.Atoi(wantField)
if err != nil {
problems = append(problems, fmt.Sprintf(
"%s is not a number: %s", name,
wantField,
))
return
}
if got != want {
problems = append(problems, fmt.Sprintf(
"%s is %d, want %d", name, got, want,
))
}
}
// A satisfaction size of -1 means the expression cannot be
// satisfied at all, which the accessors report as an error.
compareSat := func(name string, got int, err error,
wantField string) {
if wantField == "-1" {
if err == nil {
problems = append(problems, fmt.
Sprintf("%s is %d, want "+
"unsatisfiable", name,
got))
}
return
}
if err != nil {
problems = append(problems, fmt.Sprintf(
"%s is unsatisfiable, want %s", name,
wantField,
))
return
}
compare(name, got, wantField)
}
compare("script_size", node.ScriptLen(), fields[1])
if ctx != miniscript.P2TR {
ops, opsErr := node.MaxSatisfactionOps()
compareSat("op_count", ops, opsErr, fields[2])
}
elements, elementsErr := node.MaxSatisfactionWitnessElements()
compareSat(
"sat_witness_elements", elements, elementsErr,
fields[3],
)
size, sizeErr := node.MaxSatisfactionSize()
compareSat("sat_size", size, sizeErr, fields[8])
// An expression that mixes time lock kinds, that is malleable
// or that can be spent without a signature is not sane. The
// converse does not hold, as the sanity checks also enforce the
// resource limits, so only this direction is compared.
mixed, nonMalleable := fields[5] == "true", fields[6] == "true"
requiresSig := fields[7] == "true"
if (mixed || !nonMalleable || !requiresSig) &&
node.IsSane() == nil {
problems = append(problems, fmt.Sprintf("is sane, but "+
"mixed_timelocks=%v non_malleable=%v "+
"requires_sig=%v", mixed, nonMalleable,
requiresSig))
}
if len(problems) > 0 {
res.fail(true, "%s: %s", expr,
strings.Join(problems, "; "))
return
}
res.pass(true)
})
}
// scripts compiles every expression of a scripts_from_rust file and compares
// the encoded script byte for byte.
func scripts(path string, ctx miniscript.Context, res *result) error {
lookupVar := keyLookup(ctx)
return eachLine(path, func(line string) {
fields := strings.SplitN(line, "\t", 2)
if len(fields) != 2 {
res.fail(true, "malformed row: %s", line)
return
}
expr, want := fields[0], fields[1]
script, err := compile(expr, ctx, lookupVar)
// Rows without an encoding are a negative vector: the
// expression has no script in this context.
if want == "ERR" {
if err == nil {
res.fail(false, "%s encodes to %x but must "+
"not encode", expr, script)
return
}
res.pass(false)
return
}
// Expressions that use the same key twice are rejected when the
// concrete keys are substituted, which is a check of this
// implementation rather than of the vector, so they are not
// compared.
if err != nil && strings.Contains(err.Error(), "duplicate key") {
res.skipped++
res.note = "expressions with duplicate keys"
return
}
if err != nil {
res.fail(true, "%s: %v", expr, err)
return
}
if got := hex.EncodeToString(script); got != want {
res.fail(true, "%s encodes to %s, want %s", expr, got,
want)
return
}
res.pass(true)
})
}
// compile parses an expression, substitutes the concrete key and hash values
// and returns the encoded script.
func compile(expr string, ctx miniscript.Context,
lookupVar func(string) ([]byte, error)) ([]byte, error) {
node, err := miniscript.ParseInsane(expr, ctx)
if err != nil {
return nil, err
}
if err := node.ApplyVars(lookupVar); err != nil {
return nil, err
}
return node.Script()
}
// keyLookup returns the substitution of the key placeholders A..Z, which stand
// for the public keys of the secret keys 0x00..01 to 0x00..1a, serialized
// compressed in P2WSH and x-only in Tapscript. Any other identifier is a hash
// value, which the parser decodes from the expression itself.
func keyLookup(ctx miniscript.Context) func(string) ([]byte, error) {
keys := make(map[string][]byte, numKeys)
for i := 1; i <= numKeys; i++ {
var secret [32]byte
secret[31] = byte(i)
priv, pub := btcec.PrivKeyFromBytes(secret[:])
key := pub.SerializeCompressed()
if ctx == miniscript.P2TR {
key = schnorr.SerializePubKey(priv.PubKey())
}
keys[string(rune('A'+i-1))] = key
}
return func(identifier string) ([]byte, error) {
return keys[identifier], nil
}
}
// redeemVectors is the content of the redeem.json file: the concrete values the
// expressions refer to, and the spending scenarios.
type redeemVectors struct {
Identifiers map[string]string `json:"identifiers"`
TestCases []redeemCase `json:"test_cases"`
}
// redeemCase is one spending scenario: an expression, the keys and preimage the
// spender holds, the sequence of the input, and whether that is enough to spend
// the output.
type redeemCase struct {
Miniscript string `json:"miniscript"`
Comment string `json:"comment"`
Valid bool `json:"valid"`
Sequence uint32 `json:"sequence,omitempty"`
CanSign1 bool `json:"can_sign_1,omitempty"`
CanSign2 bool `json:"can_sign_2,omitempty"`
CanSign3 bool `json:"can_sign_3,omitempty"`
HasPreimage bool `json:"has_preimage,omitempty"`
}
// redeem runs every satisfaction vector as a real spend: it builds the
// P2WSH output the expression describes, has the satisfier produce a witness
// from the assets of the scenario and executes the result in the script engine.
func redeem(path string, _ miniscript.Context, res *result) error {
content, err := os.ReadFile(path)
if err != nil {
return err
}
vectors := &redeemVectors{}
if err := json.Unmarshal(content, vectors); err != nil {
return err
}
res.note = "each spend is executed in the script engine"
for _, testCase := range vectors.TestCases {
err := spend(vectors, testCase)
switch {
case testCase.Valid && err != nil:
res.fail(true, "%s (%s): %v", testCase.Miniscript,
testCase.Comment, err)
case !testCase.Valid && err == nil:
res.fail(false, "%s (%s) can be spent but must not be",
testCase.Miniscript, testCase.Comment)
default:
res.pass(testCase.Valid)
}
}
return nil
}
// spend builds and executes the spend of one satisfaction vector, returning an
// error if the expression cannot be satisfied with the assets of the scenario
// or if the resulting witness does not satisfy the script.
func spend(vectors *redeemVectors, testCase redeemCase) error {
value := func(identifier string) []byte {
raw, err := hex.DecodeString(vectors.Identifiers[identifier])
if err != nil {
return nil
}
return raw
}
node, err := miniscript.Parse(testCase.Miniscript, miniscript.P2WSH)
if err != nil {
return err
}
if err := node.IsSane(); err != nil {
return err
}
err = node.ApplyVars(func(identifier string) ([]byte, error) {
return value(identifier), nil
})
if err != nil {
return err
}
witnessScript, err := node.Script()
if err != nil {
return err
}
// The expression is the witness script of a P2WSH output, which the
// transaction below spends into an OP_RETURN.
addr, err := address.NewAddressWitnessScriptHash(
chainhash.HashB(witnessScript), &chaincfg.TestNet3Params,
)
if err != nil {
return err
}
pkScript, err := txscript.PayToAddrScript(addr)
if err != nil {
return err
}
burnScript, err := txscript.NullDataScript(nil)
if err != nil {
return err
}
input := wire.NewTxIn(&wire.OutPoint{}, nil, nil)
input.Sequence = testCase.Sequence
tx := wire.MsgTx{
Version: 2,
TxIn: []*wire.TxIn{input},
TxOut: []*wire.TxOut{{
Value: utxoAmount - burnFee,
PkScript: burnScript,
}},
}
prevOuts := txscript.NewCannedPrevOutputFetcher(pkScript, utxoAmount)
sigHashes := txscript.NewTxSigHashes(&tx, prevOuts)
sigHash, err := txscript.CalcWitnessSigHash(
witnessScript, sigHashes, txscript.SigHashAll, &tx, 0,
utxoAmount,
)
if err != nil {
return err
}
// The scenario names the keys the spender can sign with as can_sign_N,
// which is the secret key pk_N.
signers := map[string]*btcec.PrivateKey{}
for i, canSign := range []bool{
testCase.CanSign1, testCase.CanSign2, testCase.CanSign3,
} {
if !canSign {
continue
}
secret := value(fmt.Sprintf("pk_%d", i+1))
priv, pub := btcec.PrivKeyFromBytes(secret)
signers[string(pub.SerializeCompressed())] = priv
}
preimage := value("preimage_1")
witness, err := node.Satisfy(&miniscript.Satisfier{
Sign: func(pubKey []byte) ([]byte, bool) {
priv, ok := signers[string(pubKey)]
if !ok {
return nil, false
}
signature := ecdsa.Sign(priv, sigHash).Serialize()
return append(
signature, byte(txscript.SigHashAll),
), true
},
CheckOlder: func(lockTime uint32) (bool, error) {
return miniscript.CheckOlder(
lockTime, tx.Version,
tx.TxIn[0].Sequence,
), nil
},
CheckAfter: func(lockTime uint32) (bool, error) {
return miniscript.CheckAfter(
lockTime, tx.LockTime, tx.TxIn[0].Sequence,
), nil
},
Preimage: func(hashFunc string, hash []byte) ([]byte, bool) {
if !testCase.HasPreimage {
return nil, false
}
switch hashFunc {
case "sha256":
return preimage, bytes.Equal(
hash, chainhash.HashB(preimage),
)
case "ripemd160":
return preimage, bytes.Equal(
hash, address.Hash160(preimage),
)
}
return nil, false
},
})
if err != nil {
return err
}
// The witness of a P2WSH spend is the satisfaction followed by the
// witness script itself.
elements, err := node.MaxSatisfactionWitnessElements()
if err != nil {
return err
}
if len(witness)+1 > elements {
return fmt.Errorf("witness has %d elements, more than the "+
"computed maximum of %d", len(witness)+1, elements)
}
tx.TxIn[0].Witness = append(witness, witnessScript)
engine, err := txscript.NewEngine(
pkScript, &tx, 0, txscript.StandardVerifyFlags, nil, sigHashes,
utxoAmount, prevOuts,
)
if err != nil {
return err
}
return engine.Execute()
}
// eachLine calls the given function for every non-empty line of a file.
func eachLine(path string, fn func(line string)) error {
file, err := os.Open(path)
if err != nil {
return err
}
defer file.Close()
scanner := bufio.NewScanner(file)
scanner.Buffer(make([]byte, 1024*1024), 1024*1024)
for scanner.Scan() {
line := strings.TrimRight(scanner.Text(), "\r")
if strings.TrimSpace(line) == "" {
continue
}
fn(line)
}
if err := scanner.Err(); err != nil {
return fmt.Errorf("reading %s: %w", path, err)
}
return nil
}
File diff suppressed because it is too large. Load diff
+18185
View File
File diff suppressed because it is too large. Load diff
File diff suppressed because it is too large. Load diff
File diff suppressed because it is too large. Load diff
+304
View File
@@ -0,0 +1,304 @@
{
"identifiers": {
"pk_1": "22a47fa09a223f2aa079edf85a7c2d4f8720ee63e502ee2869afab7de234b80c",
"key_1": "02a673638cb9587cb68ea08dbef685c6f2d2a751a8b3c6f2a7e9a4999e6e4bfaf5",
"pk_2": "9106e8d2191b58e6c12f10b70d86ba54396db99ecedffd3c150e72960bd11305",
"key_2": "034a3f8cebf79df4dbaf67db66b4b20d115a1003c1d8863f977d027600b4db175b",
"pk_3": "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
"key_3": "026a04ab98d9e4774ad806e302dddeb63bea16b5cb5f223ee77478e861bb583eb3",
"preimage_1": "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
"h256_1": "e0e77a507412b120f6ede61f62295b1a7b2ff19d3dcc8f7253e51663470c888e",
"h160_1": "b3256e789b42b4e73b0954beb516ec7dfc032dd3",
"h256_2": "926a54995ca48600920a19bf7bc502ca5f2f7d07e6f804c4f00ebf0325084dbc"
},
"test_cases": [
{
"miniscript": "pk(key_1)",
"script_description": "A single key.",
"comment": "key_1 signs.",
"valid": true,
"can_sign_1": true
},
{
"miniscript": "pk(key_1)",
"comment": "No satisfaction (key_1 missing).",
"valid": false
},
{
"miniscript": "or_b(pk(key_1),s:pk(key_2))",
"script_description": "One of two keys (equally likely).",
"comment": "No satisfaction (keys missing).",
"valid": false
},
{
"miniscript": "or_b(pk(key_1),s:pk(key_2))",
"comment": "key_1 signs.",
"valid": true,
"can_sign_1": true
},
{
"miniscript": "or_b(pk(key_1),s:pk(key_2))",
"comment": "key_2 signs.",
"valid": true,
"can_sign_2": true
},
{
"miniscript": "or_b(pk(key_1),s:pk(key_2))",
"comment": "both keys sign.",
"valid": true,
"can_sign_1": true,
"can_sign_2": true
},
{
"miniscript": "and_v(v:pk(key_1),or_d(pk(key_2),older(12960)))",
"script_description": "A user and a 2FA service need to sign off, but after 90 days the user alone is enough.",
"comment": "No satisfaction (keys missing).",
"valid": false
},
{
"miniscript": "and_v(v:pk(key_1),or_d(pk(key_2),older(12960)))",
"comment": "key_1 signs alone before 12960.",
"valid": false,
"sequence": 12959,
"can_sign_1": true
},
{
"miniscript": "and_v(v:pk(key_1),or_d(pk(key_2),older(12960)))",
"comment": "key_1 signs alone, utxo older than 12960.",
"valid": true,
"sequence": 12960,
"can_sign_1": true
},
{
"miniscript": "and_v(v:pk(key_1),or_d(pk(key_2),older(12960)))",
"comment": "key_2 signs alone before 12960.",
"valid": false,
"sequence": 12959,
"can_sign_2": true
},
{
"miniscript": "and_v(v:pk(key_1),or_d(pk(key_2),older(12960)))",
"comment": "key_2 signs alone after 12960.",
"valid": false,
"sequence": 12960,
"can_sign_2": true
},
{
"miniscript": "and_v(v:pk(key_1),or_d(pk(key_2),older(12960)))",
"comment": "Both sign before 12960.",
"valid": true,
"can_sign_1": true,
"can_sign_2": true
},
{
"miniscript": "thresh(3,pk(key_1),s:pk(key_2),s:pk(key_3),sln:older(12960))",
"script_description": "A 3-of-3 that turns into a 2-of-3 after 90 days.",
"comment": "No satisfaction (keys missing).",
"valid": false
},
{
"miniscript": "thresh(3,pk(key_1),s:pk(key_2),s:pk(key_3),sln:older(12960))",
"comment": "All three sign before 12960.",
"valid": true,
"can_sign_1": true,
"can_sign_2": true,
"can_sign_3": true
},
{
"miniscript": "thresh(3,pk(key_1),s:pk(key_2),s:pk(key_3),sln:older(12960))",
"comment": "Only one signs before 12960.",
"valid": false,
"can_sign_1": true
},
{
"miniscript": "thresh(3,pk(key_1),s:pk(key_2),s:pk(key_3),sln:older(12960))",
"comment": "Only two sign before 12960.",
"valid": false,
"can_sign_1": true,
"can_sign_2": true
},
{
"miniscript": "thresh(3,pk(key_1),s:pk(key_2),s:pk(key_3),sln:older(12960))",
"comment": "Only two sign before 12960.",
"valid": false,
"can_sign_1": true,
"can_sign_3": true
},
{
"miniscript": "thresh(3,pk(key_1),s:pk(key_2),s:pk(key_3),sln:older(12960))",
"comment": "Only two sign before 12960.",
"valid": false,
"can_sign_2": true,
"can_sign_3": true
},
{
"miniscript": "thresh(3,pk(key_1),s:pk(key_2),s:pk(key_3),sln:older(12960))",
"comment": "Two sign after 12960.",
"valid": true,
"sequence": 12960,
"can_sign_1": true,
"can_sign_2": true
},
{
"miniscript": "thresh(3,pk(key_1),s:pk(key_2),s:pk(key_3),sln:older(12960))",
"comment": "Two sign after 12960.",
"valid": true,
"sequence": 12960,
"can_sign_1": true,
"can_sign_3": true
},
{
"miniscript": "thresh(3,pk(key_1),s:pk(key_2),s:pk(key_3),sln:older(12960))",
"comment": "One signs after 12960.",
"valid": false,
"sequence": 12960,
"can_sign_1": true
},
{
"miniscript": "thresh(3,pk(key_1),s:pk(key_2),s:pk(key_3),sln:older(12960))",
"comment": "No one signs after 12960.",
"valid": false,
"sequence": 12960
},
{
"miniscript": "andor(pk(key_1),older(1008),pk(key_2))",
"script_description": "The BOLT #3 to_local policy.",
"comment": "No satisfaction (keys missing).",
"valid": false
},
{
"miniscript": "andor(pk(key_1),older(1008),pk(key_2))",
"comment": "key_1 signs before 1008.",
"valid": false,
"can_sign_1": true
},
{
"miniscript": "andor(pk(key_1),older(1008),pk(key_2))",
"comment": "key_1 signs after 1008.",
"valid": true,
"sequence": 1008,
"can_sign_1": true
},
{
"miniscript": "andor(pk(key_1),older(1008),pk(key_2))",
"comment": "key_2 signs before 1008.",
"valid": true,
"can_sign_2": true
},
{
"miniscript": "t:or_c(pk(key_1),and_v(v:pk(key_2),or_c(pk(key_3),v:hash160(h160_1))))",
"script_description": "The BOLT #3 offered HTLC policy",
"comment": "No satisfaction (keys missing).",
"valid": false
},
{
"miniscript": "and_v(v:pk(key_1),sha256(h256_1))",
"script_description": "A key and a preimage.",
"comment": "No satisfaction (keys missing).",
"valid": false
},
{
"miniscript": "and_v(v:pk(key_1),sha256(h256_1))",
"comment": "key_1 but no preimage.",
"valid": false,
"can_sign_1": true
},
{
"miniscript": "and_v(v:pk(key_1),sha256(h256_1))",
"comment": "Preimage but no key_1.",
"valid": false,
"has_preimage": true
},
{
"miniscript": "and_v(v:pk(key_1),sha256(h256_1))",
"comment": "Both key_1 and preimage.",
"valid": true,
"can_sign_1": true,
"has_preimage": true
},
{
"miniscript": "and_v(v:pk(key_1),pk(key_2))",
"script_description": "A 2-of-2 multisig.",
"comment": "No satisfaction (keys missing).",
"valid": false
},
{
"miniscript": "and_b(c:pk_k(key_1),s:pk(key_2))",
"script_description": "a 2-of-2 multisig with boolean logic.",
"comment": "No satisfaction (keys missing).",
"valid": false
},
{
"miniscript": "or_b(pk(key_1),s:pk(key_2))",
"script_description": "A 1-of-2 multisig with boolean logic.",
"comment": "No satisfaction (keys missing).",
"valid": false
},
{
"miniscript": "multi(2,key_1,key_2,key_3)",
"script_description": "A 2-of-3 multisig.",
"comment": "No satisfaction (keys missing).",
"valid": false
},
{
"miniscript": "thresh(1,thresh(2,sha256(h256_2),sc:pk_k(key_2),sc:pk_k(key_3)),sc:pk_k(key_4),sc:pk_k(key_5))",
"script_description": "Nested threshold with preimage and 4 keys.",
"comment": "No satisfaction (keys missing).",
"valid": false
},
{
"miniscript": "and_v(or_c(multi(2,key_1,key_2,key_3),v:sha256(h256_2)),1)",
"script_description": "A 2-of-3 multisig or hash lock with superfluous boolean AND.",
"comment": "No satisfaction (keys missing).",
"valid": false
},
{
"miniscript": "and_v(v:sha256(h256_1),c:pk_k(key_1))",
"script_description": "A hash lock and single key.",
"comment": "No satisfaction (keys missing).",
"valid": false
},
{
"miniscript": "or_d(multi(2,key_1,key_2,key_3),multi(2,key_4,key_5))",
"script_description": "A 2-of-3 multisig or a 2-of-2 multisig.",
"comment": "No satisfaction (keys missing).",
"valid": false
},
{
"miniscript": "or_i(multi(2,key_1,key_2,key_3),multi(2,key_4,key_5))",
"script_description": "A 2-of-3 multisig or a 2-of-2 multisig with IF.",
"comment": "No satisfaction (keys missing).",
"valid": false
},
{
"miniscript": "and_v(v:pk(key_1),or_d(pk(key_2),after(12960)))",
"comment": "No satisfaction (keys missing).",
"valid": false
},
{
"miniscript": "or_d(pk(key_1),and_v(v:pk(key_2),older(0)))",
"comment": "No satisfaction (keys missing).",
"valid": false
},
{
"miniscript": "or_b(pk(key_1),s:pk(key_2))",
"comment": "No satisfaction (keys missing).",
"valid": false
},
{
"miniscript": "andor(pk(key_1),pk(key_2),and_v(v:multi(2,key_3,key_4,key_5),older(2)))",
"comment": "No satisfaction (keys missing).",
"valid": false
},
{
"miniscript": "or_b(and_b(pk(key_1),s:pk(key_2)),s:pk(key_3))",
"comment": "No satisfaction (keys missing).",
"valid": false
},
{
"miniscript": "or_b(and_b(sha256(h256_1),s:pk(key_2)),s:pk(key_3))",
"comment": "No satisfaction (keys missing).",
"valid": false
}
]
}
File diff suppressed because it is too large. Load diff
File diff suppressed because it is too large. Load diff
File diff suppressed because it is too large. Load diff
File diff suppressed because it is too large. Load diff