Skip to content

Releases: dfinity/motoko

0.11.2

06 Jul 22:00
e6d5d03
Compare
Choose a tag to compare
  • motoko (moc)

    • deprecation: Deprecate the use of base library's ExperimentalStableMemory (ESM) (#4573).
      New moc flag --experimental-stable-memory <n> controls the level of deprecation:

      • n < 0: error on use of stable memory primitives.
      • n = 0: warn on use of stable memory primitives.
      • n > 1: warning-less use of stable memory primitives (for legacy applications).
        Users of ESM should consider migrating their code to use isolated regions (library Region.mo) instead.
    • bugfix: Fix the detection of unused declarations in switch and catch alternatives (#4560).

    • improvement: Only warn on unused identifiers if type checking is error-free (#4561).

0.11.1

15 Mar 18:42
dfd5672
Compare
Choose a tag to compare
  • motoko (moc)

    • feat: Custom error message for unused, punned field bindings (#4454).

    • feat: Don't report top-level identifiers as unused (#4452).

    • bugfix: Declaring <system, ...> capability on a class enables system capabilities in its body (#4449).

    • bugfix: Fix crash compiling actor reference containing an await (#4418, #4450).

    • bugfix: Fix crash when compiling with flag --experimental-rtti (#4434).

0.11.0

05 Mar 22:45
90013cb
Compare
Choose a tag to compare
  • motoko (moc)

    • Warn on detection of unused identifiers (code M0194) (#4377).

      • By design, warnings are not emitted for code imported from a package.
      • A warning can be suppressed by replacing the identifier entirely by a wildcard _,
        or by prefixing it with an _, e.g. replace x by _x.

      Limitations: recursive and mutually recursive definitions are considered used,
      even if never referenced outside the recursive definition.

    • Remove __get_candid_interface_tmp_hack endpoint. Candid interface is already stored as canister metadata, this temporary endpoint is redundant, thus removed. (#4386)

    • Improved capability system, introducing a synchronous (system) capability (#4406).

      actor initialisation body, pre/postupgrade hooks, async function bodies (and
      blocks) possess this capability. Functions (and classes) can demand it by prepending system
      to the type argument list. The capability can be forwarded in calls by mentioning <system, …>
      in the instantiation parameter list.

      BREAKING CHANGE (Minor): A few built-in functions have been marked with demand
      for the system capability. In order to call these, the full call hierarchy needs to be
      adapted to pass the system capability.

    • Introduced the feature for precise tagging of scalar values (#4369).

      Controlled by flag --experimental-rtti (off by default). Minor performance changes for
      arithmetic expected. We advise to only turn on the feature for testing, as currently no
      productive upsides exist (though future improvements will depend on it), and performance
      of arithmetic will degrade somewhat. See the PR for the whole picture.

  • motoko-base

    • Added Option.equal function (thanks to ByronBecker) (dfinity/motoko-base⁠#615).

0.10.4

10 Jan 17:28
60f079d
Compare
Choose a tag to compare
  • motoko (moc)

    • Officializing the new incremental garbage collector after a successful beta testing phase.
      The incremental GC can be enabled by the moc flag --incremental-gc (#3837) and is designed to scale for large program heap sizes.

      Note: While resolving scalability issues with regard to the instruction limit of the GC work, it is now possible to hit other scalability limits:

      • Out of memory: A program can run out of memory if it fills the entire memory space with live objects.
      • Upgrade limits: When using stable variables, the current mechanism of serialization and deserialization to and from stable memory can exceed the instruction limit or run out of memory.

      Recommendations:

      • Test the upgrade: Thoroughly test the upgrade mechanism for different data volumes and heap sizes and conservatively determine the amount of stable data that is supported when upgrading the program.
      • Monitor the heap size: Monitor the memory and heap size (Prim.rts_memory_size() and Prim.rts_heap_size()) of the application in production.
      • Limit the heap size: Implement a custom limit in the application to keep the heap size and data volume below the scalability limit that has been determined during testing, in particular for the upgrade mechanism.
      • Avoid large allocations per message: Avoid large allocations of 100 MB or more per message, but rather distribute larger allocations across multiple messages. Large allocations per message extend the duration of the GC increment. Moreover, memory pressure may occur because the GC has a higher reclamation latency than a classical stop-the-world collector.
      • Consider a backup query function: Depending on the application case, it can be beneficial to offer an privileged query function to extract the critical canister state in several chunks. The runtime system maintains an extra memory reserve for query functions. Of course, such a function has to be implemented with a check that restricts it to authorized callers only. It is also important to test this function well.
      • Last resort if memory would be full: Assuming the memory is full with objects that have shortly become garbage before the memory space has been exhausted, the canister owner or controllers can call the system-level function __motoko_gc_trigger() multiple times to run extra GC increments and complete a GC run, for collecting the latest garbage in a full heap. Up to 100 calls of this function may be needed to complete a GC run in a 4GB memory space. The GC keeps an specific memory reserve to be able to perform its work even if the application has exhausted the memory. Usually, this functionality is not needed in practice but is only useful in such exceptional cases.
    • Allow type annotations on free-standing object/module/actor blocks, in order to perform a conformity check with an interface type (#4324).

0.10.3

20 Dec 13:02
5d2dce9
Compare
Choose a tag to compare
  • motoko (moc)

    • Include doc comments to Candid interfaces generated via the --idl flag (#4334).

    • bugfix: fix broken implementations of Region.loadNat32, Region.storeNat32, Region.loadInt32, Region.storeInt32 (#4335).
      Values previously stored with the broken 32-bit operations must be loaded with care.
      If bit 0 is clear, the original value can be obtained by an arithmetic shift right by 1 bit.
      If bit 0 is set, the value cannot be trusted and should be ignored
      (it encodes some transient address of a boxed value).

  • motoko-base

    • Added ExperimentalInternetComputer.performanceCounter function to get the raw performance
      counters (dfinity/motoko-base⁠#600).

    • Added Array.take function to get some prefix of an array (dfinity/motoko-base⁠#587).

    • Deprecated TrieSet.mem in favor of TrieSet.has (dfinity/motoko-base⁠#576).

    • bugfix: Array.chain(as, f) was incorrectly trapping when f(a) was an empty array
      (dfinity/motoko-base⁠#599).

0.10.2

12 Nov 18:45
14962ff
Compare
Choose a tag to compare
  • motoko (moc)

    • bugfix: separate tag from underscore in coverage warnings (#4274).

    • Code compiled for targets WASI (-wasi-system-api) and pure Wasm (-no-system-api) can now
      use up to 4GB of (efficiently emulated) stable memory, enabling more offline testing of, for example,
      stable data structures built using libraries Regions.mo and ExperimentalStableMemory.mo.
      Note that any Wasm engine (such as wasmtime), used to execute such binaries, must support and enable
      Wasm features multi-memory and bulk-memory (as well as the standard NaN canonicalization) (#4256).

    • bugfix: fully implement Region.loadXXX/storeXXX for Int8, Int16 and Float (#4270).

    • BREAKING CHANGE (Minor): values of type Principal are now constrained to contain
      at most 29 bytes, matching the IC's notion of principal (#4268).

      In particular:

      • An actor import will be statically rejected if the binary representation of the (aliased) textually encoded
        principal contains strictly more than 29 bytes.

      • Principal.fromBlob(b) will trap if b contains strictly more than 29 bytes.

      • The actor literal, actor <exp>, will trap if the binary representation of
        of the textually encoded principal <exp> contains strictly more than 29 bytes.

  • motoko-base

    • bugfix: fix Array.tabulateVar to avoid repeated side-effects (dfinity/motoko-base⁠#596)

0.10.1

16 Oct 21:04
0040bbf
Compare
Choose a tag to compare
  • motoko (moc)

    • bugfix: fix assertion failure renaming or-patterns (#4236, #4224).

    • bugfix: unsuccessful Candid decoding of an optional array now defaults to null instead of crashing (#4240).

    • bugfix: Candid decoding of an optional, unknown variant with a payload now succeeds instead of crashing (#4238).

    • Implement Prim.textLowercase and Prim.textUppercase (via Rust) (#4216).

    • perf: inline sharable low-level functions in generated coded,
      trading code size for reduced cycle count (#4212).
      Controlled by flags:

      • -fno-shared-code (default)
      • -fshared-code (legacy)
        (Helps mitigate the effect of the IC's new cost model, that increases
        the cost of function calls).
  • motoko-base

    • Added Principal.toLedgerAccount (#582).

    • Added Text.toLowercase and Text.toUppercase (#590).

0.10.0

11 Sep 12:17
e1dddb5
Compare
Choose a tag to compare
  • motoko (moc)

    • Added a new stable Region type of dynamically allocated, independently growable and
      isolated regions of IC stable memory (#3768). See documentation.
      BREAKING CHANGE: stable memory changes may occur that can prevent returning
      to previous moc versions.

    • Added doc comments in generated Candid files (#4178).

  • motoko-base

0.9.8

11 Aug 16:51
d0df147
Compare
Choose a tag to compare
  • motoko (moc)

    • Added numerical type conversions between adjacent fixed-width types (#4139).

    • Administrative: legacy-named release artefacts are no longer created (#4111).

0.9.7

18 Jul 09:48
7f1b6bd
Compare
Choose a tag to compare
  • motoko (moc)

    • Performance improvement: lower the default allocation for bignums (#4102).

    • Performance improvement: generate better code for pattern matches on some small variants (#4093).

    • bugfix: don't crash on import of Candid composite queries (#4128).