diff --git a/src/proto_alpha/lib_benchmark/michelson_samplers.ml b/src/proto_alpha/lib_benchmark/michelson_samplers.ml index b522cca91740dc694785aff653a4cfabe123dc7c..f1b643175a664240a956449b33cc343a5932c412 100644 --- a/src/proto_alpha/lib_benchmark/michelson_samplers.ml +++ b/src/proto_alpha/lib_benchmark/michelson_samplers.ml @@ -538,10 +538,11 @@ end) let* c = originated in let* entrypoint = entrypoint in let destination = Alpha_context.Destination.Contract (Originated c) in - let destination = - Typed_destination.Internal_for_tests.typed_exn arg_ty destination - in - return (Typed_contract {arg_ty; destination; entrypoint}) + return + (Typed_contract.Internal_for_tests.typed_exn + arg_ty + destination + entrypoint) let generate_sc_rollup_contract : type arg argc. @@ -552,10 +553,11 @@ end) let* ru = sc_rollup in let* entrypoint = entrypoint in let destination = Alpha_context.Destination.Sc_rollup ru in - let destination = - Typed_destination.Internal_for_tests.typed_exn arg_ty destination - in - return (Typed_contract {arg_ty; destination; entrypoint}) + return + (Typed_contract.Internal_for_tests.typed_exn + arg_ty + destination + entrypoint) let generate_any_type_contract : type arg argc. @@ -582,10 +584,11 @@ end) Alpha_context.Destination.Contract (Implicit pkh) in let entrypoint = Alpha_context.Entrypoint.default in - let destination = - Typed_destination.Internal_for_tests.typed_exn arg_ty destination - in - return (Typed_contract {arg_ty; destination; entrypoint}) + return + (Typed_contract.Internal_for_tests.typed_exn + arg_ty + destination + entrypoint) else generate_any_type_contract arg_ty | Pair_t (Ticket_t _, Tx_rollup_l2_address_t, _, _) -> let* b = Base_samplers.uniform_bool in @@ -593,10 +596,11 @@ end) let* tx_rollup = tx_rollup in let destination = Alpha_context.Destination.Tx_rollup tx_rollup in let entrypoint = Alpha_context.Tx_rollup.deposit_entrypoint in - let destination = - Typed_destination.Internal_for_tests.typed_exn arg_ty destination - in - return (Typed_contract {arg_ty; destination; entrypoint}) + return + (Typed_contract.Internal_for_tests.typed_exn + arg_ty + destination + entrypoint) else generate_any_type_contract arg_ty | _ -> generate_any_type_contract arg_ty diff --git a/src/proto_alpha/lib_plugin/RPC.ml b/src/proto_alpha/lib_plugin/RPC.ml index 3134da934873edf2bc75b7e788989e78560865db..771fcefd31ce27d574f710aa3899a78c31ecb6ba 100644 --- a/src/proto_alpha/lib_plugin/RPC.ml +++ b/src/proto_alpha/lib_plugin/RPC.ml @@ -518,9 +518,8 @@ module Scripts = struct {log_exit; log_entry; log_interp; get_log; log_control} let execute ctxt step_constants ~script ~entrypoint ~parameter = - let open Script_interpreter in let logger = trace_logger () in - execute + Script_interpreter.execute ~logger ~cached_script:None ctxt diff --git a/src/proto_alpha/lib_protocol/apply.ml b/src/proto_alpha/lib_protocol/apply.ml index 43b9fbb2ffb1e935a247654c25431694c1381b39..58b03e065f7fc73491a119fa2413caa92d17929f 100644 --- a/src/proto_alpha/lib_protocol/apply.ml +++ b/src/proto_alpha/lib_protocol/apply.ml @@ -3118,10 +3118,6 @@ let apply_liquidity_baking_subsidy ctxt ~toggle_vote = level; } in - let parameter = - Micheline.strip_locations - Michelson_v1_primitives.(Prim (0, D_Unit, [], [])) - in (* Call CPPM default entrypoint with parameter Unit. This is necessary for the CPMM's xtz_pool in storage to @@ -3133,13 +3129,15 @@ let apply_liquidity_baking_subsidy ctxt ~toggle_vote = - storage burn (extra storage is free) - fees (the operation is mandatory) *) - Script_interpreter.execute + Script_interpreter.execute_with_typed_parameter ctxt Optimized step_constants ~script - ~parameter + ~parameter:() + ~parameter_ty:Unit_t ~cached_script:(Some script_ir) + ~location:Micheline.dummy_location ~entrypoint:Entrypoint.default ~internal:false >>=? fun ( { diff --git a/src/proto_alpha/lib_protocol/script_interpreter.ml b/src/proto_alpha/lib_protocol/script_interpreter.ml index f57b42b8efea904fdb56e0261f0a32a816380312..0432fb11ef57b5ef64375da4393e693450546d98 100644 --- a/src/proto_alpha/lib_protocol/script_interpreter.ml +++ b/src/proto_alpha/lib_protocol/script_interpreter.ml @@ -1101,8 +1101,9 @@ and step : type a s b t r f. (a, s, b, t, r, f) step_type = >>=? fun (opt, ctxt, gas) -> (step [@ocaml.tailcall]) (ctxt, sc) gas k ks opt stack | IAddress (_, k) -> - let (Typed_contract {destination; entrypoint; _}) = accu in - let destination = Typed_destination.untyped destination in + let typed_contract = accu in + let destination = Typed_contract.destination typed_contract in + let entrypoint = Typed_contract.entrypoint typed_contract in let address = {destination; entrypoint} in (step [@ocaml.tailcall]) g gas k ks address stack | IContract (loc, t, entrypoint, k) -> ( @@ -1128,24 +1129,13 @@ and step : type a s b t r f. (a, s, b, t, r, f) step_type = | None -> (step [@ocaml.tailcall]) (ctxt, sc) gas k ks None stack) | ITransfer_tokens (loc, k) -> let p = accu in - let amount, (Typed_contract {arg_ty; destination; entrypoint}, stack) - = - stack - in - transfer (ctxt, sc) gas amount loc arg_ty p destination entrypoint + let amount, (typed_contract, stack) = stack in + transfer (ctxt, sc) gas amount loc typed_contract p >>=? fun (accu, ctxt, gas) -> (step [@ocaml.tailcall]) (ctxt, sc) gas k ks accu stack | IImplicit_account (_, k) -> let key = accu in - let arg_ty = unit_t in - let res = - Typed_contract - { - arg_ty; - destination = Typed_implicit key; - entrypoint = Entrypoint.default; - } - in + let res = Typed_implicit key in (step [@ocaml.tailcall]) g gas k ks res stack | IView (_, view_signature, stack_ty, k) -> (iview [@ocaml.tailcall]) @@ -1226,8 +1216,9 @@ and step : type a s b t r f. (a, s, b, t, r, f) step_type = let res = {destination; entrypoint = Entrypoint.default} in (step [@ocaml.tailcall]) g gas k ks res (accu, stack) | ISelf (_, ty, entrypoint, k) -> - let destination = Typed_originated sc.self in - let res = Typed_contract {arg_ty = ty; destination; entrypoint} in + let res = + Typed_originated {arg_ty = ty; contract_hash = sc.self; entrypoint} + in (step [@ocaml.tailcall]) g gas k ks res (accu, stack) | ISelf_address (_, k) -> let destination : Destination.t = Contract (Originated sc.self) in diff --git a/src/proto_alpha/lib_protocol/script_interpreter_defs.ml b/src/proto_alpha/lib_protocol/script_interpreter_defs.ml index bff19c21f1c6670d4e6aba3b1827b8755a0b7878..67f8fa5791c623e34a8548b06dda11758524d6d1 100644 --- a/src/proto_alpha/lib_protocol/script_interpreter_defs.ml +++ b/src/proto_alpha/lib_protocol/script_interpreter_defs.ml @@ -463,7 +463,7 @@ let apply ctxt gas capture_ty capture lam = let gas, ctxt = local_gas_counter_and_outdated_context ctxt in return (lam', ctxt, gas) -let make_transaction_to_tx_rollup (type t) ctxt ~destination ~amount ~entrypoint +let make_transaction_to_tx_rollup (type t) ctxt ~destination ~amount ~(parameters_ty : ((t ticket, tx_rollup_l2_address) pair, _) ty) ~parameters = (* The entrypoints of a transaction rollup are polymorphic wrt. the @@ -479,10 +479,6 @@ let make_transaction_to_tx_rollup (type t) ctxt ~destination ~amount ~entrypoint the type of the ticket. *) error_unless Tez.(amount = zero) Rollup_invalid_transaction_amount >>?= fun () -> - error_unless - Entrypoint.(entrypoint = Tx_rollup.deposit_entrypoint) - (Script_tc_errors.No_such_entrypoint entrypoint) - >>?= fun () -> let (Pair_t (Ticket_t (tp, _), _, _, _)) = parameters_ty in unparse_data ctxt Optimized parameters_ty parameters >>=? fun (unparsed_parameters, ctxt) -> @@ -541,30 +537,27 @@ let emit_event (type t tc) (ctxt, sc) gas ~(event_type : (t, tc) ty) creates an operation that transfers an amount of [tez] to a destination and an entrypoint instantiated with argument [parameters] of type [parameters_ty]. *) -let transfer (type t tc) (ctxt, sc) gas amount location - (parameters_ty : (t, tc) ty) (parameters : t) - (destination : t typed_destination) entrypoint = +let transfer (type t) (ctxt, sc) gas amount location + (typed_contract : t typed_contract) (parameters : t) = let ctxt = update_context gas ctxt in - collect_lazy_storage ctxt parameters_ty parameters - >>?= fun (to_duplicate, ctxt) -> - let to_update = no_lazy_storage_id in - extract_lazy_storage_diff - ctxt - Optimized - parameters_ty - parameters - ~to_duplicate - ~to_update - ~temporary:true - >>=? fun (parameters, lazy_storage_diff, ctxt) -> - (match destination with + (match typed_contract with | Typed_implicit destination -> - let Unit_t = parameters_ty in let () = parameters in - (if Entrypoint.is_default entrypoint then Result.return_unit - else error (Script_tc_errors.No_such_entrypoint entrypoint)) - >>?= fun () -> return (Transaction_to_implicit {destination; amount}, ctxt) - | Typed_originated destination -> + return (Transaction_to_implicit {destination; amount}, None, ctxt) + | Typed_originated + {arg_ty = parameters_ty; contract_hash = destination; entrypoint} -> + collect_lazy_storage ctxt parameters_ty parameters + >>?= fun (to_duplicate, ctxt) -> + let to_update = no_lazy_storage_id in + extract_lazy_storage_diff + ctxt + Optimized + parameters_ty + parameters + ~to_duplicate + ~to_update + ~temporary:true + >>=? fun (parameters, lazy_storage_diff, ctxt) -> unparse_data ctxt Optimized parameters_ty parameters >>=? fun (unparsed_parameters, ctxt) -> Lwt.return @@ -583,24 +576,27 @@ let transfer (type t tc) (ctxt, sc) gas amount location parameters; unparsed_parameters; }, + lazy_storage_diff, ctxt ) ) - | Typed_tx_rollup destination -> + | Typed_tx_rollup {arg_ty = parameters_ty; tx_rollup = destination} -> make_transaction_to_tx_rollup ctxt ~destination ~amount - ~entrypoint ~parameters_ty ~parameters - | Typed_sc_rollup destination -> + >|=? fun (operation, ctxt) -> (operation, None, ctxt) + | Typed_sc_rollup + {arg_ty = parameters_ty; sc_rollup = destination; entrypoint} -> make_transaction_to_sc_rollup ctxt ~destination ~amount ~entrypoint ~parameters_ty - ~parameters) - >>=? fun (operation, ctxt) -> + ~parameters + >|=? fun (operation, ctxt) -> (operation, None, ctxt)) + >>=? fun (operation, lazy_storage_diff, ctxt) -> fresh_internal_nonce ctxt >>?= fun (ctxt, nonce) -> let iop = {source = Contract.Originated sc.self; operation; nonce} in let res = {piop = Internal_operation iop; lazy_storage_diff} in diff --git a/src/proto_alpha/lib_protocol/script_ir_translator.ml b/src/proto_alpha/lib_protocol/script_ir_translator.ml index 08569a251d5b04e9cfa8d70d006b80e862c25ec9..c224c3471340d60fa4464bd2a499032d3c11023a 100644 --- a/src/proto_alpha/lib_protocol/script_ir_translator.ml +++ b/src/proto_alpha/lib_protocol/script_ir_translator.ml @@ -373,9 +373,9 @@ let unparse_tx_rollup_l2_address ~loc ctxt mode let b58check = Tx_rollup_l2_address.to_b58check tx_address in (String (loc, b58check), ctxt) -let unparse_contract ~loc ctxt mode - (Typed_contract {arg_ty = _; destination; entrypoint}) = - let destination = Typed_destination.untyped destination in +let unparse_contract ~loc ctxt mode typed_contract = + let destination = Typed_contract.destination typed_contract in + let entrypoint = Typed_contract.entrypoint typed_contract in let address = {destination; entrypoint} in unparse_address ~loc ctxt mode address @@ -4922,11 +4922,7 @@ and parse_contract : (* An implicit account on the "default" entrypoint always exists and has type unit. *) Gas_monad.run ctxt @@ ty_eq ~error_details arg unit_t >|? fun (eq, ctxt) -> - ( ctxt, - eq >|? fun Eq -> - let destination = Typed_implicit pkh in - (Typed_contract {arg_ty = arg; destination; entrypoint} - : arg typed_contract) ) + (ctxt, eq >|? fun Eq : arg typed_contract -> Typed_implicit pkh) else (* An implicit account on any other entrypoint is not a valid contract. *) ok (error ctxt (fun _loc -> No_such_entrypoint entrypoint))) @@ -4966,8 +4962,7 @@ and parse_contract : >|? fun (entrypoint_arg, ctxt) -> ( ctxt, entrypoint_arg >|? fun (entrypoint, arg_ty) -> - let destination = Typed_originated contract_hash in - Typed_contract {arg_ty; destination; entrypoint} )) )) + Typed_originated {arg_ty; contract_hash; entrypoint} )) )) | Tx_rollup tx_rollup -> Tx_rollup_state.assert_exist ctxt tx_rollup >|=? fun ctxt -> if Entrypoint.(entrypoint = Tx_rollup.deposit_entrypoint) then @@ -4975,10 +4970,9 @@ and parse_contract : [parse_tx_rollup_deposit_parameters]. *) match arg with | Pair_t (Ticket_t (_, _), Tx_rollup_l2_address_t, _, _) -> - let destination = Typed_tx_rollup tx_rollup in ( ctxt, ok - @@ (Typed_contract {arg_ty = arg; destination; entrypoint} + @@ (Typed_tx_rollup {arg_ty = arg; tx_rollup} : arg typed_contract) ) | _ -> error ctxt (fun loc -> @@ -5017,8 +5011,7 @@ and parse_contract : >|? fun (entrypoint_arg, ctxt) -> ( ctxt, entrypoint_arg >|? fun (entrypoint, arg_ty) -> - let destination = Typed_sc_rollup sc_rollup in - Typed_contract {arg_ty; destination; entrypoint} )) + Typed_sc_rollup {arg_ty; sc_rollup; entrypoint} )) (* Same as [parse_contract], but does not fail when the contact is missing or if the expected type doesn't match the actual one. In that case None is diff --git a/src/proto_alpha/lib_protocol/script_typed_ir.ml b/src/proto_alpha/lib_protocol/script_typed_ir.ml index fd4dc38337444cf9b89a8afc98047fe3b5743fa8..60514a7975b4373920e4445072a319aecf99879d 100644 --- a/src/proto_alpha/lib_protocol/script_typed_ir.ml +++ b/src/proto_alpha/lib_protocol/script_typed_ir.ml @@ -1109,18 +1109,22 @@ and ('arg, 'ret) lambda = ('arg, end_of_stack, 'ret, end_of_stack) kdescr * Script.node -> ('arg, 'ret) lambda -and 'arg typed_destination = - | Typed_implicit : public_key_hash -> unit typed_destination - | Typed_originated of Contract_hash.t - | Typed_tx_rollup : - Tx_rollup.t - -> (_ ticket, tx_rollup_l2_address) pair typed_destination - | Typed_sc_rollup of Sc_rollup.t - and 'arg typed_contract = - | Typed_contract : { + | Typed_implicit : public_key_hash -> unit typed_contract + | Typed_originated : { + arg_ty : ('arg, _) ty; + contract_hash : Contract_hash.t; + entrypoint : Entrypoint.t; + } + -> 'arg typed_contract + | Typed_tx_rollup : { + arg_ty : (('a ticket, tx_rollup_l2_address) pair, _) ty; + tx_rollup : Tx_rollup.t; + } + -> ('a ticket, tx_rollup_l2_address) pair typed_contract + | Typed_sc_rollup : { arg_ty : ('arg, _) ty; - destination : 'arg typed_destination; + sc_rollup : Sc_rollup.t; entrypoint : Entrypoint.t; } -> 'arg typed_contract @@ -2148,30 +2152,45 @@ let value_traverse (type t tc) (ty : (t, tc) ty) (x : t) init f = let stack_top_ty : type a b s. (a, b * s) stack_ty -> a ty_ex_c = function | Item_t (ty, _) -> Ty_ex_c ty -module Typed_destination = struct - let untyped : type a. a typed_destination -> Destination.t = function +module Typed_contract = struct + let destination : type a. a typed_contract -> Destination.t = function | Typed_implicit pkh -> Destination.Contract (Implicit pkh) - | Typed_originated contract_hash -> + | Typed_originated {contract_hash; _} -> Destination.Contract (Originated contract_hash) - | Typed_tx_rollup tx_rollup -> Destination.Tx_rollup tx_rollup - | Typed_sc_rollup sc_rollup -> Destination.Sc_rollup sc_rollup + | Typed_tx_rollup {tx_rollup; _} -> Destination.Tx_rollup tx_rollup + | Typed_sc_rollup {sc_rollup; _} -> Destination.Sc_rollup sc_rollup + + let arg_ty : type a. a typed_contract -> a ty_ex_c = function + | Typed_implicit _ -> (Ty_ex_c Unit_t : a ty_ex_c) + | Typed_originated {arg_ty; _} -> Ty_ex_c arg_ty + | Typed_tx_rollup {arg_ty; _} -> Ty_ex_c arg_ty + | Typed_sc_rollup {arg_ty; _} -> Ty_ex_c arg_ty + + let entrypoint : type a. a typed_contract -> Entrypoint.t = function + | Typed_implicit _ -> Entrypoint.default + | Typed_tx_rollup _ -> Tx_rollup.deposit_entrypoint + | Typed_originated {entrypoint; _} | Typed_sc_rollup {entrypoint; _} -> + entrypoint module Internal_for_tests = struct let typed_exn : - type a ac. (a, ac) ty -> Destination.t -> a typed_destination = - fun ty destination -> - match (destination, ty) with + type a ac. + (a, ac) ty -> Destination.t -> Entrypoint.t -> a typed_contract = + fun arg_ty destination entrypoint -> + match (destination, arg_ty) with | Contract (Implicit pkh), Unit_t -> Typed_implicit pkh | Contract (Implicit _), _ -> invalid_arg "Implicit contracts expect type unit" - | Contract (Originated contract_hash), _ -> Typed_originated contract_hash + | Contract (Originated contract_hash), _ -> + Typed_originated {arg_ty; contract_hash; entrypoint} | Tx_rollup tx_rollup, Pair_t (Ticket_t _, Tx_rollup_l2_address_t, _, _) -> - Typed_tx_rollup tx_rollup + (Typed_tx_rollup {arg_ty; tx_rollup} : a typed_contract) | Tx_rollup _, _ -> invalid_arg "Transaction rollups expect type (pair (ticket _) \ tx_rollup_l2_address)" - | Sc_rollup sc_rollup, _ -> Typed_sc_rollup sc_rollup + | Sc_rollup sc_rollup, _ -> + Typed_sc_rollup {arg_ty; sc_rollup; entrypoint} end end diff --git a/src/proto_alpha/lib_protocol/script_typed_ir.mli b/src/proto_alpha/lib_protocol/script_typed_ir.mli index 2b7e742450d68af201076e476d9d0747f9155b77..010b1ab6f20abd2681836ab42021857aac8121da 100644 --- a/src/proto_alpha/lib_protocol/script_typed_ir.mli +++ b/src/proto_alpha/lib_protocol/script_typed_ir.mli @@ -1110,18 +1110,22 @@ and ('arg, 'ret) lambda = ('arg, end_of_stack, 'ret, end_of_stack) kdescr * Script.node -> ('arg, 'ret) lambda -and 'arg typed_destination = - | Typed_implicit : public_key_hash -> unit typed_destination - | Typed_originated of Contract_hash.t - | Typed_tx_rollup : - Tx_rollup.t - -> (_ ticket, tx_rollup_l2_address) pair typed_destination - | Typed_sc_rollup of Sc_rollup.t - and 'arg typed_contract = - | Typed_contract : { + | Typed_implicit : public_key_hash -> unit typed_contract + | Typed_originated : { + arg_ty : ('arg, _) ty; + contract_hash : Contract_hash.t; + entrypoint : Entrypoint.t; + } + -> 'arg typed_contract + | Typed_tx_rollup : { + arg_ty : (('a ticket, tx_rollup_l2_address) pair, _) ty; + tx_rollup : Tx_rollup.t; + } + -> ('a ticket, tx_rollup_l2_address) pair typed_contract + | Typed_sc_rollup : { arg_ty : ('arg, _) ty; - destination : 'arg typed_destination; + sc_rollup : Sc_rollup.t; entrypoint : Entrypoint.t; } -> 'arg typed_contract @@ -1750,13 +1754,18 @@ val value_traverse : ('t, _) ty -> 't -> 'r -> 'r value_traverse -> 'r val stack_top_ty : ('a, 'b * 's) stack_ty -> 'a ty_ex_c -module Typed_destination : sig - val untyped : _ typed_destination -> Destination.t +module Typed_contract : sig + val destination : _ typed_contract -> Destination.t + + val arg_ty : 'a typed_contract -> 'a ty_ex_c + + val entrypoint : _ typed_contract -> Entrypoint.t module Internal_for_tests : sig (* This function doesn't guarantee that the contract is well-typed wrt its registered type at origination, it only guarantees that the type is plausible wrt to the destination kind. *) - val typed_exn : ('a, _) ty -> Destination.t -> 'a typed_destination + val typed_exn : + ('a, _) ty -> Destination.t -> Entrypoint.t -> 'a typed_contract end end diff --git a/src/proto_alpha/lib_protocol/script_typed_ir_size.ml b/src/proto_alpha/lib_protocol/script_typed_ir_size.ml index b7d7813edf31dc9ed6f19cdc4f10dbe0444b04e7..0e463f1172dbc101f5f9440c7f305c1e1ed2c042 100644 --- a/src/proto_alpha/lib_protocol/script_typed_ir_size.ml +++ b/src/proto_alpha/lib_protocol/script_typed_ir_size.ml @@ -133,12 +133,6 @@ let address_size addr = +! destination_size addr.destination +! Entrypoint.in_memory_size addr.entrypoint -let typed_destination_size : type a. a typed_destination -> sint = function - | Typed_implicit _ -> h1w +! public_key_hash_in_memory_size - | Typed_originated _ -> h1w +! blake2b_hash_size - | Typed_tx_rollup k -> h1w +! Tx_rollup.in_memory_size k - | Typed_sc_rollup k -> h1w +! Sc_rollup.in_memory_size k - let tx_rollup_l2_address_size (tx : tx_rollup_l2_address) = Tx_rollup_l2_address.Indexable.in_memory_size @@ Indexable.forget tx @@ -185,12 +179,20 @@ let comb_set_gadt_witness_size n (_w : (_, _, _) comb_set_gadt_witness) = let dup_n_gadt_witness_size n (_w : (_, _, _, _) dup_n_gadt_witness) = peano_shape_proof n -let contract_size (Typed_contract {arg_ty; destination; entrypoint}) = - ret_adding - (ty_size arg_ty) - (h3w - +! typed_destination_size destination - +! Entrypoint.in_memory_size entrypoint) +let contract_size : type t. t typed_contract -> nodes_and_size = function + | Typed_implicit _ -> ret_adding zero (h1w +! public_key_hash_in_memory_size) + | Typed_originated {arg_ty; contract_hash = _; entrypoint} -> + ret_adding + (ty_size arg_ty) + (h3w +! blake2b_hash_size +! Entrypoint.in_memory_size entrypoint) + | Typed_tx_rollup {arg_ty; tx_rollup} -> + ret_adding (ty_size arg_ty) (h2w +! Tx_rollup.in_memory_size tx_rollup) + | Typed_sc_rollup {arg_ty; sc_rollup; entrypoint} -> + ret_adding + (ty_size arg_ty) + (h3w + +! Sc_rollup.in_memory_size sc_rollup + +! Entrypoint.in_memory_size entrypoint) let sapling_state_size {Sapling.id; diff; memo_size} = h3w diff --git a/src/proto_alpha/lib_protocol/test/integration/michelson/test_script_typed_ir_size.ml b/src/proto_alpha/lib_protocol/test/integration/michelson/test_script_typed_ir_size.ml index d7c2e129a24ec2b6d40112a61b5558ab7f64c842..a9d66415bd8c2ca173ba42fade4bf6758d208600 100644 --- a/src/proto_alpha/lib_protocol/test/integration/michelson/test_script_typed_ir_size.ml +++ b/src/proto_alpha/lib_protocol/test/integration/michelson/test_script_typed_ir_size.ml @@ -589,8 +589,9 @@ let check_value_size () = Contract_t ========= *) - @ (let show fmt (Typed_contract {arg_ty = _; destination; entrypoint}) = - let destination = Typed_destination.untyped destination in + @ (let show fmt typed_contract = + let destination = Typed_contract.destination typed_contract in + let entrypoint = Typed_contract.entrypoint typed_contract in show_address fmt {destination; entrypoint} in exs 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 4004172feb9f49d5ee25eea0315bd91322adefc9..4d1c2d79b9a3a6fbf8ff1f301d2e0472c6a47f85 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 @@ -793,9 +793,7 @@ let test_parse_contract_data_for_unit_rollup () = let* block, rollup = sc_originate block contract "unit" in let* incr = Incremental.begin_construction block in let ctxt = Incremental.alpha_ctxt incr in - let* ( _ctxt, - Typed_contract - {arg_ty = Script_typed_ir.Unit_t; destination; entrypoint} ) = + let* _ctxt, typed_contract = wrap_error_lwt @@ Script_ir_translator.parse_contract_data ctxt @@ -804,7 +802,11 @@ let test_parse_contract_data_for_unit_rollup () = (Destination.Sc_rollup rollup) ~entrypoint:Entrypoint.default in - let destination = Script_typed_ir.Typed_destination.untyped destination in + let (Ty_ex_c Script_typed_ir.Unit_t) = + Script_typed_ir.Typed_contract.arg_ty typed_contract + in + let destination = Script_typed_ir.Typed_contract.destination typed_contract in + let entrypoint = Script_typed_ir.Typed_contract.entrypoint typed_contract in (* Check that the destinations match. *) let* () = Assert.equal_string @@ -828,7 +830,7 @@ let test_parse_contract_data_for_rollup_with_entrypoints () = let rollup_destination = Sc_rollup.Address.to_b58check rollup in let* incr = Incremental.begin_construction block in let ctxt = Incremental.alpha_ctxt incr in - let* ctxt, Typed_contract {arg_ty = _; destination; entrypoint} = + let* ctxt, typed_contract = let*? (Script_typed_ir.Ty_ex_c nat_pair) = Environment.wrap_tzresult Script_typed_ir.(pair_t (-1) nat_t nat_t) in @@ -840,7 +842,8 @@ let test_parse_contract_data_for_rollup_with_entrypoints () = (Destination.Sc_rollup rollup) ~entrypoint:(Entrypoint.of_string_strict_exn "add") in - let destination = Script_typed_ir.Typed_destination.untyped destination in + let destination = Script_typed_ir.Typed_contract.destination typed_contract in + let entrypoint = Script_typed_ir.Typed_contract.entrypoint typed_contract in (* Check that the destinations match. *) let* () = Assert.equal_string @@ -852,7 +855,7 @@ let test_parse_contract_data_for_rollup_with_entrypoints () = let* () = Assert.equal_string ~loc:__LOC__ (Entrypoint.to_string entrypoint) "add" in - let* _ctxt, Typed_contract {arg_ty = _; destination; entrypoint} = + let* _ctxt, typed_contract = wrap_error_lwt @@ Script_ir_translator.parse_contract_data ctxt @@ -861,7 +864,8 @@ let test_parse_contract_data_for_rollup_with_entrypoints () = (Destination.Sc_rollup rollup) ~entrypoint:(Entrypoint.of_string_strict_exn "reset") in - let destination = Script_typed_ir.Typed_destination.untyped destination in + let destination = Script_typed_ir.Typed_contract.destination typed_contract in + let entrypoint = Script_typed_ir.Typed_contract.entrypoint typed_contract in (* Check that the destinations match. *) let* () = Assert.equal_string diff --git a/tests_python/tests_alpha/_regtest_outputs/test_contract_onchain_opcodes.TestContractOnchainOpcodes::test_slice_success[(Pair 0xe009ab79e8b84ef0e55c43a9a857214d8761e67b.7da5c9014e.out b/tests_python/tests_alpha/_regtest_outputs/test_contract_onchain_opcodes.TestContractOnchainOpcodes::test_slice_success[(Pair 0xe009ab79e8b84ef0e55c43a9a857214d8761e67b.7da5c9014e.out index 16d12cdc9d92e0181d64bde2f19e80bbedae3502..192ff9da894b40fb9a373615cd3450e9fe3431c3 100644 --- a/tests_python/tests_alpha/_regtest_outputs/test_contract_onchain_opcodes.TestContractOnchainOpcodes::test_slice_success[(Pair 0xe009ab79e8b84ef0e55c43a9a857214d8761e67b.7da5c9014e.out +++ b/tests_python/tests_alpha/_regtest_outputs/test_contract_onchain_opcodes.TestContractOnchainOpcodes::test_slice_success[(Pair 0xe009ab79e8b84ef0e55c43a9a857214d8761e67b.7da5c9014e.out @@ -1,7 +1,7 @@ tests_alpha/test_contract_onchain_opcodes.py::TestContractOnchainOpcodes::test_slice_success[(Pair 0xe009ab79e8b84ef0e55c43a9a857214d8761e67b75ba63500a5694fb2ffe174acc2de22d01ccb7259342437f05e1987949f0ad82e9f32e9a0b79cb252d7f7b8236ad728893f4e7150742eefdbeda254970f9fcd92c6228c178e1a923e5600758eb83f2a05edd0be7625657901f2ba81eaf145d003dbef78e33f43a32a3788bdf0501000000085341554349535345 "spsig1PPUFZucuAQybs5wsqsNQ68QNgFaBnVKMFaoZZfi1BtNnuCAWnmL9wVy5HfHkR6AeodjVGxpBVVSYcJKyMURn6K1yknYLm")] Node is bootstrapped. -Estimated gas: 3595.227 units (will add 100 for safety) +Estimated gas: 3594.787 units (will add 100 for safety) Estimated storage: 257 bytes added (will add 20 for safety) Operation successfully injected in the node. Operation hash is '[BLOCK_HASH]' @@ -14,7 +14,7 @@ This sequence of operations was run: From: [CONTRACT_HASH] Fee to the baker: ꜩ0.000877 Expected counter: [EXPECTED_COUNTER] - Gas limit: 3696 + Gas limit: 3695 Storage limit: 277 bytes Balance updates: [CONTRACT_HASH] ... -ꜩ0.000877 @@ -29,7 +29,7 @@ This sequence of operations was run: Updated storage: [OPERATION_HASH]48f709699019725ba Storage size: 578 bytes - Consumed gas: 2595.227 + Consumed gas: 2594.787 Internal operations: Internal Transaction: Amount: ꜩ1000 diff --git a/tests_python/tests_alpha/_regtest_outputs/test_liquidity_baking.TestAddApproveTransferRemove::test_remove_liquidity.out b/tests_python/tests_alpha/_regtest_outputs/test_liquidity_baking.TestAddApproveTransferRemove::test_remove_liquidity.out index c679ce44b3bd6711bc0035a93f929ba387e200d4..763556d3762bd5042fbe5706b5fb850610681d25 100644 --- a/tests_python/tests_alpha/_regtest_outputs/test_liquidity_baking.TestAddApproveTransferRemove::test_remove_liquidity.out +++ b/tests_python/tests_alpha/_regtest_outputs/test_liquidity_baking.TestAddApproveTransferRemove::test_remove_liquidity.out @@ -1,7 +1,7 @@ tests_alpha/test_liquidity_baking.py::TestAddApproveTransferRemove::test_remove_liquidity Node is bootstrapped. -Estimated gas: 7517.858 units (will add 100 for safety) +Estimated gas: 7517.418 units (will add 100 for safety) Estimated storage: 67 bytes added (will add 20 for safety) Operation successfully injected in the node. Operation hash is '[BLOCK_HASH]' @@ -33,7 +33,7 @@ This sequence of operations was run: 0x01e927f00ef734dfc85919635e9afc9166c83ef9fc00 ; 0x0115eb0104481a6d7921160bc982c5e0a561cd8a3a00 } Storage size: 4633 bytes - Consumed gas: 2276.791 + Consumed gas: 2276.351 Internal operations: Internal Transaction: Amount: ꜩ0 diff --git a/tests_python/tests_alpha/_regtest_outputs/test_liquidity_baking.TestTrades::test_buy_tok.out b/tests_python/tests_alpha/_regtest_outputs/test_liquidity_baking.TestTrades::test_buy_tok.out index 28fb91d67dcbeafd4383373f44a76312fff45c39..3a325d5c51f2f8b7ee100454eecf23d1c49cbc22 100644 --- a/tests_python/tests_alpha/_regtest_outputs/test_liquidity_baking.TestTrades::test_buy_tok.out +++ b/tests_python/tests_alpha/_regtest_outputs/test_liquidity_baking.TestTrades::test_buy_tok.out @@ -1,7 +1,7 @@ tests_alpha/test_liquidity_baking.py::TestTrades::test_buy_tok Node is bootstrapped. -Estimated gas: 5113.486 units (will add 100 for safety) +Estimated gas: 5113.046 units (will add 100 for safety) Estimated storage: 326 bytes added (will add 20 for safety) Operation successfully injected in the node. Operation hash is '[BLOCK_HASH]' @@ -34,7 +34,7 @@ This sequence of operations was run: 0x0115eb0104481a6d7921160bc982c5e0a561cd8a3a00 } Storage size: 4634 bytes Paid storage size diff: 1 bytes - Consumed gas: 1745.645 + Consumed gas: 1745.205 Balance updates: [CONTRACT_HASH] ... -ꜩ0.00025 storage fees ........................... +ꜩ0.00025 diff --git a/tests_python/tests_alpha/_regtest_outputs/test_liquidity_baking.TestTrades::test_sell_tok.out b/tests_python/tests_alpha/_regtest_outputs/test_liquidity_baking.TestTrades::test_sell_tok.out index a605e9bb3c96fb0ddf6c7b99d6634525a2b5561f..4659d038264f6ba2b06eb44a12cf49e24534f636 100644 --- a/tests_python/tests_alpha/_regtest_outputs/test_liquidity_baking.TestTrades::test_sell_tok.out +++ b/tests_python/tests_alpha/_regtest_outputs/test_liquidity_baking.TestTrades::test_sell_tok.out @@ -1,7 +1,7 @@ tests_alpha/test_liquidity_baking.py::TestTrades::test_sell_tok Node is bootstrapped. -Estimated gas: 7012.321 units (will add 100 for safety) +Estimated gas: 7011.441 units (will add 100 for safety) Estimated storage: no bytes added Operation successfully injected in the node. Operation hash is '[BLOCK_HASH]' @@ -14,7 +14,7 @@ This sequence of operations was run: From: [CONTRACT_HASH] Fee to the baker: ꜩ0.001057 Expected counter: [EXPECTED_COUNTER] - Gas limit: 7113 + Gas limit: 7112 Storage limit: 0 bytes Balance updates: [CONTRACT_HASH] ... -ꜩ0.001057 @@ -33,7 +33,7 @@ This sequence of operations was run: 0x01e927f00ef734dfc85919635e9afc9166c83ef9fc00 ; 0x0115eb0104481a6d7921160bc982c5e0a561cd8a3a00 } Storage size: 4633 bytes - Consumed gas: 1746.733 + Consumed gas: 1745.853 Internal operations: Internal Transaction: Amount: ꜩ0