smartledger-bsv 4.2.1 → 4.4.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,56 @@ 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.4.0] - 2026-06-07
9
+
10
+ ### Added — BSV string opcodes OP_SUBSTR / OP_LEFT / OP_RIGHT
11
+
12
+ - **Implemented the re-enabled BSV (Chronicle) string opcodes in the script
13
+ interpreter.** They were declared in the opcode map (`0xb3`/`0xb4`/`0xb5`) but
14
+ unimplemented — executing one returned `BAD_OPCODE`. Now they evaluate with the
15
+ original Satoshi semantics:
16
+ - `OP_LEFT (in n -- out)` — the first `n` bytes.
17
+ - `OP_RIGHT (in n -- out)` — the last `n` bytes (`OP_RIGHT 0` ⇒ empty, not the
18
+ whole string).
19
+ - `OP_SUBSTR (in begin size -- out)` — `in[begin : begin+size]`.
20
+ Out-of-range lengths clamp to the string length; negative arguments fail with
21
+ `SCRIPT_ERR_INVALID_NUMBER_RANGE`. New test: `test/script/string_ops.js`.
22
+
23
+ ### Changed
24
+
25
+ - **Covenant field-extraction now uses these opcodes**, shrinking the scripts
26
+ further: perpetual covenant 429→**421 B**, ownership token 493→**482 B**, value
27
+ covenant 428→**424 B** (vs. the verbose `OP_SIZE/OP_SUB/OP_SPLIT/OP_NIP` form).
28
+
29
+ Full mocha suite 4190 → 4199 passing, 0 failing. Lint clean.
30
+
31
+ ## [4.3.0] - 2026-06-07
32
+
33
+ ### Changed — mainnet hardening of OP_PUSH_TX covenants
34
+
35
+ - **Canonical low-S signatures.** The OP_PUSH_TX grind now requires `s <= n/2`,
36
+ so the in-script signature is canonical (low-S) and non-malleable, and the
37
+ covenant verify path enforces `SCRIPT_VERIFY_LOW_S`. This makes the produced
38
+ spends standard for mainnet relay/mining. Cost: zero extra script bytes — the
39
+ constraint is satisfied by the spender's grind, not by added opcodes.
40
+ (`SmartContract.PushTx.sFromPreimage`, `CovenantHelpers.flags`.)
41
+ - **Smaller scripts (−22 bytes per covenant).** `pushTxCore` now shares a single
42
+ `Gx` push between the DER signature's r-value and the `02||Gx` public key
43
+ (parked on the alt-stack) instead of embedding the 32-byte constant twice.
44
+ Authenticator 404→382 B, value covenant 450→428 B, perpetual 451→429 B,
45
+ ownership token 515→493 B.
46
+
47
+ ### Notes
48
+
49
+ - The remaining ~382-byte floor is intrinsic to OP_PUSH_TX on BSV: ~248 B is the
50
+ two mandatory 32-byte endianness reversals (big-endian hash ↔ little-endian
51
+ script arithmetic ↔ big-endian DER), the rest is fixed secp256k1 constants and
52
+ the DER template. There is no single-opcode byte reverse on BSV —
53
+ `OP_REVERSEBYTES` is a Bitcoin Cash opcode, not part of the BSV opcode set, so
54
+ the `OP_SPLIT`/`OP_SWAP`/`OP_CAT` reversal gadget is the correct approach.
55
+ - New test: `test/smart_contract/covenants.js` proves the grind yields low-S
56
+ signatures enforced under `SCRIPT_VERIFY_LOW_S`. Full suite 4189 → 4190.
57
+
8
58
  ## [4.2.1] - 2026-06-07
9
59
 
10
60
  ### Docs