.tar.gz"
},
"esm": {
From 983c988ef5add870f2d05043c41d9ed69df7ecb7 Mon Sep 17 00:00:00 2001
From: Luc Blaeser <112870813+luc-blaeser@users.noreply.github.com>
Date: Wed, 11 Sep 2024 13:12:59 +0200
Subject: [PATCH 09/27] Fix: Start Wasm table for the RTS at offset >= 1
(#4685)
Rust requires a table offset of at least 1 as the element index 0 is considered invalid and causes a debug null check to panic when called. On the other hand, `elem[0]` can be used by the Motoko backend code, as correct Rust-generated Wasm code does not call `elem[0]`.
This bug is independent of `wasm32` and `wasm64`.
This issue has been observed in https://github.com/dfinity/motoko/actions/runs/10703077671/job/29672766216?pr=4683 and happened only on Linux and only under `nix-build` (not `nix-shell`).
---
src/linking/linkModule.ml | 8 +++++++-
test/ld/ok/representative.linked.wat.ok | 2 +-
2 files changed, 8 insertions(+), 2 deletions(-)
diff --git a/src/linking/linkModule.ml b/src/linking/linkModule.ml
index 6adf1535312..55c657285a1 100644
--- a/src/linking/linkModule.ml
+++ b/src/linking/linkModule.ml
@@ -846,7 +846,13 @@ let link (em1 : extended_module) libname (em2 : extended_module) =
)
end else ();
- let old_table_size = read_table_size em1.module_ in
+ let max x y = if x >= y then x else y in (* use `Int.max` when bumping to 4.13 *)
+
+ (* Rust requires a table offset of at least 1 as elem[0] is considered invalid.
+ There are debug checks panicking if the element index is zero.
+ On the other hand, elem[0] can be used by the Motoko backend code (em1),
+ as correct Rust-generated Wasm code does not call elem[0]. *)
+ let old_table_size = max (read_table_size em1.module_) 1l in
let lib_table_start = align_i32 dylink.table_alignment old_table_size in
let uses_memory64 = uses_memory64 em1.module_ in
diff --git a/test/ld/ok/representative.linked.wat.ok b/test/ld/ok/representative.linked.wat.ok
index bcf3c073ec9..076c64ab1df 100644
--- a/test/ld/ok/representative.linked.wat.ok
+++ b/test/ld/ok/representative.linked.wat.ok
@@ -22,7 +22,7 @@
i32.mul)
(func $link_start (type 0)
call $__wasm_call_ctors)
- (table (;0;) 0 0 funcref)
+ (table (;0;) 1 1 funcref)
(memory (;0;) i64 2)
(global (;0;) i64 (i64.const 65536))
(start $link_start))
From 074ffca17f95a3da876d8d0dda4d123cd5c16674 Mon Sep 17 00:00:00 2001
From: Jessie Mongeon <133128541+jessiemongeon1@users.noreply.github.com>
Date: Thu, 12 Sep 2024 05:20:55 -0500
Subject: [PATCH 10/27] doc: add `try`/`finally` code example (#4669)
---
doc/md/examples/try-finally.mo | 18 ++++++++++++++++++
doc/md/writing-motoko/errors.md | 19 +++++++++++++++++++
2 files changed, 37 insertions(+)
create mode 100644 doc/md/examples/try-finally.mo
diff --git a/doc/md/examples/try-finally.mo b/doc/md/examples/try-finally.mo
new file mode 100644
index 00000000000..a8deebc6d92
--- /dev/null
+++ b/doc/md/examples/try-finally.mo
@@ -0,0 +1,18 @@
+import Text "mo:base/Text";
+import Debug "mo:base/Debug"
+
+actor {
+ public func tryFunction() {
+
+ try {
+ func greetOptional(optionalName : ?Text) : Text =
+ switch optionalName {
+ case null { "No name to be found." };
+ case (?name) { "Hello, " # name # "!" };
+ };
+ assert greetOptional(?"Motoko") == "Motoko";
+ } finally {
+ Debug.print("Finally block executed");
+ }
+ }
+}
diff --git a/doc/md/writing-motoko/errors.md b/doc/md/writing-motoko/errors.md
index 02a8fe7c6a8..65212bac916 100644
--- a/doc/md/writing-motoko/errors.md
+++ b/doc/md/writing-motoko/errors.md
@@ -121,6 +121,25 @@ Callsite:
``` motoko no-repl file=../examples/todo-error.mo#L143-L150
```
+## Using try/finally
+
+A `finally` clause can be used within a `try/catch` error handling expression that facilitates control-flow expression cleanups, resource deallocation, or rolling back temporary state changes. The `finally` clause is optional, and when used, the `catch` clause may be omitted. Any uncaught error from the `try` block will be propagated after the `finally` block has executed.
+
+:::info
+
+`try/finally` is supported in `moc` `v0.12.0` and newer, and `dfx` `v0.24.0` and newer.
+
+:::
+
+`try/finally` must be used within an async expression or in the body of a shared function. Before using `try/finally`, please review the [security best practices](https://internetcomputer.org/docs/current/developer-docs/security/security-best-practices/inter-canister-calls#recommendation) for using this syntax.
+
+``` motoko no-repl file=../examples/try-finally.mo
+```
+
+Inside the `try` block, include code that may throw an error. In the `finally` block, include code that should be executed whether an error was thrown or not. Code within the `finally` block should not trap and should terminate promptly. If a `finally` block were to trap, it may prevent a future upgrade to the canister.
+
+Learn more about [`try/finally`](https://internetcomputer.org/docs/current/motoko/main/reference/language-manual#try).
+
### How not to handle errors
A generally poor way of reporting errors is through the use of a sentinel value. For example, for your `markDone` function, you might decide to use the value `-1` to signal that something failed. The callsite then has to check the return value against this special value and report the error. It's easy to not check for that error condition and continue to work with that value in the code. This can lead to delayed or even missing error detection and is strongly discouraged.
From c75e20cd53139481d94f392a41368ab817fbaa26 Mon Sep 17 00:00:00 2001
From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com>
Date: Fri, 13 Sep 2024 00:46:05 +0000
Subject: [PATCH 11/27] chore(deps): Bump `cachix/install-nix-action` from 27
to 28 (#4691)
Bumps [cachix/install-nix-action](https://github.com/cachix/install-nix-action) from 27 to 28.
Release notes
Sourced from cachix/install-nix-action's releases.
v28
Nix 2.24.6 - https://github.com/NixOS/nix/security/advisories/GHSA-h4vv-h3jq-v493
Commits
[![Dependabot compatibility score](https://dependabot-badges.githubapp.com/badges/compatibility_score?dependency-name=cachix/install-nix-action&package-manager=github_actions&previous-version=27&new-version=28)](https://docs.github.com/en/github/managing-security-vulnerabilities/about-dependabot-security-updates#about-compatibility-scores)
Dependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting `@dependabot rebase`.
[//]: # (dependabot-automerge-start)
[//]: # (dependabot-automerge-end)
---
Dependabot commands and options
You can trigger Dependabot actions by commenting on this PR:
- `@dependabot rebase` will rebase this PR
- `@dependabot recreate` will recreate this PR, overwriting any edits that have been made to it
- `@dependabot merge` will merge this PR after your CI passes on it
- `@dependabot squash and merge` will squash and merge this PR after your CI passes on it
- `@dependabot cancel merge` will cancel a previously requested merge and block automerging
- `@dependabot reopen` will reopen this PR if it is closed
- `@dependabot close` will close this PR and stop Dependabot recreating it. You can achieve the same result by closing it manually
- `@dependabot show ignore conditions` will show all of the ignore conditions of the specified dependency
- `@dependabot ignore this major version` will close this PR and stop Dependabot creating any more for this major version (unless you reopen the PR or upgrade to it yourself)
- `@dependabot ignore this minor version` will close this PR and stop Dependabot creating any more for this minor version (unless you reopen the PR or upgrade to it yourself)
- `@dependabot ignore this dependency` will close this PR and stop Dependabot creating any more for this dependency (unless you reopen the PR or upgrade to it yourself)
---
.github/workflows/release.yml | 4 ++--
.github/workflows/test.yml | 6 +++---
.github/workflows/update-hash.yml | 2 +-
3 files changed, 6 insertions(+), 6 deletions(-)
diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml
index d59e9c9cc83..d532e4bc059 100644
--- a/.github/workflows/release.yml
+++ b/.github/workflows/release.yml
@@ -48,7 +48,7 @@ jobs:
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v4
- - uses: cachix/install-nix-action@v27
+ - uses: cachix/install-nix-action@V28
- uses: cachix/cachix-action@v15
if: startsWith(github.ref, 'refs/heads/')
with:
@@ -74,7 +74,7 @@ jobs:
needs: [ changelog, build ]
steps:
- uses: actions/checkout@v4
- - uses: cachix/install-nix-action@v27
+ - uses: cachix/install-nix-action@V28
- uses: cachix/cachix-action@v15
with:
name: ic-hs-test
diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml
index 94826e0613c..f0ddb388739 100644
--- a/.github/workflows/test.yml
+++ b/.github/workflows/test.yml
@@ -17,7 +17,7 @@ jobs:
fetch-depth: 0
# fetch PR commit, not predicted merge commit
ref: ${{ github.event.pull_request.head.sha }}
- - uses: cachix/install-nix-action@V27
+ - uses: cachix/install-nix-action@V28
# We are using the ic-hs-test cachix cache that is also used by
# dfinity/ic-hs. This is partly laziness (on need to set up a separate
@@ -106,7 +106,7 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- - uses: cachix/install-nix-action@v27
+ - uses: cachix/install-nix-action@V28
- uses: cachix/cachix-action@v15
with:
name: ic-hs-test
@@ -129,7 +129,7 @@ jobs:
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v4
- - uses: cachix/install-nix-action@v27
+ - uses: cachix/install-nix-action@V28
- uses: cachix/cachix-action@v15
with:
name: ic-hs-test
diff --git a/.github/workflows/update-hash.yml b/.github/workflows/update-hash.yml
index 92959b5fe72..fd0749ad33e 100644
--- a/.github/workflows/update-hash.yml
+++ b/.github/workflows/update-hash.yml
@@ -16,7 +16,7 @@ jobs:
with:
# This is needed to be able to push and trigger CI with that push
token: ${{ secrets.NIV_UPDATER_TOKEN }}
- - uses: cachix/install-nix-action@V27
+ - uses: cachix/install-nix-action@V28
with:
nix_path: nixpkgs=channel:nixos-22.11
- uses: cachix/cachix-action@v15
From 0ff90e080d599949af3423de9c3c0ff6dbb161a0 Mon Sep 17 00:00:00 2001
From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com>
Date: Fri, 13 Sep 2024 00:56:20 +0000
Subject: [PATCH 12/27] chore(deps): Bump body-parser and express in
/doc/docusaurus (#4695)
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Bumps [body-parser](https://github.com/expressjs/body-parser) and [express](https://github.com/expressjs/express). These dependencies needed to be updated together.
Updates `body-parser` from 1.20.2 to 1.20.3
Release notes
Sourced from body-parser's releases.
1.20.3
What's Changed
Important
- deps: qs@6.13.0
- add
depth
option to customize the depth level in the parser
- IMPORTANT: The default
depth
level for parsing URL-encoded data is now 32
(previously was Infinity
). Documentation
Other changes
New Contributors
Full Changelog: https://github.com/expressjs/body-parser/compare/1.20.2...1.20.3
Changelog
Sourced from body-parser's changelog.
1.20.3 / 2024-09-10
- deps: qs@6.13.0
- add
depth
option to customize the depth level in the parser
- IMPORTANT: The default
depth
level for parsing URL-encoded data is now 32
(previously was Infinity
)
Commits
Maintainer changes
This version was pushed to npm by ulisesgascon, a new releaser for body-parser since your current version.
Updates `express` from 4.19.2 to 4.21.0
Release notes
Sourced from express's releases.
4.21.0
What's Changed
New Contributors
Full Changelog: https://github.com/expressjs/express/compare/4.20.0...4.21.0
4.20.0
What's Changed
Important
- IMPORTANT: The default
depth
level for parsing URL-encoded data is now 32
(previously was Infinity
)
- Remove link renderization in html while using
res.redirect
Other Changes
... (truncated)
Changelog
Sourced from express's changelog.
4.21.0 / 2024-09-11
- Deprecate
res.location("back")
and res.redirect("back")
magic string
- deps: serve-static@1.16.2
- deps: finalhandler@1.3.1
- deps: qs@6.13.0
4.20.0 / 2024-09-10
- deps: serve-static@0.16.0
- Remove link renderization in html while redirecting
- deps: send@0.19.0
- Remove link renderization in html while redirecting
- deps: body-parser@0.6.0
- add
depth
option to customize the depth level in the parser
- IMPORTANT: The default
depth
level for parsing URL-encoded data is now 32
(previously was Infinity
)
- Remove link renderization in html while using
res.redirect
- deps: path-to-regexp@0.1.10
- Adds support for named matching groups in the routes using a regex
- Adds backtracking protection to parameters without regexes defined
- deps: encodeurl@~2.0.0
- Removes encoding of
\
, |
, and ^
to align better with URL spec
- Deprecate passing
options.maxAge
and options.expires
to res.clearCookie
- Will be ignored in v5, clearCookie will set a cookie with an expires in the past to instruct clients to delete the cookie
Commits
Dependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting `@dependabot rebase`.
[//]: # (dependabot-automerge-start)
[//]: # (dependabot-automerge-end)
---
Dependabot commands and options
You can trigger Dependabot actions by commenting on this PR:
- `@dependabot rebase` will rebase this PR
- `@dependabot recreate` will recreate this PR, overwriting any edits that have been made to it
- `@dependabot merge` will merge this PR after your CI passes on it
- `@dependabot squash and merge` will squash and merge this PR after your CI passes on it
- `@dependabot cancel merge` will cancel a previously requested merge and block automerging
- `@dependabot reopen` will reopen this PR if it is closed
- `@dependabot close` will close this PR and stop Dependabot recreating it. You can achieve the same result by closing it manually
- `@dependabot show ignore conditions` will show all of the ignore conditions of the specified dependency
- `@dependabot ignore this major version` will close this PR and stop Dependabot creating any more for this major version (unless you reopen the PR or upgrade to it yourself)
- `@dependabot ignore this minor version` will close this PR and stop Dependabot creating any more for this minor version (unless you reopen the PR or upgrade to it yourself)
- `@dependabot ignore this dependency` will close this PR and stop Dependabot creating any more for this dependency (unless you reopen the PR or upgrade to it yourself)
You can disable automated security fix PRs for this repo from the [Security Alerts page](https://github.com/dfinity/motoko/network/alerts).
---
doc/docusaurus/package-lock.json | 191 +++++++++++++++++--------------
1 file changed, 105 insertions(+), 86 deletions(-)
diff --git a/doc/docusaurus/package-lock.json b/doc/docusaurus/package-lock.json
index e33fd27a22b..90b7adf2fdf 100644
--- a/doc/docusaurus/package-lock.json
+++ b/doc/docusaurus/package-lock.json
@@ -4845,9 +4845,9 @@
}
},
"node_modules/body-parser": {
- "version": "1.20.2",
- "resolved": "https://registry.npmjs.org/body-parser/-/body-parser-1.20.2.tgz",
- "integrity": "sha512-ml9pReCu3M61kGlqoTm2umSXTlRTuGTx0bfYj+uIUKKYycG5NtSbeetV3faSU6R7ajOPw0g/J1PvK4qNy7s5bA==",
+ "version": "1.20.3",
+ "resolved": "https://registry.npmjs.org/body-parser/-/body-parser-1.20.3.tgz",
+ "integrity": "sha512-7rAxByjUMqQ3/bHJy7D6OGXvx/MMc4IqBn/X0fcM1QUcAItpZrBEYhWGem+tzXH90c+G01ypMcYJBO9Y30203g==",
"dependencies": {
"bytes": "3.1.2",
"content-type": "~1.0.5",
@@ -4857,7 +4857,7 @@
"http-errors": "2.0.0",
"iconv-lite": "0.4.24",
"on-finished": "2.4.1",
- "qs": "6.11.0",
+ "qs": "6.13.0",
"raw-body": "2.5.2",
"type-is": "~1.6.18",
"unpipe": "1.0.0"
@@ -6601,9 +6601,9 @@
}
},
"node_modules/encodeurl": {
- "version": "1.0.2",
- "resolved": "https://registry.npmjs.org/encodeurl/-/encodeurl-1.0.2.tgz",
- "integrity": "sha512-TPJXq8JqFaVYm2CWmPvnP2Iyo4ZSM7/QKcSmuMLDObfpH5fi7RUGmd/rTDf+rut/saiDiQEeVTNgAmJEdAOx0w==",
+ "version": "2.0.0",
+ "resolved": "https://registry.npmjs.org/encodeurl/-/encodeurl-2.0.0.tgz",
+ "integrity": "sha512-Q0n9HRi4m6JuGIV1eFlmvJB7ZEVxu93IrMyiMsGC0lrMJMWzRgx6WGquyfQgZVb31vhGgXnfmPNNXmxnOkRBrg==",
"engines": {
"node": ">= 0.8"
}
@@ -6829,36 +6829,36 @@
}
},
"node_modules/express": {
- "version": "4.19.2",
- "resolved": "https://registry.npmjs.org/express/-/express-4.19.2.tgz",
- "integrity": "sha512-5T6nhjsT+EOMzuck8JjBHARTHfMht0POzlA60WV2pMD3gyXw2LZnZ+ueGdNxG+0calOJcWKbpFcuzLZ91YWq9Q==",
+ "version": "4.21.0",
+ "resolved": "https://registry.npmjs.org/express/-/express-4.21.0.tgz",
+ "integrity": "sha512-VqcNGcj/Id5ZT1LZ/cfihi3ttTn+NJmkli2eZADigjq29qTlWi/hAQ43t/VLPq8+UX06FCEx3ByOYet6ZFblng==",
"dependencies": {
"accepts": "~1.3.8",
"array-flatten": "1.1.1",
- "body-parser": "1.20.2",
+ "body-parser": "1.20.3",
"content-disposition": "0.5.4",
"content-type": "~1.0.4",
"cookie": "0.6.0",
"cookie-signature": "1.0.6",
"debug": "2.6.9",
"depd": "2.0.0",
- "encodeurl": "~1.0.2",
+ "encodeurl": "~2.0.0",
"escape-html": "~1.0.3",
"etag": "~1.8.1",
- "finalhandler": "1.2.0",
+ "finalhandler": "1.3.1",
"fresh": "0.5.2",
"http-errors": "2.0.0",
- "merge-descriptors": "1.0.1",
+ "merge-descriptors": "1.0.3",
"methods": "~1.1.2",
"on-finished": "2.4.1",
"parseurl": "~1.3.3",
- "path-to-regexp": "0.1.7",
+ "path-to-regexp": "0.1.10",
"proxy-addr": "~2.0.7",
- "qs": "6.11.0",
+ "qs": "6.13.0",
"range-parser": "~1.2.1",
"safe-buffer": "5.2.1",
- "send": "0.18.0",
- "serve-static": "1.15.0",
+ "send": "0.19.0",
+ "serve-static": "1.16.2",
"setprototypeof": "1.2.0",
"statuses": "2.0.1",
"type-is": "~1.6.18",
@@ -6899,9 +6899,9 @@
"integrity": "sha512-Tpp60P6IUJDTuOq/5Z8cdskzJujfwqfOTkrwIwj7IRISpnkJnT6SyJ4PCPnGMoFjC9ddhal5KVIYtAt97ix05A=="
},
"node_modules/express/node_modules/path-to-regexp": {
- "version": "0.1.7",
- "resolved": "https://registry.npmjs.org/path-to-regexp/-/path-to-regexp-0.1.7.tgz",
- "integrity": "sha512-5DFkuoqlv1uYQKxy8omFBeJPQcdoE07Kv2sferDCrAq1ohOU+MSDswDIbnx3YAM60qIOnYa53wBhXW0EbMonrQ=="
+ "version": "0.1.10",
+ "resolved": "https://registry.npmjs.org/path-to-regexp/-/path-to-regexp-0.1.10.tgz",
+ "integrity": "sha512-7lf7qcQidTku0Gu3YDPc8DJ1q7OOucfa/BSsIwjuh56VU7katFvuM8hULfkwB3Fns/rsVF7PwPKVw1sl5KQS9w=="
},
"node_modules/express/node_modules/range-parser": {
"version": "1.2.1",
@@ -7092,12 +7092,12 @@
}
},
"node_modules/finalhandler": {
- "version": "1.2.0",
- "resolved": "https://registry.npmjs.org/finalhandler/-/finalhandler-1.2.0.tgz",
- "integrity": "sha512-5uXcUVftlQMFnWC9qu/svkWv3GTd2PfUhK/3PLkYNAe7FbqJMt3515HaxE6eRL74GdsriiwujiawdaB1BpEISg==",
+ "version": "1.3.1",
+ "resolved": "https://registry.npmjs.org/finalhandler/-/finalhandler-1.3.1.tgz",
+ "integrity": "sha512-6BN9trH7bp3qvnrRyzsBz+g3lZxTNZTbVO2EV1CS0WIcDbawYVdYvGflME/9QP0h0pYlCDBCTjYa9nZzMDpyxQ==",
"dependencies": {
"debug": "2.6.9",
- "encodeurl": "~1.0.2",
+ "encodeurl": "~2.0.0",
"escape-html": "~1.0.3",
"on-finished": "2.4.1",
"parseurl": "~1.3.3",
@@ -8950,9 +8950,12 @@
}
},
"node_modules/merge-descriptors": {
- "version": "1.0.1",
- "resolved": "https://registry.npmjs.org/merge-descriptors/-/merge-descriptors-1.0.1.tgz",
- "integrity": "sha512-cCi6g3/Zr1iqQi6ySbseM1Xvooa98N0w31jzUYrXPX2xqObmFGHJ0tQ5u74H3mVh7wLouTseZyYIq39g8cNp1w=="
+ "version": "1.0.3",
+ "resolved": "https://registry.npmjs.org/merge-descriptors/-/merge-descriptors-1.0.3.tgz",
+ "integrity": "sha512-gaNvAS7TZ897/rVaZ0nMtAyxNyi/pdbjbAwUpFQpN70GqnVfOiXpeUUMKRBmzXaSQ8DdTX4/0ms62r2K+hE6mQ==",
+ "funding": {
+ "url": "https://github.com/sponsors/sindresorhus"
+ }
},
"node_modules/merge-stream": {
"version": "2.0.0",
@@ -9242,9 +9245,12 @@
}
},
"node_modules/object-inspect": {
- "version": "1.13.1",
- "resolved": "https://registry.npmjs.org/object-inspect/-/object-inspect-1.13.1.tgz",
- "integrity": "sha512-5qoj1RUiKOMsCCNLV1CBiPYE10sziTsnmNxkAI/rZhiD63CF7IqdFGC/XzjWjpSgLf0LxXX3bDFIh0E18f6UhQ==",
+ "version": "1.13.2",
+ "resolved": "https://registry.npmjs.org/object-inspect/-/object-inspect-1.13.2.tgz",
+ "integrity": "sha512-IRZSRuzJiynemAXPYtPe5BoI/RESNYR7TYm50MC5Mqbd3Jmw5y790sErYw3V6SryFJD64b74qQQs9wn5Bg/k3g==",
+ "engines": {
+ "node": ">= 0.4"
+ },
"funding": {
"url": "https://github.com/sponsors/ljharb"
}
@@ -10414,11 +10420,11 @@
"integrity": "sha512-QFADYnsVoBMw1srW7OVKEYjG+MbIa49s54w1MA1EDY6r2r/sTcKKYqRX1f4GYvnXP7eN/Pe9HFcX+hwzmrXRHA=="
},
"node_modules/qs": {
- "version": "6.11.0",
- "resolved": "https://registry.npmjs.org/qs/-/qs-6.11.0.tgz",
- "integrity": "sha512-MvjoMCJwEarSbUYk5O+nmoSzSutSsTwF85zcHPQ9OrlFoZOYIjaqBAJIqIXjptyD5vThxGq52Xu/MaJzRkIk4Q==",
+ "version": "6.13.0",
+ "resolved": "https://registry.npmjs.org/qs/-/qs-6.13.0.tgz",
+ "integrity": "sha512-+38qI9SOr8tfZ4QmJNplMUxqjbe7LKvvZgWdExBOmd+egZTtjLB67Gu0HRX3u/XOq7UU2Nx6nsjvS16Z9uwfpg==",
"dependencies": {
- "side-channel": "^1.0.4"
+ "side-channel": "^1.0.6"
},
"engines": {
"node": ">=0.6"
@@ -11606,9 +11612,9 @@
}
},
"node_modules/send": {
- "version": "0.18.0",
- "resolved": "https://registry.npmjs.org/send/-/send-0.18.0.tgz",
- "integrity": "sha512-qqWzuOjSFOuqPjFe4NOsMLafToQQwBSOEpS+FwEt3A2V3vKubTquT3vmLTQpFgMXp8AlFWFuP1qKaJZOtPpVXg==",
+ "version": "0.19.0",
+ "resolved": "https://registry.npmjs.org/send/-/send-0.19.0.tgz",
+ "integrity": "sha512-dW41u5VfLXu8SJh5bwRmyYUbAoSB3c9uQh6L8h/KtsFREPWpbX1lrljJo186Jc4nmci/sGUZ9a0a0J2zgfq2hw==",
"dependencies": {
"debug": "2.6.9",
"depd": "2.0.0",
@@ -11641,6 +11647,14 @@
"resolved": "https://registry.npmjs.org/ms/-/ms-2.0.0.tgz",
"integrity": "sha512-Tpp60P6IUJDTuOq/5Z8cdskzJujfwqfOTkrwIwj7IRISpnkJnT6SyJ4PCPnGMoFjC9ddhal5KVIYtAt97ix05A=="
},
+ "node_modules/send/node_modules/encodeurl": {
+ "version": "1.0.2",
+ "resolved": "https://registry.npmjs.org/encodeurl/-/encodeurl-1.0.2.tgz",
+ "integrity": "sha512-TPJXq8JqFaVYm2CWmPvnP2Iyo4ZSM7/QKcSmuMLDObfpH5fi7RUGmd/rTDf+rut/saiDiQEeVTNgAmJEdAOx0w==",
+ "engines": {
+ "node": ">= 0.8"
+ }
+ },
"node_modules/send/node_modules/ms": {
"version": "2.1.3",
"resolved": "https://registry.npmjs.org/ms/-/ms-2.1.3.tgz",
@@ -11753,14 +11767,14 @@
}
},
"node_modules/serve-static": {
- "version": "1.15.0",
- "resolved": "https://registry.npmjs.org/serve-static/-/serve-static-1.15.0.tgz",
- "integrity": "sha512-XGuRDNjXUijsUL0vl6nSD7cwURuzEgglbOaFuZM9g3kwDXOWVTck0jLzjPzGD+TazWbboZYu52/9/XPdUgne9g==",
+ "version": "1.16.2",
+ "resolved": "https://registry.npmjs.org/serve-static/-/serve-static-1.16.2.tgz",
+ "integrity": "sha512-VqpjJZKadQB/PEbEwvFdO43Ax5dFBZ2UECszz8bQ7pi7wt//PWe1P6MN7eCnjsatYtBT6EuiClbjSWP2WrIoTw==",
"dependencies": {
- "encodeurl": "~1.0.2",
+ "encodeurl": "~2.0.0",
"escape-html": "~1.0.3",
"parseurl": "~1.3.3",
- "send": "0.18.0"
+ "send": "0.19.0"
},
"engines": {
"node": ">= 0.8.0"
@@ -17249,9 +17263,9 @@
"integrity": "sha512-jDctJ/IVQbZoJykoeHbhXpOlNBqGNcwXJKJog42E5HDPUwQTSdjCHdihjj0DlnheQ7blbT6dHOafNAiS8ooQKA=="
},
"body-parser": {
- "version": "1.20.2",
- "resolved": "https://registry.npmjs.org/body-parser/-/body-parser-1.20.2.tgz",
- "integrity": "sha512-ml9pReCu3M61kGlqoTm2umSXTlRTuGTx0bfYj+uIUKKYycG5NtSbeetV3faSU6R7ajOPw0g/J1PvK4qNy7s5bA==",
+ "version": "1.20.3",
+ "resolved": "https://registry.npmjs.org/body-parser/-/body-parser-1.20.3.tgz",
+ "integrity": "sha512-7rAxByjUMqQ3/bHJy7D6OGXvx/MMc4IqBn/X0fcM1QUcAItpZrBEYhWGem+tzXH90c+G01ypMcYJBO9Y30203g==",
"requires": {
"bytes": "3.1.2",
"content-type": "~1.0.5",
@@ -17261,7 +17275,7 @@
"http-errors": "2.0.0",
"iconv-lite": "0.4.24",
"on-finished": "2.4.1",
- "qs": "6.11.0",
+ "qs": "6.13.0",
"raw-body": "2.5.2",
"type-is": "~1.6.18",
"unpipe": "1.0.0"
@@ -18494,9 +18508,9 @@
"integrity": "sha512-SNujglcLTTg+lDAcApPNgEdudaqQFiAbJCqzjNxJkvN9vAwCGi0uu8IUVvx+f16h+V44KCY6Y2yboroc9pilHg=="
},
"encodeurl": {
- "version": "1.0.2",
- "resolved": "https://registry.npmjs.org/encodeurl/-/encodeurl-1.0.2.tgz",
- "integrity": "sha512-TPJXq8JqFaVYm2CWmPvnP2Iyo4ZSM7/QKcSmuMLDObfpH5fi7RUGmd/rTDf+rut/saiDiQEeVTNgAmJEdAOx0w=="
+ "version": "2.0.0",
+ "resolved": "https://registry.npmjs.org/encodeurl/-/encodeurl-2.0.0.tgz",
+ "integrity": "sha512-Q0n9HRi4m6JuGIV1eFlmvJB7ZEVxu93IrMyiMsGC0lrMJMWzRgx6WGquyfQgZVb31vhGgXnfmPNNXmxnOkRBrg=="
},
"end-of-stream": {
"version": "1.4.4",
@@ -18651,36 +18665,36 @@
}
},
"express": {
- "version": "4.19.2",
- "resolved": "https://registry.npmjs.org/express/-/express-4.19.2.tgz",
- "integrity": "sha512-5T6nhjsT+EOMzuck8JjBHARTHfMht0POzlA60WV2pMD3gyXw2LZnZ+ueGdNxG+0calOJcWKbpFcuzLZ91YWq9Q==",
+ "version": "4.21.0",
+ "resolved": "https://registry.npmjs.org/express/-/express-4.21.0.tgz",
+ "integrity": "sha512-VqcNGcj/Id5ZT1LZ/cfihi3ttTn+NJmkli2eZADigjq29qTlWi/hAQ43t/VLPq8+UX06FCEx3ByOYet6ZFblng==",
"requires": {
"accepts": "~1.3.8",
"array-flatten": "1.1.1",
- "body-parser": "1.20.2",
+ "body-parser": "1.20.3",
"content-disposition": "0.5.4",
"content-type": "~1.0.4",
"cookie": "0.6.0",
"cookie-signature": "1.0.6",
"debug": "2.6.9",
"depd": "2.0.0",
- "encodeurl": "~1.0.2",
+ "encodeurl": "~2.0.0",
"escape-html": "~1.0.3",
"etag": "~1.8.1",
- "finalhandler": "1.2.0",
+ "finalhandler": "1.3.1",
"fresh": "0.5.2",
"http-errors": "2.0.0",
- "merge-descriptors": "1.0.1",
+ "merge-descriptors": "1.0.3",
"methods": "~1.1.2",
"on-finished": "2.4.1",
"parseurl": "~1.3.3",
- "path-to-regexp": "0.1.7",
+ "path-to-regexp": "0.1.10",
"proxy-addr": "~2.0.7",
- "qs": "6.11.0",
+ "qs": "6.13.0",
"range-parser": "~1.2.1",
"safe-buffer": "5.2.1",
- "send": "0.18.0",
- "serve-static": "1.15.0",
+ "send": "0.19.0",
+ "serve-static": "1.16.2",
"setprototypeof": "1.2.0",
"statuses": "2.0.1",
"type-is": "~1.6.18",
@@ -18715,9 +18729,9 @@
"integrity": "sha512-Tpp60P6IUJDTuOq/5Z8cdskzJujfwqfOTkrwIwj7IRISpnkJnT6SyJ4PCPnGMoFjC9ddhal5KVIYtAt97ix05A=="
},
"path-to-regexp": {
- "version": "0.1.7",
- "resolved": "https://registry.npmjs.org/path-to-regexp/-/path-to-regexp-0.1.7.tgz",
- "integrity": "sha512-5DFkuoqlv1uYQKxy8omFBeJPQcdoE07Kv2sferDCrAq1ohOU+MSDswDIbnx3YAM60qIOnYa53wBhXW0EbMonrQ=="
+ "version": "0.1.10",
+ "resolved": "https://registry.npmjs.org/path-to-regexp/-/path-to-regexp-0.1.10.tgz",
+ "integrity": "sha512-7lf7qcQidTku0Gu3YDPc8DJ1q7OOucfa/BSsIwjuh56VU7katFvuM8hULfkwB3Fns/rsVF7PwPKVw1sl5KQS9w=="
},
"range-parser": {
"version": "1.2.1",
@@ -18860,12 +18874,12 @@
}
},
"finalhandler": {
- "version": "1.2.0",
- "resolved": "https://registry.npmjs.org/finalhandler/-/finalhandler-1.2.0.tgz",
- "integrity": "sha512-5uXcUVftlQMFnWC9qu/svkWv3GTd2PfUhK/3PLkYNAe7FbqJMt3515HaxE6eRL74GdsriiwujiawdaB1BpEISg==",
+ "version": "1.3.1",
+ "resolved": "https://registry.npmjs.org/finalhandler/-/finalhandler-1.3.1.tgz",
+ "integrity": "sha512-6BN9trH7bp3qvnrRyzsBz+g3lZxTNZTbVO2EV1CS0WIcDbawYVdYvGflME/9QP0h0pYlCDBCTjYa9nZzMDpyxQ==",
"requires": {
"debug": "2.6.9",
- "encodeurl": "~1.0.2",
+ "encodeurl": "~2.0.0",
"escape-html": "~1.0.3",
"on-finished": "2.4.1",
"parseurl": "~1.3.3",
@@ -20184,9 +20198,9 @@
}
},
"merge-descriptors": {
- "version": "1.0.1",
- "resolved": "https://registry.npmjs.org/merge-descriptors/-/merge-descriptors-1.0.1.tgz",
- "integrity": "sha512-cCi6g3/Zr1iqQi6ySbseM1Xvooa98N0w31jzUYrXPX2xqObmFGHJ0tQ5u74H3mVh7wLouTseZyYIq39g8cNp1w=="
+ "version": "1.0.3",
+ "resolved": "https://registry.npmjs.org/merge-descriptors/-/merge-descriptors-1.0.3.tgz",
+ "integrity": "sha512-gaNvAS7TZ897/rVaZ0nMtAyxNyi/pdbjbAwUpFQpN70GqnVfOiXpeUUMKRBmzXaSQ8DdTX4/0ms62r2K+hE6mQ=="
},
"merge-stream": {
"version": "2.0.0",
@@ -20377,9 +20391,9 @@
"integrity": "sha512-rJgTQnkUnH1sFw8yT6VSU3zD3sWmu6sZhIseY8VX+GRu3P6F7Fu+JNDoXfklElbLJSnc3FUQHVe4cU5hj+BcUg=="
},
"object-inspect": {
- "version": "1.13.1",
- "resolved": "https://registry.npmjs.org/object-inspect/-/object-inspect-1.13.1.tgz",
- "integrity": "sha512-5qoj1RUiKOMsCCNLV1CBiPYE10sziTsnmNxkAI/rZhiD63CF7IqdFGC/XzjWjpSgLf0LxXX3bDFIh0E18f6UhQ=="
+ "version": "1.13.2",
+ "resolved": "https://registry.npmjs.org/object-inspect/-/object-inspect-1.13.2.tgz",
+ "integrity": "sha512-IRZSRuzJiynemAXPYtPe5BoI/RESNYR7TYm50MC5Mqbd3Jmw5y790sErYw3V6SryFJD64b74qQQs9wn5Bg/k3g=="
},
"object-keys": {
"version": "1.1.1",
@@ -21151,11 +21165,11 @@
"integrity": "sha512-QFADYnsVoBMw1srW7OVKEYjG+MbIa49s54w1MA1EDY6r2r/sTcKKYqRX1f4GYvnXP7eN/Pe9HFcX+hwzmrXRHA=="
},
"qs": {
- "version": "6.11.0",
- "resolved": "https://registry.npmjs.org/qs/-/qs-6.11.0.tgz",
- "integrity": "sha512-MvjoMCJwEarSbUYk5O+nmoSzSutSsTwF85zcHPQ9OrlFoZOYIjaqBAJIqIXjptyD5vThxGq52Xu/MaJzRkIk4Q==",
+ "version": "6.13.0",
+ "resolved": "https://registry.npmjs.org/qs/-/qs-6.13.0.tgz",
+ "integrity": "sha512-+38qI9SOr8tfZ4QmJNplMUxqjbe7LKvvZgWdExBOmd+egZTtjLB67Gu0HRX3u/XOq7UU2Nx6nsjvS16Z9uwfpg==",
"requires": {
- "side-channel": "^1.0.4"
+ "side-channel": "^1.0.6"
}
},
"queue": {
@@ -22026,9 +22040,9 @@
}
},
"send": {
- "version": "0.18.0",
- "resolved": "https://registry.npmjs.org/send/-/send-0.18.0.tgz",
- "integrity": "sha512-qqWzuOjSFOuqPjFe4NOsMLafToQQwBSOEpS+FwEt3A2V3vKubTquT3vmLTQpFgMXp8AlFWFuP1qKaJZOtPpVXg==",
+ "version": "0.19.0",
+ "resolved": "https://registry.npmjs.org/send/-/send-0.19.0.tgz",
+ "integrity": "sha512-dW41u5VfLXu8SJh5bwRmyYUbAoSB3c9uQh6L8h/KtsFREPWpbX1lrljJo186Jc4nmci/sGUZ9a0a0J2zgfq2hw==",
"requires": {
"debug": "2.6.9",
"depd": "2.0.0",
@@ -22060,6 +22074,11 @@
}
}
},
+ "encodeurl": {
+ "version": "1.0.2",
+ "resolved": "https://registry.npmjs.org/encodeurl/-/encodeurl-1.0.2.tgz",
+ "integrity": "sha512-TPJXq8JqFaVYm2CWmPvnP2Iyo4ZSM7/QKcSmuMLDObfpH5fi7RUGmd/rTDf+rut/saiDiQEeVTNgAmJEdAOx0w=="
+ },
"ms": {
"version": "2.1.3",
"resolved": "https://registry.npmjs.org/ms/-/ms-2.1.3.tgz",
@@ -22163,14 +22182,14 @@
}
},
"serve-static": {
- "version": "1.15.0",
- "resolved": "https://registry.npmjs.org/serve-static/-/serve-static-1.15.0.tgz",
- "integrity": "sha512-XGuRDNjXUijsUL0vl6nSD7cwURuzEgglbOaFuZM9g3kwDXOWVTck0jLzjPzGD+TazWbboZYu52/9/XPdUgne9g==",
+ "version": "1.16.2",
+ "resolved": "https://registry.npmjs.org/serve-static/-/serve-static-1.16.2.tgz",
+ "integrity": "sha512-VqpjJZKadQB/PEbEwvFdO43Ax5dFBZ2UECszz8bQ7pi7wt//PWe1P6MN7eCnjsatYtBT6EuiClbjSWP2WrIoTw==",
"requires": {
- "encodeurl": "~1.0.2",
+ "encodeurl": "~2.0.0",
"escape-html": "~1.0.3",
"parseurl": "~1.3.3",
- "send": "0.18.0"
+ "send": "0.19.0"
}
},
"set-function-length": {
From 22b228b6ea262308d661194ed74b1416b47ad484 Mon Sep 17 00:00:00 2001
From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com>
Date: Fri, 13 Sep 2024 01:06:05 +0000
Subject: [PATCH 13/27] chore(deps): Bump serve-static and express in
/doc/docusaurus (#4692)
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Bumps [serve-static](https://github.com/expressjs/serve-static) and [express](https://github.com/expressjs/express). These dependencies needed to be updated together.
Updates `serve-static` from 1.15.0 to 1.16.2
Release notes
Sourced from serve-static's releases.
1.16.0
What's Changed
New Contributors
Full Changelog: https://github.com/expressjs/serve-static/compare/v1.15.0...1.16.0
Changelog
Sourced from serve-static's changelog.
1.16.2 / 2024-09-11
1.16.1 / 2024-09-11
1.16.0 / 2024-09-10
- Remove link renderization in html while redirecting
Commits
Maintainer changes
This version was pushed to npm by wesleytodd, a new releaser for serve-static since your current version.
Updates `express` from 4.19.2 to 4.21.0
Release notes
Sourced from express's releases.
4.21.0
What's Changed
New Contributors
Full Changelog: https://github.com/expressjs/express/compare/4.20.0...4.21.0
4.20.0
What's Changed
Important
- IMPORTANT: The default
depth
level for parsing URL-encoded data is now 32
(previously was Infinity
)
- Remove link renderization in html while using
res.redirect
Other Changes
... (truncated)
Changelog
Sourced from express's changelog.
4.21.0 / 2024-09-11
- Deprecate
res.location("back")
and res.redirect("back")
magic string
- deps: serve-static@1.16.2
- deps: finalhandler@1.3.1
- deps: qs@6.13.0
4.20.0 / 2024-09-10
- deps: serve-static@0.16.0
- Remove link renderization in html while redirecting
- deps: send@0.19.0
- Remove link renderization in html while redirecting
- deps: body-parser@0.6.0
- add
depth
option to customize the depth level in the parser
- IMPORTANT: The default
depth
level for parsing URL-encoded data is now 32
(previously was Infinity
)
- Remove link renderization in html while using
res.redirect
- deps: path-to-regexp@0.1.10
- Adds support for named matching groups in the routes using a regex
- Adds backtracking protection to parameters without regexes defined
- deps: encodeurl@~2.0.0
- Removes encoding of
\
, |
, and ^
to align better with URL spec
- Deprecate passing
options.maxAge
and options.expires
to res.clearCookie
- Will be ignored in v5, clearCookie will set a cookie with an expires in the past to instruct clients to delete the cookie
Commits
Dependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting `@dependabot rebase`.
[//]: # (dependabot-automerge-start)
[//]: # (dependabot-automerge-end)
---
Dependabot commands and options
You can trigger Dependabot actions by commenting on this PR:
- `@dependabot rebase` will rebase this PR
- `@dependabot recreate` will recreate this PR, overwriting any edits that have been made to it
- `@dependabot merge` will merge this PR after your CI passes on it
- `@dependabot squash and merge` will squash and merge this PR after your CI passes on it
- `@dependabot cancel merge` will cancel a previously requested merge and block automerging
- `@dependabot reopen` will reopen this PR if it is closed
- `@dependabot close` will close this PR and stop Dependabot recreating it. You can achieve the same result by closing it manually
- `@dependabot show ignore conditions` will show all of the ignore conditions of the specified dependency
- `@dependabot ignore this major version` will close this PR and stop Dependabot creating any more for this major version (unless you reopen the PR or upgrade to it yourself)
- `@dependabot ignore this minor version` will close this PR and stop Dependabot creating any more for this minor version (unless you reopen the PR or upgrade to it yourself)
- `@dependabot ignore this dependency` will close this PR and stop Dependabot creating any more for this dependency (unless you reopen the PR or upgrade to it yourself)
You can disable automated security fix PRs for this repo from the [Security Alerts page](https://github.com/dfinity/motoko/network/alerts).
From ddf5299f75608a17dc0bf3af94402cc02132ff46 Mon Sep 17 00:00:00 2001
From: Gabor Greif
Date: Fri, 13 Sep 2024 09:58:45 +0200
Subject: [PATCH 14/27] chore: regenerate documentation (#4696)
---
doc/md/base/Iter.md | 21 ++++++++++++++++++++-
1 file changed, 20 insertions(+), 1 deletion(-)
diff --git a/doc/md/base/Iter.md b/doc/md/base/Iter.md
index 81bcdf106ac..280190e1e08 100644
--- a/doc/md/base/Iter.md
+++ b/doc/md/base/Iter.md
@@ -108,7 +108,7 @@ func filter(xs : Iter, f : A -> Bool) : Iter
Takes a function and an iterator and returns a new iterator that produces
elements from the original iterator if and only if the predicate is true.
```motoko
-import Iter "o:base/Iter";
+import Iter "mo:base/Iter";
let iter = Iter.range(1, 3);
let mappedIter = Iter.filter(iter, func (x : Nat) : Bool { x % 2 == 1 });
assert(?1 == mappedIter.next());
@@ -131,6 +131,25 @@ assert(?10 == iter.next());
// ...
```
+## Function `concat`
+``` motoko no-repl
+func concat(a : Iter, b : Iter) : Iter
+```
+
+Takes two iterators and returns a new iterator that produces
+elements from the original iterators sequentally.
+```motoko
+import Iter "mo:base/Iter";
+let iter1 = Iter.range(1, 2);
+let iter2 = Iter.range(5, 6);
+let concatenatedIter = Iter.concat(iter1, iter2);
+assert(?1 == concatenatedIter.next());
+assert(?2 == concatenatedIter.next());
+assert(?5 == concatenatedIter.next());
+assert(?6 == concatenatedIter.next());
+assert(null == concatenatedIter.next());
+```
+
## Function `fromArray`
``` motoko no-repl
func fromArray(xs : [A]) : Iter
From 1511fba2ff050b9fed8482f4bbcf935accb87496 Mon Sep 17 00:00:00 2001
From: Gabor Greif
Date: Fri, 13 Sep 2024 12:08:01 +0200
Subject: [PATCH 15/27] feat: burning cycles programmatically (#4690)
This adds a new primitive `(prim "cyclesBurn")` and a `prim.mo` function `cyclesBurn : Nat -> Nat`. It can be used to burn (some of the) canister's cycles programmatically using the system interface `ic0.cycles_burn128`.
---
Building.md | 24 ++++++------
Changelog.md | 5 ++-
src/codegen/compile_classical.ml | 46 ++++++++++++++--------
src/codegen/compile_enhanced.ml | 54 ++++++++++++++++----------
src/ir_def/arrange_ir.ml | 1 +
src/ir_def/check_ir.ml | 2 +-
src/ir_def/construct.ml | 3 +-
src/ir_def/ir.ml | 2 +
src/lowering/desugar.ml | 2 +
src/prelude/prim.mo | 4 ++
test/fail/ok/no-timer-canc.tc.ok | 1 +
test/fail/ok/no-timer-set.tc.ok | 1 +
test/run-drun/basic-cycles.mo | 2 +
test/run-drun/empty-actor-classical.mo | 4 +-
test/run-drun/ok/basic-cycles.tc.ok | 2 +-
15 files changed, 99 insertions(+), 54 deletions(-)
diff --git a/Building.md b/Building.md
index 2c210777c0f..f89b5389e6d 100644
--- a/Building.md
+++ b/Building.md
@@ -56,11 +56,11 @@ For more details on our CI and CI setup, see `CI.md`.
## Making releases
-We make frequent releases, at least weekly. The steps to make a release (say, version 0.12.1) are:
+We make frequent releases, at least weekly. The steps to make a release (say, version 0.13.1) are:
* Make sure that the top section of `Changelog.md` has a title like
- ## 0.12.1 (2024-07-29)
+ ## 0.13.1 (2024-09-10)
with today’s date.
@@ -77,18 +77,18 @@ We make frequent releases, at least weekly. The steps to make a release (say, ve
* Define a shell variable `export MOC_MINOR=1`
- * Look at `git log --first-parent 0.12.$(expr $MOC_MINOR - 1)..HEAD` and check
+ * Look at `git log --first-parent 0.13.$(expr $MOC_MINOR - 1)..HEAD` and check
that everything relevant is mentioned in the changelog section, and possibly
clean it up a bit, curating the information for the target audience.
- * `git commit -am "chore: Releasing 0.12."$MOC_MINOR`
+ * `git commit -am "chore: Releasing 0.13."$MOC_MINOR`
* Create a PR from this commit, and label it `automerge-squash`. E.g.
- with `git push origin HEAD:$USER/0.12.$MOC_MINOR`. Mergify will
+ with `git push origin HEAD:$USER/0.13.$MOC_MINOR`. Mergify will
merge it into `master` without additional approval, but it will take some
time as the title (version number) enters into the `nix` dependency tracking.
* `git switch master; git pull --rebase`. The release commit should be your `HEAD`
- * `git tag 0.12.$MOC_MINOR -m "Motoko 0.12."$MOC_MINOR`
- * `git push origin 0.12.$MOC_MINOR`
+ * `git tag 0.13.$MOC_MINOR -m "Motoko 0.13."$MOC_MINOR`
+ * `git push origin 0.13.$MOC_MINOR`
Pushing the tag should cause GitHub Actions to create a “Release” on the GitHub
project. This will fail if the changelog is not in order (in this case, fix and
@@ -102,12 +102,12 @@ branch to the `next-moc` branch.
* Wait ca. 5min after releasing to give the CI/CD pipeline time to upload the release artifacts
* Change into `motoko-base`
* `git switch next-moc; git pull`
-* `git switch -c $USER/update-moc-0.12.$MOC_MINOR`
+* `git switch -c $USER/update-moc-0.13.$MOC_MINOR`
* Update the `CHANGELOG.md` file with an entry at the top
* Update the `moc_version` env variable in `.github/workflows/{ci, package-set}.yml` and `mops.toml`
to the new released version:
- `perl -pi -e "s/moc_version: \"0\.12\.\\d+\"/moc_version: \"0.12.$MOC_MINOR\"/g; s/moc = \"0\.12\.\\d+\"/moc = \"0.12.$MOC_MINOR\"/g; s/version = \"0\.12\.\\d+\"/version = \"0.12.$MOC_MINOR\"/g" .github/workflows/ci.yml .github/workflows/package-set.yml mops.toml`
-* `git add .github/ CHANGELOG.md mops.toml && git commit -m "Motoko 0.12."$MOC_MINOR`
+ `perl -pi -e "s/moc_version: \"0\.13\.\\d+\"/moc_version: \"0.13.$MOC_MINOR\"/g; s/moc = \"0\.13\.\\d+\"/moc = \"0.13.$MOC_MINOR\"/g; s/version = \"0\.13\.\\d+\"/version = \"0.13.$MOC_MINOR\"/g" .github/workflows/ci.yml .github/workflows/package-set.yml mops.toml`
+* `git add .github/ CHANGELOG.md mops.toml && git commit -m "Motoko 0.13."$MOC_MINOR`
* Revise `CHANGELOG.md`, adding a top entry for the release
* You can `git push` now
@@ -117,8 +117,8 @@ repo by a scheduled `niv-updater-action`.
Finally tag the base release (so the documentation interpreter can do the right thing):
* `git switch master && git pull`
-* `git tag moc-0.12.$MOC_MINOR`
-* `git push origin moc-0.12.$MOC_MINOR`
+* `git tag moc-0.13.$MOC_MINOR`
+* `git push origin moc-0.13.$MOC_MINOR`
If you want to update the portal documentation, typically to keep in sync with a `dfx` release, follow the instructions in https://github.com/dfinity/portal/blob/master/MAINTENANCE.md.
diff --git a/Changelog.md b/Changelog.md
index b3efc5a4a31..8c2e608e4fc 100644
--- a/Changelog.md
+++ b/Changelog.md
@@ -2,7 +2,10 @@
* motoko (`moc`)
- * **For beta testing:** Support __enhanced orthogonal persistence__, enabled with new moc flag `--enhanced-orthogonal-persistence` (#4193).
+ * Added a new primitive `cyclesBurn : 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.
diff --git a/src/codegen/compile_classical.ml b/src/codegen/compile_classical.ml
index 18448230778..354c755307a 100644
--- a/src/codegen/compile_classical.ml
+++ b/src/codegen/compile_classical.ml
@@ -5073,6 +5073,7 @@ module IC = struct
E.add_func_import env "ic0" "msg_cycles_available128" [I32Type] [];
E.add_func_import env "ic0" "msg_cycles_refunded128" [I32Type] [];
E.add_func_import env "ic0" "msg_cycles_accept128" [I64Type; I64Type; I32Type] [];
+ E.add_func_import env "ic0" "cycles_burn128" [I64Type; I64Type; I32Type] [];
E.add_func_import env "ic0" "certified_data_set" (i32s 2) [];
E.add_func_import env "ic0" "data_certificate_present" [] [I32Type];
E.add_func_import env "ic0" "data_certificate_size" [] [I32Type];
@@ -5093,8 +5094,7 @@ module IC = struct
E.add_func_import env "ic0" "stable64_grow" [I64Type] [I64Type];
E.add_func_import env "ic0" "time" [] [I64Type];
if !Flags.global_timer then
- E.add_func_import env "ic0" "global_timer_set" [I64Type] [I64Type];
- ()
+ E.add_func_import env "ic0" "global_timer_set" [I64Type] [I64Type]
let system_imports env =
match E.mode env with
@@ -5490,48 +5490,49 @@ module IC = struct
let cycle_balance env =
match E.mode env with
- | Flags.ICMode
- | Flags.RefMode ->
+ | Flags.(ICMode | RefMode) ->
system_call env "canister_cycle_balance128"
| _ ->
E.trap_with env "cannot read balance when running locally"
let cycles_add env =
match E.mode env with
- | Flags.ICMode
- | Flags.RefMode ->
+ | Flags.(ICMode | RefMode) ->
system_call env "call_cycles_add128"
| _ ->
E.trap_with env "cannot accept cycles when running locally"
let cycles_accept env =
match E.mode env with
- | Flags.ICMode
- | Flags.RefMode ->
+ | Flags.(ICMode | RefMode) ->
system_call env "msg_cycles_accept128"
| _ ->
E.trap_with env "cannot accept cycles when running locally"
let cycles_available env =
match E.mode env with
- | Flags.ICMode
- | Flags.RefMode ->
+ | Flags.(ICMode | RefMode) ->
system_call env "msg_cycles_available128"
| _ ->
E.trap_with env "cannot get cycles available when running locally"
let cycles_refunded env =
match E.mode env with
- | Flags.ICMode
- | Flags.RefMode ->
+ | Flags.(ICMode | RefMode) ->
system_call env "msg_cycles_refunded128"
| _ ->
E.trap_with env "cannot get cycles refunded when running locally"
+ let cycles_burn env =
+ match E.mode env with
+ | Flags.(ICMode | RefMode) ->
+ system_call env "cycles_burn128"
+ | _ ->
+ E.trap_with env "cannot burn cycles when running locally"
+
let set_certified_data env =
match E.mode env with
- | Flags.ICMode
- | Flags.RefMode ->
+ | Flags.(ICMode | RefMode) ->
Blob.as_ptr_len env ^^
system_call env "certified_data_set"
| _ ->
@@ -5539,8 +5540,7 @@ module IC = struct
let get_certificate env =
match E.mode env with
- | Flags.ICMode
- | Flags.RefMode ->
+ | Flags.(ICMode | RefMode) ->
system_call env "data_certificate_present" ^^
G.if1 I32Type
begin
@@ -5649,6 +5649,18 @@ module Cycles = struct
)
)
+ let burn env =
+ Func.share_code1 Func.Always env "cycle_burn" ("cycles", I32Type) [I32Type] (fun env get_x ->
+ Stack.with_words env "dst" 4l (fun get_dst ->
+ get_x ^^
+ to_two_word64 env ^^
+ get_dst ^^
+ IC.cycles_burn env ^^
+ get_dst ^^
+ from_word128_ptr env
+ )
+ )
+
end (* Cycles *)
(* Low-level, almost raw access to IC stable memory.
@@ -12067,6 +12079,8 @@ and compile_prim_invocation (env : E.t) ae p es at =
SR.Vanilla, Cycles.available env
| SystemCyclesRefundedPrim, [] ->
SR.Vanilla, Cycles.refunded env
+ | SystemCyclesBurnPrim, [e1] ->
+ SR.Vanilla, compile_exp_vanilla env ae e1 ^^ Cycles.burn env
| SetCertifiedData, [e1] ->
SR.unit, compile_exp_vanilla env ae e1 ^^ IC.set_certified_data env
diff --git a/src/codegen/compile_enhanced.ml b/src/codegen/compile_enhanced.ml
index 080f1acfb7d..2a1351135ac 100644
--- a/src/codegen/compile_enhanced.ml
+++ b/src/codegen/compile_enhanced.ml
@@ -4731,6 +4731,7 @@ module IC = struct
E.add_func_import env "ic0" "msg_cycles_available128" [I64Type] [];
E.add_func_import env "ic0" "msg_cycles_refunded128" [I64Type] [];
E.add_func_import env "ic0" "msg_cycles_accept128" (i64s 3) [];
+ E.add_func_import env "ic0" "cycles_burn128" (i64s 3) [];
E.add_func_import env "ic0" "certified_data_set" (i64s 2) [];
E.add_func_import env "ic0" "data_certificate_present" [] [I32Type];
E.add_func_import env "ic0" "data_certificate_size" [] [I64Type];
@@ -4751,8 +4752,7 @@ module IC = struct
E.add_func_import env "ic0" "stable64_grow" [I64Type] [I64Type];
E.add_func_import env "ic0" "time" [] [I64Type];
if !Flags.global_timer then
- E.add_func_import env "ic0" "global_timer_set" [I64Type] [I64Type];
- ()
+ E.add_func_import env "ic0" "global_timer_set" [I64Type] [I64Type]
let system_imports env =
match E.mode env with
@@ -5221,48 +5221,49 @@ module IC = struct
let cycle_balance env =
match E.mode env with
- | Flags.ICMode
- | Flags.RefMode ->
+ | Flags.(ICMode | RefMode) ->
system_call env "canister_cycle_balance128"
| _ ->
E.trap_with env "cannot read balance when running locally"
let cycles_add env =
match E.mode env with
- | Flags.ICMode
- | Flags.RefMode ->
+ | Flags.(ICMode | RefMode) ->
system_call env "call_cycles_add128"
| _ ->
E.trap_with env "cannot accept cycles when running locally"
let cycles_accept env =
match E.mode env with
- | Flags.ICMode
- | Flags.RefMode ->
+ | Flags.(ICMode | RefMode) ->
system_call env "msg_cycles_accept128"
| _ ->
E.trap_with env "cannot accept cycles when running locally"
let cycles_available env =
match E.mode env with
- | Flags.ICMode
- | Flags.RefMode ->
+ | Flags.(ICMode | RefMode) ->
system_call env "msg_cycles_available128"
| _ ->
E.trap_with env "cannot get cycles available when running locally"
let cycles_refunded env =
match E.mode env with
- | Flags.ICMode
- | Flags.RefMode ->
+ | Flags.(ICMode | RefMode) ->
system_call env "msg_cycles_refunded128"
| _ ->
E.trap_with env "cannot get cycles refunded when running locally"
+ let cycles_burn env =
+ match E.mode env with
+ | Flags.(ICMode | RefMode) ->
+ system_call env "cycles_burn128"
+ | _ ->
+ E.trap_with env "cannot burn cycles when running locally"
+
let set_certified_data env =
match E.mode env with
- | Flags.ICMode
- | Flags.RefMode ->
+ | Flags.(ICMode | RefMode) ->
Blob.as_ptr_len env ^^
system_call env "certified_data_set"
| _ ->
@@ -5270,8 +5271,7 @@ module IC = struct
let get_certificate env =
match E.mode env with
- | Flags.ICMode
- | Flags.RefMode ->
+ | Flags.(ICMode | RefMode) ->
system_call env "data_certificate_present" ^^
Bool.from_rts_int32 ^^
E.if1 I64Type
@@ -5338,7 +5338,7 @@ module Cycles = struct
let balance env =
Func.share_code0 Func.Always env "cycle_balance" [I64Type] (fun env ->
- Stack.with_words env "dst" 4L (fun get_dst ->
+ Stack.with_words env "dst" 2L (fun get_dst ->
get_dst ^^
IC.cycle_balance env ^^
get_dst ^^
@@ -5355,7 +5355,7 @@ module Cycles = struct
let accept env =
Func.share_code1 Func.Always env "cycle_accept" ("cycles", I64Type) [I64Type] (fun env get_x ->
- Stack.with_words env "dst" 4L (fun get_dst ->
+ Stack.with_words env "dst" 2L (fun get_dst ->
get_x ^^
to_two_word64 env ^^
get_dst ^^
@@ -5367,7 +5367,7 @@ module Cycles = struct
let available env =
Func.share_code0 Func.Always env "cycle_available" [I64Type] (fun env ->
- Stack.with_words env "dst" 4L (fun get_dst ->
+ Stack.with_words env "dst" 2L (fun get_dst ->
get_dst ^^
IC.cycles_available env ^^
get_dst ^^
@@ -5377,7 +5377,7 @@ module Cycles = struct
let refunded env =
Func.share_code0 Func.Always env "cycle_refunded" [I64Type] (fun env ->
- Stack.with_words env "dst" 4L (fun get_dst ->
+ Stack.with_words env "dst" 2L (fun get_dst ->
get_dst ^^
IC.cycles_refunded env ^^
get_dst ^^
@@ -5385,6 +5385,18 @@ module Cycles = struct
)
)
+ let burn env =
+ Func.share_code1 Func.Always env "cycle_burn" ("cycles", I64Type) [I64Type] (fun env get_x ->
+ Stack.with_words env "dst" 2L (fun get_dst ->
+ get_x ^^
+ to_two_word64 env ^^
+ get_dst ^^
+ IC.cycles_burn env ^^
+ get_dst ^^
+ from_word128_ptr env
+ )
+ )
+
end (* Cycles *)
(* Low-level, almost raw access to IC stable memory.
@@ -12245,6 +12257,8 @@ and compile_prim_invocation (env : E.t) ae p es at =
SR.Vanilla, Cycles.available env
| SystemCyclesRefundedPrim, [] ->
SR.Vanilla, Cycles.refunded env
+ | SystemCyclesBurnPrim, [e1] ->
+ SR.Vanilla, compile_exp_vanilla env ae e1 ^^ Cycles.burn env
| SetCertifiedData, [e1] ->
SR.unit, compile_exp_vanilla env ae e1 ^^ IC.set_certified_data env
diff --git a/src/ir_def/arrange_ir.ml b/src/ir_def/arrange_ir.ml
index d476aa83ec7..02cb40bde7d 100644
--- a/src/ir_def/arrange_ir.ml
+++ b/src/ir_def/arrange_ir.ml
@@ -101,6 +101,7 @@ and prim = function
| SystemCyclesAvailablePrim -> Atom "SystemCyclesAvailablePrim"
| SystemCyclesBalancePrim -> Atom "SystemCyclesBalancePrim"
| SystemCyclesRefundedPrim -> Atom "SystemCyclesRefundedPrim"
+ | SystemCyclesBurnPrim -> Atom "SystemCyclesBurnPrim"
| SetCertifiedData -> Atom "SetCertifiedData"
| GetCertificate -> Atom "GetCertificate"
| OtherPrim s -> Atom s
diff --git a/src/ir_def/check_ir.ml b/src/ir_def/check_ir.ml
index a70c10f47d1..0d9f45279a6 100644
--- a/src/ir_def/check_ir.ml
+++ b/src/ir_def/check_ir.ml
@@ -676,7 +676,7 @@ let rec check_exp env (exp:Ir.exp) : unit =
(* Cycles *)
| (SystemCyclesBalancePrim | SystemCyclesAvailablePrim | SystemCyclesRefundedPrim), [] ->
T.nat <: t
- | SystemCyclesAcceptPrim, [e1] ->
+ | (SystemCyclesAcceptPrim | SystemCyclesBurnPrim), [e1] ->
typ e1 <: T.nat;
T.nat <: t
| SystemCyclesAddPrim, [e1] ->
diff --git a/src/ir_def/construct.ml b/src/ir_def/construct.ml
index 5de2e5ef0a7..6564490287e 100644
--- a/src/ir_def/construct.ml
+++ b/src/ir_def/construct.ml
@@ -107,7 +107,8 @@ let primE prim es =
| RelPrim _ -> T.bool
| SerializePrim _ -> T.blob
| SystemCyclesAvailablePrim
- | SystemCyclesAcceptPrim -> T.nat
+ | SystemCyclesAcceptPrim
+ | SystemCyclesBurnPrim -> T.nat
| DeserializePrim ts -> T.seq ts
| DeserializeOptPrim ts -> T.Opt (T.seq ts)
| OtherPrim "trap" -> T.Non
diff --git a/src/ir_def/ir.ml b/src/ir_def/ir.ml
index 413b56506dd..18b28c8b9ff 100644
--- a/src/ir_def/ir.ml
+++ b/src/ir_def/ir.ml
@@ -159,6 +159,7 @@ and prim =
| SystemCyclesAvailablePrim
| SystemCyclesBalancePrim
| SystemCyclesRefundedPrim
+ | SystemCyclesBurnPrim
| SetCertifiedData
| GetCertificate
@@ -308,6 +309,7 @@ let map_prim t_typ t_id p =
| SystemCyclesAvailablePrim
| SystemCyclesBalancePrim
| SystemCyclesRefundedPrim
+ | SystemCyclesBurnPrim
| SetCertifiedData
| GetCertificate
| OtherPrim _ -> p
diff --git a/src/lowering/desugar.ml b/src/lowering/desugar.ml
index 9c498035d41..bcbb995e46d 100644
--- a/src/lowering/desugar.ml
+++ b/src/lowering/desugar.ml
@@ -183,6 +183,8 @@ and exp' at note = function
I.PrimE (I.SystemCyclesAcceptPrim, [exp e])
| S.CallE ({it=S.AnnotE ({it=S.PrimE "cyclesAdd";_},_);_}, _, e) ->
I.PrimE (I.SystemCyclesAddPrim, [exp e])
+ | S.CallE ({it=S.AnnotE ({it=S.PrimE "cyclesBurn";_},_);_}, _, e) ->
+ I.PrimE (I.SystemCyclesBurnPrim, [exp e])
(* Certified data *)
| S.CallE ({it=S.AnnotE ({it=S.PrimE "setCertifiedData";_},_);_}, _, e) ->
I.PrimE (I.SetCertifiedData, [exp e])
diff --git a/src/prelude/prim.mo b/src/prelude/prim.mo
index f900e2063cf..209337400e0 100644
--- a/src/prelude/prim.mo
+++ b/src/prelude/prim.mo
@@ -351,6 +351,10 @@ func cyclesAdd(amount : Nat) : () {
};
};
+func cyclesBurn(amount : Nat) : Nat {
+ (prim "cyclesBurn" : Nat -> Nat) amount;
+};
+
// certified data
func setCertifiedData(data : Blob) = (prim "setCertifiedData" : Blob -> ()) data;
func getCertificate() : ?Blob = (prim "getCertificate" : () -> ?Blob)();
diff --git a/test/fail/ok/no-timer-canc.tc.ok b/test/fail/ok/no-timer-canc.tc.ok
index 7918c4887dd..e1877945e59 100644
--- a/test/fail/ok/no-timer-canc.tc.ok
+++ b/test/fail/ok/no-timer-canc.tc.ok
@@ -88,6 +88,7 @@ no-timer-canc.mo:3.10-3.21: type error [M0119], object field cancelTimer is not
cyclesAdd : Nat -> ();
cyclesAvailable : () -> Nat;
cyclesBalance : () -> Nat;
+ cyclesBurn : Nat -> Nat;
cyclesRefunded : () -> Nat;
debugPrint : Text -> ();
debugPrintChar : Char -> ();
diff --git a/test/fail/ok/no-timer-set.tc.ok b/test/fail/ok/no-timer-set.tc.ok
index a015c4bae8e..f4951c74796 100644
--- a/test/fail/ok/no-timer-set.tc.ok
+++ b/test/fail/ok/no-timer-set.tc.ok
@@ -88,6 +88,7 @@ no-timer-set.mo:3.10-3.18: type error [M0119], object field setTimer is not cont
cyclesAdd : Nat -> ();
cyclesAvailable : () -> Nat;
cyclesBalance : () -> Nat;
+ cyclesBurn : Nat -> Nat;
cyclesRefunded : () -> Nat;
debugPrint : Text -> ();
debugPrintChar : Char -> ();
diff --git a/test/run-drun/basic-cycles.mo b/test/run-drun/basic-cycles.mo
index 42b3b159282..73cfd970224 100644
--- a/test/run-drun/basic-cycles.mo
+++ b/test/run-drun/basic-cycles.mo
@@ -8,6 +8,7 @@ actor a {
let available : () -> Nat = Prim.cyclesAvailable;
let accept : Nat -> Nat = Prim.cyclesAccept;
let add : Nat -> () = Prim.cyclesAdd;
+ let burn : Nat -> Nat = Prim.cyclesBurn;
let refunded : () -> Nat = Prim.cyclesRefunded;
@@ -91,6 +92,7 @@ actor a {
public func go() : async (){
await overflow();
await iter();
+ assert 1000 == burn 1000
}
};
diff --git a/test/run-drun/empty-actor-classical.mo b/test/run-drun/empty-actor-classical.mo
index 564bf9d4ddd..babae5e5f94 100644
--- a/test/run-drun/empty-actor-classical.mo
+++ b/test/run-drun/empty-actor-classical.mo
@@ -8,11 +8,11 @@ actor {};
// CHECK-NEXT: call $trans_state
// CHECK-NEXT: call $init
// CHECK-NEXT: i32.const 0
-// CHECK-NEXT: call 32
+// CHECK-NEXT: call 33
// CHECK-NEXT: global.set 4
// CHECK-NEXT: call ${{copying_gc|compacting_gc|generational_gc|incremental_gc}}
// CHECK-NEXT: i32.const 0
-// CHECK-NEXT: call 32
+// CHECK-NEXT: call 33
// CHECK-NEXT: global.get 4
// CHECK-NEXT: i64.sub
// CHECK-NEXT: global.set 5
diff --git a/test/run-drun/ok/basic-cycles.tc.ok b/test/run-drun/ok/basic-cycles.tc.ok
index 6b3df344d9d..d80be283628 100644
--- a/test/run-drun/ok/basic-cycles.tc.ok
+++ b/test/run-drun/ok/basic-cycles.tc.ok
@@ -1 +1 @@
-basic-cycles.mo:12.7-12.15: warning [M0194], unused identifier refunded (delete or rename to wildcard `_` or `_refunded`)
+basic-cycles.mo:13.7-13.15: warning [M0194], unused identifier refunded (delete or rename to wildcard `_` or `_refunded`)
From 9a3ea6e48b40e0bee85d5ed5f43358d20a2b85e6 Mon Sep 17 00:00:00 2001
From: Gabor Greif
Date: Fri, 13 Sep 2024 14:54:43 +0200
Subject: [PATCH 16/27] chore: Releasing 0.13.0 (#4697)
---
Changelog.md | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)
diff --git a/Changelog.md b/Changelog.md
index 8c2e608e4fc..0a83672e5f8 100644
--- a/Changelog.md
+++ b/Changelog.md
@@ -1,5 +1,7 @@
# Motoko compiler changelog
+## 0.13.0 (2024-09-13)
+
* motoko (`moc`)
* Added a new primitive `cyclesBurn : Nat -> Nat` for burning the canister's cycles
@@ -31,10 +33,11 @@
"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`.
+ * 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.
From eb29e5f5df0fdb96c2695e767e75b342503ca78e Mon Sep 17 00:00:00 2001
From: Gabor Greif
Date: Sat, 14 Sep 2024 17:23:03 +0200
Subject: [PATCH 17/27] strip from checks and uploads
---
.github/workflows/release.yml | 52 -----------------------------------
1 file changed, 52 deletions(-)
diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml
index d532e4bc059..907bdebb358 100644
--- a/.github/workflows/release.yml
+++ b/.github/workflows/release.yml
@@ -13,38 +13,12 @@ on:
- 'master'
jobs:
- # first check that the changelog is in good order and extract the changelog
- # This will fail for non-release tags.
- changelog:
- runs-on: 'ubuntu-latest'
- steps:
- - uses: actions/checkout@v4
-
- - name: Get the version
- id: get_version
- run: echo version=${{ github.ref_name }} >> "$GITHUB_OUTPUT"
-
- - name: Extract changelog
- id: read_changelog
- if: startsWith(github.ref, 'refs/tags/')
- run: |
- export VERSION='${{ steps.get_version.outputs.version }}'
- perl -0777 -ne '/^# Motoko compiler changelog\n\n## (??{quotemeta($ENV{VERSION})}) \(\d\d\d\d-\d\d-\d\d\)\n\n(.*?)^##/sm or die "Changelog does not look right for this version\n" ; print $1' Changelog.md > changelog-extract.md
- cat changelog-extract.md
- # need to mangle to use with $GITHUB_OUTPUT (previously: set-output),
- # see https://github.com/svenstaro/upload-release-action/blob/master/README.md
- # under "Example for feeding a file from repo to the body tag"
- echo "RELEASE_BODY=$(perl -0777 -p -e 's/%/%25/g; s/\n/%0A/g; s/\r/%0D/g' changelog-extract.md)" >> "$GITHUB_OUTPUT"
-
- outputs:
- release_body: ${{ steps.read_changelog.outputs.RELEASE_BODY }}
# Now build the release on both linux and darwin
build:
strategy:
matrix:
os: [ ubuntu-latest, macos-12 ]
- needs: changelog
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v4
@@ -64,29 +38,3 @@ jobs:
# these are the dependencies listed in release-files. Sorry for the duplication
run: |
nix-build --max-jobs 1 --arg officialRelease true -A moc -A mo-ide -A mo-doc -A js.moc -A js.moc_interpreter
-
- # Finally do the upload. Hopefully the previous job has uploaded the
- # build product to the cachix cache, as we cannot build the darwin products on
- # linux
- release:
- if: startsWith(github.ref, 'refs/tags/')
- runs-on: 'ubuntu-latest'
- needs: [ changelog, build ]
- steps:
- - uses: actions/checkout@v4
- - uses: cachix/install-nix-action@V28
- - uses: cachix/cachix-action@v15
- with:
- name: ic-hs-test
- # NB: No auth token, we don’t expect to push new stuff here
-
- - run: nix-build --max-jobs 1 --arg officialRelease true release-files.nix
-
- - name: Upload Release Assets
- uses: svenstaro/upload-release-action@v2
- with:
- repo_token: ${{ secrets.GITHUB_TOKEN }}
- tag: ${{ github.ref }}
- file: result/*
- file_glob: true
- body: ${{ needs.changelog.outputs.release_body }}
From 624d52d2a53dc4ee079b1e4c11e70874fe698749 Mon Sep 17 00:00:00 2001
From: Gabor Greif
Date: Sat, 14 Sep 2024 18:46:03 +0200
Subject: [PATCH 18/27] eeek, re-add
---
.github/workflows/release.yml | 17 +++++++++++++++++
1 file changed, 17 insertions(+)
diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml
index 907bdebb358..e39e89693df 100644
--- a/.github/workflows/release.yml
+++ b/.github/workflows/release.yml
@@ -38,3 +38,20 @@ jobs:
# these are the dependencies listed in release-files. Sorry for the duplication
run: |
nix-build --max-jobs 1 --arg officialRelease true -A moc -A mo-ide -A mo-doc -A js.moc -A js.moc_interpreter
+
+ # Finally do the upload. Hopefully the previous job has uploaded the
+ # build product to the cachix cache, as we cannot build the darwin products on
+ # linux
+ release:
+ if: startsWith(github.ref, 'refs/tags/')
+ runs-on: 'ubuntu-latest'
+ needs: [ build ]
+ steps:
+ - uses: actions/checkout@v4
+ - uses: cachix/install-nix-action@V28
+ - uses: cachix/cachix-action@v15
+ with:
+ name: ic-hs-test
+ # NB: No auth token, we don’t expect to push new stuff here
+
+ - run: nix-build --max-jobs 1 --arg officialRelease true release-files.nix
From 5ff0b7277fcfba34e83699592ba7802b00e46923 Mon Sep 17 00:00:00 2001
From: Gabor Greif
Date: Sat, 14 Sep 2024 19:01:08 +0200
Subject: [PATCH 19/27] experiment
---
.github/workflows/release.yml | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml
index e39e89693df..c8750a971e1 100644
--- a/.github/workflows/release.yml
+++ b/.github/workflows/release.yml
@@ -54,4 +54,4 @@ jobs:
name: ic-hs-test
# NB: No auth token, we don’t expect to push new stuff here
- - run: nix-build --max-jobs 1 --arg officialRelease true release-files.nix
+ - run: nix-build --download-buffer-size 167108864 --max-jobs 1 --arg officialRelease true release-files.nix
From cfd919c9db94d5e2f9ef2f108853845aa3288935 Mon Sep 17 00:00:00 2001
From: Gabor Greif
Date: Sat, 14 Sep 2024 19:10:25 +0200
Subject: [PATCH 20/27] damn
---
.github/workflows/release.yml | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml
index c8750a971e1..d7185a08829 100644
--- a/.github/workflows/release.yml
+++ b/.github/workflows/release.yml
@@ -54,4 +54,4 @@ jobs:
name: ic-hs-test
# NB: No auth token, we don’t expect to push new stuff here
- - run: nix-build --download-buffer-size 167108864 --max-jobs 1 --arg officialRelease true release-files.nix
+ - run: nix-build --option download-buffer-size 167108864 --max-jobs 1 --arg officialRelease true release-files.nix
From 14d68cc9414cf1a360b2054781abcfc7ded2e69d Mon Sep 17 00:00:00 2001
From: Gabor Greif
Date: Sat, 14 Sep 2024 20:24:47 +0200
Subject: [PATCH 21/27] harmless change
---
default.nix | 2 +-
rts/cargo-vendor-tools/src/vendor_rust_std_deps.rs | 2 +-
2 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/default.nix b/default.nix
index a582d9adcd1..39e5ac43b9e 100644
--- a/default.nix
+++ b/default.nix
@@ -165,7 +165,7 @@ rec {
cargoVendorTools = nixpkgs.rustPlatform.buildRustPackage rec {
name = "cargo-vendor-tools";
src = subpath "./rts/${name}/";
- cargoSha256 = "sha256-E6GTFvmZMjGsVlec7aH3QaizqIET6Dz8Csh0N1jeX+M=";
+ cargoSha256 = "sha256-X6GTFvmZMjGsVlec7aH3QaizqIET6Dz8Csh0N1jeX+M=";
};
# Path to vendor-rust-std-deps, provided by cargo-vendor-tools
diff --git a/rts/cargo-vendor-tools/src/vendor_rust_std_deps.rs b/rts/cargo-vendor-tools/src/vendor_rust_std_deps.rs
index 3c3bf7e7848..014f418d308 100644
--- a/rts/cargo-vendor-tools/src/vendor_rust_std_deps.rs
+++ b/rts/cargo-vendor-tools/src/vendor_rust_std_deps.rs
@@ -7,7 +7,7 @@ use serde_json as json;
use sha2::{Digest, Sha256};
static DESCR: &str = "
-Given a Rust toolchain path and a vendor directory, this program vendors Rust std dependencies in
+XGiven a Rust toolchain path and a vendor directory, this program vendors Rust std dependencies in
the given vendor directory. This directory can then be used to build packages with `-Zbuild-std`
parameters in nix.
";
From e3cf0b32dd5102329b4fc70972f4ddb35994d900 Mon Sep 17 00:00:00 2001
From: Gabor Greif
Date: Sat, 14 Sep 2024 21:49:45 +0200
Subject: [PATCH 22/27] assert release build archs
---
default.nix | 2 ++
1 file changed, 2 insertions(+)
diff --git a/default.nix b/default.nix
index 39e5ac43b9e..32ef79e6e4b 100644
--- a/default.nix
+++ b/default.nix
@@ -6,6 +6,8 @@
let nixpkgs = import ./nix { inherit system; }; in
+assert !officialRelease || nixpkgs.lib.asserts.assertOneOf "system" system [ "x86_64-linux" "x86_64-darwin" ];
+
let releaseVersion = import nix/releaseVersion.nix { pkgs = nixpkgs; inherit officialRelease; }; in
let stdenv = nixpkgs.stdenv; in
From 6163213e645da3595389d058fc38ac203057e499 Mon Sep 17 00:00:00 2001
From: Gabor Greif
Date: Sat, 14 Sep 2024 22:09:38 +0200
Subject: [PATCH 23/27] debug
---
.github/workflows/release.yml | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml
index d7185a08829..e15bfce98e8 100644
--- a/.github/workflows/release.yml
+++ b/.github/workflows/release.yml
@@ -54,4 +54,5 @@ jobs:
name: ic-hs-test
# NB: No auth token, we don’t expect to push new stuff here
- - run: nix-build --option download-buffer-size 167108864 --max-jobs 1 --arg officialRelease true release-files.nix
+ - run: |
+ nix-build --option download-buffer-size 167108864 --max-jobs 1 --arg officialRelease true release-files.nix || derivation show /nix/store/*-moc-rts.drv
From a914dae678f4a76713b16d534c3e1afa0ab77f77 Mon Sep 17 00:00:00 2001
From: Gabor Greif
Date: Sat, 14 Sep 2024 22:10:17 +0200
Subject: [PATCH 24/27] grrr
---
.github/workflows/release.yml | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml
index e15bfce98e8..69c260a3dda 100644
--- a/.github/workflows/release.yml
+++ b/.github/workflows/release.yml
@@ -55,4 +55,4 @@ jobs:
# NB: No auth token, we don’t expect to push new stuff here
- run: |
- nix-build --option download-buffer-size 167108864 --max-jobs 1 --arg officialRelease true release-files.nix || derivation show /nix/store/*-moc-rts.drv
+ nix-build --option download-buffer-size 167108864 --max-jobs 1 --arg officialRelease true release-files.nix || nix derivation show /nix/store/*-moc-rts.drv
From c7e71ec2d5b371e91d983e325428809701ba7d9a Mon Sep 17 00:00:00 2001
From: Gabor Greif
Date: Sat, 14 Sep 2024 22:26:39 +0200
Subject: [PATCH 25/27] more debug
---
.github/workflows/release.yml | 1 +
1 file changed, 1 insertion(+)
diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml
index 69c260a3dda..4f73e08fbab 100644
--- a/.github/workflows/release.yml
+++ b/.github/workflows/release.yml
@@ -38,6 +38,7 @@ jobs:
# these are the dependencies listed in release-files. Sorry for the duplication
run: |
nix-build --max-jobs 1 --arg officialRelease true -A moc -A mo-ide -A mo-doc -A js.moc -A js.moc_interpreter
+ nix derivation show /nix/store/*-moc-rts.drv
# Finally do the upload. Hopefully the previous job has uploaded the
# build product to the cachix cache, as we cannot build the darwin products on
From ede2ac6c5887f58eed5e2aa68afce8def9090fa5 Mon Sep 17 00:00:00 2001
From: Gabor Greif
Date: Sat, 14 Sep 2024 22:54:06 +0200
Subject: [PATCH 26/27] more debug
---
.github/workflows/release.yml | 2 ++
1 file changed, 2 insertions(+)
diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml
index 4f73e08fbab..7e8f1c4fc5c 100644
--- a/.github/workflows/release.yml
+++ b/.github/workflows/release.yml
@@ -39,6 +39,7 @@ jobs:
run: |
nix-build --max-jobs 1 --arg officialRelease true -A moc -A mo-ide -A mo-doc -A js.moc -A js.moc_interpreter
nix derivation show /nix/store/*-moc-rts.drv
+ ls -l /nix/store/*-moc-rts.drv
# Finally do the upload. Hopefully the previous job has uploaded the
# build product to the cachix cache, as we cannot build the darwin products on
@@ -57,3 +58,4 @@ jobs:
- run: |
nix-build --option download-buffer-size 167108864 --max-jobs 1 --arg officialRelease true release-files.nix || nix derivation show /nix/store/*-moc-rts.drv
+ ls -l /nix/store/*-moc-rts.drv
From 65ef5171cd144d9a7c3653ccdf10a889bde28dca Mon Sep 17 00:00:00 2001
From: Gabor Greif
Date: Mon, 16 Sep 2024 11:06:14 +0200
Subject: [PATCH 27/27] chore: bump `nixpkgs` to `release-24.05`
---
nix/sources.json | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/nix/sources.json b/nix/sources.json
index b96398b1b44..62145f09787 100644
--- a/nix/sources.json
+++ b/nix/sources.json
@@ -108,16 +108,16 @@
"url_template": "https://github.com///archive/.tar.gz"
},
"nixpkgs": {
- "branch": "release-23.11",
+ "branch": "release-24.05",
"builtin": true,
"description": "Nixpkgs/NixOS branches that track the Nixpkgs/NixOS channels",
"homepage": null,
"owner": "NixOS",
"repo": "nixpkgs",
- "rev": "6a5b92486ae7826c07fbfad302f569ceb187b0eb",
- "sha256": "058kf03v7yh1c4ns96af6jq3ymadv71s7ajv9s05ipl9bnkjfrhm",
+ "rev": "f5173c0827d19dc1a46003a9df9de653b1285173",
+ "sha256": "1swhcfxcdx3kj4pkzwh82yaq3s2vbvjimbvd8qndkqxf2127wyak",
"type": "tarball",
- "url": "https://github.com/NixOS/nixpkgs/archive/6a5b92486ae7826c07fbfad302f569ceb187b0eb.tar.gz",
+ "url": "https://github.com/NixOS/nixpkgs/archive/f5173c0827d19dc1a46003a9df9de653b1285173.tar.gz",
"url_template": "https://github.com///archive/.tar.gz"
},
"nixpkgs-mozilla": {