Skip to content

Latest commit

 

History

History
337 lines (284 loc) · 15.9 KB

CHANGELOG.md

File metadata and controls

337 lines (284 loc) · 15.9 KB

Changelog

This version is compatible with 960f8d139940fa0814d3fac44da9a2975642f5d3 of clvm

Breaking Change

  • The type of None is now undefined (Previously it was null)
  • Removed isSExp() and isCLVMObject() since these don't exist in the Python's clvm and they brought slightly different behaviour.
  • run_program() has been deprecated. Use run_chia_program or run_clvm instead.
    Note: run_program() is still available, but it cannot handle new CHIP-0011 operators like secp256k1_verify.

Changed

  • Now op_div does not accept negative operands.
  • convert_atom_to_bytes() now is able to convert an object which has toBytes() method.
  • SExp can be initialized from LazyNode of clvm_wasm (Rust version of clvm)
  • Upgraded bls-signatures to 2.0.3
  • Upgraded npm dev dependencies
  • Replaced yarn.lock with pnpm-lock.yaml

Added

  • Added clvm_rs(clvm_wasm) support
    • Exposed run_chia_program
    • Exposed run_clvm
    • Exposed LazyNode
      • Added toJSON() method to LazyNode (This is not implemented in clvm_wasm)
    • Exposed Flag
    • Exposed serialized_length
    • Exposed node_from_bytes
  • Added asUint8Array() method to Stream
  • Added toJSON() method to Bytes
  • Added toJSON() method to SExp
  • Added tests
  • Added example code

Known Issues

  • Loading blsjs.wasm into a web browser from ESModule code requires to put the wasm file into url's root path.
    For example, when the main (compiled) js file is loaded by
    <script type='module' src="https://xxx.yyy.zzz/aaa/bbb/ccc/main.js"></script>
    blsjs.wasm will be fetched from https://xxx.yyy.zzz/blsjs.wasm.
    This is module context only. if the main js file is not on module context like
    <script defer src="https://xxx.yyy.zzz/aaa/bbb/ccc/main.js"></script>,
    blsjs.wasm will be fetched from https://xxx.yyy.zzz/aaa/bbb/ccc/blsjs.wasm.
    However, with clvm >= 3.0.0, most of bls operations run inside clvm_wasm_bg.wasm.
    So I believe you don't need to load blsjs.wasm in most cases.

This version is compatible with 480b32840c525e17b5ab2f29036c033febaae71e of clvm

Changed

  • Changed error message format if argument of x is a single atom.
    For example, when you run (x (q . 2000)), output will be
    (Prev) FAIL: clvm raise (2000) => (Now) FAIL: clvm raise 2000

This version is compatible with fc73cd9dc2fc30a1fd461d0f05af9f9679e042c8 of clvm

Breaking Change

The behaviour of op_div has changed. See detailed explanation here

Changed

  • Made op_div bug-compatible with clvm_rs
  • Replaced npm package @chiamine/bls-signatures with bls-signatures

This version is compatible with 389efa3fbe65c77600da63c78d29c0866d292754 of clvm

Fixed

  • Fixed an issue of as_javascript with tuples inside tuples and ending with 0

This version is compatible with 2722c78ddb92f067c5025196f397e4d2955f9053 of clvm

Fixed

  • Fixed typo in error message
  • Fixed an issue where op_substr did not work as expected.
  • Fixed an issue where cost calculation for op_subtract was not correct.
  • Fixed limbs_for_int return wrong value when argument is 0.
  • Fixed an issue where Bytes comparison returns wrong result in some cases.
  • Fixed an issue where op_softfork crashed with argument atom larger than or equal to 53bit.
  • Fixed G1Element error message.

This version is compatible with 2722c78ddb92f067c5025196f397e4d2955f9053 of clvm

Added

  • Added type declaration file browser/index.d.ts on build.

Changed

  • Changed SExp/CLVMObject properties atom and pair to readonly to prevent potential bug.
  • Changed src/__bls_signatures__.ts location to src/__bls_signatures__/index.ts to prepare for future wasm-loading tweaks.
  • Upgraded @chiamine/bls-signatures to 0.2.1-beta.2.
  • Use CLVMType instead of CLVMObject as a valid type representation of CLVMObject.
    (CLVMObject should not be used as a type because there might be number of type incompatibility due to new private field)
  • Replace ** operator on BigInt by user-defined function because babel or some transpiler always converts ** to Math.pow which cannot be used with BigInt
    • Although I tried this, it turns out to be 100x slower than ** operator, so I gave up. It is required to disable such a transform by end-developer. See detail here

This version is compatible with 2722c78ddb92f067c5025196f397e4d2955f9053 of clvm

Changed

  • Improved bigint_from_bytes around 3-10 times faster.
  • Improved int_from_bytes performance.
  • Improved bigint_to_bytes around 2 times faster.
  • Improved int_to_bytes performance.

Fixed

  • Fixed an issue where utility function division/modulo returned wrong values in some cases.

Added

  • Added divmod utility function.

This version is compatible with ab4560900cf475ff515054bec0ca9a4491aca366 of clvm

Fixed

  • Fixed an issue where op_lsh did not work as expected.

This version is compatible with ab4560900cf475ff515054bec0ca9a4491aca366 of clvm

Fixed

  • Fixed an issue where int_from_bytes and bigint_from_bytes returned always signed int/bigint.
  • Fixed an issue where int_to_bytes and bigint_to_bytes blindly recognized the argument as a signed int/bigint.

This version is compatible with ab4560900cf475ff515054bec0ca9a4491aca366 of clvm

Fixed

  • Fixed an issue where op_logand, op_logior, op_logxor did not work
  • Fixed an issue where result of div/mod against negative bigint was not compatible with original clvm

This version is compatible with 1a5cb17895d8707f784a85180bc97d3c6ebe71a0 of clvm

Fixed

  • Fixed an issue where op_pubkey_for_exp was missing.
  • Fixed an issue where arithmetic op of atoms larger than 32 bit integer did not work.

Added

  • Added bigint_to_bytes function in src/casts.ts
  • Added tests for Bytes-BigInt conversion.

This version is compatible with 1a5cb17895d8707f784a85180bc97d3c6ebe71a0 of clvm

Changed

  • Improved Stream::read performance by removing extra memory copy.

This version is compatible with 1a5cb17895d8707f784a85180bc97d3c6ebe71a0 of clvm

Removed

  • Removed .dist folder from git.
    • This folder made it harder to check diffs between versions.

Added

  • Added GitHub Action
  • Added str(), repr() utility functions.
  • Added Bytes::subarray to get bytes data without additional memory allocation/copy.

Changed

  • Updated README.md
  • Changed method name Bytes::get_byte_at to Bytes::at (Breaking change).

Deprecated

  • Deprecated python specific type definition such as str, int. Use string, number instead.

There are 2 breaking changes.

  • Changed OperatorDict arguments format.
    Past: OperatorDict(atom_op_function_map, quote_atom, apply_atom, unknown_op_handler)
    New: OperatorDict(atom_op_function_map, option)
    where option is {quote_atom: Bytes, apply_atom: Bytes, unknown_op_handler: typeof default_unknown_op}

  • When you initialize Bytes using constructor like new Byte(data), data is not copied but just stored and keeps reference of data, for performance enhancement.
    In javascript, byte copy by TypedArray constructor is not sufficiently fast.
    So I left user an option how to initialize Bytes instance. Data copy, or Store reference.
    If you want to copy data and cut reference apart, then please get Bytes instance by Bytes.from factory function.

Resolved a deep tree performance issue
Before this version, yarn test serialize_test --testNamePattern=test_very_deep_tree was really slow. It took around 80 seconds to complete test.
At this version, I've managed to improve test complete time to 79s -> 2s by pre-allocating buffer memory on Stream instance.

Changed

  • Changed OperatorDict arguments format.
  • When you initialize Bytes using constructor like new Byte(data), data is not copied but just stored and keeps reference of data, for performance enhancement.
  • Greatly improved overall performance by pre-allocating buffer memory on Stream instance.
  • Improved performance of Bytes::equal_to.
  • Changed parameter type of SExp::equal_to from CastableType to any
  • Replaced use of instanceof operator for non-native types.
  • Updated bls-signatures version to 0.2.1-beta.1
  • Improved Bytes::concat performance.
  • Reorganized dist folder

Fixed

  • Fixed an issue where SExp.to(<boolean>) did not work the same as python's clvm.
  • Fixed an issue where Bytes-SExp comparison like b('aaa').equal_to(SExp.null()) did not work.
  • Fixed an issue where OperatorDict did not throw Error when either quote or apply is not specified.

Added

  • Added list() function working similar to Python's list().
  • Added Bytes::repeat function.

Changed

  • Fixed an issue where int_to_bytes did not work as expected if the argument is a negative number.
  • Changed Bytes::toString() to return python's bytes.__repr__ style string.

Changed

  • Updated jscrypto version to 1.0.2

Added

  • Added license information to README.md

Fixed

  • Fixed a bug in sexp_from_stream
  • Fixed incorrect use of int_to_bytes

Fixed

  • Fixed a bug in pre_build.js

Changed

  • Changed new line style for files in dist/ from windows-style(CR) to linux-style(LF).

Removed

  • Removed WordArray32 from possible argument of Bytes.from.

Added

  • Added Bytes.SHA256().

Changed

  • Bytes.from() now accepts an array of number.

Fixed

  • Fixed an issue where int_to_bytes returns value incompatible with clvm in python.
  • Fixed a minor issue

Fixed

  • Don't remove leading '00' or 'ff' when serializing SExp to hex string.
  • Fixed an issue where SExp.to(0) is converted to SExp(0x00) where SExp(0x80) is expected.
  • Fixed an issue where it raises an Error when executing Bytes::equal_to(None).
  • Fixed a minor issue

Changed

  • Made EvalError::_sexp public.

Added

  • Added h(<str>) helper function which equals to Bytes.from(<str>, "hex")

Fixed

  • Removed type-guard from SExp::listp()
  • Removed SExpAsAtom type and SExpAsPair type as they seem not working.

Added

  • Added Bytes::hex() which is an alias of Bytes::toString()
  • Added Bytes::decode()
  • Added Bytes::startswith() and Bytes::endswith()
  • Added SExpAsAtom type and SExpAsPair type.
  • Added hex string support to b(<str>). In b("0xaa", "hex"), 0xaa is now parsed as hex string.

Fixed

  • Fixed value of SExp.TRUE and SExp.FALSE

Added

  • Added b(<str>) helper function which equals to Bytes.from(<str>, "utf8")
  • Added isTuple, isList functions.

Changed

  • Made return type of as_javascript() explicit
  • Updated CastableType

Fixed

  • Fixed an issue where SExp::as_javascript() does not return expected value.
  • Fixed an issue where SExp.to(<tuple>) raises unexpected Error.
  • Fixed incorrect function name __repl__ to __repr__

Changed

  • Removed '0x' prefix from results of SExp::__repr__()

Fixed

  • Fixed an issue where SExp.to(<str>) falls in infinite loop.

Changed

  • Changed source of bls-signatures to @chiamine/bls-signatures
    • When installing from previous Chia-Mine/bls-signatures#npm, the npm module version is too old or unstable.
      Sometimes it installed the latest commit and another time installed old cache.
      I decided to install the module not from GitHub branch but official npm registry for stability.
  • Updated README

Fixed

  • Fixed various eslint errors

Added

  • Added to_sexp_f export to index.ts/index.js

Changed

  • Change tuple type Tuple2 -> Tuple.

0.0.1 - 2021-06-16

Fixed

  • Fixed various bugs

0.0.0 - 2021-06-15

Initial (beta) release.