@smartledger/bsv 4.4.0 → 4.6.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 CHANGED
@@ -5,6 +5,62 @@ All notable changes to SmartLedger-BSV will be documented in this file.
5
5
  The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
6
6
  and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
7
7
 
8
+ ## [4.6.0] - 2026-06-09
9
+
10
+ ### Fixed — covenants are now mainnet-relayable (MINIMALDATA)
11
+
12
+ OP_PUSH_TX covenants up to 4.5.0 were consensus-valid but **non-standard**: their
13
+ locking scripts contained non-minimal data pushes, so every mainnet miner
14
+ rejected the spend with `non-mandatory-script-verify-flag (Data push larger than
15
+ necessary)` = `SCRIPT_ERR_MINIMALDATA`. Found by actually broadcasting to BSV
16
+ mainnet (WhatsOnChain/Taal **and** GorillaPool ARC both rejected it).
17
+
18
+ The non-minimal pushes were: a bare `0x00` sign byte, a bare `0x02` pubkey
19
+ prefix, and small integers (3/4/8) pushed as data. Fixes:
20
+
21
+ - **`PushTx.pushTxCore`**: drop the `0x00` sign-extension — the grind now requires
22
+ `z[0]` (first byte of HASH256(preimage)) to be `0x01..0x7f`, so the hash is
23
+ already a positive, minimally-encoded number. Use `OP_2` for the pubkey prefix.
24
+ - **`CovenantHelpers.scriptNum`**: emit `OP_0`/`OP_1..OP_16`/`OP_1NEGATE` for
25
+ `0..16`/`-1` instead of a data push (fixes PELS, token, and the DSL's
26
+ `lockUntil`).
27
+ - **`CovenantHelpers.flags`**: now includes `SCRIPT_VERIFY_MINIMALDATA`, so local
28
+ `verifyScript`/`trace` mirror real mainnet relay policy and catch non-relayable
29
+ covenants before broadcast.
30
+
31
+ A value covenant built with this release was **deployed and spent on BSV
32
+ mainnet** (txids `f9f25dbd…` deploy, `ea438096…` spend). Full suite 4206 passing,
33
+ lint clean.
34
+
35
+ ## [4.5.0] - 2026-06-09
36
+
37
+ ### Added — declarative covenant DSL + stack debugger
38
+
39
+ - **`SmartContract.policy()` — a declarative covenant DSL.** Describe a spending
40
+ policy and compile it to a verified OP_PUSH_TX locking script, no opcodes:
41
+ ```js
42
+ const c = bsv.SmartContract.policy()
43
+ .payTo(aliceAddr, 9500) // the spend MUST create this output...
44
+ .lockUntil(800000) // ...with nLockTime >= 800000
45
+ .compile()
46
+ // c.lock, c.outputs, c.unlock(spendTx, satoshis)
47
+ ```
48
+ Clauses AND together (each compiles to one preimage-field check on a single
49
+ OP_PUSH_TX authentication). `payTo` pins outputs via `hashOutputs`; `lockUntil`
50
+ checks the `nLockTime` field. The compiled `unlock()` grinds the OP_PUSH_TX
51
+ nonce *from the locktime floor upward* so it never collides with a `lockUntil`
52
+ constraint. Shortcuts: `policy.perpetual(fee)`, `policy.token(fee, ownerHash)`.
53
+ - **`SmartContract.trace()` — a covenant stack debugger.** Step-traces a
54
+ locking/unlocking pair and records the stack + alt-stack after every opcode, so
55
+ you can watch an OP_PUSH_TX covenant build its signature and enforce its
56
+ constraints. `SmartContract.Debugger.format(result)` pretty-prints it.
57
+ - **TypeScript types** for the full covenant suite in `bsv.d.ts`
58
+ (`SmartContract.{PushTx,PELS,Token,Locks,CovenantHelpers,policy,Policy,trace,
59
+ Debugger}` + `enableGenesis`/`verifyScript`/`perpetualCovenant`/…).
60
+
61
+ New mocha suite `test/smart_contract/dsl_debugger.js` (7 specs). Full suite
62
+ 4199 → 4206 passing. Lint clean; `bsv.d.ts` type-checks.
63
+
8
64
  ## [4.4.0] - 2026-06-07
9
65
 
10
66
  ### Added — BSV string opcodes OP_SUBSTR / OP_LEFT / OP_RIGHT