From 607ecfd956d2ddde2c1acef64d9b9a95b609e4ce Mon Sep 17 00:00:00 2001 From: Claudio Russo Date: Fri, 17 Jan 2025 10:07:07 +0000 Subject: [PATCH 1/4] experiment: eop compatibility check rewrite (#4855) * bug repro for dropping a field * tentative fix: only compare fields with equal tags, otherwise skip the check * duplicate logic before simplifying * simplify each case * Update test/run-drun/tmp_upgrade/version0.mo * Update test/run-drun/tmp_upgrade/version1.mo * comments * rewrite the compatibility check for records and memories from scratch@ * fix to advance both to next fields * advance until equal tags@ @ * re-expresss loop as while loop --- rts/motoko-rts/src/idl.rs | 85 ++++++++++++++++++--------- test/run-drun/ok/tmp_upgrade.drun.ok | 3 + test/run-drun/tmp_upgrade.drun | 3 + test/run-drun/tmp_upgrade/version0.mo | 6 ++ test/run-drun/tmp_upgrade/version1.mo | 6 ++ 5 files changed, 76 insertions(+), 27 deletions(-) create mode 100644 test/run-drun/ok/tmp_upgrade.drun.ok create mode 100644 test/run-drun/tmp_upgrade.drun create mode 100644 test/run-drun/tmp_upgrade/version0.mo create mode 100644 test/run-drun/tmp_upgrade/version1.mo diff --git a/rts/motoko-rts/src/idl.rs b/rts/motoko-rts/src/idl.rs index cfca1b9bfc2..95de54350bd 100644 --- a/rts/motoko-rts/src/idl.rs +++ b/rts/motoko-rts/src/idl.rs @@ -841,49 +841,80 @@ pub(crate) unsafe fn memory_compatible( } true } - (IDL_CON_record, IDL_CON_record) => { + (IDL_CON_record, IDL_CON_record) if !main_actor => { + // plain object/record subtyping + // symmetric to variant case let mut n1 = leb128_decode(&mut tb1); let n2 = leb128_decode(&mut tb2); - let mut tag1 = 0; - let mut t11 = 0; - let mut advance = true; for _ in 0..n2 { let tag2 = leb128_decode(&mut tb2); let t21 = sleb128_decode(&mut tb2); if n1 == 0 { - // Additional fields are only supported in the main actor type. - if variance == TypeVariance::Invariance || !main_actor { - return false; - } - continue; - }; - if advance { - loop { - tag1 = leb128_decode(&mut tb1); - t11 = sleb128_decode(&mut tb1); - n1 -= 1; - // Do not skip fields during invariance check. - if variance == TypeVariance::Invariance || !(tag1 < tag2 && n1 > 0) { - break; - } - } + return false; }; - if tag1 > tag2 { - // Additional fields are only supported in the main actor type. - if variance == TypeVariance::Invariance || !main_actor { - return false; + let mut tag1: u32; + let mut t11: i32; + loop { + tag1 = leb128_decode(&mut tb1); + t11 = sleb128_decode(&mut tb1); + n1 -= 1; + if variance == TypeVariance::Invariance || !(tag1 < tag2 && n1 > 0) { + break; } - advance = false; // reconsider this field in next round - continue; + } + if tag1 != tag2 { + return false; }; if !memory_compatible(rel, variance, typtbl1, typtbl2, end1, end2, t11, t21, false) { return false; } - advance = true; } variance != TypeVariance::Invariance || n1 == 0 } + (IDL_CON_record, IDL_CON_record) if main_actor => { + // memory compatibility + assert!(variance == TypeVariance::Covariance); + let mut n1 = leb128_decode(&mut tb1); + let mut n2 = leb128_decode(&mut tb2); + let mut tag1: u32; + let mut t11: i32; + let mut tag2: u32; + let mut t21: i32; + while n1 > 0 && n2 > 0 { + tag1 = leb128_decode(&mut tb1); + t11 = sleb128_decode(&mut tb1); + tag2 = leb128_decode(&mut tb2); + t21 = sleb128_decode(&mut tb2); + n1 -= 1; + n2 -= 1; + while tag1 != tag2 { + if tag1 < tag2 { + if n1 > 0 { + tag1 = leb128_decode(&mut tb1); + t11 = sleb128_decode(&mut tb1); + n1 -= 1; + continue; + }; + return true; + }; + if tag1 > tag2 { + if n2 > 0 { + tag2 = leb128_decode(&mut tb2); + t21 = sleb128_decode(&mut tb2); + n2 -= 1; + continue; + }; + return true; + }; + } + if !memory_compatible(rel, variance, typtbl1, typtbl2, end1, end2, t11, t21, false) + { + return false; + } + } + return true; + } (IDL_CON_variant, IDL_CON_variant) => { let n1 = leb128_decode(&mut tb1); let mut n2 = leb128_decode(&mut tb2); diff --git a/test/run-drun/ok/tmp_upgrade.drun.ok b/test/run-drun/ok/tmp_upgrade.drun.ok new file mode 100644 index 00000000000..c76c471c7d5 --- /dev/null +++ b/test/run-drun/ok/tmp_upgrade.drun.ok @@ -0,0 +1,3 @@ +ingress Completed: Reply: 0x4449444c016c01b3c4b1f204680100010a00000000000000000101 +ingress Completed: Reply: 0x4449444c0000 +ingress Completed: Reply: 0x4449444c0000 diff --git a/test/run-drun/tmp_upgrade.drun b/test/run-drun/tmp_upgrade.drun new file mode 100644 index 00000000000..75542076835 --- /dev/null +++ b/test/run-drun/tmp_upgrade.drun @@ -0,0 +1,3 @@ +# SKIP ic-ref-run +install $ID tmp_upgrade/version0.mo "" +upgrade $ID tmp_upgrade/version1.mo "" diff --git a/test/run-drun/tmp_upgrade/version0.mo b/test/run-drun/tmp_upgrade/version0.mo new file mode 100644 index 00000000000..bec0a350e1a --- /dev/null +++ b/test/run-drun/tmp_upgrade/version0.mo @@ -0,0 +1,6 @@ +persistent actor { + + var four : [var (Nat, Text)] = [var]; + var zero = 0; + +} diff --git a/test/run-drun/tmp_upgrade/version1.mo b/test/run-drun/tmp_upgrade/version1.mo new file mode 100644 index 00000000000..95b855fdec4 --- /dev/null +++ b/test/run-drun/tmp_upgrade/version1.mo @@ -0,0 +1,6 @@ +persistent actor { + + var three : [var (Nat, Text)] = [var]; + var zero = 0; + +} From a9bc214c09470a8b3d48f7d689a09359b627d00c Mon Sep 17 00:00:00 2001 From: Gabor Greif Date: Fri, 17 Jan 2025 20:09:39 +0100 Subject: [PATCH 2/4] bugfix: check that timer servicing worked (#4846) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This fixes a disappearing timer situation described by Timo in https://dfinity.slack.com/archives/CPL67E7MX/p1736347600078339. It turns out that under high message load the `async` timer servicing routine cannot be run. The fix is simple, check if the self-call succeeded (causes a `throw` already), and if not, set a very near global timer to retry ASAP (in the top-level `catch`). TODO: - [x] `catch` send errors for user workers (and mitigate) — see #4852 - [ ] document that the user thunk may be called more than once, and thus should have no side effects other than submitting the self-call — see https://github.com/dfinity/motoko-base/pull/682 --- src/ir_def/construct.ml | 7 +++++++ src/ir_def/construct.mli | 1 + src/ir_passes/await.ml | 16 +++++++++++++--- src/lowering/desugar.ml | 8 ++++---- src/mo_frontend/typing.ml | 12 ++---------- src/mo_frontend/typing.mli | 2 -- src/mo_types/type.ml | 16 +++++++++++++++- src/mo_types/type.mli | 5 ++++- src/prelude/internals.mo | 21 ++++++++++++++++++--- test/fail/ok/illegal-await.tc.ok | 10 +++++----- 10 files changed, 69 insertions(+), 29 deletions(-) diff --git a/src/ir_def/construct.ml b/src/ir_def/construct.ml index 6564490287e..3031fdcc2c2 100644 --- a/src/ir_def/construct.ml +++ b/src/ir_def/construct.ml @@ -112,6 +112,7 @@ let primE prim es = | DeserializePrim ts -> T.seq ts | DeserializeOptPrim ts -> T.Opt (T.seq ts) | OtherPrim "trap" -> T.Non + | OtherPrim "global_timer_set" -> T.nat64 | OtherPrim "call_perform_status" -> T.(Prim Nat32) | OtherPrim "call_perform_message" -> T.text | OtherPrim "array_len" @@ -269,6 +270,12 @@ let nat32E n = note = Note.{ def with typ = T.(Prim Nat32) } } +let nat64E n = + { it = LitE (Nat64Lit n); + at = no_region; + note = Note.{ def with typ = T.nat64 } + } + let natE n = { it = LitE (NatLit n); at = no_region; diff --git a/src/ir_def/construct.mli b/src/ir_def/construct.mli index 26387ef5097..7cc0bef4c3d 100644 --- a/src/ir_def/construct.mli +++ b/src/ir_def/construct.mli @@ -66,6 +66,7 @@ val let_else_switch : pat -> exp -> exp -> exp val natE : Mo_values.Numerics.Nat.t -> exp val intE : Mo_values.Numerics.Int.t -> exp val nat32E : Mo_values.Numerics.Nat32.t -> exp +val nat64E : Mo_values.Numerics.Nat64.t -> exp val textE : string -> exp val blobE : string -> exp val letE : var -> exp -> exp -> exp diff --git a/src/ir_passes/await.ml b/src/ir_passes/await.ml index 84a2170a8d2..410776ca813 100644 --- a/src/ir_passes/await.ml +++ b/src/ir_passes/await.ml @@ -653,14 +653,14 @@ and t_comp_unit context = function preupgrade = t_exp LabelEnv.empty preupgrade; postupgrade = t_exp LabelEnv.empty postupgrade; heartbeat = t_ignore_throw LabelEnv.empty heartbeat; - timer = t_ignore_throw LabelEnv.empty timer; + timer = t_timer_throw LabelEnv.empty timer; inspect = t_exp LabelEnv.empty inspect; stable_record = t_exp LabelEnv.empty stable_record; stable_type; }, t) -and t_ignore_throw context exp = +and t_on_throw context exp t_exp = match exp.it with | Ir.PrimE (Ir.TupPrim, []) -> exp @@ -671,7 +671,7 @@ and t_ignore_throw context exp = (LabelEnv.add Throw (Cont throw) context) in let e = fresh_var "e" T.catch in { (blockE [ - funcD throw e (tupE[]); + funcD throw e t_exp; ] (c_exp context' exp (meta (T.unit) (fun v1 -> tupE [])))) (* timer logic requires us to preserve any source location, @@ -679,6 +679,16 @@ and t_ignore_throw context exp = with at = exp.at } +and t_ignore_throw context exp = t_on_throw context exp (tupE[]) + +(* if self-call queue full: expire global timer soon and retry *) +and t_timer_throw context exp = + t_on_throw context exp + (blockE + [expD (primE + (OtherPrim "global_timer_set") + [Mo_values.Numerics.Nat64.of_int 1 |> nat64E])] + (tupE[])) and t_prog (prog, flavor) = (t_comp_unit LabelEnv.empty prog, { flavor with has_await = false }) diff --git a/src/lowering/desugar.ml b/src/lowering/desugar.ml index 7049a6d8a6c..59b3b6f8692 100644 --- a/src/lowering/desugar.ml +++ b/src/lowering/desugar.ml @@ -367,8 +367,8 @@ and call_system_func_opt name es obj_typ = let timer = blockE [ expD T.(callE (varE (var id.it note)) [Any] - (varE (var "@set_global_timer" (Func (Local, Returns, [], [Prim Nat64], []))))) ] - (unitE ()) in + (varE (var "@set_global_timer" T.global_timer_set_type))) ] + (unitE()) in { timer with at } | "heartbeat" -> blockE @@ -605,8 +605,8 @@ and build_actor at ts self_id es obj_typ = | Some call -> call | None when !Mo_config.Flags.global_timer -> blockE - [ expD T.(callE (varE (var "@timer_helper" Mo_frontend.Typing.heartbeat_type)) [unit] (unitE())) ] - (unitE ()) + [ expD T.(callE (varE (var "@timer_helper" T.heartbeat_type)) [unit] (unitE())) ] + (unitE()) | None -> tupE []); inspect = (match call_system_func_opt "inspect" es obj_typ with diff --git a/src/mo_frontend/typing.ml b/src/mo_frontend/typing.ml index eb0c2c36051..06973302d4f 100644 --- a/src/mo_frontend/typing.ml +++ b/src/mo_frontend/typing.ml @@ -386,18 +386,10 @@ let infer_mut mut : T.typ -> T.typ = (* System method types *) -let heartbeat_type = - T.(Func (Local, Returns, [scope_bind], [], [Async (Fut, Var (default_scope_var, 0), unit)])) - -let timer_type = - T.(Func (Local, Returns, [scope_bind], - [Func (Local, Returns, [], [Prim Nat64], [])], - [Async (Fut, Var (default_scope_var, 0), unit)])) - let system_funcs tfs = [ - ("heartbeat", heartbeat_type); - ("timer", timer_type); + ("heartbeat", T.heartbeat_type); + ("timer", T.timer_type); T.("preupgrade", Func (Local, Returns, [scope_bind], [], [])); T.("postupgrade", Func (Local, Returns, [scope_bind], [], [])); ("inspect", diff --git a/src/mo_frontend/typing.mli b/src/mo_frontend/typing.mli index be0d8b40b7e..b5081cf06ca 100644 --- a/src/mo_frontend/typing.mli +++ b/src/mo_frontend/typing.mli @@ -11,5 +11,3 @@ val infer_prog : ?viper_mode:bool -> scope -> string option -> Async_cap.async_c val check_lib : scope -> string option -> Syntax.lib -> scope Diag.result val check_actors : ?viper_mode:bool -> ?check_actors:bool -> scope -> Syntax.prog list -> unit Diag.result val check_stab_sig : scope -> Syntax.stab_sig -> (field list) Diag.result - -val heartbeat_type : typ diff --git a/src/mo_types/type.ml b/src/mo_types/type.ml index 3c0b25609ff..58a9f3ac1b7 100644 --- a/src/mo_types/type.ml +++ b/src/mo_types/type.ml @@ -307,7 +307,7 @@ let compare_field f1 f2 = | {lab = l1; typ = _; _}, {lab = l2; typ = _; _} -> compare l1 l2 -(* Short-hands *) +(* Shorthands *) let unit = Tup [] let bool = Prim Bool @@ -321,6 +321,7 @@ let char = Prim Char let principal = Prim Principal let region = Prim Region + let fields flds = List.sort compare_field (List.map (fun (lab, typ) -> {lab; typ; src = empty_src}) flds) @@ -1341,6 +1342,19 @@ let default_scope_var = scope_var "" let scope_bound = Any let scope_bind = { var = default_scope_var; sort = Scope; bound = scope_bound } +(* Shorthands for replica callbacks *) + +let heartbeat_type = + Func (Local, Returns, [scope_bind], [], [Async (Fut, Var (default_scope_var, 0), unit)]) + +let global_timer_set_type = Func (Local, Returns, [], [Prim Nat64], []) + +let timer_type = + Func (Local, Returns, [scope_bind], + [global_timer_set_type], + [Async (Fut, Var (default_scope_var, 0), unit)]) + + (* Well-known fields *) let motoko_async_helper_fld = diff --git a/src/mo_types/type.mli b/src/mo_types/type.mli index b94c9eb7468..8498ac7e57f 100644 --- a/src/mo_types/type.mli +++ b/src/mo_types/type.mli @@ -84,7 +84,7 @@ end val is_shared_sort : 'a shared -> bool -(* Short-hands *) +(* Shorthands *) val unit : typ val bool : typ @@ -97,6 +97,9 @@ val error : typ val char : typ val principal : typ val region : typ +val heartbeat_type : typ +val timer_type : typ +val global_timer_set_type : typ val sum : (lab * typ) list -> typ val obj : obj_sort -> (lab * typ) list -> typ diff --git a/src/prelude/internals.mo b/src/prelude/internals.mo index 713b7544ddb..70da6648924 100644 --- a/src/prelude/internals.mo +++ b/src/prelude/internals.mo @@ -544,7 +544,7 @@ func @prune(n : ?@Node) : ?@Node = switch n { if (n.expire[0] == 0) { @prune(n.post) // by corollary } else { - ?{ n with pre = @prune(n.pre); post = @prune(n.post) } + ?{ n with pre = @prune(n.pre) } } } }; @@ -612,9 +612,25 @@ func @timer_helper() : async () { ignore (prim "global_timer_set" : Nat64 -> Nat64) exp; if (exp == 0) @timers := null; + var failed : Nat64 = 0; + func reinsert(job : () -> async ()) { + if (failed == 0) { + @timers := @prune @timers; + ignore (prim "global_timer_set" : Nat64 -> Nat64) 1 + }; + failed += 1; + @timers := ?(switch @timers { + case (?{ id = 0; pre; post; job = j; expire; delay }) + // push top node's contents into pre + ({ expire = [var failed]; id = 0; delay; job; post + ; pre = ?{ id = 0; expire; pre; post = null; delay; job = j } }); + case _ ({ expire = [var failed]; id = 0; delay = null; job; pre = null; post = @timers }) + }) + }; + for (o in thunks.vals()) { switch o { - case (?thunk) ignore thunk(); + case (?thunk) try ignore thunk() catch _ reinsert thunk; case _ return } } @@ -675,5 +691,4 @@ func @cancelTimer(id : Nat) { } }; - func @set_global_timer(time : Nat64) = ignore (prim "global_timer_set" : Nat64 -> Nat64) time; diff --git a/test/fail/ok/illegal-await.tc.ok b/test/fail/ok/illegal-await.tc.ok index 3e32e84fd34..0e695b1bc02 100644 --- a/test/fail/ok/illegal-await.tc.ok +++ b/test/fail/ok/illegal-await.tc.ok @@ -24,14 +24,14 @@ illegal-await.mo:24.11: info, start of scope $@anon-async-24.11 mentioned in err illegal-await.mo:26.5: info, end of scope $@anon-async-24.11 mentioned in error at illegal-await.mo:25.7-25.14 illegal-await.mo:22.10: info, start of scope $@anon-async-22.10 mentioned in error at illegal-await.mo:25.7-25.14 illegal-await.mo:27.3: info, end of scope $@anon-async-22.10 mentioned in error at illegal-await.mo:25.7-25.14 -illegal-await.mo:35.11-35.12: type error [M0087], ill-scoped await: expected async type from current scope $Rec, found async type from other scope $__15 +illegal-await.mo:35.11-35.12: type error [M0087], ill-scoped await: expected async type from current scope $Rec, found async type from other scope $__19 scope $Rec is illegal-await.mo:33.44-40.2 - scope $__15 is illegal-await.mo:33.1-40.2 + scope $__19 is illegal-await.mo:33.1-40.2 illegal-await.mo:33.44: info, start of scope $Rec mentioned in error at illegal-await.mo:35.5-35.12 illegal-await.mo:40.1: info, end of scope $Rec mentioned in error at illegal-await.mo:35.5-35.12 -illegal-await.mo:33.1: info, start of scope $__15 mentioned in error at illegal-await.mo:35.5-35.12 -illegal-await.mo:40.1: info, end of scope $__15 mentioned in error at illegal-await.mo:35.5-35.12 +illegal-await.mo:33.1: info, start of scope $__19 mentioned in error at illegal-await.mo:35.5-35.12 +illegal-await.mo:40.1: info, end of scope $__19 mentioned in error at illegal-await.mo:35.5-35.12 illegal-await.mo:38.20-38.21: type error [M0096], expression of type - async<$__15> () + async<$__19> () cannot produce expected type async<$Rec> () From 6dcbc9b6ce533167c06808e9d4fef0526961ef56 Mon Sep 17 00:00:00 2001 From: Luc Blaeser <112870813+luc-blaeser@users.noreply.github.com> Date: Fri, 17 Jan 2025 23:03:58 +0100 Subject: [PATCH 3/4] fix: Use lower case for Wasm persistence modes (#4854) Related to https://github.com/dfinity/ic/pull/3479. This changes the variant names for the Wasm memory persistence modes used for enhanced orthogonal persistence to lower case to align it with the IC specification, i.e. using `keep` and `replace` instead of `Keep` and `Replace`. For installed Motoko programs using enhanced orthogonal persistence, the change only affects the programmatic upgrades of Motoko actor class instances. Existing such programs would need to be recompiled with a new Motoko compiler and upgraded. The IC detects mismatching variant names of Wasm memory persistence by raising an error while still preserving persistent memory. --- Changelog.md | 12 ++++++++++++ nix/drun.nix | 15 ++------------- nix/sources.json | 8 ++++---- src/mo_types/type.ml | 4 ++-- src/prelude/internals.mo | 6 +++--- test/bench/ok/region-mem.drun-run.ok | 2 +- test/bench/ok/region0-mem.drun-run.ok | 2 +- test/bench/ok/stable-mem.drun-run.ok | 2 +- test/run-drun/actor-class-mgmt-enhanced.mo | 4 ++-- test/run-drun/map-mixed-upgrades/map0.mo | 4 ++-- test/run-drun/map-mixed-upgrades/map1.mo | 4 ++-- test/run-drun/migration-paths/new-installer.mo | 4 ++-- test/run-drun/migration-paths/old-installer.mo | 4 ++-- 13 files changed, 36 insertions(+), 35 deletions(-) diff --git a/Changelog.md b/Changelog.md index 35686efe229..b31f4430784 100644 --- a/Changelog.md +++ b/Changelog.md @@ -1,5 +1,17 @@ # Motoko compiler changelog +## 0.13.6 (tbd) + +* motoko (`moc`) + + * Breaking change (minor): + + * 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. + ## 0.13.5 (2024-12-06) * motoko (`moc`) diff --git a/nix/drun.nix b/nix/drun.nix index 2a0b84b25f8..0f0076617e9 100644 --- a/nix/drun.nix +++ b/nix/drun.nix @@ -20,6 +20,8 @@ pkgs: outputHashes = { "build-info-0.0.27" = "sha256-SkwWwDNrTsntkNiCv6rsyTFGazhpRDnKtVzPpYLKF9U="; "cloudflare-0.12.0" = "sha256-FxCAK7gUKp/63fdvzI5Ufsy4aur74fO4R/K3YFiUw0Y="; + "ic-bn-lib-0.1.0" = "sha256-wqWfF70B+YQWg63yiEvIxOq+LN1AasrNXcyPkDM4/jw="; + "ic-canister-sig-creation-1.1.0" = "sha256-c47Fh4kZbmezWCYVHMci2BMXJfESaOGsyNlWh8YR6oU="; "icrc1-test-env-0.1.1" = "sha256-2PB7e64Owin/Eji3k8UoeWs+pfDfOOTaAyXjvjOZ/4g="; "jsonrpc-0.12.1" = "sha256-3FtdZlt2PqVDkE5iKWYIp1eiIELsaYlUPRSP2Xp8ejM="; "lmdb-rkv-0.14.99" = "sha256-5WcUzapkrc/s3wCBNCuUDhtbp17n67rTbm2rx0qtITg="; @@ -42,19 +44,6 @@ pkgs: EOF cd - - # static linking of libunwind fails under nix Linux - patch rs/monitoring/backtrace/build.rs << EOF -@@ -1,8 +1,2 @@ - fn main() { -- if std::env::var("TARGET").unwrap() == "x86_64-unknown-linux-gnu" { -- println!("cargo:rustc-link-lib=static=unwind"); -- println!("cargo:rustc-link-lib=static=unwind-ptrace"); -- println!("cargo:rustc-link-lib=static=unwind-x86_64"); -- println!("cargo:rustc-link-lib=dylib=lzma"); -- } - } -EOF - mkdir -p .cargo cat > .cargo/config.toml << EOF [target.x86_64-apple-darwin] diff --git a/nix/sources.json b/nix/sources.json index bef8be1fa0a..b3961ffedb1 100644 --- a/nix/sources.json +++ b/nix/sources.json @@ -21,15 +21,15 @@ "version": "3.2.25" }, "ic": { - "branch": "luc/adjust-drun", + "branch": "luc/lower-case-persistence-modes", "description": "Internet Computer blockchain source: the client/replica software run by nodes", "homepage": "", "owner": "luc-blaeser", "repo": "ic", - "rev": "bebe89514a6abd26e940b295323823169911a965", - "sha256": "1g68fyi5acbcgs2kjribk97fj8ki5g6pd99nwl5azz1rw1b0xycx", + "rev": "48ba595fb1a6bc828e7e9dae976db42b5526a5b6", + "sha256": "0136hxidak4qsk0nhjdy2nmciwb0lprm07vs117xdw3cp4m6py2z", "type": "tarball", - "url": "https://github.com/luc-blaeser/ic/archive/bebe89514a6abd26e940b295323823169911a965.tar.gz", + "url": "https://github.com/luc-blaeser/ic/archive/48ba595fb1a6bc828e7e9dae976db42b5526a5b6.tar.gz", "url_template": "https://github.com///archive/.tar.gz" }, "ic-hs": { diff --git a/src/mo_types/type.ml b/src/mo_types/type.ml index 58a9f3ac1b7..6023cc4bdae 100644 --- a/src/mo_types/type.ml +++ b/src/mo_types/type.ml @@ -1434,8 +1434,8 @@ let canister_settings_typ = let wasm_memory_persistence_typ = sum [ - ("Keep", unit); - ("Replace", unit); + ("keep", unit); + ("replace", unit); ] let upgrade_with_persistence_option_typ = diff --git a/src/prelude/internals.mo b/src/prelude/internals.mo index 70da6648924..405d25390fe 100644 --- a/src/prelude/internals.mo +++ b/src/prelude/internals.mo @@ -401,8 +401,8 @@ module @ManagementCanister = { }; type @WasmMemoryPersistence = { - #Keep; - #Replace; + #keep; + #replace; }; type @UpgradeOptions = { @@ -460,7 +460,7 @@ func @install_actor_helper( }; case (#upgrade actor2) { let wasm_memory_persistence = if enhanced_orthogonal_persistence { - ?(#Keep) + ?(#keep) } else { null }; diff --git a/test/bench/ok/region-mem.drun-run.ok b/test/bench/ok/region-mem.drun-run.ok index 28c1137fc32..3cd8271667f 100644 --- a/test/bench/ok/region-mem.drun-run.ok +++ b/test/bench/ok/region-mem.drun-run.ok @@ -1,4 +1,4 @@ ingress Completed: Reply: 0x4449444c016c01b3c4b1f204680100010a00000000000000000101 ingress Completed: Reply: 0x4449444c0000 -debug.print: {heap_diff = 0; instr_diff = 5_234_491_753} +debug.print: {heap_diff = 0; instr_diff = 5_240_635_753} ingress Completed: Reply: 0x4449444c0000 diff --git a/test/bench/ok/region0-mem.drun-run.ok b/test/bench/ok/region0-mem.drun-run.ok index 1d45643d325..1b1eccc80c7 100644 --- a/test/bench/ok/region0-mem.drun-run.ok +++ b/test/bench/ok/region0-mem.drun-run.ok @@ -1,4 +1,4 @@ ingress Completed: Reply: 0x4449444c016c01b3c4b1f204680100010a00000000000000000101 ingress Completed: Reply: 0x4449444c0000 -debug.print: {heap_diff = 0; instr_diff = 5_662_310_761} +debug.print: {heap_diff = 0; instr_diff = 5_668_454_761} ingress Completed: Reply: 0x4449444c0000 diff --git a/test/bench/ok/stable-mem.drun-run.ok b/test/bench/ok/stable-mem.drun-run.ok index 5e3eeec3bce..13861dd869a 100644 --- a/test/bench/ok/stable-mem.drun-run.ok +++ b/test/bench/ok/stable-mem.drun-run.ok @@ -1,4 +1,4 @@ ingress Completed: Reply: 0x4449444c016c01b3c4b1f204680100010a00000000000000000101 ingress Completed: Reply: 0x4449444c0000 -debug.print: {heap_diff = 0; instr_diff = 3_875_537_257} +debug.print: {heap_diff = 0; instr_diff = 3_881_681_257} ingress Completed: Reply: 0x4449444c0000 diff --git a/test/run-drun/actor-class-mgmt-enhanced.mo b/test/run-drun/actor-class-mgmt-enhanced.mo index 17a82939001..730ad569bf4 100644 --- a/test/run-drun/actor-class-mgmt-enhanced.mo +++ b/test/run-drun/actor-class-mgmt-enhanced.mo @@ -123,7 +123,7 @@ actor a { assert (c5 == c4); let c6 = await - (system Cs.C)(#upgrade_with_persistence { wasm_memory_persistence = #Keep ; canister = c5 })(6, null); + (system Cs.C)(#upgrade_with_persistence { wasm_memory_persistence = #keep ; canister = c5 })(6, null); assert ({args = 6; upgrades = 3} == (await c6.observe())); assert (c6 == c5); @@ -135,7 +135,7 @@ actor a { // no need to add cycles let c8 = await - (system Cs.C)(#upgrade_with_persistence { wasm_memory_persistence = #Replace ; canister = c7 })(8, null); + (system Cs.C)(#upgrade_with_persistence { wasm_memory_persistence = #replace ; canister = c7 })(8, null); assert ({args = 8; upgrades = 0} == (await c8.observe())); assert (c8 == c7); diff --git a/test/run-drun/map-mixed-upgrades/map0.mo b/test/run-drun/map-mixed-upgrades/map0.mo index 96ac9dea3a9..3a73ef81682 100644 --- a/test/run-drun/map-mixed-upgrades/map0.mo +++ b/test/run-drun/map-mixed-upgrades/map0.mo @@ -68,7 +68,7 @@ actor a { case null {}; case (?n) { nodes[i] := - ? (await (system Lib.Node)(#upgrade_with_persistence { wasm_memory_persistence = #Keep; canister = n })(i)); // upgrade! + ? (await (system Lib.Node)(#upgrade_with_persistence { wasm_memory_persistence = #keep; canister = n })(i)); // upgrade! } } } @@ -80,7 +80,7 @@ actor a { case null {}; case (?n) { nodes[i] := - ? (await (system Lib.Node)(#upgrade_with_persistence { wasm_memory_persistence = #Replace; canister = n })(i)); // upgrade! + ? (await (system Lib.Node)(#upgrade_with_persistence { wasm_memory_persistence = #replace; canister = n })(i)); // upgrade! } } } diff --git a/test/run-drun/map-mixed-upgrades/map1.mo b/test/run-drun/map-mixed-upgrades/map1.mo index f85e7439064..60c7f00fc37 100644 --- a/test/run-drun/map-mixed-upgrades/map1.mo +++ b/test/run-drun/map-mixed-upgrades/map1.mo @@ -79,7 +79,7 @@ actor a { case null {}; case (?n) { nodes[i] := - ? (await (system Lib.Node)(#upgrade_with_persistence { wasm_memory_persistence = #Keep; canister = n })(i)); // upgrade! + ? (await (system Lib.Node)(#upgrade_with_persistence { wasm_memory_persistence = #keep; canister = n })(i)); // upgrade! } } } @@ -91,7 +91,7 @@ actor a { case null {}; case (?n) { nodes[i] := - ? (await (system Lib.Node)(#upgrade_with_persistence { wasm_memory_persistence = #Replace; canister = n })(i)); // upgrade! + ? (await (system Lib.Node)(#upgrade_with_persistence { wasm_memory_persistence = #replace; canister = n })(i)); // upgrade! } } } diff --git a/test/run-drun/migration-paths/new-installer.mo b/test/run-drun/migration-paths/new-installer.mo index de73aae5e23..777fda0ab5d 100644 --- a/test/run-drun/migration-paths/new-installer.mo +++ b/test/run-drun/migration-paths/new-installer.mo @@ -19,7 +19,7 @@ actor { switch testCanister { case null Prim.trap("null canister"); case (?canister) { - ignore await (system TestCanister.TestCanister)(#upgrade_with_persistence { wasm_memory_persistence = #Keep; canister })(); + ignore await (system TestCanister.TestCanister)(#upgrade_with_persistence { wasm_memory_persistence = #keep; canister })(); Prim.debugPrint("Upgraded (keep main memory)"); }; }; @@ -29,7 +29,7 @@ actor { switch testCanister { case null Prim.trap("null canister"); case (?canister) { - ignore await (system TestCanister.TestCanister)(#upgrade_with_persistence { wasm_memory_persistence = #Replace; canister })(); + ignore await (system TestCanister.TestCanister)(#upgrade_with_persistence { wasm_memory_persistence = #replace; canister })(); Prim.debugPrint("Upgraded (replace main memory)"); }; }; diff --git a/test/run-drun/migration-paths/old-installer.mo b/test/run-drun/migration-paths/old-installer.mo index 461e2f459e7..a5708fca3d7 100644 --- a/test/run-drun/migration-paths/old-installer.mo +++ b/test/run-drun/migration-paths/old-installer.mo @@ -31,7 +31,7 @@ actor installer { switch testCanister { case null Prim.trap("null canister"); case (?canister) { - ignore await (system TestCanister.TestCanister)(#upgrade_with_persistence { wasm_memory_persistence = #Keep; canister })(); + ignore await (system TestCanister.TestCanister)(#upgrade_with_persistence { wasm_memory_persistence = #keep; canister })(); Prim.debugPrint("Upgraded (keep main memory)"); } } @@ -41,7 +41,7 @@ actor installer { switch testCanister { case null Prim.trap("null canister"); case (?canister) { - ignore await (system TestCanister.TestCanister)(#upgrade_with_persistence { wasm_memory_persistence = #Replace; canister })(); + ignore await (system TestCanister.TestCanister)(#upgrade_with_persistence { wasm_memory_persistence = #replace; canister })(); Prim.debugPrint("Upgraded (replace main memory)"); } } From 1312aff3cf14e944cb869385572631ffa1b4daa8 Mon Sep 17 00:00:00 2001 From: DFINITY bot <58022693+dfinity-bot@users.noreply.github.com> Date: Fri, 17 Jan 2025 23:19:25 +0100 Subject: [PATCH 4/4] niv motoko-base: update bf3b522b -> 010611b4 (#4848) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ## Changelog for motoko-base: Branch: next-moc Commits: [dfinity/motoko-base@bf3b522b...010611b4](https://github.com/dfinity/motoko-base/compare/bf3b522b3e2dab992c9d2544cb438e10ef2fac1a...010611b42d67b39aee1ec61b3c1f004771994359) * [`87f65ab8`](https://github.com/dfinity/motoko-base/commit/87f65ab8a2a15c47622383f7bf99fbb5f1dce798) Update formatter ([dfinity/motoko-base⁠#681](https://togithub.com/dfinity/motoko-base/issues/681)) --- nix/sources.json | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/nix/sources.json b/nix/sources.json index b3961ffedb1..01c01a1e2e4 100644 --- a/nix/sources.json +++ b/nix/sources.json @@ -75,10 +75,10 @@ "homepage": "", "owner": "dfinity", "repo": "motoko-base", - "rev": "bf3b522b3e2dab992c9d2544cb438e10ef2fac1a", - "sha256": "0pyqwv7af6ccd3imwbnww64959k56vl8r9dsr2g25spmnfsnrl7a", + "rev": "010611b42d67b39aee1ec61b3c1f004771994359", + "sha256": "1gzlg84d28pnd68li735l3bk3hnc3anj985yy8fm62rf9h8p2jdx", "type": "tarball", - "url": "https://github.com/dfinity/motoko-base/archive/bf3b522b3e2dab992c9d2544cb438e10ef2fac1a.tar.gz", + "url": "https://github.com/dfinity/motoko-base/archive/010611b42d67b39aee1ec61b3c1f004771994359.tar.gz", "url_template": "https://github.com///archive/.tar.gz" }, "motoko-matchers": {