@smartledger/bsv 8.3.1 → 9.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (169) hide show
  1. package/CHANGELOG.md +228 -0
  2. package/README.md +152 -1031
  3. package/STABILITY.md +134 -0
  4. package/bsv-gdaf.min.js +58 -53
  5. package/bsv-ltp.min.js +23 -18
  6. package/bsv-script-helper.min.js +1 -1
  7. package/bsv-smartcontract.min.js +21 -21
  8. package/bsv.bundle.js +58 -53
  9. package/bsv.d.ts +0 -4
  10. package/bsv.min.js +58 -53
  11. package/docs/BRC220_BATCH_LEAF_AMENDMENT.md +82 -7
  12. package/docs/MODULE_REFERENCE_COMPLETE.md +27 -27
  13. package/docs/README.md +2 -1
  14. package/docs/THREAT_MODEL.md +10 -2
  15. package/docs/advanced/UTXO_MANAGER_GUIDE.md +1 -1
  16. package/docs/getting-started/INSTALLATION.md +23 -23
  17. package/docs/getting-started/QUICK_START.md +7 -7
  18. package/docs/migration/FROM_BSV_1_5_6.md +5 -5
  19. package/docs/proposals/10.0.0-package-split.md +131 -0
  20. package/index.js +15 -26
  21. package/lib/block/merkleblock.js +19 -5
  22. package/lib/covenant/helpers.js +34 -35
  23. package/lib/covenant/pushtx.js +2 -2
  24. package/lib/custom-script-helper.js +0 -16
  25. package/lib/hdprivatekey.js +15 -0
  26. package/lib/ordinals/ordlock.js +1 -1
  27. package/lib/script/interpreter.js +109 -1
  28. package/lib/smart_contract/builder.js +14 -0
  29. package/lib/smart_contract/debugger.js +2 -2
  30. package/lib/smart_contract/dsl.js +2 -2
  31. package/lib/smart_contract/index.js +0 -3
  32. package/lib/smart_contract/locks.js +1 -41
  33. package/lib/smart_contract/pels.js +1 -1
  34. package/lib/smart_contract/token.js +1 -1
  35. package/lib/util/deprecate.js +159 -0
  36. package/package.json +19 -82
  37. package/tools/gen-brc220-batch-vector.js +205 -0
  38. package/version.js +1 -1
  39. package/.mocharc.json +0 -5
  40. package/test/address.js +0 -629
  41. package/test/block/block.js +0 -239
  42. package/test/block/blockheader.js +0 -270
  43. package/test/block/merkleblock.js +0 -207
  44. package/test/build/bundle_crypto_shim.js +0 -104
  45. package/test/build/bundle_externals.js +0 -125
  46. package/test/build/bundle_smoke.js +0 -55
  47. package/test/build/esbuild_main.js +0 -65
  48. package/test/build/esm_wrapper.js +0 -73
  49. package/test/build/exports_resolution.js +0 -84
  50. package/test/build/version_sync.js +0 -14
  51. package/test/cli/smoke.js +0 -261
  52. package/test/consensus/base58-vectors.js +0 -120
  53. package/test/consensus/sv-script-vectors.js +0 -81
  54. package/test/consensus/sv-sighash-vectors.js +0 -51
  55. package/test/consensus/sv-tx-vectors.js +0 -48
  56. package/test/credentials-test.js +0 -332
  57. package/test/crypto/backend_selection.js +0 -126
  58. package/test/crypto/bn.js +0 -168
  59. package/test/crypto/ecdsa.js +0 -426
  60. package/test/crypto/elliptic-fixed.js +0 -61
  61. package/test/crypto/hash.browser.js +0 -121
  62. package/test/crypto/hash.js +0 -122
  63. package/test/crypto/point.js +0 -193
  64. package/test/crypto/random.js +0 -105
  65. package/test/crypto/security.js +0 -176
  66. package/test/crypto/shamir.js +0 -177
  67. package/test/crypto/shamir_rngcap.js +0 -29
  68. package/test/crypto/signature.js +0 -399
  69. package/test/data/bip69.json +0 -215
  70. package/test/data/bitcoin-sv/README.md +0 -170
  71. package/test/data/bitcoin-sv/base58_encode_decode.json +0 -14
  72. package/test/data/bitcoin-sv/base58_keys_invalid.json +0 -152
  73. package/test/data/bitcoin-sv/base58_keys_valid.json +0 -452
  74. package/test/data/bitcoin-sv/script_tests.json +0 -2591
  75. package/test/data/bitcoin-sv/sighash.json +0 -1003
  76. package/test/data/bitcoin-sv/tx_invalid.json +0 -285
  77. package/test/data/bitcoin-sv/tx_valid.json +0 -367
  78. package/test/data/bitcoind/base58_keys_invalid.json +0 -152
  79. package/test/data/bitcoind/base58_keys_valid.json +0 -452
  80. package/test/data/bitcoind/blocks.json +0 -27
  81. package/test/data/bitcoind/script_tests.json +0 -2244
  82. package/test/data/bitcoind/sig_canonical.json +0 -7
  83. package/test/data/bitcoind/sig_noncanonical.json +0 -22
  84. package/test/data/bitcoind/tx_invalid.json +0 -177
  85. package/test/data/bitcoind/tx_valid.json +0 -224
  86. package/test/data/blk86756-testnet.dat +0 -0
  87. package/test/data/blk86756-testnet.js +0 -12
  88. package/test/data/blk86756-testnet.json +0 -684
  89. package/test/data/ecdsa.json +0 -230
  90. package/test/data/merkleblocks.js +0 -486
  91. package/test/data/messages.json +0 -22
  92. package/test/data/sighash.json +0 -1004
  93. package/test/data/tx_creation.json +0 -85
  94. package/test/didweb/relationships.js +0 -144
  95. package/test/ecies/bitcore-ecies.js +0 -178
  96. package/test/ecies/electrum-ecies.js +0 -206
  97. package/test/encoding/base58.js +0 -131
  98. package/test/encoding/base58check.js +0 -145
  99. package/test/encoding/bufferreader.js +0 -328
  100. package/test/encoding/bufferwriter.js +0 -160
  101. package/test/encoding/varint.js +0 -104
  102. package/test/gdaf/anchor_no_key_leak.js +0 -146
  103. package/test/gdaf/anchor_spv.js +0 -163
  104. package/test/gdaf/canonicalization.js +0 -106
  105. package/test/gdaf/canonicalize.js +0 -140
  106. package/test/gdaf/zk_prover.js +0 -204
  107. package/test/hdkeys.js +0 -365
  108. package/test/hdprivatekey.js +0 -339
  109. package/test/hdpublickey.js +0 -293
  110. package/test/index.js +0 -16
  111. package/test/ltp/ids.js +0 -74
  112. package/test/ltp/right.js +0 -198
  113. package/test/ltp/verify_failclosed.js +0 -134
  114. package/test/message/message.js +0 -190
  115. package/test/mnemonic/data/fixtures.json +0 -300
  116. package/test/mnemonic/mnemonic.js +0 -277
  117. package/test/mnemonic/mocha.opts +0 -1
  118. package/test/mnemonic/pbkdf2.test.js +0 -43
  119. package/test/networks.js +0 -207
  120. package/test/notaryhash/batch_leaf.js +0 -140
  121. package/test/notaryhash/certificate.js +0 -249
  122. package/test/notaryhash/encoding.js +0 -186
  123. package/test/notaryhash/interop.js +0 -112
  124. package/test/notaryhash/merkle.js +0 -181
  125. package/test/notaryhash/script.js +0 -270
  126. package/test/notaryhash/verify.js +0 -342
  127. package/test/opcode.js +0 -186
  128. package/test/ordinals/bsv20.js +0 -337
  129. package/test/ordinals/inscription.js +0 -319
  130. package/test/ordinals/ordlock.js +0 -613
  131. package/test/privatekey.js +0 -540
  132. package/test/publickey.js +0 -411
  133. package/test/regressions.js +0 -215
  134. package/test/script/chronicle.js +0 -543
  135. package/test/script/defaults.js +0 -160
  136. package/test/script/genesis_limits.js +0 -203
  137. package/test/script/interpreter.js +0 -776
  138. package/test/script/script.js +0 -1259
  139. package/test/script/string_ops.js +0 -88
  140. package/test/security/fail_closed_contracts.js +0 -104
  141. package/test/security/threat_model_coverage.js +0 -31
  142. package/test/smart_contract/covenants.js +0 -245
  143. package/test/smart_contract/dsl_debugger.js +0 -101
  144. package/test/smart_contract/extract_field.js +0 -61
  145. package/test/smart_contract/nonenforcing_guard.js +0 -44
  146. package/test/smart_contract/ordinal_transfer.js +0 -81
  147. package/test/smart_contract/preimage.js +0 -98
  148. package/test/smart_contract/sighash_marketplace.js +0 -108
  149. package/test/smart_contract/token_generalized.js +0 -185
  150. package/test/spv/headerchain.js +0 -86
  151. package/test/spv/merkleproof.js +0 -133
  152. package/test/statuslist/failclosed.js +0 -78
  153. package/test/transaction/deserialize.js +0 -33
  154. package/test/transaction/input/input.js +0 -92
  155. package/test/transaction/input/multisig.js +0 -174
  156. package/test/transaction/input/multisigscripthash.js +0 -111
  157. package/test/transaction/input/publickey.js +0 -68
  158. package/test/transaction/input/publickeyhash.js +0 -59
  159. package/test/transaction/output.js +0 -185
  160. package/test/transaction/sighash.js +0 -91
  161. package/test/transaction/signature.js +0 -127
  162. package/test/transaction/transaction.js +0 -1299
  163. package/test/transaction/unspentoutput.js +0 -97
  164. package/test/types/dts_drift.js +0 -124
  165. package/test/types/surface_honesty.js +0 -102
  166. package/test/util/id.js +0 -72
  167. package/test/util/js.js +0 -76
  168. package/test/util/preconditions.js +0 -79
  169. package/test/vcjwt/interop.js +0 -126
@@ -1,215 +0,0 @@
1
- {
2
- "inputs": [
3
- {
4
- "description": "Ordered by txId, descending (reverse-byte-order ascending)",
5
- "inputs": [
6
- {
7
- "txId": "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
8
- "vout": 0
9
- },
10
- {
11
- "txId": "cccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc",
12
- "vout": 0
13
- },
14
- {
15
- "txId": "bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb",
16
- "vout": 0
17
- },
18
- {
19
- "txId": "bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbff",
20
- "vout": 0
21
- },
22
- {
23
- "txId": "ffbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb",
24
- "vout": 0
25
- }
26
- ],
27
- "expected": [0, 2, 3, 1, 4]
28
- },
29
- {
30
- "description": "Ordered by vout, ascending",
31
- "inputs": [
32
- {
33
- "txId": "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
34
- "vout": 1
35
- },
36
- {
37
- "txId": "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
38
- "vout": 2
39
- },
40
- {
41
- "txId": "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
42
- "vout": 0
43
- }
44
- ],
45
- "expected": [2, 0, 1]
46
- },
47
- {
48
- "description": "Ordered by txId, then vout",
49
- "inputs": [
50
- {
51
- "txId": "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
52
- "vout": 99
53
- },
54
- {
55
- "txId": "bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb",
56
- "vout": 99
57
- },
58
- {
59
- "txId": "cccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc",
60
- "vout": 0
61
- },
62
- {
63
- "txId": "bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb",
64
- "vout": 0
65
- }
66
- ],
67
- "expected": [0, 3, 1, 2]
68
- },
69
- {
70
- "description": "BIP69 test vector 1",
71
- "inputs": [
72
- { "txId": "0e53ec5dfb2cb8a71fec32dc9a634a35b7e24799295ddd5278217822e0b31f57", "vout": 0 },
73
- { "txId": "26aa6e6d8b9e49bb0630aac301db6757c02e3619feb4ee0eea81eb1672947024", "vout": 1 },
74
- { "txId": "28e0fdd185542f2c6ea19030b0796051e7772b6026dd5ddccd7a2f93b73e6fc2", "vout": 0 },
75
- { "txId": "381de9b9ae1a94d9c17f6a08ef9d341a5ce29e2e60c36a52d333ff6203e58d5d", "vout": 1 },
76
- { "txId": "3b8b2f8efceb60ba78ca8bba206a137f14cb5ea4035e761ee204302d46b98de2", "vout": 0 },
77
- { "txId": "402b2c02411720bf409eff60d05adad684f135838962823f3614cc657dd7bc0a", "vout": 1 },
78
- { "txId": "54ffff182965ed0957dba1239c27164ace5a73c9b62a660c74b7b7f15ff61e7a", "vout": 1 },
79
- { "txId": "643e5f4e66373a57251fb173151e838ccd27d279aca882997e005016bb53d5aa", "vout": 0 },
80
- { "txId": "6c1d56f31b2de4bfc6aaea28396b333102b1f600da9c6d6149e96ca43f1102b1", "vout": 1 },
81
- { "txId": "7a1de137cbafb5c70405455c49c5104ca3057a1f1243e6563bb9245c9c88c191", "vout": 0 },
82
- { "txId": "7d037ceb2ee0dc03e82f17be7935d238b35d1deabf953a892a4507bfbeeb3ba4", "vout": 1 },
83
- { "txId": "a5e899dddb28776ea9ddac0a502316d53a4a3fca607c72f66c470e0412e34086", "vout": 0 },
84
- { "txId": "b4112b8f900a7ca0c8b0e7c4dfad35c6be5f6be46b3458974988e1cdb2fa61b8", "vout": 0 },
85
- { "txId": "bafd65e3c7f3f9fdfdc1ddb026131b278c3be1af90a4a6ffa78c4658f9ec0c85", "vout": 0 },
86
- { "txId": "de0411a1e97484a2804ff1dbde260ac19de841bebad1880c782941aca883b4e9", "vout": 1 },
87
- { "txId": "f0a130a84912d03c1d284974f563c5949ac13f8342b8112edff52971599e6a45", "vout": 0 },
88
- { "txId": "f320832a9d2e2452af63154bc687493484a0e7745ebd3aaf9ca19eb80834ad60", "vout": 0 }
89
- ],
90
- "expected": [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16]
91
- },
92
- {
93
- "description": "BIP69 test vector 2",
94
- "inputs": [
95
- { "txId": "35288d269cee1941eaebb2ea85e32b42cdb2b04284a56d8b14dcc3f5c65d6055", "vout": 0 },
96
- { "txId": "35288d269cee1941eaebb2ea85e32b42cdb2b04284a56d8b14dcc3f5c65d6055", "vout": 1 }
97
- ],
98
- "expected": [0, 1]
99
- }
100
- ],
101
- "outputs": [
102
- {
103
- "description": "Ordered by Amount, ascending",
104
- "outputs": [
105
- {
106
- "script": "00000000",
107
- "value": 3000
108
- },
109
- {
110
- "script": "00000000",
111
- "value": 2000
112
- },
113
- {
114
- "script": "00000000",
115
- "value": 1000
116
- }
117
- ],
118
- "expected": [2, 1, 0]
119
- },
120
- {
121
- "description": "Ordered by Script, ascending",
122
- "outputs": [
123
- {
124
- "script": "00000000",
125
- "value": 1000
126
- },
127
- {
128
- "script": "22222222",
129
- "value": 1000
130
- },
131
- {
132
- "script": "11111111",
133
- "value": 1000
134
- }
135
- ],
136
- "expected": [0, 2, 1]
137
- },
138
- {
139
- "description": "Ordered by Amount, then Script",
140
- "outputs": [
141
- {
142
- "script": "11111111",
143
- "value": 1000
144
- },
145
- {
146
- "script": "11111111",
147
- "value": 2000
148
- },
149
- {
150
- "script": "00000000",
151
- "value": 3000
152
- },
153
- {
154
- "script": "00000000",
155
- "value": 2000
156
- }
157
- ],
158
- "expected": [0, 3, 1, 2]
159
- },
160
- {
161
- "description": "Sorting is irrelevant for equivalent outputs",
162
- "outputs": [
163
- {
164
- "script": "00000000",
165
- "value": 2000
166
- },
167
- {
168
- "script": "11111111",
169
- "value": 2000
170
- },
171
- {
172
- "script": "00000000",
173
- "value": 2000
174
- },
175
- {
176
- "script": "11111111",
177
- "value": 3000
178
- },
179
- {
180
- "script": "22222222",
181
- "value": 3000
182
- }
183
- ],
184
- "expected": [0, 2, 1, 3, 4]
185
- },
186
- {
187
- "description": "BIP69 test vector 1",
188
- "outputs": [
189
- {
190
- "script": "76a9144a5fba237213a062f6f57978f796390bdcf8d01588ac",
191
- "value": 400057456
192
- },
193
- {
194
- "script": "76a9145be32612930b8323add2212a4ec03c1562084f8488ac",
195
- "value": 40000000000
196
- }
197
- ],
198
- "expected": [0, 1]
199
- },
200
- {
201
- "description": "BIP69 test vector 2",
202
- "outputs": [
203
- {
204
- "script": "41046a0765b5865641ce08dd39690aade26dfbf5511430ca428a3089261361cef170e3929a68aee3d8d4848b0c5111b0a37b82b86ad559fd2a745b44d8e8d9dfdc0cac",
205
- "value": 100000000
206
- },
207
- {
208
- "script": "41044a656f065871a353f216ca26cef8dde2f03e8c16202d2e8ad769f02032cb86a5eb5e56842e92e19141d60a01928f8dd2c875a390f67c1f6c94cfc617c0ea45afac",
209
- "value": 2400000000
210
- }
211
- ],
212
- "expected": [0, 1]
213
- }
214
- ]
215
- }
@@ -1,170 +0,0 @@
1
- # SV Node consensus vectors
2
-
3
- Consensus test vectors copied verbatim from the reference node implementation.
4
- These are the specification this library is measured against — do not hand-edit
5
- them. To update, re-copy from a node tag and record the new provenance here.
6
-
7
- | field | value |
8
- | --- | --- |
9
- | source | [`bitcoin-sv/bitcoin-sv`](https://github.com/bitcoin-sv/bitcoin-sv) `src/test/data` |
10
- | tag | `v1.2.0` (Chronicle); byte-identical in `v1.2.2`, the current release |
11
- | commit | `60dc6a3f2547eeaaa3a605e5a69a9fc8686b0a25` |
12
- | retrieved | 2026-08-11 |
13
- | licence | MIT (same as this library) |
14
-
15
- Genesis activated at block **620,538** on **2020-02-04**; Chronicle at block
16
- **943,816** on **2026-04-07**.
17
-
18
- ## Files
19
-
20
- | file | rows run | covers | gate |
21
- | --- | --- | --- | --- |
22
- | `script_tests.json` | 1483 | script evaluation, including Genesis and Chronicle rules | `test/consensus/sv-script-vectors.js` |
23
- | `sighash.json` | 1000 | transaction digest algorithm | `test/consensus/sv-sighash-vectors.js` |
24
- | `tx_valid.json` | 93 | transactions that must validate | `test/consensus/sv-tx-vectors.js` |
25
- | `tx_invalid.json` | 68 | transactions that must be rejected | `test/consensus/sv-tx-vectors.js` |
26
- | `base58_keys_valid.json` | 50 | address and WIF encoding | `test/consensus/base58-vectors.js` |
27
- | `base58_keys_invalid.json` | 50 | malformed address rejection | `test/consensus/base58-vectors.js` |
28
- | `base58_encode_decode.json` | 12 | raw base58 round-trips | `test/consensus/base58-vectors.js` |
29
-
30
- Every one of these is exercised, and every one passes completely. There is no
31
- known-failure list and nothing is exempted, so any list added later should read
32
- as a decision someone made rather than as inherited debt.
33
-
34
- These supersede the older pre-Genesis vectors in `test/data/bitcoind`, which are
35
- inherited from the upstream fork and encode consensus rules the network
36
- abandoned in 2020. Those are retained for now so the two can be diffed, but
37
- they are **not** a valid consensus reference. Where they disagree with these,
38
- these win.
39
-
40
- ## Measuring the gap
41
-
42
- npm run vectors:sv # script vectors
43
- npm run vectors:sv-tx # transaction vectors
44
- npm run vectors:sv-sighash # transaction digest vectors
45
-
46
- Each takes `-- --verbose` for the full failing list. Every report shares its
47
- harness with the corresponding gate under `test/consensus`, so the progress
48
- figure and the regression gate cannot disagree about what passes.
49
-
50
- The script and transaction reports separate the two directions of failure. A
51
- **false accept** — accepting a script the node rejects — is the direction that
52
- can cost money, and is held at zero outright. A false reject only costs a
53
- transaction. The digest report makes no such distinction: a wrong digest is
54
- equally bad either way, since it both makes valid signatures unverifiable and
55
- signs something other than what the caller was shown.
56
-
57
- ## Row layout, and two columns that are easy to get wrong
58
-
59
- Defined by `script_json_test` in the node's `src/test/script_tests.cpp`:
60
-
61
- [ [nValue]?, txnVersion, scriptSig, scriptPubKey, flags, expected, comment? ]
62
-
63
- - **`nValue`** is present only when a row needs an input amount, and it is
64
- wrapped in an **array**. It states whole coins; the transaction carries
65
- satoshis, so multiply by 1e8 (the node's `AmountFromValue`).
66
- - **`txnVersion`** is the *spending* transaction's version, and is present on
67
- every row. Chronicle gates its malleability relaxations on version > 1, so
68
- this column is consensus-relevant — it is not padding, and it is not an
69
- amount. Mistaking it for one changes the crediting transaction's value, which
70
- changes its txid, which changes the sighash, which silently breaks every
71
- signature-checking vector in the corpus.
72
-
73
- The crediting transaction is always version 1; only the spending transaction
74
- carries the version under test. Both use locktime 0 and a final sequence, and
75
- the crediting input's scriptSig is `OP_0 OP_0`.
76
-
77
- ## Flags, and one place this fork differs
78
-
79
- Flags are mapped by **name**, never by value. This library assigns
80
- `MONOLITH_OPCODES` and `MAGNETIC_OPCODES` to bits `1<<18` and `1<<19`, which
81
- are the bits the node uses for `SCRIPT_GENESIS` and `SCRIPT_UTXO_AFTER_GENESIS`
82
- — mapping by value would quietly run vectors under the wrong rules while
83
- appearing to pass.
84
-
85
- The corpus never names `MONOLITH` or `MAGNETIC`, because the node has no such
86
- flags: those opcodes were restored on BSV in 2018 and are simply enabled. This
87
- library still gates them, so the harness enables them for every row; otherwise
88
- the report would be dominated by that one difference rather than by consensus.
89
- The gating is itself a divergence from BSV and is worth removing. It is
90
- compensated for here rather than hidden, so that the figures mean what they
91
- say.
92
-
93
- ## Transaction vectors
94
-
95
- `tx_valid.json` and `tx_invalid.json` go a level above the script corpus: a
96
- whole transaction is deserialised, each input resolved against the output it
97
- claims to spend, and every one required to verify — with locktimes, sequence
98
- numbers and multiple inputs in play.
99
-
100
- That level is worth having. It found a Genesis rule the script corpus cannot
101
- reach: `OP_CHECKLOCKTIMEVERIFY` and `OP_CHECKSEQUENCEVERIFY` revert to
102
- upgradable NOPs after Genesis, and without that, four transactions the network
103
- accepts were being rejected. The behaviour only appears once a real nLockTime
104
- and sequence exist, so no single-script vector exercises it.
105
-
106
- ## Digest vectors
107
-
108
- Each row of `sighash.json` carries **two** expected digests for the same inputs
109
- — one with forkid enabled and one without — which pins the routing in
110
- `SignatureHash()` rather than one branch of it.
111
-
112
- That second column earned its keep. It found 260 rows where this library
113
- honoured `SIGHASH_CHRONICLE` only when `SCRIPT_ENABLE_CHRONICLE` was also set,
114
- where the node routes on the bit alone and instead rejects a signature carrying
115
- that bit outside Chronicle in `CheckSignatureEncoding`, as
116
- `SCRIPT_ERR_ILLEGAL_CHRONICLE`. Rejected, not reinterpreted.
117
-
118
- For a row whose hash type sets `0x20`, both columns are identical — the
119
- original algorithm is taken either way. 511 of the 1000 rows are of that kind,
120
- so a gate checking only one column would be blind to half the corpus.
121
-
122
- ## Base58
123
-
124
- The key vectors are content-identical to the bitcoind copies already used by
125
- `test/address.js` and `test/privatekey.js` — same 50 rows, different whitespace
126
- — but `base58_encode_decode.json` has no counterpart there, and nothing else
127
- pins the raw codec against the node in both directions.
128
-
129
- Note what the invalid-key vectors actually claim: that a string is neither a
130
- valid address nor a valid WIF. Several carry a perfectly good checksum and are
131
- simply the wrong length or version, so `Base58Check` accepts them and the layer
132
- above is what refuses. A test asserting the checksum layer rejects them would
133
- be asserting something the corpus does not say.
134
-
135
- ## Result codes
136
-
137
- Matching the node's accept/reject outcome is not the same as failing for the
138
- node's *reason*, and the gap between the two is where bugs live. Comparing the
139
- result code of all 600 rejected vectors found four, each of which left the
140
- script failing — so the outcome check stayed green through every one:
141
-
142
- - a div-by-zero guard comparing a `BN` against the number `0`, so it never
143
- fired and bn.js asserted instead
144
- - script number decoding throwing past the evaluator into a generic catch,
145
- which is what 78 of the four hundred were
146
- - a truncated `PUSHDATA` doing the same
147
- - `OP_NUM2BIN` checking only the upper bound of its size argument, so a
148
- negative size reported the wrong failure
149
-
150
- All 600 now match: 491 exactly, and 109 through `ERROR_CODE_ALIASES` in
151
- `tools/sv-vector-harness.js` — names this library reports more narrowly than
152
- the node, such as `EVAL_FALSE_IN_STACK` for `EVAL_FALSE`. That table is a short
153
- statement of intent rather than a list of exempted vectors, and it ratchets
154
- both ways: an unlisted mismatch fails, and so does an alias no vector produces
155
- any more, so an exemption cannot outlive its reason. Anything added to it
156
- should be a name that says *more* than the node's, never a different failure
157
- wearing its label.
158
-
159
- ## What the vectors cannot reach
160
-
161
- Passing this corpus completely is not the same as matching the node. Reading
162
- the code alongside it found `OP_CAT` capping its result at the static 520-byte
163
- element size rather than the era-derived one, so after Genesis it rejected
164
- concatenations the network accepts — built from two 300-byte halves that are
165
- each legal on their own. It is the one opcode that can grow an element past the
166
- cap without ever pushing an oversized element, which is why no vector here
167
- covers it. `test/script/genesis_limits.js` holds it instead.
168
-
169
- Where a rule has no vector, the test that holds it belongs somewhere that says
170
- so.
@@ -1,14 +0,0 @@
1
- [
2
- ["", ""],
3
- ["61", "2g"],
4
- ["626262", "a3gV"],
5
- ["636363", "aPEr"],
6
- ["73696d706c792061206c6f6e6720737472696e67", "2cFupjhnEsSn59qHXstmK2ffpLv2"],
7
- ["00eb15231dfceb60925886b67d065299925915aeb172c06647", "1NS17iag9jJgTHD1VXjvLCEnZuQ3rJDE9L"],
8
- ["516b6fcd0f", "ABnLTmg"],
9
- ["bf4f89001e670274dd", "3SEo3LWLoPntC"],
10
- ["572e4794", "3EFU7m"],
11
- ["ecac89cad93923c02321", "EJDM8drfXA6uyA"],
12
- ["10c8511e", "Rt5zm"],
13
- ["00000000000000000000", "1111111111"]
14
- ]
@@ -1,152 +0,0 @@
1
- [
2
- [
3
- ""
4
- ],
5
- [
6
- "x"
7
- ],
8
- [
9
- "37qgekLpCCHrQuSjvX3fs496FWTGsHFHizjJAs6NPcR47aefnnCWECAhHV6E3g4YN7u7Yuwod5Y"
10
- ],
11
- [
12
- "dzb7VV1Ui55BARxv7ATxAtCUeJsANKovDGWFVgpTbhq9gvPqP3yv"
13
- ],
14
- [
15
- "MuNu7ZAEDFiHthiunm7dPjwKqrVNCM3mAz6rP9zFveQu14YA8CxExSJTHcVP9DErn6u84E6Ej7S"
16
- ],
17
- [
18
- "rPpQpYknyNQ5AEHuY6H8ijJJrYc2nDKKk9jjmKEXsWzyAQcFGpDLU2Zvsmoi8JLR7hAwoy3RQWf"
19
- ],
20
- [
21
- "4Uc3FmN6NQ6zLBK5QQBXRBUREaaHwCZYsGCueHauuDmJpZKn6jkEskMB2Zi2CNgtb5r6epWEFfUJq"
22
- ],
23
- [
24
- "7aQgR5DFQ25vyXmqZAWmnVCjL3PkBcdVkBUpjrjMTcghHx3E8wb"
25
- ],
26
- [
27
- "17QpPprjeg69fW1DV8DcYYCKvWjYhXvWkov6MJ1iTTvMFj6weAqW7wybZeH57WTNxXVCRH4veVs"
28
- ],
29
- [
30
- "KxuACDviz8Xvpn1xAh9MfopySZNuyajYMZWz16Dv2mHHryznWUp3"
31
- ],
32
- [
33
- "7nK3GSmqdXJQtdohvGfJ7KsSmn3TmGqExug49583bDAL91pVSGq5xS9SHoAYL3Wv3ijKTit65th"
34
- ],
35
- [
36
- "cTivdBmq7bay3RFGEBBuNfMh2P1pDCgRYN2Wbxmgwr4ki3jNUL2va"
37
- ],
38
- [
39
- "gjMV4vjNjyMrna4fsAr8bWxAbwtmMUBXJS3zL4NJt5qjozpbQLmAfK1uA3CquSqsZQMpoD1g2nk"
40
- ],
41
- [
42
- "emXm1naBMoVzPjbk7xpeTVMFy4oDEe25UmoyGgKEB1gGWsK8kRGs"
43
- ],
44
- [
45
- "7VThQnNRj1o3Zyvc7XHPRrjDf8j2oivPTeDXnRPYWeYGE4pXeRJDZgf28ppti5hsHWXS2GSobdqyo"
46
- ],
47
- [
48
- "1G9u6oCVCPh2o8m3t55ACiYvG1y5BHewUkDSdiQarDcYXXhFHYdzMdYfUAhfxn5vNZBwpgUNpso"
49
- ],
50
- [
51
- "31QQ7ZMLkScDiB4VyZjuptr7AEc9j1SjstF7pRoLhHTGkW4Q2y9XELobQmhhWxeRvqcukGd1XCq"
52
- ],
53
- [
54
- "DHqKSnpxa8ZdQyH8keAhvLTrfkyBMQxqngcQA5N8LQ9KVt25kmGN"
55
- ],
56
- [
57
- "2LUHcJPbwLCy9GLH1qXmfmAwvadWw4bp4PCpDfduLqV17s6iDcy1imUwhQJhAoNoN1XNmweiJP4i"
58
- ],
59
- [
60
- "7USRzBXAnmck8fX9HmW7RAb4qt92VFX6soCnts9s74wxm4gguVhtG5of8fZGbNPJA83irHVY6bCos"
61
- ],
62
- [
63
- "1DGezo7BfVebZxAbNT3XGujdeHyNNBF3vnficYoTSp4PfK2QaML9bHzAMxke3wdKdHYWmsMTJVu"
64
- ],
65
- [
66
- "2D12DqDZKwCxxkzs1ZATJWvgJGhQ4cFi3WrizQ5zLAyhN5HxuAJ1yMYaJp8GuYsTLLxTAz6otCfb"
67
- ],
68
- [
69
- "8AFJzuTujXjw1Z6M3fWhQ1ujDW7zsV4ePeVjVo7D1egERqSW9nZ"
70
- ],
71
- [
72
- "163Q17qLbTCue8YY3AvjpUhotuaodLm2uqMhpYirsKjVqnxJRWTEoywMVY3NbBAHuhAJ2cF9GAZ"
73
- ],
74
- [
75
- "2MnmgiRH4eGLyLc9eAqStzk7dFgBjFtUCtu"
76
- ],
77
- [
78
- "461QQ2sYWxU7H2PV4oBwJGNch8XVTYYbZxU"
79
- ],
80
- [
81
- "2UCtv53VttmQYkVU4VMtXB31REvQg4ABzs41AEKZ8UcB7DAfVzdkV9JDErwGwyj5AUHLkmgZeobs"
82
- ],
83
- [
84
- "cSNjAsnhgtiFMi6MtfvgscMB2Cbhn2v1FUYfviJ1CdjfidvmeW6mn"
85
- ],
86
- [
87
- "gmsow2Y6EWAFDFE1CE4Hd3Tpu2BvfmBfG1SXsuRARbnt1WjkZnFh1qGTiptWWbjsq2Q6qvpgJVj"
88
- ],
89
- [
90
- "nksUKSkzS76v8EsSgozXGMoQFiCoCHzCVajFKAXqzK5on9ZJYVHMD5CKwgmX3S3c7M1U3xabUny"
91
- ],
92
- [
93
- "L3favK1UzFGgdzYBF2oBT5tbayCo4vtVBLJhg2iYuMeePxWG8SQc"
94
- ],
95
- [
96
- "7VxLxGGtYT6N99GdEfi6xz56xdQ8nP2dG1CavuXx7Rf2PrvNMTBNevjkfgs9JmkcGm6EXpj8ipyPZ"
97
- ],
98
- [
99
- "2mbZwFXF6cxShaCo2czTRB62WTx9LxhTtpP"
100
- ],
101
- [
102
- "dB7cwYdcPSgiyAwKWL3JwCVwSk6epU2txw"
103
- ],
104
- [
105
- "HPhFUhUAh8ZQQisH8QQWafAxtQYju3SFTX"
106
- ],
107
- [
108
- "4ctAH6AkHzq5ioiM1m9T3E2hiYEev5mTsB"
109
- ],
110
- [
111
- "Hn1uFi4dNexWrqARpjMqgT6cX1UsNPuV3cHdGg9ExyXw8HTKadbktRDtdeVmY3M1BxJStiL4vjJ"
112
- ],
113
- [
114
- "Sq3fDbvutABmnAHHExJDgPLQn44KnNC7UsXuT7KZecpaYDMU9Txs"
115
- ],
116
- [
117
- "6TqWyrqdgUEYDQU1aChMuFMMEimHX44qHFzCUgGfqxGgZNMUVWJ"
118
- ],
119
- [
120
- "giqJo7oWqFxNKWyrgcBxAVHXnjJ1t6cGoEffce5Y1y7u649Noj5wJ4mmiUAKEVVrYAGg2KPB3Y4"
121
- ],
122
- [
123
- "cNzHY5e8vcmM3QVJUcjCyiKMYfeYvyueq5qCMV3kqcySoLyGLYUK"
124
- ],
125
- [
126
- "37uTe568EYc9WLoHEd9jXEvUiWbq5LFLscNyqvAzLU5vBArUJA6eydkLmnMwJDjkL5kXc2VK7ig"
127
- ],
128
- [
129
- "EsYbG4tWWWY45G31nox838qNdzksbPySWc"
130
- ],
131
- [
132
- "nbuzhfwMoNzA3PaFnyLcRxE9bTJPDkjZ6Rf6Y6o2ckXZfzZzXBT"
133
- ],
134
- [
135
- "cQN9PoxZeCWK1x56xnz6QYAsvR11XAce3Ehp3gMUdfSQ53Y2mPzx"
136
- ],
137
- [
138
- "1Gm3N3rkef6iMbx4voBzaxtXcmmiMTqZPhcuAepRzYUJQW4qRpEnHvMojzof42hjFRf8PE2jPde"
139
- ],
140
- [
141
- "2TAq2tuN6x6m233bpT7yqdYQPELdTDJn1eU"
142
- ],
143
- [
144
- "ntEtnnGhqPii4joABvBtSEJG6BxjT2tUZqE8PcVYgk3RHpgxgHDCQxNbLJf7ardf1dDk2oCQ7Cf"
145
- ],
146
- [
147
- "Ky1YjoZNgQ196HJV3HpdkecfhRBmRZdMJk89Hi5KGfpfPwS2bUbfd"
148
- ],
149
- [
150
- "2A1q1YsMZowabbvta7kTy2Fd6qN4r5ZCeG3qLpvZBMzCixMUdkN2Y4dHB1wPsZAeVXUGD83MfRED"
151
- ]
152
- ]