Skip to content
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Commit 210692b

Browse files
committedMar 6, 2024·
system capability
1 parent 24f0234 commit 210692b

File tree

5 files changed

+26
-28
lines changed

5 files changed

+26
-28
lines changed
 

‎.github/workflows/backend.yml

+7-7
Original file line numberDiff line numberDiff line change
@@ -14,9 +14,9 @@ jobs:
1414
strategy:
1515
fail-fast: false
1616
env:
17-
DFX_VERSION: 0.15.2-beta.3
18-
IC_REPL_VERSION: 0.6.0
19-
MOC_VERSION: 0.10.2
17+
DFX_VERSION: 0.18.0-beta.3
18+
IC_REPL_VERSION: 0.6.2
19+
MOC_VERSION: 0.11.0
2020
steps:
2121
- name: Setup Rust
2222
uses: actions-rs/toolchain@v1
@@ -26,14 +26,14 @@ jobs:
2626
override: true
2727
target: wasm32-unknown-unknown
2828
- name: Cache cargo build
29-
uses: actions/cache@v3
29+
uses: actions/cache@v4
3030
with:
3131
path: |
3232
~/.cargo/registry
3333
~/.cargo/git
3434
service/wasm-utils/target
3535
key: cargo-${{ hashFiles('**/Cargo.lock') }}
36-
- uses: actions/setup-node@v3
36+
- uses: actions/setup-node@v4
3737
with:
3838
node-version: 18
3939
- name: Install dfx
@@ -55,14 +55,14 @@ jobs:
5555
dfx start --background
5656
- name: Checkout base branch
5757
if: github.event_name == 'pull_request' && !contains(github.event.pull_request.labels.*.name, 'breaking_changes')
58-
uses: actions/checkout@v3
58+
uses: actions/checkout@v4
5959
with:
6060
ref: ${{ github.base_ref }}
6161
- name: Deploy main branch
6262
if: github.event_name == 'pull_request' && !contains(github.event.pull_request.labels.*.name, 'breaking_changes')
6363
run: |
6464
dfx deploy backend
65-
- uses: actions/checkout@v3
65+
- uses: actions/checkout@v4
6666
- name: Deploy current branch
6767
run: dfx deploy backend
6868
- name: CanisterPool test

‎.github/workflows/frontend.yml

+4-4
Original file line numberDiff line numberDiff line change
@@ -21,13 +21,13 @@ jobs:
2121
- 16
2222
- 18
2323
env:
24-
DFX_VERSION: 0.15.2-beta.3
24+
DFX_VERSION: 0.19.0-beta.3
2525
SKIP_WASM: true
26-
MOC_VERSION: 0.10.2
26+
MOC_VERSION: 0.11.0
2727
steps:
28-
- uses: actions/checkout@v2
28+
- uses: actions/checkout@v4
2929
- name: Setup Node.js ${{ matrix.node }}
30-
uses: actions/setup-node@v3
30+
uses: actions/setup-node@v4
3131
with:
3232
node-version: ${{ matrix.node }}
3333
cache: 'npm'

‎mops.toml

+1-2
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
11
[dependencies]
2-
base = "https://github.com/dfinity/motoko-base#master"
2+
base = "0.11.0"
33
splay = "0.1.0"
4-

‎service/pool/Main.mo

+11-12
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@ import Error "mo:base/Error";
55
import Option "mo:base/Option";
66
import Nat "mo:base/Nat";
77
import Text "mo:base/Text";
8-
import Array "mo:base/Array";
98
import Buffer "mo:base/Buffer";
109
import List "mo:base/List";
1110
import Deque "mo:base/Deque";
@@ -53,7 +52,7 @@ shared (creator) actor class Self(opt_params : ?Types.InitParams) = this {
5352
};
5453
pool.unshare(stablePool, stableMetadata, stableChildren);
5554
for (info in stableTimers.vals()) {
56-
updateTimer(info);
55+
updateTimer<system>(info);
5756
};
5857
statsByOrigin.unshare(stableStatsByOrigin);
5958
};
@@ -73,13 +72,13 @@ shared (creator) actor class Self(opt_params : ?Types.InitParams) = this {
7372

7473
public func wallet_receive() : async () {
7574
let amount = Cycles.available();
76-
ignore Cycles.accept amount;
75+
ignore Cycles.accept<system> amount;
7776
};
7877

7978
private func getExpiredCanisterInfo(origin : Logs.Origin) : async Types.CanisterInfo {
8079
switch (pool.getExpiredCanisterId()) {
8180
case (#newId) {
82-
Cycles.add(params.cycles_per_canister);
81+
Cycles.add<system>(params.cycles_per_canister);
8382
let cid = await IC.create_canister { settings = null };
8483
let now = Time.now();
8584
let info = { id = cid.canister_id; timestamp = now };
@@ -95,7 +94,7 @@ shared (creator) actor class Self(opt_params : ?Types.InitParams) = this {
9594
params.cycles_per_canister - status.cycles;
9695
} else { 0 };
9796
if (topUpCycles > 0) {
98-
Cycles.add topUpCycles;
97+
Cycles.add<system> topUpCycles;
9998
await IC.deposit_cycles cid;
10099
};
101100
if (Option.isSome(status.module_hash)) {
@@ -206,22 +205,22 @@ shared (creator) actor class Self(opt_params : ?Types.InitParams) = this {
206205
statsByOrigin.addInstall(origin);
207206
switch (pool.refresh(info, install_config.profiling)) {
208207
case (?newInfo) {
209-
updateTimer(newInfo);
208+
updateTimer<system>(newInfo);
210209
newInfo;
211210
};
212211
case null { throw Error.reject "Cannot find canister" };
213212
};
214213
};
215214
};
216215

217-
func updateTimer(info: Types.CanisterInfo) {
216+
func updateTimer<system>(info: Types.CanisterInfo) {
218217
func job() : async () {
219-
pool.removeTimer(info.id);
218+
pool.removeTimer<system>(info.id);
220219
// It is important that the timer job checks for the timestamp first.
221220
// This prevents late-runner jobs from deleting newly installed code.
222221
await removeCode(info);
223222
};
224-
pool.updateTimer(info, job);
223+
pool.updateTimer<system>(info, job);
225224
};
226225

227226
public func callForward(info : Types.CanisterInfo, function : Text, args : Blob) : async Blob {
@@ -359,9 +358,9 @@ shared (creator) actor class Self(opt_params : ?Types.InitParams) = this {
359358
};
360359

361360
// Disabled to prevent the user from updating the controller list (amongst other settings)
362-
public shared ({ caller }) func update_settings({
363-
canister_id : ICType.canister_id;
364-
settings : ICType.canister_settings;
361+
public shared func update_settings({
362+
_canister_id : ICType.canister_id;
363+
_settings : ICType.canister_settings;
365364
}) : async () {
366365
throw Error.reject "Cannot call update_settings from within Motoko Playground";
367366
};

‎service/pool/Types.mo

+3-3
Original file line numberDiff line numberDiff line change
@@ -137,10 +137,10 @@ module {
137137
return true;
138138
};
139139

140-
public func updateTimer(info: CanisterInfo, job : () -> async ()) {
140+
public func updateTimer<system>(info: CanisterInfo, job : () -> async ()) {
141141
let elapsed = Time.now() - info.timestamp;
142142
let duration = if (elapsed > ttl) { 0 } else { Int.abs(ttl - elapsed) };
143-
let tid = Timer.setTimer(#nanoseconds duration, job);
143+
let tid = Timer.setTimer<system>(#nanoseconds duration, job);
144144
switch (timers.replace(info.id, tid)) {
145145
case null {};
146146
case (?old_id) {
@@ -151,7 +151,7 @@ module {
151151
};
152152
};
153153

154-
public func removeTimer(cid: Principal) {
154+
public func removeTimer<system>(cid: Principal) {
155155
timers.delete cid;
156156
};
157157

0 commit comments

Comments
 (0)
Please sign in to comment.