diff --git a/src/proto_alpha/lib_benchmark/michelson_samplers.ml b/src/proto_alpha/lib_benchmark/michelson_samplers.ml index 022b2b20a94a6892c0aa686d46f7043d1ccc0e49..0ced7ddd8a71ee272f37f15f625b2afcac46fc6f 100644 --- a/src/proto_alpha/lib_benchmark/michelson_samplers.ml +++ b/src/proto_alpha/lib_benchmark/michelson_samplers.ml @@ -318,20 +318,20 @@ end) (cmp_tn : 'a comparable_and_atomic) : Script_ir_translator.ex_comparable_ty = match cmp_tn with - | `TString -> Ex_comparable_ty string_key - | `TNat -> Ex_comparable_ty nat_key - | `TBytes -> Ex_comparable_ty bytes_key - | `TBool -> Ex_comparable_ty bool_key - | `TAddress -> Ex_comparable_ty address_key - | `TTx_rollup_l2_address -> Ex_comparable_ty tx_rollup_l2_address_key - | `TTimestamp -> Ex_comparable_ty timestamp_key - | `TKey_hash -> Ex_comparable_ty key_hash_key - | `TMutez -> Ex_comparable_ty mutez_key - | `TInt -> Ex_comparable_ty int_key - | `TUnit -> Ex_comparable_ty unit_key - | `TSignature -> Ex_comparable_ty signature_key - | `TKey -> Ex_comparable_ty key_key - | `TChain_id -> Ex_comparable_ty chain_id_key + | `TString -> Ex_comparable_ty string_t + | `TNat -> Ex_comparable_ty nat_t + | `TBytes -> Ex_comparable_ty bytes_t + | `TBool -> Ex_comparable_ty bool_t + | `TAddress -> Ex_comparable_ty address_t + | `TTx_rollup_l2_address -> Ex_comparable_ty tx_rollup_l2_address_t + | `TTimestamp -> Ex_comparable_ty timestamp_t + | `TKey_hash -> Ex_comparable_ty key_hash_t + | `TMutez -> Ex_comparable_ty mutez_t + | `TInt -> Ex_comparable_ty int_t + | `TUnit -> Ex_comparable_ty unit_t + | `TSignature -> Ex_comparable_ty signature_t + | `TKey -> Ex_comparable_ty key_t + | `TChain_id -> Ex_comparable_ty chain_id_t let rec m_type ~size : Script_ir_translator.ex_ty sampler = let open Script_ir_translator in @@ -443,7 +443,7 @@ end) let option_case size = let size = size - 1 in let* (Ex_comparable_ty t) = m_comparable_type ~size in - match option_key (-1) t with + match comparable_option_t (-1) t with | Error _ -> (* what should be done here? *) assert false | Ok res_ty -> return @@ Ex_comparable_ty res_ty in @@ -455,7 +455,7 @@ end) let size_right = size - size_left in let* (Ex_comparable_ty l) = m_comparable_type ~size:size_left in let* (Ex_comparable_ty r) = m_comparable_type ~size:size_right in - match pair_key (-1) l r with + match comparable_pair_t (-1) l r with | Error _ -> assert false | Ok res_ty -> return @@ Ex_comparable_ty res_ty in @@ -467,7 +467,7 @@ end) let size_right = size - size_left in let* (Ex_comparable_ty l) = m_comparable_type ~size:size_left in let* (Ex_comparable_ty r) = m_comparable_type ~size:size_right in - match union_key (-1) l r with + match comparable_union_t (-1) l r with | Error _ -> assert false | Ok res_ty -> return @@ Ex_comparable_ty res_ty in diff --git a/src/proto_alpha/lib_benchmarks_proto/interpreter_benchmarks.ml b/src/proto_alpha/lib_benchmarks_proto/interpreter_benchmarks.ml index c036e023f030ed69a0c2cb7a4f5ee188bdf4c584..632fd4831facdd711cd8193394113fa8c112ec92 100644 --- a/src/proto_alpha/lib_benchmarks_proto/interpreter_benchmarks.ml +++ b/src/proto_alpha/lib_benchmarks_proto/interpreter_benchmarks.ml @@ -1118,13 +1118,12 @@ module Registration_section = struct let () = simple_benchmark ~name:Interpreter_workload.N_IEmpty_set - ~kinstr: - (IEmpty_set (kinfo_unit, unit_cmp, halt (set unit_cmp @$ unit @$ bot))) + ~kinstr:(IEmpty_set (kinfo_unit, unit, halt (set unit @$ unit @$ bot))) () let set_iter_code = ISet_iter - ( kinfo (set int_cmp @$ unit @$ bot), + ( kinfo (set int @$ unit @$ bot), IDrop (kinfo (int @$ unit @$ bot), halt_unit), halt_unit ) @@ -1141,7 +1140,7 @@ module Registration_section = struct *) simple_benchmark ~name:Interpreter_workload.N_ISet_iter - ~intercept_stack:(Script_set.empty int_cmp, ((), eos)) + ~intercept_stack:(Script_set.empty int, ((), eos)) ~kinstr:set_iter_code () @@ -1150,9 +1149,8 @@ module Registration_section = struct ~name:Interpreter_workload.N_ISet_mem ~kinstr: (ISet_mem - ( kinfo (int @$ set int_cmp @$ unit @$ bot), - halt (bool @$ unit @$ bot) )) - ~intercept_stack:(Script_int.zero, (Script_set.empty int_cmp, ((), eos))) + (kinfo (int @$ set int @$ unit @$ bot), halt (bool @$ unit @$ bot))) + ~intercept_stack:(Script_int.zero, (Script_set.empty int, ((), eos))) ~stack_sampler:(fun cfg rng_state () -> assert (cfg.sampler.set_size.min >= 1) ; let n = @@ -1164,7 +1162,7 @@ module Registration_section = struct let set = List.fold_left (fun set elt -> Script_set.update elt true set) - (Script_set.empty int_cmp) + (Script_set.empty int) elts in let elt = @@ -1179,10 +1177,8 @@ module Registration_section = struct ~name:Interpreter_workload.N_ISet_update ~kinstr: (ISet_update - ( kinfo (int @$ bool @$ set int_cmp @$ bot), - halt (set int_cmp @$ bot) )) - ~intercept_stack: - (Script_int.zero, (false, (Script_set.empty int_cmp, eos))) + (kinfo (int @$ bool @$ set int @$ bot), halt (set int @$ bot))) + ~intercept_stack:(Script_int.zero, (false, (Script_set.empty int, eos))) ~stack_sampler:(fun cfg rng_state () -> assert (cfg.sampler.set_size.min >= 2) ; let n = @@ -1197,7 +1193,7 @@ module Registration_section = struct let set = List.fold_left (fun set elt -> Script_set.update elt true set) - (Script_set.empty int_cmp) + (Script_set.empty int) in_set in let stack = @@ -1217,7 +1213,7 @@ module Registration_section = struct let () = simple_benchmark ~name:Interpreter_workload.N_ISet_size - ~kinstr:(ISet_size (kinfo (set unit_cmp @$ bot), halt (nat @$ bot))) + ~kinstr:(ISet_size (kinfo (set unit @$ bot), halt (nat @$ bot))) () end @@ -1230,7 +1226,7 @@ module Registration_section = struct let map = List.fold_left (fun map i -> Script_map.update i (Some ()) map) - (Script_map.empty int_cmp) + (Script_map.empty int) keys in let (module M) = Script_map.get_module map in @@ -1244,23 +1240,22 @@ module Registration_section = struct simple_benchmark ~name:Interpreter_workload.N_IEmpty_map ~kinstr: - (IEmpty_map - (kinfo_unit, unit_cmp, halt (map unit_cmp unit @$ unit @$ bot))) + (IEmpty_map (kinfo_unit, unit, halt (map unit unit @$ unit @$ bot))) () (* let map_map_code = IMap_map - ( kinfo (map int_cmp unit @$ unit @$ bot), + ( kinfo (map int unit @$ unit @$ bot), ICdr (kinfo (cpair int unit @$ unit @$ bot), halt_unitunit), - halt (map int_cmp unit @$ unit @$ bot) ) + halt (map int unit @$ unit @$ bot) ) *) let map_map_code = IMap_map - ( kinfo (map int_cmp unit @$ unit @$ bot), + ( kinfo (map int unit @$ unit @$ bot), IFailwith (kinfo (cpair int unit @$ unit @$ bot), 0, cpair int unit), - halt (map int_cmp unit @$ unit @$ bot) ) + halt (map int unit @$ unit @$ bot) ) let () = (* @@ -1272,14 +1267,14 @@ module Registration_section = struct simple_benchmark ~name:Interpreter_workload.N_IMap_map ~intercept_stack: - (let map = Script_map.empty int_cmp in + (let map = Script_map.empty int in (map, ((), eos))) ~kinstr:map_map_code () let kmap_iter_code = IMap_iter - ( kinfo (map int_cmp unit @$ unit @$ bot), + ( kinfo (map int unit @$ unit @$ bot), IDrop (kinfo (cpair int unit @$ unit @$ bot), halt_unit), halt_unit ) @@ -1293,7 +1288,7 @@ module Registration_section = struct simple_benchmark ~name:Interpreter_workload.N_IMap_iter ~intercept_stack: - (let map = Script_map.empty int_cmp in + (let map = Script_map.empty int in (map, ((), eos))) ~kinstr:kmap_iter_code () @@ -1308,10 +1303,10 @@ module Registration_section = struct ~name:Interpreter_workload.N_IMap_mem ~kinstr: (IMap_mem - ( kinfo (int @$ map int_cmp unit @$ unit @$ bot), + ( kinfo (int @$ map int unit @$ unit @$ bot), halt (bool @$ unit @$ bot) )) ~intercept_stack: - (let map = Script_map.empty int_cmp in + (let map = Script_map.empty int in (Script_int.zero, (map, ((), eos)))) ~stack_sampler:(fun cfg rng_state () -> let (key, map) = generate_map_and_key_in_map cfg rng_state in @@ -1328,10 +1323,10 @@ module Registration_section = struct ~name:Interpreter_workload.N_IMap_get ~kinstr: (IMap_get - ( kinfo (int @$ map int_cmp unit @$ unit @$ bot), + ( kinfo (int @$ map int unit @$ unit @$ bot), halt (option unit @$ unit @$ bot) )) ~intercept_stack: - (let map = Script_map.empty int_cmp in + (let map = Script_map.empty int in (Script_int.zero, (map, ((), eos)))) ~stack_sampler:(fun cfg rng_state () -> let (key, map) = generate_map_and_key_in_map cfg rng_state in @@ -1348,10 +1343,10 @@ module Registration_section = struct ~name:Interpreter_workload.N_IMap_update ~kinstr: (IMap_update - ( kinfo (int @$ option unit @$ map int_cmp unit @$ bot), - halt (map int_cmp unit @$ bot) )) + ( kinfo (int @$ option unit @$ map int unit @$ bot), + halt (map int unit @$ bot) )) ~intercept_stack: - (let map = Script_map.empty int_cmp in + (let map = Script_map.empty int in (Script_int.zero, (None, (map, eos)))) ~stack_sampler:(fun cfg rng_state () -> let (key, map) = generate_map_and_key_in_map cfg rng_state in @@ -1369,10 +1364,10 @@ module Registration_section = struct ~name:Interpreter_workload.N_IMap_get_and_update ~kinstr: (IMap_get_and_update - ( kinfo (int @$ option unit @$ map int_cmp unit @$ bot), - halt (option unit @$ map int_cmp unit @$ bot) )) + ( kinfo (int @$ option unit @$ map int unit @$ bot), + halt (option unit @$ map int unit @$ bot) )) ~intercept_stack: - (let map = Script_map.empty int_cmp in + (let map = Script_map.empty int in (Script_int.zero, (None, (map, eos)))) ~stack_sampler:(fun cfg rng_state () -> let (key, map) = generate_map_and_key_in_map cfg rng_state in @@ -1388,9 +1383,9 @@ module Registration_section = struct *) simple_benchmark_with_stack_sampler ~name:Interpreter_workload.N_IMap_size - ~kinstr:(IMap_size (kinfo (map int_cmp unit @$ bot), halt (nat @$ bot))) + ~kinstr:(IMap_size (kinfo (map int unit @$ bot), halt (nat @$ bot))) ~stack_sampler:(fun _cfg _rng_state -> - let map = Script_map.empty int_cmp in + let map = Script_map.empty int in fun () -> (map, eos)) () end @@ -1405,7 +1400,7 @@ module Registration_section = struct let map = List.fold_left (fun map i -> Script_map.update i (Some (Some ())) map) - (Script_map.empty int_cmp) + (Script_map.empty int) keys in let (module M) = Script_map.get_module map in @@ -1417,9 +1412,7 @@ module Registration_section = struct raise_if_error (Lwt_main.run ( Execution_context.make ~rng_state >>=? fun (ctxt, _) -> - let big_map = - Script_ir_translator.empty_big_map int_cmp unit_t - in + let big_map = Script_ir_translator.empty_big_map int unit_t in Script_map.fold (fun k v acc -> acc >>=? fun (bm, ctxt_acc) -> @@ -1436,10 +1429,7 @@ module Registration_section = struct ~name:Interpreter_workload.N_IEmpty_big_map ~kinstr: (IEmpty_big_map - ( kinfo_unit, - unit_cmp, - unit, - halt (big_map unit_cmp unit @$ unit @$ bot) )) + (kinfo_unit, unit, unit, halt (big_map unit unit @$ unit @$ bot))) () let () = @@ -1453,7 +1443,7 @@ module Registration_section = struct ~name:Interpreter_workload.N_IBig_map_mem ~kinstr: (IBig_map_mem - ( kinfo (int @$ big_map int_cmp unit @$ unit @$ bot), + ( kinfo (int @$ big_map int unit @$ unit @$ bot), halt (bool @$ unit @$ bot) )) ~stack_sampler:(fun cfg rng_state () -> let (key, map) = generate_big_map_and_key_in_map cfg rng_state in @@ -1470,10 +1460,10 @@ module Registration_section = struct ~name:Interpreter_workload.N_IBig_map_get ~kinstr: (IBig_map_get - ( kinfo (int @$ big_map int_cmp unit @$ unit @$ bot), + ( kinfo (int @$ big_map int unit @$ unit @$ bot), halt (option unit @$ unit @$ bot) )) ~intercept_stack: - (let map = Script_ir_translator.empty_big_map int_cmp unit in + (let map = Script_ir_translator.empty_big_map int unit in (Script_int.zero, (map, ((), eos)))) ~stack_sampler:(fun cfg rng_state () -> let (key, map) = generate_big_map_and_key_in_map cfg rng_state in @@ -1490,10 +1480,10 @@ module Registration_section = struct ~name:Interpreter_workload.N_IBig_map_update ~kinstr: (IBig_map_update - ( kinfo (int @$ option unit @$ big_map int_cmp unit @$ bot), - halt (big_map int_cmp unit @$ bot) )) + ( kinfo (int @$ option unit @$ big_map int unit @$ bot), + halt (big_map int unit @$ bot) )) ~intercept_stack: - (let map = Script_ir_translator.empty_big_map int_cmp unit in + (let map = Script_ir_translator.empty_big_map int unit in (Script_int.zero, (None, (map, eos)))) ~stack_sampler:(fun cfg rng_state () -> let (key, map) = generate_big_map_and_key_in_map cfg rng_state in @@ -1511,10 +1501,10 @@ module Registration_section = struct ~name:Interpreter_workload.N_IBig_map_get_and_update ~kinstr: (IBig_map_get_and_update - ( kinfo (int @$ option unit @$ big_map int_cmp unit @$ bot), - halt (option unit @$ big_map int_cmp unit @$ bot) )) + ( kinfo (int @$ option unit @$ big_map int unit @$ bot), + halt (option unit @$ big_map int unit @$ bot) )) ~intercept_stack: - (let map = Script_ir_translator.empty_big_map int_cmp unit in + (let map = Script_ir_translator.empty_big_map int unit in (Script_int.zero, (None, (map, eos)))) ~stack_sampler:(fun cfg rng_state () -> let (key, map) = generate_big_map_and_key_in_map cfg rng_state in @@ -2657,7 +2647,7 @@ module Registration_section = struct simple_benchmark ~name:Interpreter_workload.N_ITicket ~kinstr: - (ITicket (kinfo (unit @$ nat @$ bot), halt (ticket unit_cmp @$ bot))) + (ITicket (kinfo (unit @$ nat @$ bot), halt (ticket unit @$ bot))) () let () = @@ -2665,13 +2655,12 @@ module Registration_section = struct ~name:Interpreter_workload.N_IRead_ticket ~kinstr: (IRead_ticket - ( kinfo (ticket unit_cmp @$ bot), - halt (cpair address (cpair unit nat) @$ ticket unit_cmp @$ bot) - )) + ( kinfo (ticket unit @$ bot), + halt (cpair address (cpair unit nat) @$ ticket unit @$ bot) )) () let split_ticket_instr = - let ticket_unit = ticket unit_cmp in + let ticket_unit = ticket unit in let (Ty_ex_c pair_ticket_unit_ticket_unit) = pair ticket_unit ticket_unit in @@ -2707,9 +2696,7 @@ module Registration_section = struct fun () -> let half_amount = Samplers.Random_value.value nat rng_state in let amount = Script_int.add_n half_amount half_amount in - let ticket = - Samplers.Random_value.value (ticket unit_cmp) rng_state - in + let ticket = Samplers.Random_value.value (ticket unit) rng_state in let ticket = {ticket with amount} in Ex_stack_and_kinstr { @@ -2719,11 +2706,11 @@ module Registration_section = struct () let join_tickets_instr = - let ticket_str = ticket string_cmp in + let ticket_str = ticket string in let (Ty_ex_c pair_ticket_str_ticket_str) = pair ticket_str ticket_str in IJoin_tickets ( kinfo (pair_ticket_str_ticket_str @$ bot), - string_cmp, + string, halt (option ticket_str @$ bot) ) let () = @@ -2736,7 +2723,7 @@ module Registration_section = struct in fun () -> let ticket = - Samplers.Random_value.value (ticket string_cmp) rng_state + Samplers.Random_value.value (ticket string) rng_state in let ticket = { @@ -2758,7 +2745,7 @@ module Registration_section = struct in fun () -> let ticket = - Samplers.Random_value.value (ticket string_cmp) rng_state + Samplers.Random_value.value (ticket string) rng_state in let alt_amount = Samplers.Random_value.value nat rng_state in let ticket' = {ticket with amount = alt_amount} in @@ -3055,7 +3042,7 @@ module Registration_section = struct let map_enter_body_code = let kbody = ICdr (kinfo (cpair int unit @$ unit @$ bot), halt_unitunit) in - fun accu -> KMap_enter_body (kbody, accu, Script_map.empty int_cmp, KNil) + fun accu -> KMap_enter_body (kbody, accu, Script_map.empty int, KNil) let () = (* diff --git a/src/proto_alpha/lib_benchmarks_proto/michelson_types.ml b/src/proto_alpha/lib_benchmarks_proto/michelson_types.ml index 9887d7b003597953e77e9157d9d09c29dec4ab1d..95af373691cceef4e6ee0ed7162e7c715ab16b89 100644 --- a/src/proto_alpha/lib_benchmarks_proto/michelson_types.ml +++ b/src/proto_alpha/lib_benchmarks_proto/michelson_types.ml @@ -34,12 +34,6 @@ let bot = Bot_t let unit = unit_t -let unit_cmp = unit_key - -let int_cmp = int_key - -let string_cmp = string_key - (* the type of integers *) let int = int_t @@ -98,7 +92,7 @@ let pair k1 k2 = (* comparable pair type constructor *) let cpair k1 k2 = - match pair_key (-1) k1 k2 with Error _ -> assert false | Ok t -> t + match comparable_pair_t (-1) k1 k2 with Error _ -> assert false | Ok t -> t (* union type constructor*) let union k1 k2 = @@ -106,7 +100,7 @@ let union k1 k2 = (* comparable union type constructor *) let cunion k1 k2 = - match union_key (-1) k1 k2 with Error _ -> assert false | Ok t -> t + match comparable_union_t (-1) k1 k2 with Error _ -> assert false | Ok t -> t let lambda x y = match lambda_t (-1) x y with Error _ -> assert false | Ok t -> t diff --git a/src/proto_alpha/lib_benchmarks_proto/ticket_benchmarks.ml b/src/proto_alpha/lib_benchmarks_proto/ticket_benchmarks.ml index a298d2522e262d16d67bb20c907f3c73706dde0c..46df2541fd293a8f603d4da5746b4281372855eb 100644 --- a/src/proto_alpha/lib_benchmarks_proto/ticket_benchmarks.ml +++ b/src/proto_alpha/lib_benchmarks_proto/ticket_benchmarks.ml @@ -169,7 +169,7 @@ let () = Registration_helpers.register (module Compare_key_contract_benchmark) (* A simple ticket type for use in the benchmarks. *) let ticket_ty = let open Script_typed_ir in - WithExceptions.Result.get_ok ~loc:__LOC__ (ticket_t (-1) int_key) + WithExceptions.Result.get_ok ~loc:__LOC__ (ticket_t (-1) int_t) (* A dummy type generator, sampling linear terms of a given size. The generator always returns types of the shape: diff --git a/src/proto_alpha/lib_benchmarks_proto/translator_benchmarks.ml b/src/proto_alpha/lib_benchmarks_proto/translator_benchmarks.ml index 558a77503f00c80e28a8440ff1c42fc648a7cb3d..2fbb2f6c48dde48f77302856c6b810e23eb6feed 100644 --- a/src/proto_alpha/lib_benchmarks_proto/translator_benchmarks.ml +++ b/src/proto_alpha/lib_benchmarks_proto/translator_benchmarks.ml @@ -646,13 +646,15 @@ let rec dummy_type_generator size = let rec dummy_comparable_type_generator size = let open Script_ir_translator in let open Script_typed_ir in - if size <= 0 then Ex_comparable_ty unit_key + if size <= 0 then Ex_comparable_ty unit_t else match dummy_comparable_type_generator (size - 2) with | Ex_comparable_ty r -> - let l = unit_key in + let l = unit_t in Ex_comparable_ty - (match pair_key (-1) l r with Error _ -> assert false | Ok t -> t) + (match comparable_pair_t (-1) l r with + | Error _ -> assert false + | Ok t -> t) module Parse_type_shared = struct type config = {max_size : int} diff --git a/src/proto_alpha/lib_protocol/script_ir_translator.ml b/src/proto_alpha/lib_protocol/script_ir_translator.ml index 6fe18495b5081e27b2192f6d25b7ffb80e1101f4..7036bc9a6aac3ac2da9658a261db8dba9f4598d8 100644 --- a/src/proto_alpha/lib_protocol/script_ir_translator.ml +++ b/src/proto_alpha/lib_protocol/script_ir_translator.ml @@ -1039,48 +1039,43 @@ let[@coq_struct "ty"] rec parse_comparable_ty : else match ty with | Prim (loc, T_unit, [], annot) -> - check_type_annot loc annot >|? fun () -> - (Ex_comparable_ty unit_key, ctxt) + check_type_annot loc annot >|? fun () -> (Ex_comparable_ty unit_t, ctxt) | Prim (loc, T_never, [], annot) -> - check_type_annot loc annot >|? fun () -> - (Ex_comparable_ty never_key, ctxt) + check_type_annot loc annot >|? fun () -> (Ex_comparable_ty never_t, ctxt) | Prim (loc, T_int, [], annot) -> - check_type_annot loc annot >|? fun () -> (Ex_comparable_ty int_key, ctxt) + check_type_annot loc annot >|? fun () -> (Ex_comparable_ty int_t, ctxt) | Prim (loc, T_nat, [], annot) -> - check_type_annot loc annot >|? fun () -> (Ex_comparable_ty nat_key, ctxt) + check_type_annot loc annot >|? fun () -> (Ex_comparable_ty nat_t, ctxt) | Prim (loc, T_signature, [], annot) -> check_type_annot loc annot >|? fun () -> - (Ex_comparable_ty signature_key, ctxt) + (Ex_comparable_ty signature_t, ctxt) | Prim (loc, T_string, [], annot) -> check_type_annot loc annot >|? fun () -> - (Ex_comparable_ty string_key, ctxt) + (Ex_comparable_ty string_t, ctxt) | Prim (loc, T_bytes, [], annot) -> - check_type_annot loc annot >|? fun () -> - (Ex_comparable_ty bytes_key, ctxt) + check_type_annot loc annot >|? fun () -> (Ex_comparable_ty bytes_t, ctxt) | Prim (loc, T_mutez, [], annot) -> - check_type_annot loc annot >|? fun () -> - (Ex_comparable_ty mutez_key, ctxt) + check_type_annot loc annot >|? fun () -> (Ex_comparable_ty mutez_t, ctxt) | Prim (loc, T_bool, [], annot) -> - check_type_annot loc annot >|? fun () -> - (Ex_comparable_ty bool_key, ctxt) + check_type_annot loc annot >|? fun () -> (Ex_comparable_ty bool_t, ctxt) | Prim (loc, T_key_hash, [], annot) -> check_type_annot loc annot >|? fun () -> - (Ex_comparable_ty key_hash_key, ctxt) + (Ex_comparable_ty key_hash_t, ctxt) | Prim (loc, T_key, [], annot) -> - check_type_annot loc annot >|? fun () -> (Ex_comparable_ty key_key, ctxt) + check_type_annot loc annot >|? fun () -> (Ex_comparable_ty key_t, ctxt) | Prim (loc, T_timestamp, [], annot) -> check_type_annot loc annot >|? fun () -> - (Ex_comparable_ty timestamp_key, ctxt) + (Ex_comparable_ty timestamp_t, ctxt) | Prim (loc, T_chain_id, [], annot) -> check_type_annot loc annot >|? fun () -> - (Ex_comparable_ty chain_id_key, ctxt) + (Ex_comparable_ty chain_id_t, ctxt) | Prim (loc, T_address, [], annot) -> check_type_annot loc annot >|? fun () -> - (Ex_comparable_ty address_key, ctxt) + (Ex_comparable_ty address_t, ctxt) | Prim (loc, T_tx_rollup_l2_address, [], annot) -> if Constants.tx_rollup_enable ctxt then check_type_annot loc annot >|? fun () -> - (Ex_comparable_ty tx_rollup_l2_address_key, ctxt) + (Ex_comparable_ty tx_rollup_l2_address_t, ctxt) else error @@ Tx_rollup_addresses_disabled loc | Prim ( loc, @@ -1103,7 +1098,8 @@ let[@coq_struct "ty"] rec parse_comparable_ty : >>? fun (Ex_comparable_ty right, ctxt) -> parse_comparable_ty ~stack_depth:(stack_depth + 1) ctxt left >>? fun (Ex_comparable_ty left, ctxt) -> - pair_key loc left right >|? fun ty -> (Ex_comparable_ty ty, ctxt) + comparable_pair_t loc left right >|? fun ty -> + (Ex_comparable_ty ty, ctxt) | Prim (loc, T_or, [left; right], annot) -> check_type_annot loc annot >>? fun () -> remove_field_annot left >>? fun left -> @@ -1112,14 +1108,15 @@ let[@coq_struct "ty"] rec parse_comparable_ty : >>? fun (Ex_comparable_ty right, ctxt) -> parse_comparable_ty ~stack_depth:(stack_depth + 1) ctxt left >>? fun (Ex_comparable_ty left, ctxt) -> - union_key loc left right >|? fun ty -> (Ex_comparable_ty ty, ctxt) + comparable_union_t loc left right >|? fun ty -> + (Ex_comparable_ty ty, ctxt) | Prim (loc, ((T_pair | T_or) as prim), l, _) -> error (Invalid_arity (loc, prim, 2, List.length l)) | Prim (loc, T_option, [t], annot) -> check_type_annot loc annot >>? fun () -> parse_comparable_ty ~stack_depth:(stack_depth + 1) ctxt t >>? fun (Ex_comparable_ty t, ctxt) -> - option_key loc t >|? fun ty -> (Ex_comparable_ty ty, ctxt) + comparable_option_t loc t >|? fun ty -> (Ex_comparable_ty ty, ctxt) | Prim (loc, T_option, l, _) -> error (Invalid_arity (loc, T_option, 1, List.length l)) | Prim @@ -2048,7 +2045,7 @@ let parse_uint11 = parse_uint ~nb_bits:11 (* This type is used to: - serialize and deserialize tickets when they are stored or transferred, - type the READ_TICKET instruction. *) -let opened_ticket_type loc ty = pair_3_key loc address_key ty nat_key +let opened_ticket_type loc ty = comparable_pair_3_t loc address_t ty nat_t (* -- parse data of primitive types -- *) @@ -5192,7 +5189,7 @@ and parse_toplevel : let allowed = [K_parameter; K_storage; K_code; K_view] in error (Invalid_primitive (loc, allowed, name)) in - find_fields ctxt None None None (Script_map.empty string_key) fields + find_fields ctxt None None None (Script_map.empty string_t) fields >>? fun (ctxt, toplevel) -> match toplevel with | (None, _, _, _) -> error (Missing_field K_parameter) diff --git a/src/proto_alpha/lib_protocol/script_typed_ir.ml b/src/proto_alpha/lib_protocol/script_typed_ir.ml index e934766c2e328064457c5ad4f94098d1a288b6e8..ee7e39bc3e5b7e00127cf18be4eefecdc82e4998 100644 --- a/src/proto_alpha/lib_protocol/script_typed_ir.ml +++ b/src/proto_alpha/lib_protocol/script_typed_ir.ml @@ -1842,56 +1842,30 @@ type 'v ty_ex_c = Ty_ex_c : ('v, _) ty -> 'v ty_ex_c [@@ocaml.unboxed] let unit_t = Unit_t -let unit_key = unit_t - let int_t = Int_t -let int_key = int_t - let nat_t = Nat_t -let nat_key = nat_t - let signature_t = Signature_t -let signature_key = signature_t - let string_t = String_t -let string_key = string_t - let bytes_t = Bytes_t -let bytes_key = bytes_t - let mutez_t = Mutez_t -let mutez_key = mutez_t - let key_hash_t = Key_hash_t -let key_hash_key = key_hash_t - let key_t = Key_t -let key_key = key_t - let timestamp_t = Timestamp_t -let timestamp_key = timestamp_t - let address_t = Address_t -let address_key = address_t - let bool_t = Bool_t -let bool_key = bool_t - let tx_rollup_l2_address_t = Tx_rollup_l2_address_t -let tx_rollup_l2_address_key = tx_rollup_l2_address_t - let pair_t : type a ac b bc. Script.location -> (a, ac) ty -> (b, bc) ty -> (a, b) pair ty_ex_c tzresult @@ -1901,11 +1875,12 @@ let pair_t : let (Ex_dand cmp) = dand (is_comparable l) (is_comparable r) in Ty_ex_c (Pair_t (l, r, {size}, cmp)) -let pair_key loc l r = +let comparable_pair_t loc l r = Type_size.compound2 loc (ty_size l) (ty_size r) >|? fun size -> Pair_t (l, r, {size}, YesYes) -let pair_3_key loc l m r = pair_key loc m r >>? fun r -> pair_key loc l r +let comparable_pair_3_t loc l m r = + comparable_pair_t loc m r >>? fun r -> comparable_pair_t loc l r let union_t : type a ac b bc. @@ -1919,7 +1894,7 @@ let union_t : let union_bytes_bool_t = Union_t (bytes_t, bool_t, {size = Type_size.three}, YesYes) -let union_key loc l r = +let comparable_union_t loc l r = Type_size.compound2 loc (ty_size l) (ty_size r) >|? fun size -> Union_t (l, r, {size}, YesYes) @@ -1964,7 +1939,7 @@ let option_pair_int_nat_t = {size = Type_size.four}, Yes ) -let option_key loc t = +let comparable_option_t loc t = Type_size.compound1 loc (ty_size t) >|? fun size -> Option_t (t, {size}, Yes) let list_t loc t = @@ -1999,12 +1974,8 @@ let sapling_state_t ~memo_size = Sapling_state_t memo_size let chain_id_t = Chain_id_t -let chain_id_key = chain_id_t - let never_t = Never_t -let never_key = never_t - let bls12_381_g1_t = Bls12_381_g1_t let bls12_381_g2_t = Bls12_381_g2_t diff --git a/src/proto_alpha/lib_protocol/script_typed_ir.mli b/src/proto_alpha/lib_protocol/script_typed_ir.mli index a1ea5b52702ae8c9ca422eabd60db18b5f86d21a..87f2c424bb26885ff02d2e53bf07da2d3a056db0 100644 --- a/src/proto_alpha/lib_protocol/script_typed_ir.mli +++ b/src/proto_alpha/lib_protocol/script_typed_ir.mli @@ -1554,58 +1554,6 @@ val is_comparable : ('v, 'c) ty -> 'c dbool type 'v ty_ex_c = Ty_ex_c : ('v, _) ty -> 'v ty_ex_c [@@ocaml.unboxed] -val unit_key : unit comparable_ty - -val never_key : never comparable_ty - -val int_key : z num comparable_ty - -val nat_key : n num comparable_ty - -val signature_key : signature comparable_ty - -val string_key : Script_string.t comparable_ty - -val bytes_key : Bytes.t comparable_ty - -val mutez_key : Tez.t comparable_ty - -val bool_key : bool comparable_ty - -val key_hash_key : public_key_hash comparable_ty - -val key_key : public_key comparable_ty - -val timestamp_key : Script_timestamp.t comparable_ty - -val chain_id_key : Script_chain_id.t comparable_ty - -val address_key : address comparable_ty - -val tx_rollup_l2_address_key : tx_rollup_l2_address comparable_ty - -val pair_key : - Script.location -> - 'a comparable_ty -> - 'b comparable_ty -> - ('a, 'b) pair comparable_ty tzresult - -val pair_3_key : - Script.location -> - 'a comparable_ty -> - 'b comparable_ty -> - 'c comparable_ty -> - ('a, ('b, 'c) pair) pair comparable_ty tzresult - -val union_key : - Script.location -> - 'a comparable_ty -> - 'b comparable_ty -> - ('a, 'b) union comparable_ty tzresult - -val option_key : - Script.location -> 'v comparable_ty -> 'v option comparable_ty tzresult - val unit_t : unit comparable_ty val int_t : z num comparable_ty @@ -1635,9 +1583,28 @@ val bool_t : bool comparable_ty val pair_t : Script.location -> ('a, _) ty -> ('b, _) ty -> ('a, 'b) pair ty_ex_c tzresult +val comparable_pair_t : + Script.location -> + 'a comparable_ty -> + 'b comparable_ty -> + ('a, 'b) pair comparable_ty tzresult + +val comparable_pair_3_t : + Script.location -> + 'a comparable_ty -> + 'b comparable_ty -> + 'c comparable_ty -> + ('a, ('b, 'c) pair) pair comparable_ty tzresult + val union_t : Script.location -> ('a, _) ty -> ('b, _) ty -> ('a, 'b) union ty_ex_c tzresult +val comparable_union_t : + Script.location -> + 'a comparable_ty -> + 'b comparable_ty -> + ('a, 'b) union comparable_ty tzresult + val union_bytes_bool_t : (Bytes.t, bool) union comparable_ty val lambda_t : @@ -1648,6 +1615,9 @@ val lambda_t : val option_t : Script.location -> ('v, 'c) ty -> ('v option, 'c) ty tzresult +val comparable_option_t : + Script.location -> 'v comparable_ty -> 'v option comparable_ty tzresult + val option_mutez_t : Tez.t option comparable_ty val option_string_t : Script_string.t option comparable_ty diff --git a/src/proto_alpha/lib_protocol/test/integration/gas/test_gas_costs.ml b/src/proto_alpha/lib_protocol/test/integration/gas/test_gas_costs.ml index 1f35489e470357a188533f73f66fa8048457ed30..ab5546d1fe6bc5e47677f8f98816d32000279f62 100644 --- a/src/proto_alpha/lib_protocol/test/integration/gas/test_gas_costs.ml +++ b/src/proto_alpha/lib_protocol/test/integration/gas/test_gas_costs.ml @@ -45,11 +45,11 @@ let forty_two_n = Script_int.abs forty_two let dummy_set = let open Script_set in - update forty_two true (empty Script_typed_ir.int_key) + update forty_two true (empty Script_typed_ir.int_t) let dummy_map = let open Script_map in - update forty_two (Some forty_two) (empty Script_typed_ir.int_key) + update forty_two (Some forty_two) (empty Script_typed_ir.int_t) let dummy_timestamp = Script_timestamp.of_zint (Z.of_int 42) @@ -148,7 +148,7 @@ let all_interpreter_costs = ("dipn", dipn 42); ("dropn", dropn 42); ("neq", neq); - ("compare", compare Script_typed_ir.int_key forty_two forty_two); + ("compare", compare Script_typed_ir.int_t forty_two forty_two); ( "concat_string_precheck", concat_string_precheck Script_list.(cons "42" empty) ); ("concat_string", concat_string (S.safe_int 42)); diff --git a/src/proto_alpha/lib_protocol/test/integration/michelson/test_interpretation.ml b/src/proto_alpha/lib_protocol/test/integration/michelson/test_interpretation.ml index e0a111a7e440c9023c1ea9a9a9dfb7bb08e12a57..631f4901db68f16b818b02a12dcbc1cbeaeecfa9 100644 --- a/src/proto_alpha/lib_protocol/test/integration/michelson/test_interpretation.ml +++ b/src/proto_alpha/lib_protocol/test/integration/michelson/test_interpretation.ml @@ -160,17 +160,15 @@ let test_stack_overflow_in_lwt () = in let stack = Bot_t in let item ty s = Item_t (ty, s) in - let unit_t = unit_t in - let unit_k = unit_key in let bool_t = bool_t in - big_map_t (-1) unit_k unit_t >>??= fun big_map_t -> + big_map_t (-1) unit_t unit_t >>??= fun big_map_t -> let descr kinstr = {kloc = 0; kbef = stack; kaft = stack; kinstr} in let kinfo s = {iloc = -1; kstack_ty = s} in let stack1 = item big_map_t Bot_t in let stack2 = item big_map_t (item big_map_t Bot_t) in let stack3 = item unit_t stack2 in let stack4 = item bool_t stack1 in - let push_empty_big_map k = IEmpty_big_map (kinfo stack, unit_k, unit_t, k) in + let push_empty_big_map k = IEmpty_big_map (kinfo stack, unit_t, unit_t, k) in let large_mem_seq n = let rec aux n acc = if n = 0 then acc diff --git a/src/proto_alpha/lib_protocol/test/integration/michelson/test_ticket_accounting.ml b/src/proto_alpha/lib_protocol/test/integration/michelson/test_ticket_accounting.ml index 76d0586a66f527cadf7f151426e8cb058b4f0c79..b5927986155f7a8b952e05a618d5eae4a703bf72 100644 --- a/src/proto_alpha/lib_protocol/test/integration/michelson/test_ticket_accounting.ml +++ b/src/proto_alpha/lib_protocol/test/integration/michelson/test_ticket_accounting.ml @@ -413,7 +413,7 @@ let transfer_operation ctxt ~src ~destination ~arg_type ~arg = let ticket_string_type = WithExceptions.Result.get_ok ~loc:__LOC__ - @@ Script_typed_ir.(ticket_t (-1) string_key) + @@ Script_typed_ir.(ticket_t (-1) string_t) let ticket_string_list_type = Result.value_f ~default:(fun _ -> assert false) @@ -481,18 +481,18 @@ let string_ticket_token ticketer content = let*? ticketer = Environment.wrap_tzresult @@ Contract.of_b58check ticketer in return (Ticket_token.Ex_token - {ticketer; contents_type = Script_typed_ir.string_key; contents}) + {ticketer; contents_type = Script_typed_ir.string_t; contents}) let test_diffs_empty () = let open Lwt_tzresult_syntax in let open Script_typed_ir in let* (_contract, ctxt) = init () in let*? int_ticket_big_map_ty = - big_map_type ~key_type:int_key ~value_type:ticket_string_type + big_map_type ~key_type:int_t ~value_type:ticket_string_type in (* Start with an empty big-map *) let* (empty_big_map, ctxt) = - empty_big_map ctxt ~key_type:int_key ~value_type:ticket_string_type + empty_big_map ctxt ~key_type:int_t ~value_type:ticket_string_type in assert_ticket_diffs ctxt @@ -623,17 +623,17 @@ let test_diffs_lazy_storage_alloc () = let open Script_typed_ir in let* (_contract, ctxt) = init () in let*? int_ticket_big_map_ty = - big_map_type ~key_type:int_key ~value_type:ticket_string_type + big_map_type ~key_type:int_t ~value_type:ticket_string_type in (* Start with an empty big-map *) let* (empty_big_map, ctxt) = - empty_big_map ctxt ~key_type:int_key ~value_type:ticket_string_type + empty_big_map ctxt ~key_type:int_t ~value_type:ticket_string_type in (* We add one ticket to the storage. *) let* (lazy_storage_diff, ctxt) = alloc_diff ctxt - ~key_type:int_key + ~key_type:int_t ~value_type:ticket_string_type [ ( Script_int.of_int 1, @@ -657,18 +657,18 @@ let test_diffs_remove_from_big_map () = let open Script_typed_ir in let* (contract, ctxt) = init () in let*? int_ticket_big_map_ty = - big_map_type ~key_type:int_key ~value_type:ticket_string_type + big_map_type ~key_type:int_t ~value_type:ticket_string_type in (* Start with an empty big-map *) let* (empty_big_map, ctxt) = - empty_big_map ctxt ~key_type:int_key ~value_type:ticket_string_type + empty_big_map ctxt ~key_type:int_t ~value_type:ticket_string_type in (* Remove one ticket from the lazy storage. *) let* (lazy_storage_diff, ctxt) = remove_diff ctxt contract - ~key_type:int_key + ~key_type:int_t ~value_type:ticket_string_type ~existing_entries: [ @@ -693,18 +693,18 @@ let test_diffs_copy_big_map () = let open Script_typed_ir in let* (contract, ctxt) = init () in let*? int_ticket_big_map_ty = - big_map_type ~key_type:int_key ~value_type:ticket_string_type + big_map_type ~key_type:int_t ~value_type:ticket_string_type in (* Start with an empty big-map *) let* (empty_big_map, ctxt) = - empty_big_map ctxt ~key_type:int_key ~value_type:ticket_string_type + empty_big_map ctxt ~key_type:int_t ~value_type:ticket_string_type in (* We add one ticket to the storage. *) let* (lazy_storage_diff, ctxt) = copy_diff ctxt contract - ~key_type:int_key + ~key_type:int_t ~value_type:ticket_string_type ~existing_entries: [ @@ -742,13 +742,13 @@ let test_diffs_add_to_existing_big_map () = let open Script_typed_ir in let* (contract, ctxt) = init () in let*? int_ticket_big_map_ty = - big_map_type ~key_type:int_key ~value_type:ticket_string_type + big_map_type ~key_type:int_t ~value_type:ticket_string_type in let* (old_storage, ctxt) = make_big_map ctxt contract - ~key_type:int_key + ~key_type:int_t ~value_type:ticket_string_type [ (* It doesn't matter what the old entries are. They are never traversed *) @@ -765,7 +765,7 @@ let test_diffs_add_to_existing_big_map () = existing_diff ctxt contract - ~key_type:int_key + ~key_type:int_t ~value_type:ticket_string_type ~existing_entries: [ @@ -806,14 +806,14 @@ let test_diffs_args_storage_and_lazy_diffs () = let open Script_typed_ir in let* (contract, ctxt) = init () in let*? int_ticket_big_map_ty = - big_map_type ~key_type:int_key ~value_type:ticket_string_type + big_map_type ~key_type:int_t ~value_type:ticket_string_type in let*? (Ty_ex_c list_big_map_pair_type) = Environment.wrap_tzresult @@ pair_t (-1) ticket_string_list_type int_ticket_big_map_ty in let* (empty_big_map, ctxt) = - empty_big_map ctxt ~key_type:int_key ~value_type:ticket_string_type + empty_big_map ctxt ~key_type:int_t ~value_type:ticket_string_type in (* We send two tickets in the args. *) let arg = @@ -828,7 +828,7 @@ let test_diffs_args_storage_and_lazy_diffs () = existing_diff ctxt contract - ~key_type:int_key + ~key_type:int_t ~value_type:ticket_string_type ~existing_entries:[] ~updates: diff --git a/src/proto_alpha/lib_protocol/test/integration/michelson/test_ticket_balance.ml b/src/proto_alpha/lib_protocol/test/integration/michelson/test_ticket_balance.ml index ceed895495d9d7701a374eeb621c4737926047c5..ca33275908f7d2de61f3329141d0d666a5ddf75b 100644 --- a/src/proto_alpha/lib_protocol/test/integration/michelson/test_ticket_balance.ml +++ b/src/proto_alpha/lib_protocol/test/integration/michelson/test_ticket_balance.ml @@ -157,11 +157,11 @@ let string_token ~ticketer content = WithExceptions.Result.get_ok ~loc:__LOC__ @@ Script_string.of_string content in Ticket_token.Ex_token - {ticketer; contents_type = Script_typed_ir.string_key; contents} + {ticketer; contents_type = Script_typed_ir.string_t; contents} let unit_ticket ~ticketer = Ticket_token.Ex_token - {ticketer; contents_type = Script_typed_ir.unit_key; contents = ()} + {ticketer; contents_type = Script_typed_ir.unit_t; contents = ()} let new_contracts ~before ~after = let all_contracts current_block = diff --git a/src/proto_alpha/lib_protocol/test/integration/michelson/test_ticket_lazy_storage_diff.ml b/src/proto_alpha/lib_protocol/test/integration/michelson/test_ticket_lazy_storage_diff.ml index bbf5b4827362cd26bdf30b327771ca2c30d86f18..c9818c6eb9b2d16e8a44d7e2d64798b63b1cdec0 100644 --- a/src/proto_alpha/lib_protocol/test/integration/michelson/test_ticket_lazy_storage_diff.ml +++ b/src/proto_alpha/lib_protocol/test/integration/michelson/test_ticket_lazy_storage_diff.ml @@ -112,7 +112,7 @@ let updates_of_key_values ctxt key_values = wrap (Script_ir_translator.hash_comparable_data ctxt - Script_typed_ir.int_key + Script_typed_ir.int_t (Script_int.of_int key)) in return diff --git a/src/proto_alpha/lib_protocol/test/integration/michelson/test_ticket_operations_diff.ml b/src/proto_alpha/lib_protocol/test/integration/michelson/test_ticket_operations_diff.ml index 668aefffca4fa9915e67074b0bc3d891345283e1..f9f07b9491bc6a5470168c221fbd0cd2d35f9f83 100644 --- a/src/proto_alpha/lib_protocol/test/integration/michelson/test_ticket_operations_diff.ml +++ b/src/proto_alpha/lib_protocol/test/integration/michelson/test_ticket_operations_diff.ml @@ -59,7 +59,7 @@ let big_map_updates_of_key_values ctxt key_values = wrap (Script_ir_translator.hash_comparable_data ctxt - Script_typed_ir.int_key + Script_typed_ir.int_t (Script_int.of_int key)) in return @@ -176,7 +176,7 @@ let string_token ~ticketer content = @@ Script_string.of_string content in Ticket_token.Ex_token - {ticketer; contents_type = Script_typed_ir.string_key; contents} + {ticketer; contents_type = Script_typed_ir.string_t; contents} (** Initializes one address for operations and one baker. *) let init ?tx_rollup_enable () = @@ -381,7 +381,7 @@ let ticket_big_map_script = |} let list_ticket_string_ty = - ticket_t Micheline.dummy_location string_key >>? fun ticket_ty -> + ticket_t Micheline.dummy_location string_t >>? fun ticket_ty -> list_t Micheline.dummy_location ticket_ty let make_ticket (ticketer, contents, amount) = @@ -1095,18 +1095,18 @@ let test_transfer_big_map_with_tickets () = in let open Lwt_tzresult_syntax in let*? value_type = - Environment.wrap_tzresult @@ ticket_t Micheline.dummy_location string_key + Environment.wrap_tzresult @@ ticket_t Micheline.dummy_location string_t in let*? parameters_ty = Environment.wrap_tzresult - @@ big_map_t Micheline.dummy_location int_key value_type + @@ big_map_t Micheline.dummy_location int_t value_type in let parameters = Big_map { id = Some big_map_id; diff = {map = Big_map_overlay.empty; size = 0}; - key_type = int_key; + key_type = int_t; value_type; } in @@ -1154,7 +1154,7 @@ let test_tx_rollup_deposit_one_ticket () = let* incr = Incremental.add_operation incr operation in let*? ticket_ty = - Script_typed_ir.(ticket_t Micheline.dummy_location string_key) + Script_typed_ir.(ticket_t Micheline.dummy_location string_t) |> Environment.wrap_tzresult in let*? (Ty_ex_c parameters_ty) = diff --git a/src/proto_alpha/lib_protocol/test/integration/michelson/test_ticket_scanner.ml b/src/proto_alpha/lib_protocol/test/integration/michelson/test_ticket_scanner.ml index 427c0bbd835a66ad7fd8c67d6564a9e06dcb22b0..a1601223180d6858a231ff13c978caa8b87d393f 100644 --- a/src/proto_alpha/lib_protocol/test/integration/michelson/test_ticket_scanner.ml +++ b/src/proto_alpha/lib_protocol/test/integration/michelson/test_ticket_scanner.ml @@ -184,7 +184,7 @@ let tickets_from_big_map_ref ~pre_populated value_exp = wrap @@ Script_ir_translator.hash_comparable_data ctxt - Script_typed_ir.int_key + Script_typed_ir.int_t (Script_int.of_int key) in return diff --git a/src/proto_alpha/lib_protocol/test/integration/michelson/test_typechecking.ml b/src/proto_alpha/lib_protocol/test/integration/michelson/test_typechecking.ml index be2a0ae79b1513aeb51884c02656089571334a83..978e10fe7f4881660ebe595262a92e50c7526fa9 100644 --- a/src/proto_alpha/lib_protocol/test/integration/michelson/test_typechecking.ml +++ b/src/proto_alpha/lib_protocol/test/integration/michelson/test_typechecking.ml @@ -307,9 +307,9 @@ let test_unparse_comb_comparable_type () = let open Script in let open Script_typed_ir in let nat_prim = Prim ((), T_nat, [], []) in - let nat_ty = nat_key in + let nat_ty = nat_t in let pair_prim l = Prim ((), T_pair, l, []) in - let pair_ty ty1 ty2 = pair_key (-1) ty1 ty2 in + let pair_ty ty1 ty2 = comparable_pair_t (-1) ty1 ty2 in let pair_prim2 a b = pair_prim [a; b] in let pair_nat_nat_prim = pair_prim2 nat_prim nat_prim in pair_ty nat_ty nat_ty >>??= fun pair_nat_nat_ty -> @@ -381,7 +381,7 @@ let test_parse_comb_data () = let pair_prim2 a b = pair_prim [a; b] in let pair_z_z_prim = pair_prim2 z_prim z_prim in list_t (-1) nat_ty >>??= fun list_nat_ty -> - big_map_t (-1) nat_key nat_ty >>??= fun big_map_nat_nat_ty -> + big_map_t (-1) nat_ty nat_ty >>??= fun big_map_nat_nat_ty -> test_context_with_nat_nat_big_map () >>=? fun (ctxt, big_map_id) -> (* Pair 0 0 *) test_parse_data __LOC__ ctxt pair_nat_nat_ty pair_z_z_prim (z, z) @@ -452,9 +452,7 @@ let test_parse_comb_data () = let expected_big_map = let open Script_typed_ir in let diff = {map = Big_map_overlay.empty; size = 0} in - let nat_key_ty = nat_key in - Big_map - {id = Some big_map_id; diff; key_type = nat_key_ty; value_type = nat_ty} + Big_map {id = Some big_map_id; diff; key_type = nat_ty; value_type = nat_ty} in let ty_equal : type a ac1 ac2. diff --git a/src/proto_alpha/lib_protocol/test/integration/operations/test_tx_rollup.ml b/src/proto_alpha/lib_protocol/test/integration/operations/test_tx_rollup.ml index 06659ba0125495a23f1e5cc6fb54f4f1182095cc..7843633c3095854300761661305524d4616fd2e6 100644 --- a/src/proto_alpha/lib_protocol/test/integration/operations/test_tx_rollup.ml +++ b/src/proto_alpha/lib_protocol/test/integration/operations/test_tx_rollup.ml @@ -491,7 +491,7 @@ module Nat_ticket = struct @@ Script_int.(of_int contents_nat |> is_nat) in Ticket_token.Ex_token - {ticketer; contents_type = Script_typed_ir.nat_key; contents} + {ticketer; contents_type = Script_typed_ir.nat_t; contents} let contents = Expr.from_string (string_of_int contents_nat) diff --git a/src/proto_alpha/lib_protocol/test/pbt/test_script_comparison.ml b/src/proto_alpha/lib_protocol/test/pbt/test_script_comparison.ml index 3031db1659abb034ef5f3af5db7e25ed121d2b8a..dc0c058730dc43d0d76cefe66b6fb2fb2d55a1e4 100644 --- a/src/proto_alpha/lib_protocol/test/pbt/test_script_comparison.ml +++ b/src/proto_alpha/lib_protocol/test/pbt/test_script_comparison.ml @@ -342,7 +342,9 @@ let test_pack_unpack = comparable_data_arbitrary (fun (Ex_comparable_data (ty, x)) -> let oty = - match option_key (-1) ty with Ok ty -> ty | Error _ -> assert false + match comparable_option_t (-1) ty with + | Ok ty -> ty + | Error _ -> assert false in qcheck_eq ~cmp:(Script_comparable.compare_comparable oty)