diff --git a/Changelog.md b/Changelog.md index 6c37d8a787e..70ba78b9d2f 100644 --- a/Changelog.md +++ b/Changelog.md @@ -1,5 +1,11 @@ # Motoko compiler changelog +## Unreleased + +* motoko (`moc`) + + * Remove `__get_candid_interface_tmp_hack` endpoint. Candid interface is already stored as canister metadata, this temporary endpoint is redundant, thus removed. (#4386) + ## 0.10.4 (2024-01-10) * motoko (`moc`) diff --git a/src/lowering/desugar.ml b/src/lowering/desugar.ml index d02275b6cfe..821f40b22f1 100644 --- a/src/lowering/desugar.ml +++ b/src/lowering/desugar.ml @@ -411,22 +411,6 @@ and build_candid ts obj_typ = service = WithComments.string_of_prog prog; } -and export_interface txt = - (* This is probably a temporary hack. *) - let open T in - let {lab;typ;_} = get_candid_interface_fld in - let v = "$"^lab in - let scope_con1 = Cons.fresh "T1" (Abs ([], scope_bound)) in - let scope_con2 = Cons.fresh "T2" (Abs ([], Any)) in - let bind1 = typ_arg scope_con1 Scope scope_bound in - let bind2 = typ_arg scope_con2 Scope scope_bound in - ([ letD (var v typ) ( - funcE v (Shared Query) Promises [bind1] [] [text] ( - asyncE Type.Fut bind2 (textE txt) (Con (scope_con1, [])) - ) - )], - [{ it = I.{ name = lab; var = v }; at = no_region; note = typ }]) - and export_footprint self_id expr = let open T in let {lab;typ;_} = motoko_stable_var_info_fld in @@ -496,7 +480,6 @@ and build_actor at ts self_id es obj_typ = let meta = I.{ candid = candid; sig_ = T.string_of_stab_sig sig_} in - let interface_d, interface_f = export_interface candid.I.service in let with_stable_vars wrap = let vs = fresh_vars "v" (List.map (fun f -> f.T.typ) fields) in blockE @@ -514,7 +497,7 @@ and build_actor at ts self_id es obj_typ = ) fields vs) ty)) in let footprint_d, footprint_f = export_footprint self_id (with_stable_vars (fun e -> e)) in - I.(ActorE (interface_d @ footprint_d @ ds', interface_f @ footprint_f @ fs, + I.(ActorE (footprint_d @ ds', footprint_f @ fs, { meta; preupgrade = with_stable_vars (fun e -> primE (I.ICStableWrite ty) [e]); postupgrade = diff --git a/src/mo_types/type.ml b/src/mo_types/type.ml index 78c224c60e8..75ee7e132da 100644 --- a/src/mo_types/type.ml +++ b/src/mo_types/type.ml @@ -1358,17 +1358,10 @@ let motoko_gc_trigger_fld = src = empty_src; } -let get_candid_interface_fld = - { lab = "__get_candid_interface_tmp_hack"; - typ = Func(Shared Query, Promises, [scope_bind], [], [text]); - src = empty_src; - } - let well_known_actor_fields = [ motoko_async_helper_fld; motoko_stable_var_info_fld; motoko_gc_trigger_fld; - get_candid_interface_fld ] let decode_msg_typ tfs = diff --git a/src/mo_types/type.mli b/src/mo_types/type.mli index c8b29596723..acc274b0bb6 100644 --- a/src/mo_types/type.mli +++ b/src/mo_types/type.mli @@ -267,7 +267,6 @@ val string_of_stab_sig : field list -> string val motoko_async_helper_fld : field val motoko_stable_var_info_fld : field val motoko_gc_trigger_fld : field -val get_candid_interface_fld : field val well_known_actor_fields : field list val decode_msg_typ : field list -> typ diff --git a/test/bench/ok/heap-32.drun-run-opt.ok b/test/bench/ok/heap-32.drun-run-opt.ok index e7d15423545..5d4372de9ef 100644 --- a/test/bench/ok/heap-32.drun-run-opt.ok +++ b/test/bench/ok/heap-32.drun-run-opt.ok @@ -1,5 +1,5 @@ ingress Completed: Reply: 0x4449444c016c01b3c4b1f204680100010a00000000000000000101 ingress Completed: Reply: 0x4449444c0000 -debug.print: (50_227, +30_261_252, 709_322_975) -debug.print: (50_070, +32_992_212, 766_414_006) +debug.print: (50_227, +30_261_252, 709_323_215) +debug.print: (50_070, +32_992_212, 766_414_086) ingress Completed: Reply: 0x4449444c0000 diff --git a/test/bench/ok/heap-32.drun-run.ok b/test/bench/ok/heap-32.drun-run.ok index c7595595343..3ed90faae2c 100644 --- a/test/bench/ok/heap-32.drun-run.ok +++ b/test/bench/ok/heap-32.drun-run.ok @@ -1,5 +1,5 @@ ingress Completed: Reply: 0x4449444c016c01b3c4b1f204680100010a00000000000000000101 ingress Completed: Reply: 0x4449444c0000 -debug.print: (50_227, +30_261_252, 770_048_232) -debug.print: (50_070, +32_992_212, 830_127_686) +debug.print: (50_227, +30_261_252, 770_048_604) +debug.print: (50_070, +32_992_212, 830_127_810) ingress Completed: Reply: 0x4449444c0000 diff --git a/test/run-drun/ok/query-footprint.drun-run.ok b/test/run-drun/ok/query-footprint.drun-run.ok index 67a8afe9e37..e9dfaac3f24 100644 --- a/test/run-drun/ok/query-footprint.drun-run.ok +++ b/test/run-drun/ok/query-footprint.drun-run.ok @@ -4,4 +4,3 @@ ingress Completed: Reply: 0x4449444c016c01c1c1cee2047801005118000000000000 Ok: Reply: 0x4449444c016c01c1c1cee2047801005118000000000000 ingress Completed: Reply: 0x4449444c0001785118000000000000 ingress Completed: Reply: 0x4449444c0001785118000000000000 -Ok: Reply: 0x4449444c0001712973657276696365203a207b0a202064656c65676174653a202829202d3e20286e61743634293b0a7d0a diff --git a/test/run-drun/ok/query-footprint.ic-ref-run.ok b/test/run-drun/ok/query-footprint.ic-ref-run.ok index 468b5363bd0..f70a6dea81f 100644 --- a/test/run-drun/ok/query-footprint.ic-ref-run.ok +++ b/test/run-drun/ok/query-footprint.ic-ref-run.ok @@ -10,5 +10,3 @@ <= replied: ((6225 : nat64)) => update delegate() <= replied: ((6225 : nat64)) -=> query __get_candid_interface_tmp_hack() -<= replied: ("service : {\n delegate: () -> (nat64);\n}\n") diff --git a/test/run-drun/ok/self-describe.drun-run.ok b/test/run-drun/ok/self-describe.drun-run.ok deleted file mode 100644 index 879a4204ca5..00000000000 --- a/test/run-drun/ok/self-describe.drun-run.ok +++ /dev/null @@ -1,3 +0,0 @@ -ingress Completed: Reply: 0x4449444c016c01b3c4b1f204680100010a00000000000000000101 -ingress Completed: Reply: 0x4449444c0000 -Ok: Reply: 0x4449444c000171577479706520526563203d207265636f7264207b666f6f3a205265633b7d3b0a7479706520466f6f203d20746578743b0a73657276696365203a207b0a202068656c6c6f3a202852656329202d3e2028466f6f293b0a7d0a diff --git a/test/run-drun/ok/self-describe.ic-ref-run.ok b/test/run-drun/ok/self-describe.ic-ref-run.ok deleted file mode 100644 index 4514e5244d3..00000000000 --- a/test/run-drun/ok/self-describe.ic-ref-run.ok +++ /dev/null @@ -1,6 +0,0 @@ -=> update provisional_create_canister_with_cycles(record {settings = null; qgqjpK = null; amount = null; ddww... -<= replied: (record {hymijyo = principal "rwlgt-iiaaa-aaaaa-aaaaa-cai"}) -=> update install_code(record {arg = blob ""; kca_xin = blob "\00asm\01\00\00\00\0... -<= replied: () -=> query __get_candid_interface_tmp_hack() -<= replied: ("type Rec = record {foo: Rec;};\ntype Foo = text;\nservice : {\n hello: (Rec) -> (Foo);\n}\n") diff --git a/test/run-drun/query-footprint.mo b/test/run-drun/query-footprint.mo index b8c3e829074..9836dd4a7b5 100644 --- a/test/run-drun/query-footprint.mo +++ b/test/run-drun/query-footprint.mo @@ -32,7 +32,6 @@ actor footprint = { //CALL query __motoko_stable_var_info "DIDL\x00\x00" //CALL ingress delegate "DIDL\x00\x00" //CALL ingress delegate "DIDL\x00\x00" -//CALL query __get_candid_interface_tmp_hack "DIDL\x00\x00" //SKIP run //SKIP run-ir diff --git a/test/run-drun/self-describe.mo b/test/run-drun/self-describe.mo deleted file mode 100644 index 3ef127e00c4..00000000000 --- a/test/run-drun/self-describe.mo +++ /dev/null @@ -1,10 +0,0 @@ -import T "self-describe/types"; -actor { - public func hello(x : T.Rec) : async T.Foo { - "Hello!" - }; -}; -//CALL query __get_candid_interface_tmp_hack "DIDL\x00\x00" - - -//SKIP run diff --git a/test/run-drun/self-describe/types.mo b/test/run-drun/self-describe/types.mo deleted file mode 100644 index 153d7d41dde..00000000000 --- a/test/run-drun/self-describe/types.mo +++ /dev/null @@ -1,4 +0,0 @@ -module Types { -public type Foo = Text; -public type Rec = { foo : Rec }; -}