@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.
- package/CHANGELOG.md +228 -0
- package/README.md +152 -1031
- package/STABILITY.md +134 -0
- package/bsv-gdaf.min.js +58 -53
- package/bsv-ltp.min.js +23 -18
- package/bsv-script-helper.min.js +1 -1
- package/bsv-smartcontract.min.js +21 -21
- package/bsv.bundle.js +58 -53
- package/bsv.d.ts +0 -4
- package/bsv.min.js +58 -53
- package/docs/BRC220_BATCH_LEAF_AMENDMENT.md +82 -7
- package/docs/MODULE_REFERENCE_COMPLETE.md +27 -27
- package/docs/README.md +2 -1
- package/docs/THREAT_MODEL.md +10 -2
- package/docs/advanced/UTXO_MANAGER_GUIDE.md +1 -1
- package/docs/getting-started/INSTALLATION.md +23 -23
- package/docs/getting-started/QUICK_START.md +7 -7
- package/docs/migration/FROM_BSV_1_5_6.md +5 -5
- package/docs/proposals/10.0.0-package-split.md +131 -0
- package/index.js +15 -26
- package/lib/block/merkleblock.js +19 -5
- package/lib/covenant/helpers.js +34 -35
- package/lib/covenant/pushtx.js +2 -2
- package/lib/custom-script-helper.js +0 -16
- package/lib/hdprivatekey.js +15 -0
- package/lib/ordinals/ordlock.js +1 -1
- package/lib/script/interpreter.js +109 -1
- package/lib/smart_contract/builder.js +14 -0
- package/lib/smart_contract/debugger.js +2 -2
- package/lib/smart_contract/dsl.js +2 -2
- package/lib/smart_contract/index.js +0 -3
- package/lib/smart_contract/locks.js +1 -41
- package/lib/smart_contract/pels.js +1 -1
- package/lib/smart_contract/token.js +1 -1
- package/lib/util/deprecate.js +159 -0
- package/package.json +19 -82
- package/tools/gen-brc220-batch-vector.js +205 -0
- package/version.js +1 -1
- package/.mocharc.json +0 -5
- package/test/address.js +0 -629
- package/test/block/block.js +0 -239
- package/test/block/blockheader.js +0 -270
- package/test/block/merkleblock.js +0 -207
- package/test/build/bundle_crypto_shim.js +0 -104
- package/test/build/bundle_externals.js +0 -125
- package/test/build/bundle_smoke.js +0 -55
- package/test/build/esbuild_main.js +0 -65
- package/test/build/esm_wrapper.js +0 -73
- package/test/build/exports_resolution.js +0 -84
- package/test/build/version_sync.js +0 -14
- package/test/cli/smoke.js +0 -261
- package/test/consensus/base58-vectors.js +0 -120
- package/test/consensus/sv-script-vectors.js +0 -81
- package/test/consensus/sv-sighash-vectors.js +0 -51
- package/test/consensus/sv-tx-vectors.js +0 -48
- package/test/credentials-test.js +0 -332
- package/test/crypto/backend_selection.js +0 -126
- package/test/crypto/bn.js +0 -168
- package/test/crypto/ecdsa.js +0 -426
- package/test/crypto/elliptic-fixed.js +0 -61
- package/test/crypto/hash.browser.js +0 -121
- package/test/crypto/hash.js +0 -122
- package/test/crypto/point.js +0 -193
- package/test/crypto/random.js +0 -105
- package/test/crypto/security.js +0 -176
- package/test/crypto/shamir.js +0 -177
- package/test/crypto/shamir_rngcap.js +0 -29
- package/test/crypto/signature.js +0 -399
- package/test/data/bip69.json +0 -215
- package/test/data/bitcoin-sv/README.md +0 -170
- package/test/data/bitcoin-sv/base58_encode_decode.json +0 -14
- package/test/data/bitcoin-sv/base58_keys_invalid.json +0 -152
- package/test/data/bitcoin-sv/base58_keys_valid.json +0 -452
- package/test/data/bitcoin-sv/script_tests.json +0 -2591
- package/test/data/bitcoin-sv/sighash.json +0 -1003
- package/test/data/bitcoin-sv/tx_invalid.json +0 -285
- package/test/data/bitcoin-sv/tx_valid.json +0 -367
- package/test/data/bitcoind/base58_keys_invalid.json +0 -152
- package/test/data/bitcoind/base58_keys_valid.json +0 -452
- package/test/data/bitcoind/blocks.json +0 -27
- package/test/data/bitcoind/script_tests.json +0 -2244
- package/test/data/bitcoind/sig_canonical.json +0 -7
- package/test/data/bitcoind/sig_noncanonical.json +0 -22
- package/test/data/bitcoind/tx_invalid.json +0 -177
- package/test/data/bitcoind/tx_valid.json +0 -224
- package/test/data/blk86756-testnet.dat +0 -0
- package/test/data/blk86756-testnet.js +0 -12
- package/test/data/blk86756-testnet.json +0 -684
- package/test/data/ecdsa.json +0 -230
- package/test/data/merkleblocks.js +0 -486
- package/test/data/messages.json +0 -22
- package/test/data/sighash.json +0 -1004
- package/test/data/tx_creation.json +0 -85
- package/test/didweb/relationships.js +0 -144
- package/test/ecies/bitcore-ecies.js +0 -178
- package/test/ecies/electrum-ecies.js +0 -206
- package/test/encoding/base58.js +0 -131
- package/test/encoding/base58check.js +0 -145
- package/test/encoding/bufferreader.js +0 -328
- package/test/encoding/bufferwriter.js +0 -160
- package/test/encoding/varint.js +0 -104
- package/test/gdaf/anchor_no_key_leak.js +0 -146
- package/test/gdaf/anchor_spv.js +0 -163
- package/test/gdaf/canonicalization.js +0 -106
- package/test/gdaf/canonicalize.js +0 -140
- package/test/gdaf/zk_prover.js +0 -204
- package/test/hdkeys.js +0 -365
- package/test/hdprivatekey.js +0 -339
- package/test/hdpublickey.js +0 -293
- package/test/index.js +0 -16
- package/test/ltp/ids.js +0 -74
- package/test/ltp/right.js +0 -198
- package/test/ltp/verify_failclosed.js +0 -134
- package/test/message/message.js +0 -190
- package/test/mnemonic/data/fixtures.json +0 -300
- package/test/mnemonic/mnemonic.js +0 -277
- package/test/mnemonic/mocha.opts +0 -1
- package/test/mnemonic/pbkdf2.test.js +0 -43
- package/test/networks.js +0 -207
- package/test/notaryhash/batch_leaf.js +0 -140
- package/test/notaryhash/certificate.js +0 -249
- package/test/notaryhash/encoding.js +0 -186
- package/test/notaryhash/interop.js +0 -112
- package/test/notaryhash/merkle.js +0 -181
- package/test/notaryhash/script.js +0 -270
- package/test/notaryhash/verify.js +0 -342
- package/test/opcode.js +0 -186
- package/test/ordinals/bsv20.js +0 -337
- package/test/ordinals/inscription.js +0 -319
- package/test/ordinals/ordlock.js +0 -613
- package/test/privatekey.js +0 -540
- package/test/publickey.js +0 -411
- package/test/regressions.js +0 -215
- package/test/script/chronicle.js +0 -543
- package/test/script/defaults.js +0 -160
- package/test/script/genesis_limits.js +0 -203
- package/test/script/interpreter.js +0 -776
- package/test/script/script.js +0 -1259
- package/test/script/string_ops.js +0 -88
- package/test/security/fail_closed_contracts.js +0 -104
- package/test/security/threat_model_coverage.js +0 -31
- package/test/smart_contract/covenants.js +0 -245
- package/test/smart_contract/dsl_debugger.js +0 -101
- package/test/smart_contract/extract_field.js +0 -61
- package/test/smart_contract/nonenforcing_guard.js +0 -44
- package/test/smart_contract/ordinal_transfer.js +0 -81
- package/test/smart_contract/preimage.js +0 -98
- package/test/smart_contract/sighash_marketplace.js +0 -108
- package/test/smart_contract/token_generalized.js +0 -185
- package/test/spv/headerchain.js +0 -86
- package/test/spv/merkleproof.js +0 -133
- package/test/statuslist/failclosed.js +0 -78
- package/test/transaction/deserialize.js +0 -33
- package/test/transaction/input/input.js +0 -92
- package/test/transaction/input/multisig.js +0 -174
- package/test/transaction/input/multisigscripthash.js +0 -111
- package/test/transaction/input/publickey.js +0 -68
- package/test/transaction/input/publickeyhash.js +0 -59
- package/test/transaction/output.js +0 -185
- package/test/transaction/sighash.js +0 -91
- package/test/transaction/signature.js +0 -127
- package/test/transaction/transaction.js +0 -1299
- package/test/transaction/unspentoutput.js +0 -97
- package/test/types/dts_drift.js +0 -124
- package/test/types/surface_honesty.js +0 -102
- package/test/util/id.js +0 -72
- package/test/util/js.js +0 -76
- package/test/util/preconditions.js +0 -79
- package/test/vcjwt/interop.js +0 -126
package/test/data/bip69.json
DELETED
|
@@ -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
|
-
"17QpPprjeg69fW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UK"
|
|
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
|
-
]
|