diff --git a/src/proto_alpha/lib_client/client_proto_fa12.ml b/src/proto_alpha/lib_client/client_proto_fa12.ml index db0ab1d3b280c788bf27e6e60a989eab11d3ff48..957fb78c75e8f24206af152b52e5f39b2630f229 100644 --- a/src/proto_alpha/lib_client/client_proto_fa12.ml +++ b/src/proto_alpha/lib_client/client_proto_fa12.ml @@ -724,6 +724,7 @@ let contract_has_fa12_interface : ~chain ~block ~contract + ~normalize_types:true >>=? fun entrypoints -> List.iter_e (check_entrypoint entrypoints) standard_entrypoints |> Lwt.return diff --git a/src/proto_alpha/lib_client/managed_contract.ml b/src/proto_alpha/lib_client/managed_contract.ml index 7ed5db282c938bc2d81b3477dd97f7358e3098a4..247af38850ae3d36c3413c5a14402cf58dbf4997 100644 --- a/src/proto_alpha/lib_client/managed_contract.ml +++ b/src/proto_alpha/lib_client/managed_contract.ml @@ -110,6 +110,7 @@ let build_delegate_operation (cctxt : #full) ~chain ~block ?fee ~block ~contract ~entrypoint + ~normalize_types:true >>=? function | Some _ -> (* their is a "do" entrypoint (we could check its type here)*) @@ -128,6 +129,7 @@ let build_delegate_operation (cctxt : #full) ~chain ~block ?fee ~block ~contract ~entrypoint + ~normalize_types:true >>=? function | Some _ -> (* their is a "set/remove_delegate" entrypoint *) @@ -245,6 +247,7 @@ let build_transaction_operation (cctxt : #full) ~chain ~block ~contract ~block ~contract:destination ~entrypoint + ~normalize_types:true >>=? function | None -> cctxt#error diff --git a/src/proto_alpha/lib_client/michelson_v1_entrypoints.ml b/src/proto_alpha/lib_client/michelson_v1_entrypoints.ml index 190b42bfb515551a25f88a2e6452514fcd77e409..2104fc101705db82dfef1301477eba4ed9aaef7b 100644 --- a/src/proto_alpha/lib_client/michelson_v1_entrypoints.ml +++ b/src/proto_alpha/lib_client/michelson_v1_entrypoints.ml @@ -62,12 +62,13 @@ let script_entrypoint_type cctxt ~(chain : Chain_services.chain) ~block | Error _ as err -> Lwt.return err let contract_entrypoint_type cctxt ~(chain : Chain_services.chain) ~block - ~contract ~entrypoint = + ~contract ~entrypoint ~normalize_types = Alpha_services.Contract.entrypoint_type cctxt (chain, block) contract entrypoint + ~normalize_types >>= function | Ok ty -> return_some ty | Error (RPC_context.Not_found _ :: _) -> return None @@ -105,15 +106,34 @@ let print_entrypoint_type (cctxt : #Client_context.printer) >>= fun () -> return_unit | Error errs -> on_errors errs -let list_contract_unreachables_and_entrypoints cctxt ~chain ~block ~contract = - Alpha_services.Contract.list_entrypoints cctxt (chain, block) contract +let list_contract_unreachables_and_entrypoints cctxt ~chain ~block ~contract + ~normalize_types = + Alpha_services.Contract.list_entrypoints + cctxt + (chain, block) + contract + ~normalize_types let list_contract_unreachables cctxt ~chain ~block ~contract = - list_contract_unreachables_and_entrypoints cctxt ~chain ~block ~contract - >>=? fun (unreachables, _) -> return unreachables + let normalize_types = + (* no need to normalize types as typed entrypoints are ignored *) + false + in + list_contract_unreachables_and_entrypoints + cctxt + ~chain + ~block + ~contract + ~normalize_types + >>=? fun (unreachables, _typed_entrypoints) -> return unreachables -let list_contract_entrypoints cctxt ~chain ~block ~contract = - list_contract_unreachables_and_entrypoints cctxt ~chain ~block ~contract +let list_contract_entrypoints cctxt ~chain ~block ~contract ~normalize_types = + list_contract_unreachables_and_entrypoints + cctxt + ~chain + ~block + ~contract + ~normalize_types >>=? fun (_, entrypoints) -> if not @@ List.mem_assoc ~equal:String.equal "default" entrypoints then contract_entrypoint_type @@ -122,6 +142,7 @@ let list_contract_entrypoints cctxt ~chain ~block ~contract = ~block ~contract ~entrypoint:Entrypoint.default + ~normalize_types >>= function | Ok (Some ty) -> return (("default", ty) :: entrypoints) | Ok None -> return entrypoints diff --git a/src/proto_alpha/lib_client/michelson_v1_entrypoints.mli b/src/proto_alpha/lib_client/michelson_v1_entrypoints.mli index 83dfe900e3b3bbf907bbaeccbbee7245cbb9aba8..03ed32851ed25ede4b8dd0b788489ba053724e87 100644 --- a/src/proto_alpha/lib_client/michelson_v1_entrypoints.mli +++ b/src/proto_alpha/lib_client/michelson_v1_entrypoints.mli @@ -41,6 +41,7 @@ val contract_entrypoint_type : block:Block_services.block -> contract:Alpha_context.Contract.t -> entrypoint:Alpha_context.Entrypoint.t -> + normalize_types:bool -> Alpha_context.Script.expr option tzresult Lwt.t val print_entrypoint_type : @@ -87,6 +88,7 @@ val list_contract_entrypoints : chain:Chain_services.chain -> block:Block_services.block -> contract:Alpha_context.Contract.t -> + normalize_types:bool -> (string * Alpha_context.Script.expr) list tzresult Lwt.t (** List the script entrypoints with their types. *) diff --git a/src/proto_alpha/lib_client_commands/client_proto_context_commands.ml b/src/proto_alpha/lib_client_commands/client_proto_context_commands.ml index ead66538a211b3020e9920031eace95be4bf14c8..f16883d8b9ce23f34e708cbb08b2da7d77c962b3 100644 --- a/src/proto_alpha/lib_client_commands/client_proto_context_commands.ml +++ b/src/proto_alpha/lib_client_commands/client_proto_context_commands.ml @@ -35,6 +35,14 @@ open Client_proto_args let encrypted_switch = Clic.switch ~long:"encrypted" ~doc:"encrypt the key on-disk" () +let normalize_types_switch = + Clic.switch + ~long:"normalize-types" + ~doc: + "Whether types should be normalized (annotations removed, combs \ + flattened) or kept as they appeared in the original script." + () + let report_michelson_errors ?(no_print_source = false) ~msg (cctxt : #Client_context.full) = function | Error errs -> @@ -380,7 +388,7 @@ let commands_ro () = command ~group ~desc:"Get the type of an entrypoint of a contract." - no_options + (args1 normalize_types_switch) (prefixes ["get"; "contract"; "entrypoint"; "type"; "of"] @@ Clic.param ~name:"entrypoint" @@ -389,13 +397,17 @@ let commands_ro () = @@ prefixes ["for"] @@ ContractAlias.destination_param ~name:"src" ~desc:"source contract" @@ stop) - (fun () entrypoint (_, contract) (cctxt : Protocol_client_context.full) -> + (fun normalize_types + entrypoint + (_, contract) + (cctxt : Protocol_client_context.full) -> Michelson_v1_entrypoints.contract_entrypoint_type cctxt ~chain:cctxt#chain ~block:cctxt#block ~contract ~entrypoint + ~normalize_types >>= Michelson_v1_entrypoints.print_entrypoint_type cctxt ~emacs:false @@ -404,16 +416,17 @@ let commands_ro () = command ~group ~desc:"Get the entrypoint list of a contract." - no_options + (args1 normalize_types_switch) (prefixes ["get"; "contract"; "entrypoints"; "for"] @@ ContractAlias.destination_param ~name:"src" ~desc:"source contract" @@ stop) - (fun () (_, contract) (cctxt : Protocol_client_context.full) -> + (fun normalize_types (_, contract) (cctxt : Protocol_client_context.full) -> Michelson_v1_entrypoints.list_contract_entrypoints cctxt ~chain:cctxt#chain ~block:cctxt#block ~contract + ~normalize_types >>= Michelson_v1_entrypoints.print_entrypoints_list cctxt ~emacs:false diff --git a/src/proto_alpha/lib_client_commands/client_proto_multisig_commands.ml b/src/proto_alpha/lib_client_commands/client_proto_multisig_commands.ml index a03e5a04c396840b0abc98e6eff98830a076ed8b..d20ca7fa7de40156728b3499affe68475b3efc7b 100644 --- a/src/proto_alpha/lib_client_commands/client_proto_multisig_commands.ml +++ b/src/proto_alpha/lib_client_commands/client_proto_multisig_commands.ml @@ -153,6 +153,7 @@ let get_parameter_type (cctxt : #Protocol_client_context.full) ~destination ~block:cctxt#block ~contract:destination ~entrypoint + ~normalize_types:true >>=? function | None -> cctxt#error diff --git a/src/proto_alpha/lib_plugin/plugin.ml b/src/proto_alpha/lib_plugin/plugin.ml index 8bd6c0d764617d13066c18b2cfc3a2f831039fd1..6967251399eb9c079b3ac79c62531cc10d1e392a 100644 --- a/src/proto_alpha/lib_plugin/plugin.ml +++ b/src/proto_alpha/lib_plugin/plugin.ml @@ -2245,10 +2245,9 @@ module RPC = struct arg_type entrypoints entrypoint - >>? fun (r, ctxt) -> - r >>? fun (Ex_ty_cstr (ty, _)) -> - unparse_ty ~loc:() ctxt ty >|? fun (ty_node, _) -> - Micheline.strip_locations ty_node ) + >>? fun (r, _ctxt) -> + r >|? fun (Ex_ty_cstr {original_type_expr; _}) -> + Micheline.strip_locations original_type_expr ) in Registration.register0 ~chunked:true @@ -2641,14 +2640,18 @@ module RPC = struct parse_toplevel ~legacy ctxt expr >>=? fun ({arg_type; _}, ctxt) -> Lwt.return ( parse_parameter_ty_and_entrypoints ctxt ~legacy arg_type - >>? fun (Ex_parameter_ty_and_entrypoints {arg_type; entrypoints}, _) + >|? fun (Ex_parameter_ty_and_entrypoints {arg_type; entrypoints}, _) -> - Script_ir_translator.list_entrypoints ctxt arg_type entrypoints - >|? fun (unreachable_entrypoint, map) -> + let (unreachable_entrypoint, map) = + Script_ir_translator.list_entrypoints_uncarbonated + arg_type + entrypoints + in ( unreachable_entrypoint, Entrypoint.Map.fold - (fun entry (_, ty) acc -> - (Entrypoint.to_string entry, Micheline.strip_locations ty) + (fun entry (_ex_ty, original_type_expr) acc -> + ( Entrypoint.to_string entry, + Micheline.strip_locations original_type_expr ) :: acc) map [] ) )) diff --git a/src/proto_alpha/lib_protocol/alpha_context.mli b/src/proto_alpha/lib_protocol/alpha_context.mli index a234da19ce325ecf6487847a103be1d3e9b5a962..c39229e56d6ea189d53bfca37d9f010270ada0e1 100644 --- a/src/proto_alpha/lib_protocol/alpha_context.mli +++ b/src/proto_alpha/lib_protocol/alpha_context.mli @@ -679,8 +679,6 @@ module Script : sig type 'location michelson_node = ('location, prim) Micheline.node - type unlocated_michelson_node = unit michelson_node - type node = location michelson_node type t = {code : lazy_expr; storage : lazy_expr} diff --git a/src/proto_alpha/lib_protocol/contract_services.ml b/src/proto_alpha/lib_protocol/contract_services.ml index 784582bc518df25da43fffe4f7f6dffbeb0f6954..080c82530cae9d2cdb8b27f41defcc1ff26e0163 100644 --- a/src/proto_alpha/lib_protocol/contract_services.ml +++ b/src/proto_alpha/lib_protocol/contract_services.ml @@ -117,10 +117,23 @@ module S = struct ~output:Script.expr_encoding RPC_path.(custom_root /: Contract.rpc_arg / "storage") + type normalize_types_query = {normalize_types : bool} + + let normalize_types_query : normalize_types_query RPC_query.t = + let open RPC_query in + query (fun normalize_types -> {normalize_types}) + |+ flag + ~descr: + "Whether types should be normalized (annotations removed, combs \ + flattened) or kept as they appeared in the original script." + "normalize_types" + (fun t -> t.normalize_types) + |> seal + let entrypoint_type = RPC_service.get_service ~description:"Return the type of the given entrypoint of the contract" - ~query:RPC_query.empty + ~query:normalize_types_query ~output:Script.expr_encoding RPC_path.( custom_root /: Contract.rpc_arg / "entrypoints" /: Entrypoint.rpc_arg) @@ -128,7 +141,7 @@ module S = struct let list_entrypoints = RPC_service.get_service ~description:"Return the list of entrypoints of the contract" - ~query:RPC_query.empty + ~query:normalize_types_query ~output: (obj2 (dft @@ -374,7 +387,10 @@ let[@coq_axiom_with_reason "gadt"] register () = ctxt script.storage >>?= fun (storage, _ctxt) -> return_some storage) ; - opt_register2 ~chunked:true S.entrypoint_type (fun ctxt v entrypoint () () -> + opt_register2 + ~chunked:true + S.entrypoint_type + (fun ctxt v entrypoint {normalize_types} () -> Contract.get_script_code ctxt v >>=? fun (_, expr) -> match expr with | None -> return_none @@ -400,11 +416,16 @@ let[@coq_axiom_with_reason "gadt"] register () = entrypoint >>? fun (r, ctxt) -> r |> function - | Ok (Ex_ty_cstr (ty, _)) -> - unparse_ty ~loc:() ctxt ty >|? fun (ty_node, _) -> - Some (Micheline.strip_locations ty_node) + | Ok (Ex_ty_cstr {ty; original_type_expr; _}) -> + if normalize_types then + unparse_ty ~loc:() ctxt ty >|? fun (ty_node, _ctxt) -> + Some (Micheline.strip_locations ty_node) + else ok (Some (Micheline.strip_locations original_type_expr)) | Error _ -> Result.return_none )) ; - opt_register1 ~chunked:true S.list_entrypoints (fun ctxt v () () -> + opt_register1 + ~chunked:true + S.list_entrypoints + (fun ctxt v {normalize_types} () -> Contract.get_script_code ctxt v >>=? fun (_, expr) -> match expr with | None -> return_none @@ -419,20 +440,26 @@ let[@coq_axiom_with_reason "gadt"] register () = >>?= fun (expr, _) -> parse_toplevel ctxt ~legacy expr >>=? fun ({arg_type; _}, ctxt) -> Lwt.return - ( ( parse_parameter_ty_and_entrypoints ctxt ~legacy arg_type - >>? fun ( Ex_parameter_ty_and_entrypoints {arg_type; entrypoints}, - _ ) -> - Script_ir_translator.list_entrypoints ctxt arg_type entrypoints - ) - >|? fun (unreachable_entrypoint, map) -> - Some - ( unreachable_entrypoint, - Entrypoint.Map.fold - (fun entry (_, ty) acc -> - (Entrypoint.to_string entry, Micheline.strip_locations ty) - :: acc) - map - [] ) )) ; + ( parse_parameter_ty_and_entrypoints ctxt ~legacy arg_type + >>? fun (Ex_parameter_ty_and_entrypoints {arg_type; entrypoints}, _) + -> + let (unreachable_entrypoint, map) = + Script_ir_translator.list_entrypoints_uncarbonated + arg_type + entrypoints + in + Entrypoint.Map.fold_e + (fun entry (Ex_ty ty, original_type_expr) (acc, ctxt) -> + (if normalize_types then + unparse_ty ~loc:() ctxt ty >|? fun (ty_node, ctxt) -> + (Micheline.strip_locations ty_node, ctxt) + else ok (Micheline.strip_locations original_type_expr, ctxt)) + >|? fun (ty_expr, ctxt) -> + ((Entrypoint.to_string entry, ty_expr) :: acc, ctxt)) + map + ([], ctxt) + >|? fun (entrypoint_types, _ctxt) -> + Some (unreachable_entrypoint, entrypoint_types) )) ; opt_register1 ~chunked:true S.contract_big_map_get_opt @@ -536,11 +563,24 @@ let script_opt ctxt block contract = let storage ctxt block contract = RPC_context.make_call1 S.storage ctxt block contract () () -let entrypoint_type ctxt block contract entrypoint = - RPC_context.make_call2 S.entrypoint_type ctxt block contract entrypoint () () +let entrypoint_type ctxt block contract entrypoint ~normalize_types = + RPC_context.make_call2 + S.entrypoint_type + ctxt + block + contract + entrypoint + {normalize_types} + () -let list_entrypoints ctxt block contract = - RPC_context.make_call1 S.list_entrypoints ctxt block contract () () +let list_entrypoints ctxt block contract ~normalize_types = + RPC_context.make_call1 + S.list_entrypoints + ctxt + block + contract + {normalize_types} + () let storage_opt ctxt block contract = RPC_context.make_opt_call1 S.storage ctxt block contract () () diff --git a/src/proto_alpha/lib_protocol/contract_services.mli b/src/proto_alpha/lib_protocol/contract_services.mli index 95471b29743148b49d71fe1ca2fb07a424c0b046..6f86556cb0882ff848df63d7567d9712c0f932fd 100644 --- a/src/proto_alpha/lib_protocol/contract_services.mli +++ b/src/proto_alpha/lib_protocol/contract_services.mli @@ -90,12 +90,14 @@ val entrypoint_type : 'a -> Contract.t -> Entrypoint.t -> + normalize_types:bool -> Script.expr shell_tzresult Lwt.t val list_entrypoints : 'a #RPC_context.simple -> 'a -> Contract.t -> + normalize_types:bool -> (Michelson_v1_primitives.prim list list * (string * Script.expr) list) shell_tzresult Lwt.t diff --git a/src/proto_alpha/lib_protocol/script_interpreter.ml b/src/proto_alpha/lib_protocol/script_interpreter.ml index 3111b9d4cf29f82c540aa3feecd6074147c86d4f..a47fa7de1b541ba1f6b9de66b12582c807608284 100644 --- a/src/proto_alpha/lib_protocol/script_interpreter.ml +++ b/src/proto_alpha/lib_protocol/script_interpreter.ml @@ -1701,7 +1701,7 @@ type execution_arg = | Untyped_arg : Script.expr -> execution_arg let lift_execution_arg (type a ac) ctxt ~internal (entrypoint_ty : (a, ac) ty) - (box : a -> 'b) arg : ('b * context) tzresult Lwt.t = + (construct : a -> 'b) arg : ('b * context) tzresult Lwt.t = (match arg with | Untyped_arg arg -> let arg = Micheline.root arg in @@ -1718,7 +1718,7 @@ let lift_execution_arg (type a ac) ctxt ~internal (entrypoint_ty : (a, ac) ty) res >>?= fun Eq -> let parsed_arg : a = parsed_arg in return (parsed_arg, ctxt)) - >>=? fun (entrypoint_arg, ctxt) -> return (box entrypoint_arg, ctxt) + >>=? fun (entrypoint_arg, ctxt) -> return (construct entrypoint_arg, ctxt) type execution_result = { script : Script_ir_translator.ex_script; @@ -1756,10 +1756,11 @@ let execute_any_arg logger ctxt mode step_constants ~entrypoint ~internal (find_entrypoint ~error_details:Informative arg_type entrypoints entrypoint) >>?= fun (r, ctxt) -> record_trace (Bad_contract_parameter step_constants.self) r - >>?= fun (Ex_ty_cstr (entrypoint_ty, box)) -> + >>?= fun (Ex_ty_cstr {ty = entrypoint_ty; construct; original_type_expr = _}) + -> trace (Bad_contract_parameter step_constants.self) - (lift_execution_arg ctxt ~internal entrypoint_ty box arg) + (lift_execution_arg ctxt ~internal entrypoint_ty construct arg) >>=? fun (arg, ctxt) -> Script_ir_translator.collect_lazy_storage ctxt arg_type arg >>?= fun (to_duplicate, ctxt) -> diff --git a/src/proto_alpha/lib_protocol/script_ir_translator.ml b/src/proto_alpha/lib_protocol/script_ir_translator.ml index 65b9f6bd1d23fd59bd4cc4cdfdcb82441058da5c..bf2dd91fab054f38473b4823c1d24eb585790e6e 100644 --- a/src/proto_alpha/lib_protocol/script_ir_translator.ml +++ b/src/proto_alpha/lib_protocol/script_ir_translator.ml @@ -224,8 +224,8 @@ let unparse_memo_size ~loc memo_size = let rec unparse_ty_entrypoints_uncarbonated : type a ac loc. - loc:loc -> (a, ac) ty -> a entrypoints -> loc Script.michelson_node = - fun ~loc ty {nested = nested_entrypoints; name = entrypoint_name} -> + loc:loc -> (a, ac) ty -> a entrypoints_node -> loc Script.michelson_node = + fun ~loc ty {nested = nested_entrypoints; at_node} -> let (name, args) = match ty with | Unit_t -> (T_unit, []) @@ -302,9 +302,10 @@ let rec unparse_ty_entrypoints_uncarbonated : | Chest_t -> (T_chest, []) in let annot = - match entrypoint_name with + match at_node with | None -> [] - | Some name -> [Entrypoint.unparse_as_field_annot name] + | Some {name; original_type_expr = _} -> + [Entrypoint.unparse_as_field_annot name] in Prim (loc, name, args, annot) @@ -321,7 +322,7 @@ let unparse_comparable_ty ~loc ctxt comp_ty = let unparse_parameter_ty ~loc ctxt ty ~entrypoints = Gas.consume ctxt (Unparse_costs.unparse_type ty) >|? fun ctxt -> - (unparse_ty_entrypoints_uncarbonated ~loc ty entrypoints, ctxt) + (unparse_ty_entrypoints_uncarbonated ~loc ty entrypoints.root, ctxt) let serialize_ty_for_error ty = (* @@ -1225,12 +1226,12 @@ let[@coq_struct "ty"] rec parse_comparable_ty : type ex_ty = Ex_ty : ('a, _) ty -> ex_ty -type ex_parameter_ty_and_entrypoints = - | Ex_parameter_ty_and_entrypoints : { +type ex_parameter_ty_and_entrypoints_node = + | Ex_parameter_ty_and_entrypoints_node : { arg_type : ('a, _) ty; - entrypoints : 'a entrypoints; + entrypoints : 'a entrypoints_node; } - -> ex_parameter_ty_and_entrypoints + -> ex_parameter_ty_and_entrypoints_node (** [parse_ty] can be used to parse regular types as well as parameter types together with their entrypoints. @@ -1239,12 +1240,12 @@ type ex_parameter_ty_and_entrypoints = return an [ex_ty]. In the second case, use [~ret:Parse_entrypoints], [parse_ty] will return - an [ex_parameter_ty_and_entrypoints]. + an [ex_parameter_ty_and_entrypoints_node]. *) type ('ret, 'name) parse_ty_ret = | Don't_parse_entrypoints : (ex_ty, unit) parse_ty_ret | Parse_entrypoints - : (ex_parameter_ty_and_entrypoints, Entrypoint.t option) parse_ty_ret + : (ex_parameter_ty_and_entrypoints_node, Entrypoint.t option) parse_ty_ret let[@coq_axiom_with_reason "complex mutually recursive definition"] rec parse_ty : type ret name. @@ -1279,8 +1280,14 @@ let[@coq_axiom_with_reason "complex mutually recursive definition"] rec parse_ty match ret with | Don't_parse_entrypoints -> (Ex_ty ty, ctxt) | Parse_entrypoints -> - ( Ex_parameter_ty_and_entrypoints - {arg_type = ty; entrypoints = {name; nested = Entrypoints_None}}, + let at_node = + Option.map (fun name -> {name; original_type_expr = node}) name + in + ( Ex_parameter_ty_and_entrypoints_node + { + arg_type = ty; + entrypoints = {at_node; nested = Entrypoints_None}; + }, ctxt ) in match node with @@ -1411,19 +1418,23 @@ let[@coq_axiom_with_reason "complex mutually recursive definition"] rec parse_ty let (Ex_ty tr) = parsed_r in union_t loc tl tr >|? fun (Ty_ex_c ty) -> ((Ex_ty ty : ret), ctxt) | Parse_entrypoints -> - let (Ex_parameter_ty_and_entrypoints + let (Ex_parameter_ty_and_entrypoints_node {arg_type = tl; entrypoints = left}) = parsed_l in - let (Ex_parameter_ty_and_entrypoints + let (Ex_parameter_ty_and_entrypoints_node {arg_type = tr; entrypoints = right}) = parsed_r in union_t loc tl tr >|? fun (Ty_ex_c arg_type) -> let entrypoints = - {name; nested = Entrypoints_Union {left; right}} + let at_node = + Option.map (fun name -> {name; original_type_expr = node}) name + in + {at_node; nested = Entrypoints_Union {left; right}} in - (Ex_parameter_ty_and_entrypoints {arg_type; entrypoints}, ctxt)) + (Ex_parameter_ty_and_entrypoints_node {arg_type; entrypoints}, ctxt) + ) | Prim (loc, T_lambda, [uta; utr], annot) -> parse_any_ty ctxt ~stack_depth:(stack_depth + 1) ~legacy uta >>? fun (Ex_ty ta, ctxt) -> @@ -1914,7 +1925,13 @@ let rec make_comb_set_proof_argument : let whole_stack = serialize_stack_for_error ctxt stack_ty in error (Bad_stack (loc, I_UPDATE, 2, whole_stack)) -type 'a ex_ty_cstr = Ex_ty_cstr : ('b, _) ty * ('b -> 'a) -> 'a ex_ty_cstr +type 'a ex_ty_cstr = + | Ex_ty_cstr : { + ty : ('b, _) Script_typed_ir.ty; + construct : 'b -> 'a; + original_type_expr : Script.node; + } + -> 'a ex_ty_cstr let find_entrypoint (type full fullc error_trace) ~(error_details : error_trace error_details) (full : (full, fullc) ty) @@ -1924,29 +1941,41 @@ let find_entrypoint (type full fullc error_trace) let rec find_entrypoint : type t tc. (t, tc) ty -> - t entrypoints -> + t entrypoints_node -> Entrypoint.t -> (t ex_ty_cstr, unit) Gas_monad.t = fun ty entrypoints entrypoint -> let* () = Gas_monad.consume_gas Typecheck_costs.find_entrypoint_cycle in match (ty, entrypoints) with - | (_, {name = Some name; _}) when Entrypoint.(name = entrypoint) -> - return (Ex_ty_cstr (ty, fun e -> e)) + | (_, {at_node = Some {name; original_type_expr}; _}) + when Entrypoint.(name = entrypoint) -> + return (Ex_ty_cstr {ty; construct = (fun e -> e); original_type_expr}) | (Union_t (tl, tr, _, _), {nested = Entrypoints_Union {left; right}; _}) -> ( Gas_monad.bind_recover (find_entrypoint tl left entrypoint) @@ function - | Ok (Ex_ty_cstr (t, f)) -> return (Ex_ty_cstr (t, fun e -> L (f e))) + | Ok (Ex_ty_cstr {ty; construct; original_type_expr}) -> + return + (Ex_ty_cstr + { + ty; + construct = (fun e -> L (construct e)); + original_type_expr; + }) | Error () -> - let+ (Ex_ty_cstr (t, f)) = find_entrypoint tr right entrypoint in - Ex_ty_cstr (t, fun e -> R (f e))) + let+ (Ex_ty_cstr {ty; construct; original_type_expr}) = + find_entrypoint tr right entrypoint + in + Ex_ty_cstr + {ty; construct = (fun e -> R (construct e)); original_type_expr}) | (_, {nested = Entrypoints_None; _}) -> Gas_monad.of_result (Error ()) in - Gas_monad.bind_recover (find_entrypoint full entrypoints entrypoint) - @@ function + let {root; original_type_expr} = entrypoints in + Gas_monad.bind_recover (find_entrypoint full root entrypoint) @@ function | Ok f_t -> return f_t | Error () -> if Entrypoint.is_default entrypoint then - return (Ex_ty_cstr (full, fun e -> e)) + return + (Ex_ty_cstr {ty = full; construct = (fun e -> e); original_type_expr}) else Gas_monad.of_result @@ Error @@ -1961,9 +1990,10 @@ let find_entrypoint_for_type (type full fullc exp expc error_trace) let open Gas_monad.Syntax in let* res = find_entrypoint ~error_details full entrypoints entrypoint in match res with - | Ex_ty_cstr (ty, _) -> ( - match entrypoints.name with - | Some e when Entrypoint.is_root e && Entrypoint.is_default entrypoint -> + | Ex_ty_cstr {ty; _} -> ( + match entrypoints.root.at_node with + | Some {name; original_type_expr = _} + when Entrypoint.is_root name && Entrypoint.is_default entrypoint -> Gas_monad.bind_recover (ty_eq ~error_details:Fast loc ty expected) (function @@ -1977,9 +2007,10 @@ let find_entrypoint_for_type (type full fullc exp expc error_trace) let well_formed_entrypoints (type full fullc) (full : (full, fullc) ty) entrypoints = - let merge path (type t tc) (ty : (t, tc) ty) (entrypoints : t entrypoints) - reachable ((first_unreachable, all) as acc) = - match entrypoints.name with + let merge path (type t tc) (ty : (t, tc) ty) + (entrypoints : t entrypoints_node) reachable + ((first_unreachable, all) as acc) = + match entrypoints.at_node with | None -> ok ( (if reachable then acc @@ -1991,14 +2022,14 @@ let well_formed_entrypoints (type full fullc) (full : (full, fullc) ty) | None -> (Some (List.rev path), all) | Some _ -> acc)), reachable ) - | Some name -> + | Some {name; original_type_expr = _} -> if Entrypoint.Set.mem name all then error (Duplicate_entrypoint name) else ok ((first_unreachable, Entrypoint.Set.add name all), true) in let rec check : type t tc. (t, tc) ty -> - t entrypoints -> + t entrypoints_node -> prim list -> bool -> prim list option * Entrypoint.Set.t -> @@ -2015,9 +2046,10 @@ let well_formed_entrypoints (type full fullc) (full : (full, fullc) ty) | _ -> ok acc in let (init, reachable) = - match entrypoints.name with + match entrypoints.at_node with | None -> (Entrypoint.Set.empty, false) - | Some name -> (Entrypoint.Set.singleton name, true) + | Some {name; original_type_expr = _} -> + (Entrypoint.Set.singleton name, true) in check full entrypoints [] reachable (None, init) >>? fun (first_unreachable, all) -> @@ -2027,6 +2059,13 @@ let well_formed_entrypoints (type full fullc) (full : (full, fullc) ty) | None -> Result.return_unit | Some path -> error (Unreachable_entrypoint path) +type ex_parameter_ty_and_entrypoints = + | Ex_parameter_ty_and_entrypoints : { + arg_type : ('a, _) ty; + entrypoints : 'a entrypoints; + } + -> ex_parameter_ty_and_entrypoints + let parse_parameter_ty_and_entrypoints : context -> stack_depth:int -> @@ -2040,12 +2079,13 @@ let parse_parameter_ty_and_entrypoints : ~legacy node ~ret:Parse_entrypoints - >>? fun (res, ctxt) -> + >>? fun (Ex_parameter_ty_and_entrypoints_node {arg_type; entrypoints}, ctxt) + -> (if legacy then Result.return_unit - else - let (Ex_parameter_ty_and_entrypoints {arg_type; entrypoints}) = res in - well_formed_entrypoints arg_type entrypoints) - >|? fun () -> (res, ctxt) + else well_formed_entrypoints arg_type entrypoints) + >|? fun () -> + let entrypoints = {root = entrypoints; original_type_expr = node} in + (Ex_parameter_ty_and_entrypoints {arg_type; entrypoints}, ctxt) let parse_passable_ty = parse_passable_ty ~ret:Don't_parse_entrypoints @@ -4688,7 +4728,7 @@ and[@coq_axiom_with_reason "gadt"] parse_instr : entrypoints entrypoint >>? fun (r, ctxt) -> - r >>? fun (Ex_ty_cstr (param_type, _)) -> + r >>? fun (Ex_ty_cstr {ty = param_type; _}) -> contract_t loc param_type >>? fun res_ty -> let instr = { @@ -5530,57 +5570,54 @@ let typecheck_code : trace (Ill_typed_contract (code, !type_map)) views_result >|=? fun ctxt -> (!type_map, ctxt) -let list_entrypoints ctxt (type full fullc) (full : (full, fullc) ty) +(* Uncarbonated because used only in RPCs *) +let list_entrypoints_uncarbonated (type full fullc) (full : (full, fullc) ty) (entrypoints : full entrypoints) = - let merge path (type t tc) (ty : (t, tc) ty) (entrypoints : t entrypoints) - reachable ((unreachables, all) as acc) = - match entrypoints.name with + let merge path (type t tc) (ty : (t, tc) ty) + (entrypoints : t entrypoints_node) reachable ((unreachables, all) as acc) + = + match entrypoints.at_node with | None -> - ok - ( (if reachable then acc - else - match ty with - | Union_t _ -> acc - | _ -> (List.rev path :: unreachables, all)), - reachable ) - | Some name -> - (if Entrypoint.Map.mem name all then - ok (List.rev path :: unreachables, all) - else - unparse_ty ~loc:() ctxt ty >|? fun (unparsed_ty, _) -> - ( unreachables, - Entrypoint.Map.add name (List.rev path, unparsed_ty) all )) - >|? fun unreachable_all -> (unreachable_all, true) + ( (if reachable then acc + else + match ty with + | Union_t _ -> acc + | _ -> (List.rev path :: unreachables, all)), + reachable ) + | Some {name; original_type_expr} -> + ( (if Entrypoint.Map.mem name all then + (List.rev path :: unreachables, all) + else + ( unreachables, + Entrypoint.Map.add name (Ex_ty ty, original_type_expr) all )), + true ) in let rec fold_tree : type t tc. (t, tc) ty -> - t entrypoints -> + t entrypoints_node -> prim list -> bool -> - prim list list - * (prim list * Script.unlocated_michelson_node) Entrypoint.Map.t -> - (prim list list - * (prim list * Script.unlocated_michelson_node) Entrypoint.Map.t) - tzresult = + prim list list * (ex_ty * Script.node) Entrypoint.Map.t -> + prim list list * (ex_ty * Script.node) Entrypoint.Map.t = fun t entrypoints path reachable acc -> match (t, entrypoints) with | (Union_t (tl, tr, _, _), {nested = Entrypoints_Union {left; right}; _}) -> - merge (D_Left :: path) tl left reachable acc - >>? fun (acc, l_reachable) -> - merge (D_Right :: path) tr right reachable acc - >>? fun (acc, r_reachable) -> - fold_tree tl left (D_Left :: path) l_reachable acc >>? fun acc -> + let (acc, l_reachable) = merge (D_Left :: path) tl left reachable acc in + let (acc, r_reachable) = + merge (D_Right :: path) tr right reachable acc + in + let acc = fold_tree tl left (D_Left :: path) l_reachable acc in fold_tree tr right (D_Right :: path) r_reachable acc - | _ -> ok acc + | _ -> acc in - unparse_ty ~loc:() ctxt full >>? fun (unparsed_full, _) -> let (init, reachable) = - match entrypoints.name with + match entrypoints.root.at_node with | None -> (Entrypoint.Map.empty, false) - | Some name -> (Entrypoint.Map.singleton name ([], unparsed_full), true) + | Some {name; original_type_expr} -> + (Entrypoint.Map.singleton name (Ex_ty full, original_type_expr), true) in - fold_tree full entrypoints [] reachable ([], init) + fold_tree full entrypoints.root [] reachable ([], init) [@@coq_axiom_with_reason "unsupported syntax"] (* ---- Unparsing (Typed IR -> Untyped expressions) --------------------------*) diff --git a/src/proto_alpha/lib_protocol/script_ir_translator.mli b/src/proto_alpha/lib_protocol/script_ir_translator.mli index d6904f4765ea7a2dbb2b8a6a73641dcb77221e7c..2d88ed80ebaf99411aff5d08aee0e68215e1466e 100644 --- a/src/proto_alpha/lib_protocol/script_ir_translator.mli +++ b/src/proto_alpha/lib_protocol/script_ir_translator.mli @@ -418,7 +418,12 @@ val parse_contract_for_script : existential. Typically, it will be used to go from the type of an entry-point to the full type of a contract. *) type 'a ex_ty_cstr = - | Ex_ty_cstr : ('b, _) Script_typed_ir.ty * ('b -> 'a) -> 'a ex_ty_cstr + | Ex_ty_cstr : { + ty : ('b, _) Script_typed_ir.ty; + construct : 'b -> 'a; + original_type_expr : Script.node; + } + -> 'a ex_ty_cstr val find_entrypoint : error_details:'error_trace error_details -> @@ -427,14 +432,11 @@ val find_entrypoint : Entrypoint.t -> ('t ex_ty_cstr, 'error_trace) Gas_monad.t -val list_entrypoints : - context -> +val list_entrypoints_uncarbonated : ('t, _) Script_typed_ir.ty -> 't Script_typed_ir.entrypoints -> - (Michelson_v1_primitives.prim list list - * (Michelson_v1_primitives.prim list * Script.unlocated_michelson_node) - Entrypoint.Map.t) - tzresult + Michelson_v1_primitives.prim list list + * (ex_ty * Script.node) Entrypoint.Map.t val pack_data : context -> diff --git a/src/proto_alpha/lib_protocol/script_repr.ml b/src/proto_alpha/lib_protocol/script_repr.ml index c286e56f90874ec8c3e6dd77c50e4a9e9115bfbe..681d6d7c627a54161e667a89f2aa46381efff12d 100644 --- a/src/proto_alpha/lib_protocol/script_repr.ml +++ b/src/proto_alpha/lib_protocol/script_repr.ml @@ -36,8 +36,6 @@ type lazy_expr = expr Data_encoding.lazy_t type 'location michelson_node = ('location, Michelson_v1_primitives.prim) Micheline.node -type unlocated_michelson_node = unit michelson_node - type node = location michelson_node let expr_encoding = diff --git a/src/proto_alpha/lib_protocol/script_repr.mli b/src/proto_alpha/lib_protocol/script_repr.mli index 66569c6bf0944559dc2ba2122f81a77b21bc9ca0..386cd0761c3c3a8973ef9e537f03536ed5fc0dd1 100644 --- a/src/proto_alpha/lib_protocol/script_repr.mli +++ b/src/proto_alpha/lib_protocol/script_repr.mli @@ -50,8 +50,6 @@ type lazy_expr = expr Data_encoding.lazy_t type 'location michelson_node = ('location, Michelson_v1_primitives.prim) Micheline.node -type unlocated_michelson_node = unit michelson_node - (** Same as [expr], but used in different contexts, as required by Micheline's abstract interface. *) type node = location michelson_node diff --git a/src/proto_alpha/lib_protocol/script_typed_ir.ml b/src/proto_alpha/lib_protocol/script_typed_ir.ml index 1ef7eaf3759cab36f5a2c2e34252da8ba78c4e1e..35e736a0f32ec547feb04a2a2199fb7a02354342 100644 --- a/src/proto_alpha/lib_protocol/script_typed_ir.ml +++ b/src/proto_alpha/lib_protocol/script_typed_ir.ml @@ -421,20 +421,27 @@ type view = { type view_map = (Script_string.t, view) map -type 'arg entrypoints = { - name : Entrypoint.t option; +type entrypoint_info = {name : Entrypoint.t; original_type_expr : Script.node} + +type 'arg entrypoints_node = { + at_node : entrypoint_info option; nested : 'arg nested_entrypoints; } and 'arg nested_entrypoints = | Entrypoints_Union : { - left : 'l entrypoints; - right : 'r entrypoints; + left : 'l entrypoints_node; + right : 'r entrypoints_node; } -> ('l, 'r) union nested_entrypoints | Entrypoints_None : _ nested_entrypoints -let no_entrypoints = {name = None; nested = Entrypoints_None} +let no_entrypoints = {at_node = None; nested = Entrypoints_None} + +type 'arg entrypoints = { + root : 'arg entrypoints_node; + original_type_expr : Script.node; +} type ('arg, 'storage) script = | Script : { diff --git a/src/proto_alpha/lib_protocol/script_typed_ir.mli b/src/proto_alpha/lib_protocol/script_typed_ir.mli index 80ef6bcda3d6b408c46755c70df84450375843d2..7d69f8ada1e66014d205c95f77a8650076e8a7f6 100644 --- a/src/proto_alpha/lib_protocol/script_typed_ir.mli +++ b/src/proto_alpha/lib_protocol/script_typed_ir.mli @@ -279,29 +279,36 @@ type view = { type view_map = (Script_string.t, view) map +type entrypoint_info = {name : Entrypoint.t; original_type_expr : Script.node} + (** ['arg entrypoints] represents the tree of entrypoints of a parameter type ['arg]. - [name] is the name of the entrypoint at that node if it is not [None]. + [at_node] are entrypoint details at that node if it is not [None]. [nested] are the entrypoints below the node in the tree. It is always [Entrypoints_None] for non-union nodes. But it is also ok to have [Entrypoints_None] for a union node, it just means that there are no entrypoints below that node in the tree. *) -type 'arg entrypoints = { - name : Entrypoint.t option; +type 'arg entrypoints_node = { + at_node : entrypoint_info option; nested : 'arg nested_entrypoints; } and 'arg nested_entrypoints = | Entrypoints_Union : { - left : 'l entrypoints; - right : 'r entrypoints; + left : 'l entrypoints_node; + right : 'r entrypoints_node; } -> ('l, 'r) union nested_entrypoints | Entrypoints_None : _ nested_entrypoints -(** [no_entrypoints] is [{name = None; nested = Entrypoints_None}] *) -val no_entrypoints : _ entrypoints +(** [no_entrypoints] is [{at_node = None; nested = Entrypoints_None}] *) +val no_entrypoints : _ entrypoints_node + +type 'arg entrypoints = { + root : 'arg entrypoints_node; + original_type_expr : Script.node; +} type ('arg, 'storage) script = | Script : { diff --git a/src/proto_alpha/lib_protocol/ticket_operations_diff.ml b/src/proto_alpha/lib_protocol/ticket_operations_diff.ml index 225e2a8eda8d77ab61a22df4d67acbb2db497f3a..60837e56e172407d20d3b6b0ba1c38026d6b6107 100644 --- a/src/proto_alpha/lib_protocol/ticket_operations_diff.ml +++ b/src/proto_alpha/lib_protocol/ticket_operations_diff.ml @@ -199,7 +199,7 @@ let tickets_of_transaction ctxt ~destination ~entrypoint ~location entrypoints entrypoint) >>?= fun (res, ctxt) -> - res >>?= fun (Ex_ty_cstr (entry_arg_ty, _f)) -> + res >>?= fun (Ex_ty_cstr {ty = entry_arg_ty; _}) -> Ticket_scanner.type_has_tickets ctxt entry_arg_ty >>?= fun (has_tickets, ctxt) -> (* Check that the parameter's type matches that of the entry-point, and diff --git a/tezt/_regressions/rpc/alpha.client.contracts.out b/tezt/_regressions/rpc/alpha.client.contracts.out index b7437c250bae93cb8a45c9644d7048f27a90c8d0..cb55c7abef4e6947b651ab8fa29fe3d7be57e123 100644 --- a/tezt/_regressions/rpc/alpha.client.contracts.out +++ b/tezt/_regressions/rpc/alpha.client.contracts.out @@ -350,11 +350,15 @@ null { "rem_right": { "prim": "string" }, "rem_left": { "prim": "string" }, "rem": { "prim": "or", - "args": [ { "prim": "string" }, { "prim": "string" } ] }, + "args": + [ { "prim": "string", "annots": [ "%rem_left" ] }, + { "prim": "string", "annots": [ "%rem_right" ] } ] }, "mem_right": { "prim": "string" }, "mem_left": { "prim": "string" }, "mem": { "prim": "or", - "args": [ { "prim": "string" }, { "prim": "string" } ] }, + "args": + [ { "prim": "string", "annots": [ "%mem_left" ] }, + { "prim": "string", "annots": [ "%mem_right" ] } ] }, "default": { "prim": "unit" }, "add_right": { "prim": "pair", @@ -366,9 +370,11 @@ null { "prim": "or", "args": [ { "prim": "pair", - "args": [ { "prim": "string" }, { "prim": "nat" } ] }, + "args": [ { "prim": "string" }, { "prim": "nat" } ], + "annots": [ "%add_left" ] }, { "prim": "pair", - "args": [ { "prim": "string" }, { "prim": "nat" } ] } ] } } } + "args": [ { "prim": "string" }, { "prim": "nat" } ], + "annots": [ "%add_right" ] } ] } } } ./tezos-client rpc get '/chains/main/blocks/head/context/contracts/[CONTRACT_HASH]/script' { "code": diff --git a/tezt/_regressions/rpc/alpha.light.contracts.out b/tezt/_regressions/rpc/alpha.light.contracts.out index 30555ed188dcf8acfd3b3c8411a62ed4a3258aa5..a91680bc81096be192f98dcfbd961ce90c45308f 100644 --- a/tezt/_regressions/rpc/alpha.light.contracts.out +++ b/tezt/_regressions/rpc/alpha.light.contracts.out @@ -387,11 +387,15 @@ protocol of light mode unspecified, using the node's protocol: ProtoALphaALphaAL { "rem_right": { "prim": "string" }, "rem_left": { "prim": "string" }, "rem": { "prim": "or", - "args": [ { "prim": "string" }, { "prim": "string" } ] }, + "args": + [ { "prim": "string", "annots": [ "%rem_left" ] }, + { "prim": "string", "annots": [ "%rem_right" ] } ] }, "mem_right": { "prim": "string" }, "mem_left": { "prim": "string" }, "mem": { "prim": "or", - "args": [ { "prim": "string" }, { "prim": "string" } ] }, + "args": + [ { "prim": "string", "annots": [ "%mem_left" ] }, + { "prim": "string", "annots": [ "%mem_right" ] } ] }, "default": { "prim": "unit" }, "add_right": { "prim": "pair", @@ -403,9 +407,11 @@ protocol of light mode unspecified, using the node's protocol: ProtoALphaALphaAL { "prim": "or", "args": [ { "prim": "pair", - "args": [ { "prim": "string" }, { "prim": "nat" } ] }, + "args": [ { "prim": "string" }, { "prim": "nat" } ], + "annots": [ "%add_left" ] }, { "prim": "pair", - "args": [ { "prim": "string" }, { "prim": "nat" } ] } ] } } } + "args": [ { "prim": "string" }, { "prim": "nat" } ], + "annots": [ "%add_right" ] } ] } } } protocol of light mode unspecified, using the node's protocol: ProtoALphaALphaALphaALphaALphaALphaALphaALphaDdp3zK ./tezos-client --mode light rpc get '/chains/main/blocks/head/context/contracts/[CONTRACT_HASH]/script' diff --git a/tezt/_regressions/rpc/alpha.proxy.contracts.out b/tezt/_regressions/rpc/alpha.proxy.contracts.out index ac6cbff9836d10c8b4ec346f0b9f4e1b5783b787..0497d6d7a573b08bac6e1d2fbf6dd4957d01bc67 100644 --- a/tezt/_regressions/rpc/alpha.proxy.contracts.out +++ b/tezt/_regressions/rpc/alpha.proxy.contracts.out @@ -387,11 +387,15 @@ protocol of proxy unspecified, using the node's protocol: ProtoALphaALphaALphaAL { "rem_right": { "prim": "string" }, "rem_left": { "prim": "string" }, "rem": { "prim": "or", - "args": [ { "prim": "string" }, { "prim": "string" } ] }, + "args": + [ { "prim": "string", "annots": [ "%rem_left" ] }, + { "prim": "string", "annots": [ "%rem_right" ] } ] }, "mem_right": { "prim": "string" }, "mem_left": { "prim": "string" }, "mem": { "prim": "or", - "args": [ { "prim": "string" }, { "prim": "string" } ] }, + "args": + [ { "prim": "string", "annots": [ "%mem_left" ] }, + { "prim": "string", "annots": [ "%mem_right" ] } ] }, "default": { "prim": "unit" }, "add_right": { "prim": "pair", @@ -403,9 +407,11 @@ protocol of proxy unspecified, using the node's protocol: ProtoALphaALphaALphaAL { "prim": "or", "args": [ { "prim": "pair", - "args": [ { "prim": "string" }, { "prim": "nat" } ] }, + "args": [ { "prim": "string" }, { "prim": "nat" } ], + "annots": [ "%add_left" ] }, { "prim": "pair", - "args": [ { "prim": "string" }, { "prim": "nat" } ] } ] } } } + "args": [ { "prim": "string" }, { "prim": "nat" } ], + "annots": [ "%add_right" ] } ] } } } protocol of proxy unspecified, using the node's protocol: ProtoALphaALphaALphaALphaALphaALphaALphaALphaDdp3zK ./tezos-client --mode proxy rpc get '/chains/main/blocks/head/context/contracts/[CONTRACT_HASH]/script' diff --git a/tezt/_regressions/rpc/alpha.proxy_server_data_dir.contracts.out b/tezt/_regressions/rpc/alpha.proxy_server_data_dir.contracts.out index c41c98afe9f38d3bf13beb74bd7975a31126e7a7..0e3a12f8a4b039a0d723547140c25566bcb10997 100644 --- a/tezt/_regressions/rpc/alpha.proxy_server_data_dir.contracts.out +++ b/tezt/_regressions/rpc/alpha.proxy_server_data_dir.contracts.out @@ -350,11 +350,15 @@ null { "rem_right": { "prim": "string" }, "rem_left": { "prim": "string" }, "rem": { "prim": "or", - "args": [ { "prim": "string" }, { "prim": "string" } ] }, + "args": + [ { "prim": "string", "annots": [ "%rem_left" ] }, + { "prim": "string", "annots": [ "%rem_right" ] } ] }, "mem_right": { "prim": "string" }, "mem_left": { "prim": "string" }, "mem": { "prim": "or", - "args": [ { "prim": "string" }, { "prim": "string" } ] }, + "args": + [ { "prim": "string", "annots": [ "%mem_left" ] }, + { "prim": "string", "annots": [ "%mem_right" ] } ] }, "default": { "prim": "unit" }, "add_right": { "prim": "pair", @@ -366,9 +370,11 @@ null { "prim": "or", "args": [ { "prim": "pair", - "args": [ { "prim": "string" }, { "prim": "nat" } ] }, + "args": [ { "prim": "string" }, { "prim": "nat" } ], + "annots": [ "%add_left" ] }, { "prim": "pair", - "args": [ { "prim": "string" }, { "prim": "nat" } ] } ] } } } + "args": [ { "prim": "string" }, { "prim": "nat" } ], + "annots": [ "%add_right" ] } ] } } } ./tezos-client rpc get '/chains/main/blocks/head/context/contracts/[CONTRACT_HASH]/script' { "code": diff --git a/tezt/_regressions/rpc/alpha.proxy_server_rpc.contracts.out b/tezt/_regressions/rpc/alpha.proxy_server_rpc.contracts.out index a097a4329a103cebed6f97684799b4afc32b84a3..b255e2b9903bd349b4544476eeec4f366bf7fc5b 100644 --- a/tezt/_regressions/rpc/alpha.proxy_server_rpc.contracts.out +++ b/tezt/_regressions/rpc/alpha.proxy_server_rpc.contracts.out @@ -350,11 +350,15 @@ null { "rem_right": { "prim": "string" }, "rem_left": { "prim": "string" }, "rem": { "prim": "or", - "args": [ { "prim": "string" }, { "prim": "string" } ] }, + "args": + [ { "prim": "string", "annots": [ "%rem_left" ] }, + { "prim": "string", "annots": [ "%rem_right" ] } ] }, "mem_right": { "prim": "string" }, "mem_left": { "prim": "string" }, "mem": { "prim": "or", - "args": [ { "prim": "string" }, { "prim": "string" } ] }, + "args": + [ { "prim": "string", "annots": [ "%mem_left" ] }, + { "prim": "string", "annots": [ "%mem_right" ] } ] }, "default": { "prim": "unit" }, "add_right": { "prim": "pair", @@ -366,9 +370,11 @@ null { "prim": "or", "args": [ { "prim": "pair", - "args": [ { "prim": "string" }, { "prim": "nat" } ] }, + "args": [ { "prim": "string" }, { "prim": "nat" } ], + "annots": [ "%add_left" ] }, { "prim": "pair", - "args": [ { "prim": "string" }, { "prim": "nat" } ] } ] } } } + "args": [ { "prim": "string" }, { "prim": "nat" } ], + "annots": [ "%add_right" ] } ] } } } ./tezos-client rpc get '/chains/main/blocks/head/context/contracts/[CONTRACT_HASH]/script' { "code":