@smartledger/bsv 9.5.0 → 9.7.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 +107 -0
- package/README.md +19 -19
- package/bsv-gdaf.min.js +29 -29
- package/bsv-ltp.min.js +17 -17
- package/bsv-smartcontract.min.js +1 -1
- package/bsv.bundle.js +30 -30
- package/bsv.min.js +28 -28
- package/docs/MODULE_REFERENCE_COMPLETE.md +27 -27
- 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/lib/script/interpreter.js +112 -4
- package/package.json +1 -1
- package/version.js +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -7,6 +7,113 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|
|
7
7
|
|
|
8
8
|
## [Unreleased]
|
|
9
9
|
|
|
10
|
+
## [9.7.0] - 2026-09-05
|
|
11
|
+
|
|
12
|
+
### Fixed — the stack limits diverged from the node in both directions
|
|
13
|
+
|
|
14
|
+
The last of the pre-Genesis caps still applied as a literal, and the only one
|
|
15
|
+
left that `useGenesisLimits()` could not reach:
|
|
16
|
+
|
|
17
|
+
```js
|
|
18
|
+
// after the whole script had run:
|
|
19
|
+
if (this.stack.length + this.altstack.length > 1000) {
|
|
20
|
+
```
|
|
21
|
+
|
|
22
|
+
Two divergences in five lines.
|
|
23
|
+
|
|
24
|
+
**It was checked once, at the end of the script.** The node checks after every
|
|
25
|
+
opcode. A script that piles up 1,001 elements and drops back to one before it
|
|
26
|
+
finishes passed here and is rejected by the network — a false accept, in the
|
|
27
|
+
direction that costs money:
|
|
28
|
+
|
|
29
|
+
```
|
|
30
|
+
pre-Genesis, 1001 pushes then 500 OP_2DROPs
|
|
31
|
+
before: accepted
|
|
32
|
+
node: SCRIPT_ERR_STACK_SIZE
|
|
33
|
+
```
|
|
34
|
+
|
|
35
|
+
No vector in the corpus catches it: every `STACK_SIZE` vector *ends* over the
|
|
36
|
+
cap, which is exactly the case an end-of-script check does see. The regression
|
|
37
|
+
test uses `OP_2DROP` deliberately — it clears two elements per opcode and so
|
|
38
|
+
lands inside the pre-Genesis 500-opcode budget, where 1,001 `OP_DROP`s would
|
|
39
|
+
trip `SCRIPT_ERR_OP_COUNT` and pass the assertion for the wrong reason.
|
|
40
|
+
|
|
41
|
+
**And it was applied after Genesis, which removed it.** Genesis replaced the
|
|
42
|
+
element COUNT with a bound on the memory the two stacks occupy, so that a script
|
|
43
|
+
is limited by what it uses rather than by how it is divided up. Carrying 1000
|
|
44
|
+
unconditionally rejected post-Genesis scripts the network accepts:
|
|
45
|
+
|
|
46
|
+
```
|
|
47
|
+
post-Genesis, 1001 elements before: SCRIPT_ERR_STACK_SIZE after: accepted
|
|
48
|
+
post-Genesis, 5000 elements before: SCRIPT_ERR_STACK_SIZE after: accepted
|
|
49
|
+
```
|
|
50
|
+
|
|
51
|
+
The shape that finds it in practice is a 256-step elliptic-curve ladder, which
|
|
52
|
+
needs a witness value per step: over seven hundred elements for one scalar
|
|
53
|
+
multiplication, and two of those in an ECDSA verification.
|
|
54
|
+
|
|
55
|
+
Same shape as 9.4.0, 9.5.0 and 9.6.0 — a limit that was correct when it was
|
|
56
|
+
written, left static while the rest became era-derived. Now:
|
|
57
|
+
|
|
58
|
+
```js
|
|
59
|
+
Interpreter.prototype.maxStackSize() // 1000 before Genesis, UNLIMITED after
|
|
60
|
+
Interpreter.prototype.maxStackMemoryUsage() // UNLIMITED before, 100 MB policy after
|
|
61
|
+
Interpreter.prototype.stackMemoryUsage() // bytes + per-element container overhead
|
|
62
|
+
Interpreter.prototype.checkStackLimits() // called after every opcode
|
|
63
|
+
```
|
|
64
|
+
|
|
65
|
+
`MAX_STACK_MEMORY_USAGE_AFTER_GENESIS` is **`UNLIMITED`**, because post-Genesis
|
|
66
|
+
consensus is unbounded. The node's 100 MB figure is `-maxstackmemoryusagepolicy`,
|
|
67
|
+
a RELAY setting, and defaulting to it would have refused scripts the network
|
|
68
|
+
accepts — the same mistake as carrying the 1000-element cap past Genesis, in the
|
|
69
|
+
same function. It is kept as `STACK_MEMORY_USAGE_POLICY` for anyone who wants it:
|
|
70
|
+
|
|
71
|
+
```js
|
|
72
|
+
Interpreter.MAX_STACK_MEMORY_USAGE_AFTER_GENESIS =
|
|
73
|
+
Interpreter.STACK_MEMORY_USAGE_POLICY
|
|
74
|
+
```
|
|
75
|
+
|
|
76
|
+
Unbounded means a hostile script can allocate until the process runs out of
|
|
77
|
+
memory — the same trade `useGenesisLimits(max)` already documents for element
|
|
78
|
+
size. A validator taking scripts from strangers should set a ceiling matched to
|
|
79
|
+
its workload.
|
|
80
|
+
|
|
81
|
+
`STACK_ELEMENT_OVERHEAD` is 32 bytes, charged per element on top of its contents
|
|
82
|
+
because the container is not free either. It is only consulted once a caller has
|
|
83
|
+
set a ceiling, and 32 is deliberately conservative: a bare `std::vector<uint8_t>`
|
|
84
|
+
is 24 bytes on the common 64-bit ABIs.
|
|
85
|
+
|
|
86
|
+
Keeping the default unbounded also keeps the new per-opcode check O(1): with no
|
|
87
|
+
ceiling to test against, the O(n) memory scan is skipped. A post-Genesis script
|
|
88
|
+
holding 900 elements across 40,000 opcodes measures 42.6 ms, against 42.8 ms
|
|
89
|
+
before this change.
|
|
90
|
+
|
|
91
|
+
## [9.6.0] - 2026-09-02
|
|
92
|
+
|
|
93
|
+
### Fixed — a post-Genesis `OP_CHECKMULTISIG` was refused by a cap the era removed
|
|
94
|
+
|
|
95
|
+
There are two op-count checks. The one in `step()` became era-derived; the one
|
|
96
|
+
inside `OP_CHECKMULTISIG`, which adds the key count, kept reading the static. So
|
|
97
|
+
this ran immediately after the line allowing up to `UINT32_MAX` keys after Genesis:
|
|
98
|
+
|
|
99
|
+
```js
|
|
100
|
+
this.nOpCount += nKeysCount
|
|
101
|
+
if (this.nOpCount > Interpreter.MAX_OPS_PER_SCRIPT) { // 500, whatever the era
|
|
102
|
+
```
|
|
103
|
+
|
|
104
|
+
A post-Genesis multisig with more keys than the **pre-Genesis** limit therefore
|
|
105
|
+
returned `SCRIPT_ERR_OP_COUNT`, while `maxPubKeysPerMultisig()` had just permitted
|
|
106
|
+
it and `maxOpsPerScript()` reported no cap at all. A validator **stricter** than
|
|
107
|
+
consensus, which the flag docblocks in that same file name as being as wrong as a
|
|
108
|
+
loose one and much harder to notice.
|
|
109
|
+
|
|
110
|
+
No vector could catch it: every `OP_COUNT` vector in the node's corpus is
|
|
111
|
+
pre-Genesis, where the static and the era agree. Same shape as 9.4.0 and 9.5.0 —
|
|
112
|
+
the mechanism was covered, the era selection was not.
|
|
113
|
+
|
|
114
|
+
Found while porting the era machinery to `smartledger-bsv-core`, which carried the
|
|
115
|
+
same line; fixed in both.
|
|
116
|
+
|
|
10
117
|
## [9.5.0] - 2026-09-02
|
|
11
118
|
|
|
12
119
|
### Fixed — SIGPUSHONLY, LOW_S and NULLFAIL are consensus, and both flag helpers now say so
|
package/README.md
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
Bitcoin SV library with an interpreter-verified script engine.
|
|
4
4
|
|
|
5
|
-
[](https://www.npmjs.com/package/@smartledger/bsv)
|
|
6
6
|
[](LICENSE)
|
|
7
7
|
[](STABILITY.md)
|
|
8
8
|
|
|
@@ -155,44 +155,44 @@ const bsv = require('@smartledger/bsv') // 128 modules
|
|
|
155
155
|
### **Core Modules**
|
|
156
156
|
| Module | Size | Use Case | CDN |
|
|
157
157
|
|--------|------|----------|-----|
|
|
158
|
-
| **bsv.min.js** |
|
|
159
|
-
| **bsv.bundle.js** |
|
|
158
|
+
| **bsv.min.js** | 1046KB | Core BSV + SmartContract | `unpkg.com/@smartledger/bsv@9.7.0/bsv.min.js` |
|
|
159
|
+
| **bsv.bundle.js** | 1046KB | Everything in one file | `unpkg.com/@smartledger/bsv@9.7.0/bsv.bundle.js` |
|
|
160
160
|
|
|
161
161
|
### **W3C Verifiable Credentials**
|
|
162
162
|
| Module | Size | Use Case | CDN |
|
|
163
163
|
|--------|------|----------|-----|
|
|
164
|
-
| **🟢 bsv-didweb.min.js** | 166KB | **DID:web generation** | `unpkg.com/@smartledger/bsv@9.
|
|
165
|
-
| **🟢 bsv-vcjwt.min.js** | 166KB | **VC-JWT issue/verify** | `unpkg.com/@smartledger/bsv@9.
|
|
166
|
-
| **🟢 bsv-statuslist.min.js** | 256KB | **StatusList2021 revocation** | `unpkg.com/@smartledger/bsv@9.
|
|
167
|
-
| **🟢 bsv-anchor.min.js** | 164KB | **BSV anchoring (hash-only)** | `unpkg.com/@smartledger/bsv@9.
|
|
164
|
+
| **🟢 bsv-didweb.min.js** | 166KB | **DID:web generation** | `unpkg.com/@smartledger/bsv@9.7.0/bsv-didweb.min.js` |
|
|
165
|
+
| **🟢 bsv-vcjwt.min.js** | 166KB | **VC-JWT issue/verify** | `unpkg.com/@smartledger/bsv@9.7.0/bsv-vcjwt.min.js` |
|
|
166
|
+
| **🟢 bsv-statuslist.min.js** | 256KB | **StatusList2021 revocation** | `unpkg.com/@smartledger/bsv@9.7.0/bsv-statuslist.min.js` |
|
|
167
|
+
| **🟢 bsv-anchor.min.js** | 164KB | **BSV anchoring (hash-only)** | `unpkg.com/@smartledger/bsv@9.7.0/bsv-anchor.min.js` |
|
|
168
168
|
|
|
169
169
|
### **Smart Contract & Development**
|
|
170
170
|
| Module | Size | Use Case | CDN |
|
|
171
171
|
|--------|------|----------|-----|
|
|
172
|
-
| **bsv-smartcontract.min.js** | 141KB | Complete covenant framework | `unpkg.com/@smartledger/bsv@9.
|
|
173
|
-
| **bsv-covenant.min.js** | 35KB | Covenant operations | `unpkg.com/@smartledger/bsv@9.
|
|
174
|
-
| **bsv-script-helper.min.js** | 33KB | Custom script tools | `unpkg.com/@smartledger/bsv@9.
|
|
175
|
-
| **bsv-security.min.js** | 32KB | Security enhancements | `unpkg.com/@smartledger/bsv@9.
|
|
172
|
+
| **bsv-smartcontract.min.js** | 141KB | Complete covenant framework | `unpkg.com/@smartledger/bsv@9.7.0/bsv-smartcontract.min.js` |
|
|
173
|
+
| **bsv-covenant.min.js** | 35KB | Covenant operations | `unpkg.com/@smartledger/bsv@9.7.0/bsv-covenant.min.js` |
|
|
174
|
+
| **bsv-script-helper.min.js** | 33KB | Custom script tools | `unpkg.com/@smartledger/bsv@9.7.0/bsv-script-helper.min.js` |
|
|
175
|
+
| **bsv-security.min.js** | 32KB | Security enhancements | `unpkg.com/@smartledger/bsv@9.7.0/bsv-security.min.js` |
|
|
176
176
|
|
|
177
177
|
### **Legal & Compliance**
|
|
178
178
|
| Module | Size | Use Case | CDN |
|
|
179
179
|
|--------|------|----------|-----|
|
|
180
|
-
| **bsv-ltp.min.js** |
|
|
181
|
-
| **bsv-gdaf.min.js** |
|
|
180
|
+
| **bsv-ltp.min.js** | 540KB | Legal Token Protocol | `unpkg.com/@smartledger/bsv@9.7.0/bsv-ltp.min.js` |
|
|
181
|
+
| **bsv-gdaf.min.js** | 1046KB | Digital Identity & Attestation | `unpkg.com/@smartledger/bsv@9.7.0/bsv-gdaf.min.js` |
|
|
182
182
|
|
|
183
183
|
### **Advanced Cryptography**
|
|
184
184
|
| Module | Size | Use Case | CDN |
|
|
185
185
|
|--------|------|----------|-----|
|
|
186
|
-
| **bsv-shamir.min.js** | 177KB | Threshold Cryptography | `unpkg.com/@smartledger/bsv@9.
|
|
186
|
+
| **bsv-shamir.min.js** | 177KB | Threshold Cryptography | `unpkg.com/@smartledger/bsv@9.7.0/bsv-shamir.min.js` |
|
|
187
187
|
|
|
188
188
|
### **Utilities**
|
|
189
189
|
| Module | Size | Use Case | CDN |
|
|
190
190
|
|--------|------|----------|-----|
|
|
191
|
-
| **bsv-ecies.min.js** | 137KB | Encryption | `unpkg.com/@smartledger/bsv@9.
|
|
192
|
-
| **bsv-message.min.js** | 34KB | Message signing | `unpkg.com/@smartledger/bsv@9.
|
|
193
|
-
| **bsv-mnemonic.min.js** | 320KB | HD wallets | `unpkg.com/@smartledger/bsv@9.
|
|
191
|
+
| **bsv-ecies.min.js** | 137KB | Encryption | `unpkg.com/@smartledger/bsv@9.7.0/bsv-ecies.min.js` |
|
|
192
|
+
| **bsv-message.min.js** | 34KB | Message signing | `unpkg.com/@smartledger/bsv@9.7.0/bsv-message.min.js` |
|
|
193
|
+
| **bsv-mnemonic.min.js** | 320KB | HD wallets | `unpkg.com/@smartledger/bsv@9.7.0/bsv-mnemonic.min.js` |
|
|
194
194
|
```html
|
|
195
|
-
<script src="https://unpkg.com/@smartledger/bsv@9.
|
|
195
|
+
<script src="https://unpkg.com/@smartledger/bsv@9.7.0/bsv.min.js"></script>
|
|
196
196
|
<script>
|
|
197
197
|
const key = bsv.PrivateKey.fromRandom()
|
|
198
198
|
</script>
|
|
@@ -240,4 +240,4 @@ MIT
|
|
|
240
240
|
|
|
241
241
|
---
|
|
242
242
|
|
|
243
|
-
**SmartLedger-BSV v9.
|
|
243
|
+
**SmartLedger-BSV v9.7.0**
|