diff --git a/src/proto_alpha/bin_sc_rollup_node/inbox.ml b/src/proto_alpha/bin_sc_rollup_node/inbox.ml index 4b151a218bb88834ee7204d4391ddd2d4073d68c..6c587b8809922ed6da1f82db234ba02187121847 100644 --- a/src/proto_alpha/bin_sc_rollup_node/inbox.ml +++ b/src/proto_alpha/bin_sc_rollup_node/inbox.ml @@ -85,10 +85,9 @@ let get_messages l1_ctxt head rollup = | _ -> accu in let apply_internal (type kind) accu ~source:_ - (_operation : kind Apply_internal_results.internal_manager_operation) + (_operation : kind Apply_internal_results.internal_operation_contents) (_result : - kind Apply_internal_results.successful_internal_manager_operation_result) - = + kind Apply_internal_results.successful_internal_operation_result) = accu in let messages = diff --git a/src/proto_alpha/bin_sc_rollup_node/layer1_services.ml b/src/proto_alpha/bin_sc_rollup_node/layer1_services.ml index 1a6f2dea2e5e3d33680d6679232c6bbe345fd484..6dcd12d01413d6bc42086278211cfdf2f93efc49 100644 --- a/src/proto_alpha/bin_sc_rollup_node/layer1_services.ml +++ b/src/proto_alpha/bin_sc_rollup_node/layer1_services.ml @@ -40,8 +40,8 @@ type 'accu operation_processor = { 'kind. 'accu -> source:public_key_hash -> - 'kind Apply_internal_results.internal_manager_operation -> - 'kind Apply_internal_results.successful_internal_manager_operation_result -> + 'kind Apply_internal_results.internal_operation_contents -> + 'kind Apply_internal_results.successful_internal_operation_result -> 'accu; } @@ -78,7 +78,7 @@ let process_applied_manager_operations operations accu f = and on_applied_internal_operations accu source internal_operation_results = let open Apply_internal_results in List.fold_left - (fun accu (Internal_manager_operation_result ({operation; _}, result)) -> + (fun accu (Internal_operation_result ({operation; _}, result)) -> match result with | Applied result -> f.apply_internal accu ~source operation result | _ -> accu) diff --git a/src/proto_alpha/bin_sc_rollup_node/layer1_services.mli b/src/proto_alpha/bin_sc_rollup_node/layer1_services.mli index ea95ba3ad44976591e0cc1385dc20b0edd4f643c..f6e5a10afecf985545ec24e125ebe4c0d0b9c174 100644 --- a/src/proto_alpha/bin_sc_rollup_node/layer1_services.mli +++ b/src/proto_alpha/bin_sc_rollup_node/layer1_services.mli @@ -39,8 +39,8 @@ type 'accu operation_processor = { 'kind. 'accu -> source:public_key_hash -> - 'kind Apply_internal_results.internal_manager_operation -> - 'kind Apply_internal_results.successful_internal_manager_operation_result -> + 'kind Apply_internal_results.internal_operation_contents -> + 'kind Apply_internal_results.successful_internal_operation_result -> 'accu; } diff --git a/src/proto_alpha/lib_client/client_proto_programs.mli b/src/proto_alpha/lib_client/client_proto_programs.mli index c18ecad250bbcaa3d57b7efc0d73e4e14ed55ffa..dbe6e154e2ab9da1994cf9d051fca871ddd0cf6f 100644 --- a/src/proto_alpha/lib_client/client_proto_programs.mli +++ b/src/proto_alpha/lib_client/client_proto_programs.mli @@ -95,7 +95,7 @@ val run : block:Shell_services.block -> run_params -> (Script.expr - * Apply_internal_results.packed_internal_contents list + * Apply_internal_results.packed_internal_operation list * Lazy_storage.diffs option) tzresult Lwt.t @@ -107,7 +107,7 @@ val trace : block:Shell_services.block -> run_params -> (Script.expr - * Apply_internal_results.packed_internal_contents list + * Apply_internal_results.packed_internal_operation list * Script_typed_ir.execution_trace * Lazy_storage.diffs option) tzresult @@ -123,7 +123,7 @@ val print_run_result : show_source:bool -> parsed:Michelson_v1_parser.parsed -> (Script_repr.expr - * Apply_internal_results.packed_internal_contents list + * Apply_internal_results.packed_internal_operation list * Lazy_storage.diffs option) tzresult -> unit tzresult Lwt.t @@ -133,7 +133,7 @@ val print_trace_result : show_source:bool -> parsed:Michelson_v1_parser.parsed -> (Script_repr.expr - * Apply_internal_results.packed_internal_contents list + * Apply_internal_results.packed_internal_operation list * Script_typed_ir.execution_trace * Lazy_storage.diffs option) tzresult -> diff --git a/src/proto_alpha/lib_client/injection.ml b/src/proto_alpha/lib_client/injection.ml index 3aeb28e294b1eb07dc793f661f9fbddf4d637907..7b7f475945487fdbbc065d0f4fa87bfbd1fd7335 100644 --- a/src/proto_alpha/lib_client/injection.ml +++ b/src/proto_alpha/lib_client/injection.ml @@ -346,7 +346,7 @@ let estimated_gas_single (type kind) | Failed (_, errs) -> Error (Environment.wrap_tztrace errs) in let internal_consumed_gas (type kind) - (result : kind internal_manager_operation_result) = + (result : kind internal_operation_result) = match result with | Applied res | Backtracked (res, _) -> ( match res with @@ -364,7 +364,7 @@ let estimated_gas_single (type kind) in consumed_gas operation_result >>? fun gas -> List.fold_left_e - (fun acc (Internal_manager_operation_result (_, r)) -> + (fun acc (Internal_operation_result (_, r)) -> internal_consumed_gas r >>? fun gas -> Ok (Gas.Arith.add acc gas)) gas internal_operation_results @@ -431,7 +431,7 @@ let estimated_storage_single (type kind) ~tx_rollup_origination_size | Failed (_, errs) -> Error (Environment.wrap_tztrace errs) in let internal_storage_size_diff (type kind) - (result : kind internal_manager_operation_result) = + (result : kind internal_operation_result) = match result with | Applied res | Backtracked (res, _) -> ( match res with @@ -457,7 +457,7 @@ let estimated_storage_single (type kind) ~tx_rollup_origination_size in storage_size_diff operation_result >>? fun storage -> List.fold_left_e - (fun acc (Internal_manager_operation_result (_, r)) -> + (fun acc (Internal_operation_result (_, r)) -> internal_storage_size_diff r >>? fun storage -> Ok (Z.add acc storage)) storage internal_operation_results @@ -526,7 +526,7 @@ let originated_contracts_single (type kind) | Failed (_, errs) -> Error (Environment.wrap_tztrace errs) in let internal_originated_contracts (type kind) - (result : kind internal_manager_operation_result) = + (result : kind internal_operation_result) = match result with | Applied res | Backtracked (res, _) -> ( match res with @@ -546,7 +546,7 @@ let originated_contracts_single (type kind) originated_contracts operation_result >>? fun contracts -> let contracts = List.rev contracts in List.fold_left_e - (fun acc (Internal_manager_operation_result (_, r)) -> + (fun acc (Internal_operation_result (_, r)) -> internal_originated_contracts r >>? fun contracts -> Ok (List.rev_append contracts acc)) contracts @@ -611,8 +611,7 @@ let detect_script_failure : type kind. kind operation_metadata -> _ = in detect_script_failure operation_result >>? fun () -> List.iter_e - (fun (Internal_manager_operation_result (_, r)) -> - detect_script_failure r) + (fun (Internal_operation_result (_, r)) -> detect_script_failure r) internal_operation_results in function diff --git a/src/proto_alpha/lib_client/operation_result.ml b/src/proto_alpha/lib_client/operation_result.ml index b4427a0d05d65d4a0fb673f729ef9498a764ca32..cef3f77a81996c787dc08db15aaf9faa12610310 100644 --- a/src/proto_alpha/lib_client/operation_result.ml +++ b/src/proto_alpha/lib_client/operation_result.ml @@ -43,7 +43,7 @@ let pp_micheline_from_lazy_expr ppf expr = in pp_micheline_expr ppf expr -let pp_internal_operation ppf (Internal_contents {operation; source; _}) = +let pp_internal_operation ppf (Internal_operation {operation; source; _}) = (* For now, try to use the same format as in [pp_manager_operation_content]. *) Format.fprintf ppf "@[Internal " ; (match operation with @@ -819,17 +819,16 @@ let pp_manager_operation_contents_result ppf op_result = ppf op_result -let pp_internal_operation_and_result ppf - (Internal_manager_operation_result (op, res)) = +let pp_internal_operation_and_result ppf (Internal_operation_result (op, res)) = let internal_operation_name (type kind) : - kind successful_internal_manager_operation_result -> string = function + kind successful_internal_operation_result -> string = function | ITransaction_result _ -> "transaction" | IOrigination_result _ -> "origination" | IDelegation_result _ -> "delegation" | IEvent_result _ -> "event" in let pp_internal_operation_result (type kind) ppf - (result : kind successful_internal_manager_operation_result) = + (result : kind successful_internal_operation_result) = match result with | ITransaction_result tx -> pp_transaction_result ppf tx | IOrigination_result op_res -> pp_origination_result ppf op_res @@ -840,7 +839,7 @@ let pp_internal_operation_and_result ppf ppf "@[%a@,%a@]" pp_internal_operation - (Internal_contents op) + (Internal_operation op) (pp_operation_result ~operation_name:internal_operation_name pp_internal_operation_result) diff --git a/src/proto_alpha/lib_client/operation_result.mli b/src/proto_alpha/lib_client/operation_result.mli index d6ed7d353eddfc0160192e2d57a827fadf53f539..18c317ff3e2afff81ba5123af9c0dfa0230498df 100644 --- a/src/proto_alpha/lib_client/operation_result.mli +++ b/src/proto_alpha/lib_client/operation_result.mli @@ -29,7 +29,7 @@ open Alpha_context val tez_sym : string val pp_internal_operation : - Format.formatter -> Apply_internal_results.packed_internal_contents -> unit + Format.formatter -> Apply_internal_results.packed_internal_operation -> unit val pp_operation_result : Format.formatter -> diff --git a/src/proto_alpha/lib_client/protocol_client_context.ml b/src/proto_alpha/lib_client/protocol_client_context.ml index be5745a532e86d56822509833c9cb38505ead052..1f0810f27f4775581884add1ae05eb118a58ba4b 100644 --- a/src/proto_alpha/lib_client/protocol_client_context.ml +++ b/src/proto_alpha/lib_client/protocol_client_context.ml @@ -201,7 +201,7 @@ let () = @@ def "operation" ["internal"] - Protocol.Apply_internal_results.internal_contents_encoding ; + Protocol.Apply_internal_results.internal_operation_encoding ; register @@ def "operation" diff --git a/src/proto_alpha/lib_plugin/RPC.ml b/src/proto_alpha/lib_plugin/RPC.ml index a988aeea4c3e9b7664d4aab8eade69a7cf833617..de3553f8f64351d0141235c30a83aebba12dfba4 100644 --- a/src/proto_alpha/lib_plugin/RPC.ml +++ b/src/proto_alpha/lib_plugin/RPC.ml @@ -183,7 +183,7 @@ module Scripts = struct (req "storage" Script.expr_encoding) (req "operations" - (list Apply_internal_results.internal_contents_encoding)) + (list Apply_internal_results.internal_operation_encoding)) (opt "lazy_storage_diff" Lazy_storage.encoding)) let trace_code_input_encoding = run_code_input_encoding @@ -205,7 +205,7 @@ module Scripts = struct (req "storage" Script.expr_encoding) (req "operations" - (list Apply_internal_results.internal_contents_encoding)) + (list Apply_internal_results.internal_operation_encoding)) (req "trace" trace_encoding) (opt "lazy_storage_diff" Lazy_storage.encoding)) @@ -829,7 +829,7 @@ module Scripts = struct >>=? fun op_validated_stamp -> match protocol_data.contents with | Single (Manager_operation _) as op -> - Apply.apply_manager_operation + Apply.apply_manager_operations ctxt ~payload_producer chain_id @@ -838,7 +838,7 @@ module Scripts = struct op >|=? fun (_ctxt, result) -> ret result | Cons (Manager_operation _, _) as op -> - Apply.apply_manager_operation + Apply.apply_manager_operations ctxt ~payload_producer chain_id @@ -1050,8 +1050,7 @@ module Scripts = struct }, _ ) -> ( storage, - Apply_internal_results.contents_of_packed_internal_operations - operations, + Apply_internal_results.packed_internal_operations operations, lazy_storage_diff )) ; Registration.register0 ~chunked:true @@ -1123,8 +1122,7 @@ module Scripts = struct _ctxt ), trace ) -> ( storage, - Apply_internal_results.contents_of_packed_internal_operations - operations, + Apply_internal_results.packed_internal_operations operations, trace, lazy_storage_diff )) ; Registration.register0 diff --git a/src/proto_alpha/lib_protocol/apply.ml b/src/proto_alpha/lib_protocol/apply.ml index 46d386aa2ed91765245b8abfeaa462b3e33af001..8b5bc41e532a05a251357a7eb1061cdd5e4687a2 100644 --- a/src/proto_alpha/lib_protocol/apply.ml +++ b/src/proto_alpha/lib_protocol/apply.ml @@ -101,7 +101,8 @@ type error += | Cannot_transfer_ticket_to_implicit | Sc_rollup_feature_disabled | Wrong_voting_period of {expected : int32; provided : int32} - | Internal_operation_replay of Apply_internal_results.packed_internal_contents + | Internal_operation_replay of + Apply_internal_results.packed_internal_operation | Invalid_denunciation of denunciation_kind | Inconsistent_denunciation of { kind : denunciation_kind; @@ -568,12 +569,12 @@ let () = ~id:"internal_operation_replay" ~title:"Internal operation replay" ~description:"An internal operation was emitted twice by a script" - ~pp:(fun ppf (Apply_internal_results.Internal_contents {nonce; _}) -> + ~pp:(fun ppf (Apply_internal_results.Internal_operation {nonce; _}) -> Format.fprintf ppf "Internal operation %d was emitted twice by a script" nonce) - Apply_internal_results.internal_contents_encoding + Apply_internal_results.internal_operation_encoding (function Internal_operation_replay op -> Some op | _ -> None) (fun op -> Internal_operation_replay op) ; register_error_kind @@ -1077,15 +1078,15 @@ let apply_origination ~ctxt ~storage_type ~storage ~unparsed_code *) -let apply_internal_manager_operation_content : +let apply_internal_operation_contents : type kind. context -> payer:public_key_hash -> source:Contract.t -> chain_id:Chain_id.t -> - kind Script_typed_ir.manager_operation -> + kind Script_typed_ir.internal_operation_contents -> (context - * kind successful_internal_manager_operation_result + * kind successful_internal_operation_result * Script_typed_ir.packed_internal_operation list) tzresult Lwt.t = @@ -1118,8 +1119,7 @@ let apply_internal_manager_operation_content : ~before_operation:ctxt_before_op >|=? fun (ctxt, res, ops) -> ( ctxt, - (ITransaction_result res - : kind successful_internal_manager_operation_result), + (ITransaction_result res : kind successful_internal_operation_result), ops ) | Transaction_to_smart_contract { @@ -1219,7 +1219,7 @@ let apply_internal_manager_operation_content : >|=? fun (ctxt, consumed_gas, ops) -> (ctxt, IDelegation_result {consumed_gas}, ops) -let apply_external_manager_operation_content : +let apply_manager_operation : type kind. context -> source:public_key_hash -> @@ -1905,20 +1905,18 @@ let apply_external_manager_operation_content : type success_or_failure = Success of context | Failure -let apply_internal_manager_operations ctxt ~payer ~chain_id ops = +let apply_internal_operations ctxt ~payer ~chain_id ops = let[@coq_struct "ctxt"] rec apply ctxt applied worklist = match worklist with | [] -> Lwt.return (Success ctxt, List.rev applied) | Script_typed_ir.Internal_operation ({source; operation; nonce} as op) :: rest -> ( (if internal_nonce_already_recorded ctxt nonce then - let op_res = - Apply_internal_results.contents_of_internal_operation op - in - fail (Internal_operation_replay (Internal_contents op_res)) + let op_res = Apply_internal_results.internal_operation op in + fail (Internal_operation_replay (Internal_operation op_res)) else let ctxt = record_internal_nonce ctxt nonce in - apply_internal_manager_operation_content + apply_internal_operation_contents ctxt ~source ~payer @@ -1927,14 +1925,14 @@ let apply_internal_manager_operations ctxt ~payer ~chain_id ops = >>= function | Error errors -> let result = - pack_internal_manager_operation_result + pack_internal_operation_result op (Failed (Script_typed_ir.manager_kind op.operation, errors)) in let skipped = List.rev_map (fun (Script_typed_ir.Internal_operation op) -> - pack_internal_manager_operation_result + pack_internal_operation_result op (Skipped (Script_typed_ir.manager_kind op.operation))) rest @@ -1943,8 +1941,7 @@ let apply_internal_manager_operations ctxt ~payer ~chain_id ops = | Ok (ctxt, result, emitted) -> apply ctxt - (pack_internal_manager_operation_result op (Applied result) - :: applied) + (pack_internal_operation_result op (Applied result) :: applied) (emitted @ rest)) in apply ctxt [] ops @@ -2134,11 +2131,10 @@ let burn_manager_storage_fees : let burn_internal_storage_fees : type kind. context -> - kind successful_internal_manager_operation_result -> + kind successful_internal_operation_result -> storage_limit:Z.t -> payer:public_key_hash -> - (context * Z.t * kind successful_internal_manager_operation_result) tzresult - Lwt.t = + (context * Z.t * kind successful_internal_operation_result) tzresult Lwt.t = fun ctxt smopr ~storage_limit ~payer -> let payer = `Contract (Contract.Implicit payer) in match smopr with @@ -2165,7 +2161,7 @@ let apply_manager_contents (type kind) ctxt chain_id (op : kind Kind.manager contents) : (success_or_failure * kind manager_operation_result - * packed_internal_manager_operation_result list) + * packed_internal_operation_result list) Lwt.t = let[@coq_match_with_default] (Manager_operation { @@ -2180,14 +2176,9 @@ let apply_manager_contents (type kind) ctxt chain_id (* We do not expose the internal scaling to the users. Instead, we multiply the specified gas limit by the internal scaling. *) let ctxt = Gas.set_limit ctxt gas_limit in - apply_external_manager_operation_content ctxt ~source ~chain_id operation - >>= function + apply_manager_operation ctxt ~source ~chain_id operation >>= function | Ok (ctxt, operation_results, internal_operations) -> ( - apply_internal_manager_operations - ctxt - ~payer:source - ~chain_id - internal_operations + apply_internal_operations ctxt ~payer:source ~chain_id internal_operations >>= function | Success ctxt, internal_operations_results -> ( burn_manager_storage_fees @@ -2199,7 +2190,7 @@ let apply_manager_contents (type kind) ctxt chain_id | Ok (ctxt, storage_limit, operation_results) -> ( List.fold_left_es (fun (ctxt, storage_limit, res) imopr -> - let (Internal_manager_operation_result (op, mopr)) = imopr in + let (Internal_operation_result (op, mopr)) = imopr in match mopr with | Applied smopr -> burn_internal_storage_fees @@ -2209,7 +2200,7 @@ let apply_manager_contents (type kind) ctxt chain_id ~payer:source >>=? fun (ctxt, storage_limit, smopr) -> let imopr = - Internal_manager_operation_result (op, Applied smopr) + Internal_operation_result (op, Applied smopr) in return (ctxt, storage_limit, imopr :: res) | _ -> return (ctxt, storage_limit, imopr :: res)) @@ -2378,17 +2369,16 @@ let mark_backtracked results = | (Failed _ | Skipped _ | Backtracked _) as result -> result | Applied result -> Backtracked (result, None) in - let mark_internal_manager_operation_result : + let mark_internal_operation_result : type kind. - kind internal_manager_operation_result -> - kind internal_manager_operation_result = function + kind internal_operation_result -> kind internal_operation_result = + function | (Failed _ | Skipped _ | Backtracked _) as result -> result | Applied result -> Backtracked (result, None) in let mark_internal_operation_results - (Internal_manager_operation_result (kind, result)) = - Internal_manager_operation_result - (kind, mark_internal_manager_operation_result result) + (Internal_operation_result (kind, result)) = + Internal_operation_result (kind, mark_internal_operation_result result) in match results with | Manager_operation_result op -> @@ -2678,7 +2668,7 @@ let apply_manager_contents_list ctxt ~payload_producer chain_id | Success ctxt -> Lazy_storage.cleanup_temporaries ctxt >|= fun ctxt -> (ctxt, results) -let apply_manager_operation ctxt ~payload_producer chain_id ~mempool_mode +let apply_manager_operations ctxt ~payload_producer chain_id ~mempool_mode op_validated_stamp contents_list = let open Lwt_result_syntax in let ctxt = if mempool_mode then Gas.reset_block_gas ctxt else ctxt in @@ -3021,7 +3011,7 @@ let apply_contents_list (type kind) ctxt chain_id (apply_mode : apply_mode) (* Failing_noop _ always fails *) fail Failing_noop_error | Single (Manager_operation _) -> - apply_manager_operation + apply_manager_operations ctxt ~payload_producer chain_id @@ -3029,7 +3019,7 @@ let apply_contents_list (type kind) ctxt chain_id (apply_mode : apply_mode) op_validated_stamp contents_list | Cons (Manager_operation _, _) -> - apply_manager_operation + apply_manager_operations ctxt ~payload_producer chain_id diff --git a/src/proto_alpha/lib_protocol/apply.mli b/src/proto_alpha/lib_protocol/apply.mli index 07f0c78fc47f9807e0b843af4f4bd5f1e3438bb6..c57651730ade98e9a527f1dd510f04b73ff5c235 100644 --- a/src/proto_alpha/lib_protocol/apply.mli +++ b/src/proto_alpha/lib_protocol/apply.mli @@ -38,7 +38,7 @@ open Apply_results open Apply_internal_results type error += - | Internal_operation_replay of packed_internal_contents + | Internal_operation_replay of packed_internal_operation | Tx_rollup_feature_disabled | Tx_rollup_invalid_transaction_ticket_amount | Sc_rollup_feature_disabled @@ -129,7 +129,7 @@ type apply_mode = been extended to every kind of operation, [apply_operation] should never return an error. - See {!apply_manager_operation} for additional information on the + See {!apply_manager_operations} for additional information on the application of manager operations. *) val apply_operation : context -> @@ -185,12 +185,12 @@ val apply_contents_list : - decrease of the available block gas by operation's [gas_limit]. These updates are mandatory. In particular, taking the fees is - critically important. That's why [apply_manager_operation] takes a + critically important. That's why [apply_manager_operations] takes a [Validate_operation.stamp] argument, so that it may only be called after having validated the operation by calling {!Validate_operation}. Indeed, this module is responsible for ensuring that the operation is solvable, i.e. that fees can be - taken, i.e. that the first stage of [apply_manager_operation] + taken, i.e. that the first stage of [apply_manager_operations] cannot fail. If this stage fails nevertheless, the function returns an error. @@ -203,7 +203,7 @@ val apply_contents_list : stage, and a [contents_result_list] that contains the error. This means that the operation has no other effects than those described above during the first phase. *) -val apply_manager_operation : +val apply_manager_operations : context -> payload_producer:public_key_hash -> Chain_id.t -> diff --git a/src/proto_alpha/lib_protocol/apply_internal_results.ml b/src/proto_alpha/lib_protocol/apply_internal_results.ml index 09d5f14bc5e58f5a19368dba541a8fe9403f2d2a..9a4bec05c0ec5057c04891a10deb10f1cf87a169 100644 --- a/src/proto_alpha/lib_protocol/apply_internal_results.ml +++ b/src/proto_alpha/lib_protocol/apply_internal_results.ml @@ -27,48 +27,48 @@ open Alpha_context open Data_encoding open Apply_operation_result -type 'kind internal_manager_operation = +type 'kind internal_operation_contents = | Transaction : { amount : Tez.tez; parameters : Script.lazy_expr; entrypoint : Entrypoint.t; destination : Destination.t; } - -> Kind.transaction internal_manager_operation + -> Kind.transaction internal_operation_contents | Origination : { delegate : Signature.Public_key_hash.t option; script : Script.t; credit : Tez.tez; } - -> Kind.origination internal_manager_operation + -> Kind.origination internal_operation_contents | Delegation : Signature.Public_key_hash.t option - -> Kind.delegation internal_manager_operation + -> Kind.delegation internal_operation_contents | Event : { ty : Script.expr; tag : Entrypoint.t; payload : Script.expr; } - -> Kind.event internal_manager_operation + -> Kind.event internal_operation_contents -type packed_internal_manager_operation = - | Manager : - 'kind internal_manager_operation - -> packed_internal_manager_operation +type packed_internal_operation_contents = + | Internal_operation_contents : + 'kind internal_operation_contents + -> packed_internal_operation_contents -type 'kind internal_contents = { +type 'kind internal_operation = { source : Contract.t; - operation : 'kind internal_manager_operation; + operation : 'kind internal_operation_contents; nonce : int; } -type packed_internal_contents = - | Internal_contents : 'kind internal_contents -> packed_internal_contents +type packed_internal_operation = + | Internal_operation : 'kind internal_operation -> packed_internal_operation -let contents_of_internal_operation (type kind) +let internal_operation (type kind) ({source; operation; nonce} : kind Script_typed_ir.internal_operation) : - kind internal_contents = - let operation : kind internal_manager_operation = + kind internal_operation = + let operation : kind internal_operation_contents = match operation with | Transaction_to_implicit {destination; amount; entrypoint; unparsed_parameters; _} -> @@ -119,12 +119,10 @@ let contents_of_internal_operation (type kind) in {source; operation; nonce} -let contents_of_packed_internal_operation - (Script_typed_ir.Internal_operation op) = - Internal_contents (contents_of_internal_operation op) +let packed_internal_operation (Script_typed_ir.Internal_operation op) = + Internal_operation (internal_operation op) -let contents_of_packed_internal_operations = - List.map contents_of_packed_internal_operation +let packed_internal_operations = List.map packed_internal_operation type successful_transaction_result = | Transaction_to_contract_result of { @@ -157,50 +155,50 @@ type successful_origination_result = { paid_storage_size_diff : Z.t; } -(** Result of applying an internal {!manager_operation}. *) -type _ successful_internal_manager_operation_result = +(** Result of applying an internal operation. *) +type _ successful_internal_operation_result = | ITransaction_result : successful_transaction_result - -> Kind.transaction successful_internal_manager_operation_result + -> Kind.transaction successful_internal_operation_result | IOrigination_result : successful_origination_result - -> Kind.origination successful_internal_manager_operation_result + -> Kind.origination successful_internal_operation_result | IDelegation_result : { consumed_gas : Gas.Arith.fp; } - -> Kind.delegation successful_internal_manager_operation_result + -> Kind.delegation successful_internal_operation_result | IEvent_result : { consumed_gas : Gas.Arith.fp; } - -> Kind.event successful_internal_manager_operation_result + -> Kind.event successful_internal_operation_result -type packed_successful_internal_manager_operation_result = - | Successful_internal_manager_result : - 'kind successful_internal_manager_operation_result - -> packed_successful_internal_manager_operation_result +type packed_successful_internal_operation_result = + | Successful_internal_operation_result : + 'kind successful_internal_operation_result + -> packed_successful_internal_operation_result -type 'kind internal_manager_operation_result = +type 'kind internal_operation_result = ( 'kind, 'kind Kind.manager, - 'kind successful_internal_manager_operation_result ) + 'kind successful_internal_operation_result ) operation_result -type packed_internal_manager_operation_result = - | Internal_manager_operation_result : - 'kind internal_contents * 'kind internal_manager_operation_result - -> packed_internal_manager_operation_result +type packed_internal_operation_result = + | Internal_operation_result : + 'kind internal_operation * 'kind internal_operation_result + -> packed_internal_operation_result -let pack_internal_manager_operation_result (type kind) +let pack_internal_operation_result (type kind) (internal_op : kind Script_typed_ir.internal_operation) - (manager_op : kind internal_manager_operation_result) = - let internal_op = contents_of_internal_operation internal_op in - Internal_manager_operation_result (internal_op, manager_op) + (manager_op : kind internal_operation_result) = + let internal_op = internal_operation internal_op in + Internal_operation_result (internal_op, manager_op) type 'kind iselect = - packed_internal_manager_operation_result -> - ('kind internal_contents * 'kind internal_manager_operation_result) option + packed_internal_operation_result -> + ('kind internal_operation * 'kind internal_operation_result) option -module Internal_result = struct +module Internal_operation = struct open Data_encoding type 'kind case = @@ -210,10 +208,10 @@ module Internal_result = struct encoding : 'a Data_encoding.t; iselect : 'kind iselect; select : - packed_internal_manager_operation -> - 'kind internal_manager_operation option; - proj : 'kind internal_manager_operation -> 'a; - inj : 'a -> 'kind internal_manager_operation; + packed_internal_operation_contents -> + 'kind internal_operation_contents option; + proj : 'kind internal_operation_contents -> 'a; + inj : 'a -> 'kind internal_operation_contents; } -> 'kind case [@@coq_force_gadt] @@ -340,12 +338,14 @@ module Internal_result = struct (req "value" Script.lazy_expr_encoding))); iselect : Kind.transaction iselect = (function - | Internal_manager_operation_result + | Internal_operation_result (({operation = Transaction _; _} as op), res) -> Some (op, res) | _ -> None); select = - (function Manager (Transaction _ as op) -> Some op | _ -> None); + (function + | Internal_operation_contents (Transaction _ as op) -> Some op + | _ -> None); proj = (function | Transaction {amount; destination; parameters; entrypoint} -> @@ -381,12 +381,14 @@ module Internal_result = struct (req "script" Script.encoding); iselect : Kind.origination iselect = (function - | Internal_manager_operation_result + | Internal_operation_result (({operation = Origination _; _} as op), res) -> Some (op, res) | _ -> None); select = - (function Manager (Origination _ as op) -> Some op | _ -> None); + (function + | Internal_operation_contents (Origination _ as op) -> Some op + | _ -> None); proj = (function | Origination {credit; delegate; script} -> (credit, delegate, script)); @@ -405,12 +407,14 @@ module Internal_result = struct encoding = obj1 (opt "delegate" Signature.Public_key_hash.encoding); iselect : Kind.delegation iselect = (function - | Internal_manager_operation_result + | Internal_operation_result (({operation = Delegation _; _} as op), res) -> Some (op, res) | _ -> None); select = - (function Manager (Delegation _ as op) -> Some op | _ -> None); + (function + | Internal_operation_contents (Delegation _ as op) -> Some op + | _ -> None); proj = (function Delegation key -> key); inj = (fun key -> Delegation key); } @@ -429,11 +433,12 @@ module Internal_result = struct (opt "payload" Script.expr_encoding); iselect : Kind.event iselect = (function - | Internal_manager_operation_result - (({operation = Event _; _} as op), res) -> + | Internal_operation_result (({operation = Event _; _} as op), res) -> Some (op, res) | _ -> None); - select = (function Manager (Event _ as op) -> Some op | _ -> None); + select = + (function + | Internal_operation_contents (Event _ as op) -> Some op | _ -> None); proj = (function | Event {ty; tag; payload} -> @@ -464,7 +469,7 @@ module Internal_result = struct name encoding (fun o -> match select o with None -> None | Some o -> Some (proj o)) - (fun x -> Manager (inj x)) + (fun x -> Internal_operation_contents (inj x)) in union ~tag_size:`Uint8 @@ -476,34 +481,34 @@ module Internal_result = struct ] end -let internal_contents_encoding : packed_internal_contents Data_encoding.t = +let internal_operation_encoding : packed_internal_operation Data_encoding.t = def "apply_internal_results.alpha.operation_result" @@ conv - (fun (Internal_contents {source; operation; nonce}) -> - ((source, nonce), Manager operation)) - (fun ((source, nonce), Manager operation) -> - Internal_contents {source; operation; nonce}) + (fun (Internal_operation {source; operation; nonce}) -> + ((source, nonce), Internal_operation_contents operation)) + (fun ((source, nonce), Internal_operation_contents operation) -> + Internal_operation {source; operation; nonce}) (merge_objs (obj2 (req "source" Contract.encoding) (req "nonce" uint16)) - Internal_result.encoding) + Internal_operation.encoding) -module Internal_manager_result = struct +module Internal_operation_result = struct type 'kind case = | MCase : { - op_case : 'kind Internal_result.case; + op_case : 'kind Internal_operation.case; encoding : 'a Data_encoding.t; kind : 'kind Kind.manager; select : - packed_successful_internal_manager_operation_result -> - 'kind successful_internal_manager_operation_result option; - proj : 'kind successful_internal_manager_operation_result -> 'a; - inj : 'a -> 'kind successful_internal_manager_operation_result; - t : 'kind internal_manager_operation_result Data_encoding.t; + packed_successful_internal_operation_result -> + 'kind successful_internal_operation_result option; + proj : 'kind successful_internal_operation_result -> 'a; + inj : 'a -> 'kind successful_internal_operation_result; + t : 'kind internal_operation_result Data_encoding.t; } -> 'kind case let make ~op_case ~encoding ~kind ~select ~proj ~inj = - let (Internal_result.MCase {name; _}) = op_case in + let (Internal_operation.MCase {name; _}) = op_case in let t = def (Format.asprintf "operation.alpha.internal_operation_result.%s" name) @@ union @@ -517,7 +522,7 @@ module Internal_manager_result = struct match o with | Skipped _ | Failed _ | Backtracked _ -> None | Applied o -> ( - match select (Successful_internal_manager_result o) with + match select (Successful_internal_operation_result o) with | None -> None | Some o -> Some ((), proj o))) (fun ((), x) -> Applied (inj x)); @@ -547,7 +552,7 @@ module Internal_manager_result = struct match o with | Skipped _ | Failed _ | Applied _ -> None | Backtracked (o, errs) -> ( - match select (Successful_internal_manager_result o) with + match select (Successful_internal_operation_result o) with | None -> None | Some o -> Some (((), errs), proj o))) (fun (((), errs), x) -> Backtracked (inj x, errs)); @@ -557,10 +562,10 @@ module Internal_manager_result = struct let[@coq_axiom_with_reason "gadt"] transaction_case = make - ~op_case:Internal_result.transaction_case - ~encoding:Internal_result.transaction_contract_variant_cases + ~op_case:Internal_operation.transaction_case + ~encoding:Internal_operation.transaction_contract_variant_cases ~select:(function - | Successful_internal_manager_result (ITransaction_result _ as op) -> + | Successful_internal_operation_result (ITransaction_result _ as op) -> Some op | _ -> None) ~kind:Kind.Transaction_manager_kind @@ -569,7 +574,7 @@ module Internal_manager_result = struct let[@coq_axiom_with_reason "gadt"] origination_case = make - ~op_case:Internal_result.origination_case + ~op_case:Internal_operation.origination_case ~encoding: (obj6 (dft "balance_updates" Receipt.balance_updates_encoding []) @@ -579,7 +584,7 @@ module Internal_manager_result = struct (dft "paid_storage_size_diff" z Z.zero) (opt "lazy_storage_diff" Lazy_storage.encoding)) ~select:(function - | Successful_internal_manager_result (IOrigination_result _ as op) -> + | Successful_internal_operation_result (IOrigination_result _ as op) -> Some op | _ -> None) ~proj:(function @@ -623,12 +628,12 @@ module Internal_manager_result = struct let delegation_case = make - ~op_case:Internal_result.delegation_case + ~op_case:Internal_operation.delegation_case ~encoding: Data_encoding.( obj1 (dft "consumed_milligas" Gas.Arith.n_fp_encoding Gas.Arith.zero)) ~select:(function - | Successful_internal_manager_result (IDelegation_result _ as op) -> + | Successful_internal_operation_result (IDelegation_result _ as op) -> Some op | _ -> None) ~kind:Kind.Delegation_manager_kind @@ -638,12 +643,13 @@ module Internal_manager_result = struct let event_case = make - ~op_case:Internal_result.event_case + ~op_case:Internal_operation.event_case ~encoding: Data_encoding.( obj1 (dft "consumed_milligas" Gas.Arith.n_fp_encoding Gas.Arith.zero)) ~select:(function - | Successful_internal_manager_result (IEvent_result _ as op) -> Some op + | Successful_internal_operation_result (IEvent_result _ as op) -> + Some op | _ -> None) ~kind:Kind.Event_manager_kind ~proj:(function[@coq_match_with_default] @@ -651,13 +657,13 @@ module Internal_manager_result = struct ~inj:(fun consumed_gas -> IEvent_result {consumed_gas}) end -let internal_manager_operation_result_encoding : - packed_internal_manager_operation_result Data_encoding.t = +let internal_operation_result_encoding : + packed_internal_operation_result Data_encoding.t = let make (type kind) - (Internal_manager_result.MCase res_case : - kind Internal_manager_result.case) - (Internal_result.MCase ires_case : kind Internal_result.case) = - let (Internal_result.MCase op_case) = res_case.op_case in + (Internal_operation_result.MCase res_case : + kind Internal_operation_result.case) + (Internal_operation.MCase ires_case : kind Internal_operation.case) = + let (Internal_operation.MCase op_case) = res_case.op_case in case (Tag op_case.tag) ~title:op_case.name @@ -674,19 +680,19 @@ let internal_manager_operation_result_encoding : | None -> None) (fun (((), source, nonce), (op, res)) -> let op = {source; operation = ires_case.inj op; nonce} in - Internal_manager_operation_result (op, res)) + Internal_operation_result (op, res)) in def "apply_internal_results.alpha.operation_result" @@ union [ make - Internal_manager_result.transaction_case - Internal_result.transaction_case; + Internal_operation_result.transaction_case + Internal_operation.transaction_case; make - Internal_manager_result.origination_case - Internal_result.origination_case; + Internal_operation_result.origination_case + Internal_operation.origination_case; make - Internal_manager_result.delegation_case - Internal_result.delegation_case; - make Internal_manager_result.event_case Internal_result.event_case; + Internal_operation_result.delegation_case + Internal_operation.delegation_case; + make Internal_operation_result.event_case Internal_operation.event_case; ] diff --git a/src/proto_alpha/lib_protocol/apply_internal_results.mli b/src/proto_alpha/lib_protocol/apply_internal_results.mli index a827d2a18035de9277ebb106fb742f834ddc1c08..65e80c602af98a0e51d1326ae32baf8771e7b901 100644 --- a/src/proto_alpha/lib_protocol/apply_internal_results.mli +++ b/src/proto_alpha/lib_protocol/apply_internal_results.mli @@ -30,45 +30,50 @@ open Alpha_context -type 'kind internal_manager_operation = +(** [internal_operation_contents] are the internal operations as output in + receipts. + The type simply weakens {!Script_typed_ir.internal_operation_contents} so + that it is easier to define an encoding for it (i.e. we remove the typed + parameter). *) +type 'kind internal_operation_contents = | Transaction : { amount : Tez.tez; parameters : Script.lazy_expr; entrypoint : Entrypoint.t; destination : Destination.t; } - -> Kind.transaction internal_manager_operation + -> Kind.transaction internal_operation_contents | Origination : { delegate : Signature.Public_key_hash.t option; script : Script.t; credit : Tez.tez; } - -> Kind.origination internal_manager_operation + -> Kind.origination internal_operation_contents | Delegation : Signature.Public_key_hash.t option - -> Kind.delegation internal_manager_operation + -> Kind.delegation internal_operation_contents | Event : { ty : Script.expr; tag : Entrypoint.t; payload : Script.expr; } - -> Kind.event internal_manager_operation + -> Kind.event internal_operation_contents -type 'kind internal_contents = { +type 'kind internal_operation = { source : Contract.t; - operation : 'kind internal_manager_operation; + operation : 'kind internal_operation_contents; nonce : int; } -type packed_internal_contents = - | Internal_contents : 'kind internal_contents -> packed_internal_contents +type packed_internal_operation = + | Internal_operation : 'kind internal_operation -> packed_internal_operation -val contents_of_packed_internal_operation : - Script_typed_ir.packed_internal_operation -> packed_internal_contents +val packed_internal_operation : + Script_typed_ir.packed_internal_operation -> packed_internal_operation -val contents_of_packed_internal_operations : +val packed_internal_operations : Script_typed_ir.packed_internal_operation list -> - packed_internal_contents list + packed_internal_operation list (** Result of applying an internal transaction. *) type successful_transaction_result = @@ -103,43 +108,43 @@ type successful_origination_result = { paid_storage_size_diff : Z.t; } -(** Result of applying a {!Script_typed_ir.internal_operation}. *) -type _ successful_internal_manager_operation_result = +(** Result of applying a {!Script_typed_ir.internal_operation_contents}. *) +type _ successful_internal_operation_result = | ITransaction_result : successful_transaction_result - -> Kind.transaction successful_internal_manager_operation_result + -> Kind.transaction successful_internal_operation_result | IOrigination_result : successful_origination_result - -> Kind.origination successful_internal_manager_operation_result + -> Kind.origination successful_internal_operation_result | IDelegation_result : { consumed_gas : Gas.Arith.fp; } - -> Kind.delegation successful_internal_manager_operation_result + -> Kind.delegation successful_internal_operation_result | IEvent_result : { consumed_gas : Gas.Arith.fp; } - -> Kind.event successful_internal_manager_operation_result + -> Kind.event successful_internal_operation_result -type 'kind internal_manager_operation_result = +type 'kind internal_operation_result = ( 'kind, 'kind Kind.manager, - 'kind successful_internal_manager_operation_result ) + 'kind successful_internal_operation_result ) Apply_operation_result.operation_result -type packed_internal_manager_operation_result = - | Internal_manager_operation_result : - 'kind internal_contents * 'kind internal_manager_operation_result - -> packed_internal_manager_operation_result +type packed_internal_operation_result = + | Internal_operation_result : + 'kind internal_operation * 'kind internal_operation_result + -> packed_internal_operation_result -val contents_of_internal_operation : - 'kind Script_typed_ir.internal_operation -> 'kind internal_contents +val internal_operation : + 'kind Script_typed_ir.internal_operation -> 'kind internal_operation -val pack_internal_manager_operation_result : +val pack_internal_operation_result : 'kind Script_typed_ir.internal_operation -> - 'kind internal_manager_operation_result -> - packed_internal_manager_operation_result + 'kind internal_operation_result -> + packed_internal_operation_result -val internal_contents_encoding : packed_internal_contents Data_encoding.t +val internal_operation_encoding : packed_internal_operation Data_encoding.t -val internal_manager_operation_result_encoding : - packed_internal_manager_operation_result Data_encoding.t +val internal_operation_result_encoding : + packed_internal_operation_result Data_encoding.t diff --git a/src/proto_alpha/lib_protocol/apply_results.ml b/src/proto_alpha/lib_protocol/apply_results.ml index 1c3b6bdf02eb1355c61c7ea48120a4d65a6d1d84..e3edc5bbe3bb96e026d2b771dc291819f38d4dcd 100644 --- a/src/proto_alpha/lib_protocol/apply_results.ml +++ b/src/proto_alpha/lib_protocol/apply_results.ml @@ -1012,7 +1012,7 @@ type 'kind contents_result = | Manager_operation_result : { balance_updates : Receipt.balance_updates; operation_result : 'kind manager_operation_result; - internal_operation_results : packed_internal_manager_operation_result list; + internal_operation_results : packed_internal_operation_result list; } -> 'kind Kind.manager contents_result @@ -1378,7 +1378,7 @@ module Encoding = struct (req "operation_result" res_case.t) (dft "internal_operation_results" - (list internal_manager_operation_result_encoding) + (list internal_operation_result_encoding) []); select = (function diff --git a/src/proto_alpha/lib_protocol/apply_results.mli b/src/proto_alpha/lib_protocol/apply_results.mli index ec7cd4a0289cae8d8bcaab8049e22075c0f02aad..f9aed1d830ec71b23aa0d56a36fa4cfc64a69547 100644 --- a/src/proto_alpha/lib_protocol/apply_results.mli +++ b/src/proto_alpha/lib_protocol/apply_results.mli @@ -97,7 +97,7 @@ and 'kind contents_result = | Manager_operation_result : { balance_updates : Receipt.balance_updates; operation_result : 'kind manager_operation_result; - internal_operation_results : packed_internal_manager_operation_result list; + internal_operation_results : packed_internal_operation_result list; } -> 'kind Kind.manager contents_result diff --git a/src/proto_alpha/lib_protocol/script_ir_translator.ml b/src/proto_alpha/lib_protocol/script_ir_translator.ml index 7dcabe585ff4cf693ae98b18085c0de1a3cf62a6..454349c54190a63c49897794e45e834312acb7d7 100644 --- a/src/proto_alpha/lib_protocol/script_ir_translator.ml +++ b/src/proto_alpha/lib_protocol/script_ir_translator.ml @@ -416,10 +416,10 @@ let unparse_key_hash ~loc ctxt mode k = (* Operations are only unparsed during the production of execution traces of the interpreter. *) let unparse_operation ~loc ctxt {piop; lazy_storage_diff = _} = - let iop = Apply_internal_results.contents_of_packed_internal_operation piop in + let iop = Apply_internal_results.packed_internal_operation piop in let bytes = Data_encoding.Binary.to_bytes_exn - Apply_internal_results.internal_contents_encoding + Apply_internal_results.internal_operation_encoding iop in Gas.consume ctxt (Unparse_costs.operation bytes) >|? fun ctxt -> diff --git a/src/proto_alpha/lib_protocol/script_typed_ir.ml b/src/proto_alpha/lib_protocol/script_typed_ir.ml index c4c3c4ab5c6a6e0436be68b6d99b60320d5fb4b0..33471f475c7364b2f723062c417c78241f21bb42 100644 --- a/src/proto_alpha/lib_protocol/script_typed_ir.ml +++ b/src/proto_alpha/lib_protocol/script_typed_ir.ml @@ -1338,7 +1338,7 @@ and ('input, 'output) view_signature = } -> ('input, 'output) view_signature -and 'kind manager_operation = +and 'kind internal_operation_contents = | Transaction_to_implicit : { destination : Signature.Public_key_hash.t; amount : Tez.tez; @@ -1348,7 +1348,7 @@ and 'kind manager_operation = parameters : 'a; unparsed_parameters : Script.expr; } - -> Kind.transaction manager_operation + -> Kind.transaction internal_operation_contents | Transaction_to_smart_contract : { destination : Contract_hash.t; amount : Tez.tez; @@ -1358,14 +1358,14 @@ and 'kind manager_operation = parameters : 'a; unparsed_parameters : Script.expr; } - -> Kind.transaction manager_operation + -> Kind.transaction internal_operation_contents | Transaction_to_tx_rollup : { destination : Tx_rollup.t; parameters_ty : ('a, _) ty; parameters : 'a; unparsed_parameters : Script.expr; } - -> Kind.transaction manager_operation + -> Kind.transaction internal_operation_contents | Transaction_to_sc_rollup : { destination : Sc_rollup.t; entrypoint : Entrypoint.t; @@ -1373,13 +1373,13 @@ and 'kind manager_operation = parameters : 'a; unparsed_parameters : Script.expr; } - -> Kind.transaction manager_operation + -> Kind.transaction internal_operation_contents | Event : { ty : Script.expr; tag : Entrypoint.t; unparsed_data : Script.expr; } - -> Kind.event manager_operation + -> Kind.event internal_operation_contents | Origination : { delegate : Signature.Public_key_hash.t option; code : Script.expr; @@ -1389,14 +1389,14 @@ and 'kind manager_operation = storage_type : ('storage, _) ty; storage : 'storage; } - -> Kind.origination manager_operation + -> Kind.origination internal_operation_contents | Delegation : Signature.Public_key_hash.t option - -> Kind.delegation manager_operation + -> Kind.delegation internal_operation_contents and 'kind internal_operation = { source : Contract.t; - operation : 'kind manager_operation; + operation : 'kind internal_operation_contents; nonce : int; } @@ -1427,12 +1427,8 @@ type ('arg, 'storage) script = } -> ('arg, 'storage) script -type packed_manager_operation = - | Manager : 'kind manager_operation -> packed_manager_operation -[@@ocaml.unboxed] - -let manager_kind : type kind. kind manager_operation -> kind Kind.manager = - function +let manager_kind : + type kind. kind internal_operation_contents -> kind Kind.manager = function | Transaction_to_implicit _ -> Kind.Transaction_manager_kind | Transaction_to_smart_contract _ -> Kind.Transaction_manager_kind | Transaction_to_tx_rollup _ -> Kind.Transaction_manager_kind diff --git a/src/proto_alpha/lib_protocol/script_typed_ir.mli b/src/proto_alpha/lib_protocol/script_typed_ir.mli index 229a60e7d7b4935e0afcf2dc72133f5c222e2429..09e06ddbf84ce997a70a08b12acd82173666cd08 100644 --- a/src/proto_alpha/lib_protocol/script_typed_ir.mli +++ b/src/proto_alpha/lib_protocol/script_typed_ir.mli @@ -1469,13 +1469,13 @@ and ('input, 'output) view_signature = } -> ('input, 'output) view_signature -and 'kind manager_operation = +and 'kind internal_operation_contents = | Transaction_to_implicit : { (* The [unparsed_parameters] field may seem useless since we have access to a typed version of the field (with [parameters_ty] and [parameters]), but we keep it so that we do not have to unparse the typed version in order to produce the receipt - ([Apply_results.internal_manager_operation]). *) + ([Apply_internal_results.internal_operation_contents]). *) destination : Signature.Public_key_hash.t; amount : Tez.tez; entrypoint : Entrypoint.t; @@ -1484,13 +1484,13 @@ and 'kind manager_operation = parameters : 'a; unparsed_parameters : Script.expr; } - -> Kind.transaction manager_operation + -> Kind.transaction internal_operation_contents | Transaction_to_smart_contract : { (* The [unparsed_parameters] field may seem useless since we have access to a typed version of the field (with [parameters_ty] and [parameters]), but we keep it so that we do not have to unparse the typed version in order to produce the receipt - ([Apply_results.internal_manager_operation]). *) + ([Apply_internal_results.internal_operation_contents]). *) destination : Contract_hash.t; amount : Tez.tez; entrypoint : Entrypoint.t; @@ -1499,14 +1499,14 @@ and 'kind manager_operation = parameters : 'a; unparsed_parameters : Script.expr; } - -> Kind.transaction manager_operation + -> Kind.transaction internal_operation_contents | Transaction_to_tx_rollup : { destination : Tx_rollup.t; parameters_ty : ('a, _) ty; parameters : 'a; unparsed_parameters : Script.expr; } - -> Kind.transaction manager_operation + -> Kind.transaction internal_operation_contents | Transaction_to_sc_rollup : { destination : Sc_rollup.t; entrypoint : Entrypoint.t; @@ -1514,13 +1514,13 @@ and 'kind manager_operation = parameters : 'a; unparsed_parameters : Script.expr; } - -> Kind.transaction manager_operation + -> Kind.transaction internal_operation_contents | Event : { ty : Script.expr; tag : Entrypoint.t; unparsed_data : Script.expr; } - -> Kind.event manager_operation + -> Kind.event internal_operation_contents | Origination : { delegate : Signature.Public_key_hash.t option; code : Script.expr; @@ -1530,14 +1530,14 @@ and 'kind manager_operation = storage_type : ('storage, _) ty; storage : 'storage; } - -> Kind.origination manager_operation + -> Kind.origination internal_operation_contents | Delegation : Signature.Public_key_hash.t option - -> Kind.delegation manager_operation + -> Kind.delegation internal_operation_contents and 'kind internal_operation = { source : Contract.t; - operation : 'kind manager_operation; + operation : 'kind internal_operation_contents; nonce : int; } @@ -1563,11 +1563,7 @@ type ('arg, 'storage) script = } -> ('arg, 'storage) script -type packed_manager_operation = - | Manager : 'kind manager_operation -> packed_manager_operation -[@@ocaml.unboxed] - -val manager_kind : 'kind manager_operation -> 'kind Kind.manager +val manager_kind : 'kind internal_operation_contents -> 'kind Kind.manager val kinstr_location : (_, _, _, _) kinstr -> Script.location diff --git a/src/proto_alpha/lib_protocol/test/helpers/incremental.ml b/src/proto_alpha/lib_protocol/test/helpers/incremental.ml index 7c03e9c1d9ba13f55e73ad78ef1a9ecf5a7f91a7..195e94ff58fb9f05fd82941c0c93cdcf7435c44c 100644 --- a/src/proto_alpha/lib_protocol/test/helpers/incremental.ml +++ b/src/proto_alpha/lib_protocol/test/helpers/incremental.ml @@ -144,8 +144,7 @@ let detect_script_failure : in detect_script_failure operation_result >>? fun () -> List.iter_e - (fun (Internal_manager_operation_result (_, r)) -> - detect_script_failure r) + (fun (Internal_operation_result (_, r)) -> detect_script_failure r) internal_operation_results in function diff --git a/src/proto_alpha/lib_protocol/test/integration/michelson/test_contract_event.ml b/src/proto_alpha/lib_protocol/test/integration/michelson/test_contract_event.ml index 217f9eb453065abfda00800d7bd5d366846214b0..9bee0ddb6aea3d2120fc4ef70a080804c5cb8bca 100644 --- a/src/proto_alpha/lib_protocol/test/integration/michelson/test_contract_event.ml +++ b/src/proto_alpha/lib_protocol/test/integration/michelson/test_contract_event.ml @@ -82,14 +82,14 @@ let contract_test () = { internal_operation_results = [ - Internal_manager_operation_result + Internal_operation_result ( { operation = Event {tag = tag1; payload = data1; ty = ty1}; _; }, Applied (IEvent_result _) ); - Internal_manager_operation_result + Internal_operation_result ( { operation = Event {tag = tag2; payload = data2; ty = ty2}; diff --git a/src/proto_alpha/lib_tx_rollup/daemon.ml b/src/proto_alpha/lib_tx_rollup/daemon.ml index 0e9419d71ccf66ea402aed69e195e813dfce7e7a..673e1dd72cd6caed6508568ba60b93c7d21b9484 100644 --- a/src/proto_alpha/lib_tx_rollup/daemon.ml +++ b/src/proto_alpha/lib_tx_rollup/daemon.ml @@ -76,7 +76,7 @@ let parse_tx_rollup_deposit_parameters : let open Protocol in (* /!\ This pattern matching needs to remain in sync with the deposit parameters. See the transaction to Tx_rollup case in - Protocol.Apply.Apply.apply_internal_manager_operations *) + Protocol.Apply.Apply.apply_internal_operation_contents *) match root parameters with | Seq ( _, @@ -124,7 +124,7 @@ let extract_messages_from_block block_info rollup_id = (msg :: messages, tickets) in let get_messages_of_internal_operation ~source messages_tickets - (Internal_manager_operation_result + (Internal_operation_result ( { operation; source = _use_the_source_of_the_external_operation; @@ -164,7 +164,7 @@ let extract_messages_from_block block_info rollup_id = source:public_key_hash -> kind manager_operation -> kind manager_operation_result -> - packed_internal_manager_operation_result list -> + packed_internal_operation_result list -> Tx_rollup_message.t list * Ticket.t list -> Tx_rollup_message.t list * Ticket.t list = fun ~source op result internal_operation_results messages_tickets -> @@ -712,7 +712,7 @@ let handle_l1_operation direction (block : Alpha_block_services.block_info) source:public_key_hash -> kind manager_operation -> kind manager_operation_result -> - packed_internal_manager_operation_result list -> + packed_internal_operation_result list -> 'acc -> 'acc tzresult Lwt.t = fun ~source op result _internal_operation_results acc ->