Skip to content

@smartledger/scriptmin 0.1.1

Choose a tag to compare

@codenlighten codenlighten released this 17 Sep 14:51
· 10 commits to main since this release

Fixes

  • Data envelopes are kept byte for byte. An OP_0 OP_IF … OP_ENDIF block never runs, so the optimizer could rewrite what is inside it and still pass its equivalence checks. That is where inscription envelopes (1Sat Ordinals, BSV-21 and similar) carry their data, and 0.1.0 could change it, for example turning a repeated field into OP_OVER. Such blocks are now kept verbatim, and code around them is still optimized. Blocks containing OP_VERIF/OP_VERNOTIF are left to ordinary branch handling, because where they end depends on whether Chronicle rules apply. (#1)
  • No quadratic slowdown on very deep stacks. A constant ROLL/PICK index in the tens of thousands made stack scheduling quadratic: a 6-op script took 75 s. The scheduler now abandons schedules far larger than the code they would replace, and the script takes 3.8 s. The Miller loop, final exponentiation and other real module scripts optimize to the same bytes as before. (#2)
  • Wider fuzz test: every modelled opcode, unusual push encodings, boundary numbers, and computed PICK/ROLL indices.

Install

npm install @smartledger/scriptmin @smartledger/bsv