Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

bump moc and ic-cdk #225

Merged
merged 9 commits into from
Mar 6, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 7 additions & 7 deletions .github/workflows/backend.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,9 @@ jobs:
strategy:
fail-fast: false
env:
DFX_VERSION: 0.15.2-beta.3
IC_REPL_VERSION: 0.6.0
MOC_VERSION: 0.10.2
DFX_VERSION: 0.18.0
IC_REPL_VERSION: 0.6.2
MOC_VERSION: 0.11.0
steps:
- name: Setup Rust
uses: actions-rs/toolchain@v1
Expand All @@ -26,14 +26,14 @@ jobs:
override: true
target: wasm32-unknown-unknown
- name: Cache cargo build
uses: actions/cache@v3
uses: actions/cache@v4
with:
path: |
~/.cargo/registry
~/.cargo/git
service/wasm-utils/target
key: cargo-${{ hashFiles('**/Cargo.lock') }}
- uses: actions/setup-node@v3
- uses: actions/setup-node@v4
with:
node-version: 18
- name: Install dfx
Expand All @@ -55,14 +55,14 @@ jobs:
dfx start --background
- name: Checkout base branch
if: github.event_name == 'pull_request' && !contains(github.event.pull_request.labels.*.name, 'breaking_changes')
uses: actions/checkout@v3
uses: actions/checkout@v4
with:
ref: ${{ github.base_ref }}
- name: Deploy main branch
if: github.event_name == 'pull_request' && !contains(github.event.pull_request.labels.*.name, 'breaking_changes')
run: |
dfx deploy backend
- uses: actions/checkout@v3
- uses: actions/checkout@v4
- name: Deploy current branch
run: dfx deploy backend
- name: CanisterPool test
Expand Down
8 changes: 4 additions & 4 deletions .github/workflows/frontend.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,13 +21,13 @@ jobs:
- 16
- 18
env:
DFX_VERSION: 0.15.2-beta.3
DFX_VERSION: 0.18.0
SKIP_WASM: true
MOC_VERSION: 0.10.2
MOC_VERSION: 0.11.0
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v4
- name: Setup Node.js ${{ matrix.node }}
uses: actions/setup-node@v3
uses: actions/setup-node@v4
with:
node-version: ${{ matrix.node }}
cache: 'npm'
Expand Down
3 changes: 1 addition & 2 deletions mops.toml
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
[dependencies]
base = "https://github.com/dfinity/motoko-base#master"
base = "0.11.0"
splay = "0.1.0"

2 changes: 1 addition & 1 deletion public/moc.js

Large diffs are not rendered by default.

17 changes: 8 additions & 9 deletions service/pool/Main.mo
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ import Error "mo:base/Error";
import Option "mo:base/Option";
import Nat "mo:base/Nat";
import Text "mo:base/Text";
import Array "mo:base/Array";
import Buffer "mo:base/Buffer";
import List "mo:base/List";
import Deque "mo:base/Deque";
Expand Down Expand Up @@ -53,7 +52,7 @@ shared (creator) actor class Self(opt_params : ?Types.InitParams) = this {
};
pool.unshare(stablePool, stableMetadata, stableChildren);
for (info in stableTimers.vals()) {
updateTimer(info);
updateTimer<system>(info);
};
statsByOrigin.unshare(stableStatsByOrigin);
};
Expand All @@ -73,13 +72,13 @@ shared (creator) actor class Self(opt_params : ?Types.InitParams) = this {

public func wallet_receive() : async () {
let amount = Cycles.available();
ignore Cycles.accept amount;
ignore Cycles.accept<system> amount;
};

private func getExpiredCanisterInfo(origin : Logs.Origin) : async Types.CanisterInfo {
switch (pool.getExpiredCanisterId()) {
case (#newId) {
Cycles.add(params.cycles_per_canister);
Cycles.add<system>(params.cycles_per_canister);
let cid = await IC.create_canister { settings = null };
let now = Time.now();
let info = { id = cid.canister_id; timestamp = now };
Expand All @@ -95,7 +94,7 @@ shared (creator) actor class Self(opt_params : ?Types.InitParams) = this {
params.cycles_per_canister - status.cycles;
} else { 0 };
if (topUpCycles > 0) {
Cycles.add topUpCycles;
Cycles.add<system> topUpCycles;
await IC.deposit_cycles cid;
};
if (Option.isSome(status.module_hash)) {
Expand Down Expand Up @@ -206,22 +205,22 @@ shared (creator) actor class Self(opt_params : ?Types.InitParams) = this {
statsByOrigin.addInstall(origin);
switch (pool.refresh(info, install_config.profiling)) {
case (?newInfo) {
updateTimer(newInfo);
updateTimer<system>(newInfo);
newInfo;
};
case null { throw Error.reject "Cannot find canister" };
};
};
};

func updateTimer(info: Types.CanisterInfo) {
func updateTimer<system>(info: Types.CanisterInfo) {
func job() : async () {
pool.removeTimer(info.id);
// It is important that the timer job checks for the timestamp first.
// This prevents late-runner jobs from deleting newly installed code.
await removeCode(info);
};
pool.updateTimer(info, job);
pool.updateTimer<system>(info, job);
};

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

// Disabled to prevent the user from updating the controller list (amongst other settings)
public shared ({ caller }) func update_settings({
public shared func update_settings({
canister_id : ICType.canister_id;
settings : ICType.canister_settings;
}) : async () {
Expand Down
4 changes: 2 additions & 2 deletions service/pool/Types.mo
Original file line number Diff line number Diff line change
Expand Up @@ -137,10 +137,10 @@ module {
return true;
};

public func updateTimer(info: CanisterInfo, job : () -> async ()) {
public func updateTimer<system>(info: CanisterInfo, job : () -> async ()) {
let elapsed = Time.now() - info.timestamp;
let duration = if (elapsed > ttl) { 0 } else { Int.abs(ttl - elapsed) };
let tid = Timer.setTimer(#nanoseconds duration, job);
let tid = Timer.setTimer<system>(#nanoseconds duration, job);
switch (timers.replace(info.id, tid)) {
case null {};
case (?old_id) {
Expand Down
4 changes: 2 additions & 2 deletions service/pool/tests/actor_class/Parent.mo
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ actor Parent {
};

public func makeChild(i : Nat) : async Principal {
Cycles.add 550_000_000_000;
Cycles.add<system> 550_000_000_000;
let b = await Child.Child();
children[i] := ?b;
Principal.fromActor b
Expand Down Expand Up @@ -63,4 +63,4 @@ actor Parent {
await IC.update_settings { canister_id = Principal.fromActor(children[i]!); settings };
}
}
}
}
34 changes: 17 additions & 17 deletions service/wasm-utils/Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions service/wasm-utils/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,10 @@ crate-type = ["cdylib"]

[dependencies]
hex = "0.4.3"
ic-cdk = "0.12.0"
ic-cdk = "0.13"
serde = "1.0"
serde_bytes = "0.11"
candid = "0.10.0"
candid = "0.10"
ic-wasm = { version = "0.7.0", default-features = false }
sha2 = "0.10.6"

Expand Down
1 change: 1 addition & 0 deletions service/wasm-utils/whitelisted_wasms.txt
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,5 @@
"657938477f1dee46db70b5a9f0bd167ec5ffcd2f930a1d96593c17dcddef61b3", // dfx 0.15.2 frontend canister
"657938477f1dee46db70b5a9f0bd167ec5ffcd2f930a1d96593c17dcddef61b3", // dfx 0.15.3 frontend canister
"3c86d912ead6de7133b9f787df4ca9feee07bea8835d3ed594b47ee89e6cb730", // dfx 0.16.0 frontend canister
"32e92f1190d8321e97f8d8f3e793019e4fd2812bfc595345d46d2c23f74c1ab5", // dfx 0.18.0 frontend canister
]
2 changes: 1 addition & 1 deletion src/App.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ import { DeployModal, DeploySetter } from "./components/DeployModal";
import { backend, saved } from "./config/actor";
import { setupEditorIntegration } from "./integrations/editorIntegration";

const MOC_VERSION = "0.10.4";
const MOC_VERSION = "0.11.0";

const GlobalStyles = createGlobalStyle`
:root {
Expand Down
2 changes: 1 addition & 1 deletion src/Stats.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ playground:

function extract_slice(raw, cond) {
const res = raw
.filter(([name, _]) => cond(name))
.filter(([name, n]) => cond(name) && Number(n) > 1)
.map(([name, n]) => [name, Number(n)]);
res.sort((a, b) => b[1] - a[1]);
return res;
Expand Down
Loading
Loading