Skip to content

Releases: dfinity/motoko

0.14.0

05 Feb 08:37
b0123f5
Compare
Choose a tag to compare
  • motoko (moc)

    • Add .values() as an alias to .vals() for arrays and Blobs (#4876).

    • Support explicit, safe migration of persistent data allowing arbitrary
      transformations on a selected subset of stable variables.
      Additional static checks warn against possible data loss (#4812).

      As a very simple example:

      import Nat32 "mo:base/Nat32";
      
      (with migration =
        func (old : { var size : Nat32 }) : { var length : Nat } =
          { var length = Nat32.toNat(old.size) }
      )
      persistent actor {
        var length : Nat = 0;
      }
      

      may be used during an upgrade to rename the stable field size to length,
      and change its type from Nat32 to Nat.

      See the documentation for full details.

0.13.7

03 Feb 12:11
80ba70c
Compare
Choose a tag to compare
  • motoko (moc)

    • Support passing cycles in primitive call_raw (resp. ExperimentalInternetComputer.call) (#4868).

0.13.6

20 Jan 23:31
6cb13b5
Compare
Choose a tag to compare
  • motoko (moc)

    • Support the low Wasm memory hook: system func lowmemory() : async* () { ... } (#4849).

    • Breaking change (minor) (#4854):

      • For enhanced orthogonal persistence: The Wasm persistence modes used internally for canister upgrades have been changed to lower case names,
        keep and replace and instead of Keep and Replace:

        If using actor class instances with enhanced orthogonal persistence, you would need to recompile the program and upgrade with latest moc and dfx.
        Otherwise, no action is needed.

    • bugfix: Checks and mitigations that timer servicing works (#4846).

    • bugfix: Some valid upgrades deleting a stable variable could fail the --enhanced-orthogonal-persistence stable compatibility check due to a bug (#4855).

0.13.5

06 Dec 01:26
76f9087
Compare
Choose a tag to compare
  • motoko (moc)

    • Breaking change (minor) (#4786):

      • Add new keyword transient with exactly the same meaning as the old keyword flexible (but a more familiar reading).

      • Add keyword persistent.

        When used to modify the actor keyword in an actor or actor class definition, the keyword declares that the default stability of a
        let or var declaration is stable (not flexible or transient).

        For example, a stateful counter can now be declared as:

        persistent actor {
          // counts increments since last upgrade
          transient var invocations = 0;
        
          // counts increments since first installation
          var value = 0; 	// implicitly `stable`
        
          public func inc() : async () {
            value += 1;
            invocations += 1;
          }
        }

        On upgrade, the transient variable invocations will be reset to 0 and value, now implicitly stable, will retain its current value.

        Legacy actors and classes declared without the persistent keyword have the same semantics as before.

    • Added new primitive replyDeadline : () -> Nat64 to obtain when a response for a best-effort message is due (#4795).

    • bugfix: fail-fast by limiting subtyping depth to avoid reliance on unpredictable stack overflow (#3057, #4798).

  • motoko-base

0.13.4

29 Nov 19:46
7a72632
Compare
Choose a tag to compare
  • motoko (moc)

    • refactoring: Updating and simplifying the runtime system dependencies (#4677).
  • motoko-base

    • Breaking change (minor): Float.format(#hex) is no longer supported.
      This is because newer versions of Motoko (such as with enhanced orthogonal persistence)
      rely on the Rust-native formatter that does not offer this functionality.
      It is expected that this formatter is very rarely used in practice (dfinity/motoko-base⁠#589).

    • Formatter change (minor): The text formatting of NaN, positive or negative,
      will be NaN in newer Motoko versions, while it was nan or -nan in older versions (dfinity/motoko-base⁠#589).

0.13.3

13 Nov 23:32
ef79879
Compare
Choose a tag to compare
  • motoko (moc)

    • typing: suggest conversions between primitive types from imported libraries
      and, with --ai-errors, all available package libraries (#4747).
  • motoko-base

    • Add modules OrderedMap and OrderedSet to replace RBTree with improved functionality, performance
      and ergonomics avoiding the need for preupgrade hooks (thanks to Serokell) (#662).

0.13.2

17 Oct 22:34
a18253d
Compare
Choose a tag to compare
  • motoko (moc)

    • Made the actor's self identifier available in the toplevel block. This also allows using
      functions that refer to self from the initialiser (e.g. calls to setTimer) (#4720).

    • bugfix: actor <exp> now correctly performs definedness tracking (#4731).

0.13.1

07 Oct 15:25
00d60e4
Compare
Choose a tag to compare
  • motoko (moc)

    • Improved error messages for unbound identifiers and fields that avoid reporting large types and use an edit-distance based metric to suggest alternatives (#4720).

    • Flag --ai-errors to tailor error messages to AI clients (#4720).

    • Compilation units containing leading type definitions are now rejected with an improved error message (#4714).

    • bugfix: floatToInt64 now behaves correctly in the interpreter too (#4712).

0.13.0

17 Sep 10:01
ad93a46
Compare
Choose a tag to compare
  • motoko (moc)

    • Added a new primitive cyclesBurn : <system> Nat -> Nat for burning the canister's cycles
      programmatically (#4690).

    • For beta testing: Support enhanced orthogonal persistence, enabled with new moc flag --enhanced-orthogonal-persistence (#4193).

      This implements scalable and efficient orthogonal persistence (stable variables) for Motoko:

      • The Wasm main memory (heap) is retained on upgrade with new program versions directly picking up this state.
      • The Wasm main memory has been extended to 64-bit to scale as large as stable memory in the future.
      • The runtime system checks that data changes of new program versions are compatible with the old state.

      Implications:

      • Upgrades become extremely fast, only depending on the number of types, not on the number of heap objects.
      • Upgrades will no longer hit the IC instruction limit, even for maximum heap usage.
      • The change to 64-bit increases the memory demand on the heap, in worst case by a factor of two.
      • For step-wise release handling, the IC initially only offers a limited capacity of the 64-bit space (e.g. 4GB or 6GB), that will be gradually increased in future to the capacity of stable memory.
      • There is moderate performance regression of around 10% for normal execution due to combined related features (precise tagging, change to incremental GC, and handling of compile-time-known data).
      • The garbage collector is fixed to incremental GC and cannot be chosen.
      • Float.format(#hex prec, x) is no longer supported (expected to be very rarely used in practice).
      • The debug print format of NaN changes (originally nan).

      To activate enhanced orthogonal persistence under dfx, the following command-line argument needs to be specified in dfx.json:

      ...
        "type" : "motoko"
        ...
        "args" : "--enhanced-orthogonal-persistence"
      ...
      

      BREAKING CHANGE (Minor): changes some aspects of Float formatting.

      For more information, see:

      • The Motoko design documentation design/OrthogonalPersistence.md
      • The Motoko user documentation doc/md/canister-maintenance/upgrades.md.
    • Candid decoding: impose an upper limit on the number of values decoded or skipped in a single candid payload,
      as a linear function, max_values, of binary payload size.

        max_values(blob) = (blob.size() * numerator)/denominator + bias
      

      The current default settings are {numerator = 1; denominator = 1; bias = 1024 }, allowing a maximum
      of 1024 values plus one additional value per byte in the payload.

      While hopefully not required, the constant factors can be read/modified using system functions:

      • Prim.setCandidLimits: <system>{numerator : Nat32; denominator : Nat32; bias : Nat32 } -> ()
      • Prim.getCandidLimits: <system>() -> {numerator : Nat32; denominator : Nat32; bias : Nat32 }

0.12.1

08 Aug 15:08
a001388
Compare
Choose a tag to compare
  • motoko (moc)

    • Added a new command-line flag --print-source-on-error to print source code context on error (#4650).

    • debugging: __motoko_runtime_information() as privileged query for runtime statistics (#4635).

      Exposing a privileged system-level query function __motoko_runtime_information()
      that reports the current runtime statistics of the canister, such as the heap size,
      the total number of allocated objects, the total amount of reclaimed memory and more.
      This is useful because several statistics of the reported information cannot be
      inspected on the IC replica dashboard as they are internal to the Motoko runtime system.
      This query is only authorized to the canister controllers and self-calls of the canister.

      __motoko_runtime_information : () -> {
          compilerVersion : Text;
          rtsVersion : Text;
          garbageCollector : Text;
          sanityChecks : Nat;
          memorySize : Nat;
          heapSize : Nat;
          totalAllocation : Nat;
          reclaimed : Nat;
          maxLiveSize : Nat;
          stableMemorySize : Nat;
          logicalStableMemorySize : Nat;
          maxStackSize : Nat;
          callbackTableCount : Nat;
          callbackTableSize : Nat;
      }
  • motoko-base

    • Added Iter.concat function (thanks to AndyGura) (dfinity/motoko-base⁠#650).