diff --git a/src/proto_alpha/lib_client/injection.ml b/src/proto_alpha/lib_client/injection.ml index bf0d74bf4ab2b68cd79fdc8f65d260aeb834161a..2e5059d842e6b7630c6eea86679ee0c65d82a4c9 100644 --- a/src/proto_alpha/lib_client/injection.ml +++ b/src/proto_alpha/lib_client/injection.ml @@ -310,8 +310,7 @@ let estimated_gas_single (type kind) | Transaction_result ( Transaction_to_contract_result {consumed_gas; _} | Transaction_to_tx_rollup_result {consumed_gas; _} - | Transaction_to_sc_rollup_result {consumed_gas; _} - | Transaction_to_event_result {consumed_gas; _} ) -> + | Transaction_to_sc_rollup_result {consumed_gas; _} ) -> Ok consumed_gas | Origination_result {consumed_gas; _} -> Ok consumed_gas | Reveal_result {consumed_gas} -> Ok consumed_gas @@ -353,11 +352,11 @@ let estimated_gas_single (type kind) | ITransaction_result ( Transaction_to_contract_result {consumed_gas; _} | Transaction_to_tx_rollup_result {consumed_gas; _} - | Transaction_to_sc_rollup_result {consumed_gas; _} - | Transaction_to_event_result {consumed_gas; _} ) -> - Ok consumed_gas - | IOrigination_result {consumed_gas; _} -> Ok consumed_gas - | IDelegation_result {consumed_gas} -> Ok consumed_gas) + | Transaction_to_sc_rollup_result {consumed_gas; _} ) + | IOrigination_result {consumed_gas; _} + | IDelegation_result {consumed_gas} + | IEvent_result {consumed_gas} -> + Ok consumed_gas) | Skipped _ -> Ok Gas.Arith.zero (* there must be another error for this to happen *) | Failed (_, errs) -> Error (Environment.wrap_tztrace errs) @@ -389,10 +388,7 @@ let estimated_storage_single (type kind) ~tx_rollup_origination_size We need to charge for newly allocated storage (as we do for Michelson’s big map). *) Ok Z.zero - | Transaction_result - (Transaction_to_sc_rollup_result _ | Transaction_to_event_result _) - -> - Ok Z.zero + | Transaction_result (Transaction_to_sc_rollup_result _) -> Ok Z.zero | Origination_result {paid_storage_size_diff; _} -> Ok (Z.add paid_storage_size_diff origination_size) | Reveal_result _ -> Ok Z.zero @@ -449,13 +445,10 @@ let estimated_storage_single (type kind) ~tx_rollup_origination_size We need to charge for newly allocated storage (as we do for Michelson’s big map). *) Ok Z.zero - | ITransaction_result - (Transaction_to_sc_rollup_result _ | Transaction_to_event_result _) - -> - Ok Z.zero + | ITransaction_result (Transaction_to_sc_rollup_result _) -> Ok Z.zero | IOrigination_result {paid_storage_size_diff; _} -> Ok (Z.add paid_storage_size_diff origination_size) - | IDelegation_result _ -> Ok Z.zero) + | IDelegation_result _ | IEvent_result _ -> Ok Z.zero) | Skipped _ -> Ok Z.zero (* there must be another error for this to happen *) | Failed (_, errs) -> Error (Environment.wrap_tztrace errs) @@ -499,8 +492,7 @@ let originated_contracts_single (type kind) Ok originated_contracts | Transaction_result ( Transaction_to_tx_rollup_result _ - | Transaction_to_sc_rollup_result _ | Transaction_to_event_result _ - ) -> + | Transaction_to_sc_rollup_result _ ) -> Ok [] | Origination_result {originated_contracts; _} -> Ok originated_contracts @@ -540,12 +532,11 @@ let originated_contracts_single (type kind) Ok originated_contracts | ITransaction_result ( Transaction_to_tx_rollup_result _ - | Transaction_to_sc_rollup_result _ | Transaction_to_event_result _ - ) -> + | Transaction_to_sc_rollup_result _ ) -> Ok [] | IOrigination_result {originated_contracts; _} -> Ok originated_contracts - | IDelegation_result _ -> Ok []) + | IDelegation_result _ | IEvent_result _ -> Ok []) | Skipped _ -> Ok [] (* there must be another error for this to happen *) | Failed (_, errs) -> Error (Environment.wrap_tztrace errs) in diff --git a/src/proto_alpha/lib_client/operation_result.ml b/src/proto_alpha/lib_client/operation_result.ml index cfaf5c7c4da68afc827c4ec8fa3ff66fcd222506..dbccfee2151bd8189b542fa20f7adbd03aa2d51e 100644 --- a/src/proto_alpha/lib_client/operation_result.ml +++ b/src/proto_alpha/lib_client/operation_result.ml @@ -32,13 +32,16 @@ open Apply_internal_results let tez_sym = "\xEA\x9C\xA9" +let pp_micheline_expr ppf expr = + Format.fprintf ppf "@[%a@]" Michelson_v1_printer.print_expr expr + let pp_micheline_from_lazy_expr ppf expr = let expr = WithExceptions.Option.to_exn ~none:(Failure "ill-serialized micheline expression") (Data_encoding.force_decode expr) in - Format.fprintf ppf "@[%a@]" Michelson_v1_printer.print_expr expr + pp_micheline_expr ppf expr let pp_internal_operation ppf (Internal_contents {operation; source; _}) = (* For now, try to use the same format as in [pp_manager_operation_content]. *) @@ -99,7 +102,18 @@ let pp_internal_operation ppf (Internal_contents {operation; source; _}) = Format.fprintf ppf "Delegation:@,Contract: %a@,To: " Contract.pp source ; match delegate_opt with | None -> Format.pp_print_string ppf "nobody" - | Some delegate -> Signature.Public_key_hash.pp ppf delegate)) ; + | Some delegate -> Signature.Public_key_hash.pp ppf delegate) + | Event {addr; tag; payload} -> + Format.fprintf + ppf + "Event:@,From: %a@,To: %a" + Contract.pp + source + Contract_event.pp + addr ; + if not (Entrypoint.is_default tag) then + Format.fprintf ppf "@,Tag: %a" Entrypoint.pp tag ; + Format.fprintf ppf "@,Payload: %a" pp_micheline_expr payload) ; Format.fprintf ppf "@]" let pp_manager_operation_content (type kind) source ppf @@ -542,9 +556,6 @@ let pp_transaction_result ppf = function | Transaction_to_sc_rollup_result {consumed_gas; inbox_after} -> pp_consumed_gas ppf consumed_gas ; pp_inbox_after ppf inbox_after - | Transaction_to_event_result {consumed_gas} -> - pp_consumed_gas ppf consumed_gas ; - Format.fprintf ppf "@,@[Event Applied]" let pp_operation_result ~operation_name pp_operation_result ppf = function | Skipped _ -> Format.fprintf ppf "This operation was skipped." @@ -803,13 +814,15 @@ let pp_internal_operation_and_result ppf | 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) = match result with | ITransaction_result tx -> pp_transaction_result ppf tx | IOrigination_result op_res -> pp_origination_result ppf op_res - | IDelegation_result {consumed_gas} -> pp_consumed_gas ppf consumed_gas + | IDelegation_result {consumed_gas} | IEvent_result {consumed_gas} -> + pp_consumed_gas ppf consumed_gas in Format.fprintf ppf diff --git a/src/proto_alpha/lib_protocol/alpha_context.mli b/src/proto_alpha/lib_protocol/alpha_context.mli index 6fbd0a25f0085128d2ac2ebbc4b2d32bb160099c..31e92c6d37d9bf985707d6c2e5483b00ff8c914f 100644 --- a/src/proto_alpha/lib_protocol/alpha_context.mli +++ b/src/proto_alpha/lib_protocol/alpha_context.mli @@ -3331,7 +3331,6 @@ module Destination : sig | Contract of Contract.t | Tx_rollup of Tx_rollup.t | Sc_rollup of Sc_rollup.t - | Event of Contract_event.t val encoding : t Data_encoding.t @@ -3506,6 +3505,8 @@ module Kind : sig type delegation = Delegation_kind + type event = Event_kind + type set_deposits_limit = Set_deposits_limit_kind type failing_noop = Failing_noop_kind @@ -3556,6 +3557,7 @@ module Kind : sig | Transaction_manager_kind : transaction manager | Origination_manager_kind : origination manager | Delegation_manager_kind : delegation manager + | Event_manager_kind : event manager | Register_global_constant_manager_kind : register_global_constant manager | Set_deposits_limit_manager_kind : set_deposits_limit manager | Tx_rollup_origination_manager_kind : tx_rollup_origination manager diff --git a/src/proto_alpha/lib_protocol/apply.ml b/src/proto_alpha/lib_protocol/apply.ml index 8fbaf8d330cc908dcb4d60f5aab927059a889a4d..a740e06c671839ecb22df1f288978f8519101cbc 100644 --- a/src/proto_alpha/lib_protocol/apply.ml +++ b/src/proto_alpha/lib_protocol/apply.ml @@ -1187,12 +1187,11 @@ let apply_internal_manager_operation_content : Transaction_to_sc_rollup_result {consumed_gas; inbox_after} in (ctxt, ITransaction_result result, []) - | Transaction_to_event {addr = _; unparsed_data = _; tag = _} -> + | Event {addr = _; unparsed_data = _; tag = _} -> return ( ctxt, - ITransaction_result - (Transaction_to_event_result - {consumed_gas = Gas.consumed ~since:ctxt_before_op ~until:ctxt}), + IEvent_result + {consumed_gas = Gas.consumed ~since:ctxt_before_op ~until:ctxt}, [] ) | Origination { @@ -1970,8 +1969,6 @@ let burn_transaction_storage_fees ctxt trr ~storage_limit ~payer = storage_limit, Transaction_to_tx_rollup_result {payload with balance_updates} ) | Transaction_to_sc_rollup_result _ -> return (ctxt, storage_limit, trr) - | Transaction_to_event_result {consumed_gas} -> - return (ctxt, storage_limit, Transaction_to_event_result {consumed_gas}) let burn_origination_storage_fees ctxt { @@ -2143,6 +2140,7 @@ let burn_internal_storage_fees : >|=? fun (ctxt, storage_limit, origination_result) -> (ctxt, storage_limit, IOrigination_result origination_result) | IDelegation_result _ -> return (ctxt, storage_limit, smopr) + | IEvent_result _ -> return (ctxt, storage_limit, smopr) let apply_manager_contents (type kind) ctxt mode chain_id (op : kind Kind.manager contents) : diff --git a/src/proto_alpha/lib_protocol/apply_internal_results.ml b/src/proto_alpha/lib_protocol/apply_internal_results.ml index 2a4ddcf7d2e876ac192044257b5478f12d670d28..b81396f75c549e9ebef84b62d20ff76f7c2bde5d 100644 --- a/src/proto_alpha/lib_protocol/apply_internal_results.ml +++ b/src/proto_alpha/lib_protocol/apply_internal_results.ml @@ -44,6 +44,12 @@ type 'kind internal_manager_operation = | Delegation : Signature.Public_key_hash.t option -> Kind.delegation internal_manager_operation + | Event : { + addr : Contract_event.t; + tag : Entrypoint.t; + payload : Script.expr; + } + -> Kind.event internal_manager_operation type packed_internal_manager_operation = | Manager : @@ -91,14 +97,8 @@ let contents_of_internal_operation (type kind) entrypoint; parameters = Script.lazy_expr unparsed_parameters; } - | Transaction_to_event {addr; tag; unparsed_data} -> - Transaction - { - destination = Event addr; - amount = Tez.zero; - entrypoint = tag; - parameters = Script.lazy_expr unparsed_data; - } + | Event {addr; tag; unparsed_data} -> + Event {addr; tag; payload = unparsed_data} | Origination {delegate; code; unparsed_storage; credit; _} -> let script = { @@ -139,7 +139,6 @@ type successful_transaction_result = consumed_gas : Gas.Arith.fp; inbox_after : Sc_rollup.Inbox.t; } - | Transaction_to_event_result of {consumed_gas : Gas.Arith.fp} type successful_origination_result = { lazy_storage_diff : Lazy_storage.diffs option; @@ -162,6 +161,10 @@ type _ successful_internal_manager_operation_result = consumed_gas : Gas.Arith.fp; } -> Kind.delegation successful_internal_manager_operation_result + | IEvent_result : { + consumed_gas : Gas.Arith.fp; + } + -> Kind.event successful_internal_manager_operation_result type packed_successful_internal_manager_operation_result = | Successful_internal_manager_result : @@ -309,15 +312,6 @@ module Internal_result = struct (function | consumed_gas, inbox_after -> Transaction_to_sc_rollup_result {consumed_gas; inbox_after}); - case - ~title:"To_event" - (Tag 3) - (obj1 - (dft "consumed_milligas" Gas.Arith.n_fp_encoding Gas.Arith.zero)) - (function - | Transaction_to_event_result {consumed_gas} -> Some consumed_gas - | _ -> None) - (fun consumed_gas -> Transaction_to_event_result {consumed_gas}); ] let[@coq_axiom_with_reason "gadt"] transaction_case = @@ -413,6 +407,40 @@ module Internal_result = struct inj = (fun key -> Delegation key); } + let[@coq_axiom_with_reason "gadt"] event_case = + MCase + { + (* This value should be changed with care: maybe receipts are read by + external tools such as indexers. *) + tag = 4; + name = "event"; + encoding = + obj3 + (req "addr" Contract_event.Hash.encoding) + (opt "tag" Entrypoint.smart_encoding) + (opt "payload" Script.expr_encoding); + iselect : Kind.event iselect = + (function + | Internal_manager_operation_result + (({operation = Event _; _} as op), res) -> + Some (op, res) + | _ -> None); + select = (function Manager (Event _ as op) -> Some op | _ -> None); + proj = + (function + | Event {addr; tag; payload} -> + let tag = if Entrypoint.is_default tag then None else Some tag in + let payload = + if Script_repr.is_unit payload then None else Some payload + in + (addr, tag, payload)); + inj = + (fun (addr, tag, payload) -> + let tag = Option.value ~default:Entrypoint.default tag in + let payload = Option.value ~default:Script_repr.unit payload in + Event {addr; tag; payload}); + } + let case tag name args proj inj = case tag @@ -432,7 +460,12 @@ module Internal_result = struct in union ~tag_size:`Uint8 - [make transaction_case; make origination_case; make delegation_case] + [ + make transaction_case; + make origination_case; + make delegation_case; + make event_case; + ] end let internal_contents_encoding : packed_internal_contents Data_encoding.t = @@ -594,6 +627,20 @@ module Internal_manager_result = struct ~proj:(function[@coq_match_with_default] | IDelegation_result {consumed_gas} -> consumed_gas) ~inj:(fun consumed_gas -> IDelegation_result {consumed_gas}) + + let event_case = + make + ~op_case:Internal_result.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 + | _ -> None) + ~kind:Kind.Event_manager_kind + ~proj:(function[@coq_match_with_default] + | IEvent_result {consumed_gas} -> consumed_gas) + ~inj:(fun consumed_gas -> IEvent_result {consumed_gas}) end let internal_manager_operation_result_encoding : @@ -633,4 +680,5 @@ let internal_manager_operation_result_encoding : make Internal_manager_result.delegation_case Internal_result.delegation_case; + make Internal_manager_result.event_case Internal_result.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 2404113297bffcd3ad92b977b79f2b85880055c2..0fe963b67a78f4bada6f0e3e48fa87f215983d19 100644 --- a/src/proto_alpha/lib_protocol/apply_internal_results.mli +++ b/src/proto_alpha/lib_protocol/apply_internal_results.mli @@ -47,6 +47,12 @@ type 'kind internal_manager_operation = | Delegation : Signature.Public_key_hash.t option -> Kind.delegation internal_manager_operation + | Event : { + addr : Contract_event.t; + tag : Entrypoint.t; + payload : Script.expr; + } + -> Kind.event internal_manager_operation type 'kind internal_contents = { source : Contract.t; @@ -86,7 +92,6 @@ type successful_transaction_result = consumed_gas : Gas.Arith.fp; inbox_after : Sc_rollup.Inbox.t; } - | Transaction_to_event_result of {consumed_gas : Gas.Arith.fp} (** Result of applying an internal origination. *) type successful_origination_result = { @@ -110,6 +115,10 @@ type _ successful_internal_manager_operation_result = consumed_gas : Gas.Arith.fp; } -> Kind.delegation successful_internal_manager_operation_result + | IEvent_result : { + consumed_gas : Gas.Arith.fp; + } + -> Kind.event successful_internal_manager_operation_result type 'kind internal_manager_operation_result = ( 'kind, diff --git a/src/proto_alpha/lib_protocol/apply_results.ml b/src/proto_alpha/lib_protocol/apply_results.ml index 824c7b4bdeef6cad794a863b7bf301ed3deb2898..923048738450e0c1e602d202f938d40527fe8b99 100644 --- a/src/proto_alpha/lib_protocol/apply_results.ml +++ b/src/proto_alpha/lib_protocol/apply_results.ml @@ -389,15 +389,6 @@ module Manager_result = struct (function | consumed_gas, inbox_after -> Transaction_to_sc_rollup_result {consumed_gas; inbox_after}); - case - ~title:"To_event" - (Tag 3) - (obj1 - (dft "consumed_milligas" Gas.Arith.n_fp_encoding Gas.Arith.zero)) - (function - | Transaction_to_event_result {consumed_gas} -> Some consumed_gas - | _ -> None) - (fun consumed_gas -> Transaction_to_event_result {consumed_gas}); ] let[@coq_axiom_with_reason "gadt"] transaction_case = @@ -1002,6 +993,8 @@ let equal_manager_kind : | ( Kind.Register_global_constant_manager_kind, Kind.Register_global_constant_manager_kind ) -> Some Eq + | Kind.Event_manager_kind, Kind.Event_manager_kind -> Some Eq + | Kind.Event_manager_kind, _ -> None | Kind.Register_global_constant_manager_kind, _ -> None | Kind.Set_deposits_limit_manager_kind, Kind.Set_deposits_limit_manager_kind -> diff --git a/src/proto_alpha/lib_protocol/destination_repr.ml b/src/proto_alpha/lib_protocol/destination_repr.ml index 93cb5c141a477033d13f6fce73e1c94ef7d261df..49e73f1c0d01e6ffcecb8b29e735f2259c6bc60b 100644 --- a/src/proto_alpha/lib_protocol/destination_repr.ml +++ b/src/proto_alpha/lib_protocol/destination_repr.ml @@ -29,7 +29,6 @@ type t = | Contract of Contract_repr.t | Tx_rollup of Tx_rollup_repr.t | Sc_rollup of Sc_rollup_repr.t - | Event of Contract_event_repr.t (* If you add more cases to this type, please update the [test_compare_destination] test in [test/unit/test_destination_repr.ml] to ensure that the compare @@ -44,7 +43,6 @@ include Compare.Make (struct | Contract k1, Contract k2 -> Contract_repr.compare k1 k2 | Tx_rollup k1, Tx_rollup k2 -> Tx_rollup_repr.compare k1 k2 | Sc_rollup k1, Sc_rollup k2 -> Sc_rollup_repr.Address.compare k1 k2 - | Event k1, Event k2 -> Contract_event_repr.Hash.compare k1 k2 (* This function is used by the Michelson interpreter to compare addresses. It is of significant importance to remember that in Michelson, address comparison is used to distinguish between @@ -56,15 +54,12 @@ include Compare.Make (struct | _, Contract _ -> 1 | Tx_rollup _, _ -> -1 | _, Tx_rollup _ -> 1 - | Sc_rollup _, _ -> -1 - | _, Sc_rollup _ -> 1 end) let to_b58check = function | Contract k -> Contract_repr.to_b58check k | Tx_rollup k -> Tx_rollup_repr.to_b58check k | Sc_rollup k -> Sc_rollup_repr.Address.to_b58check k - | Event k -> Contract_event_repr.to_b58check k type error += Invalid_destination_b58check of string @@ -86,12 +81,9 @@ let of_b58data data = | None -> ( match Tx_rollup_repr.of_b58data data with | Some tx_rollup -> Some (Tx_rollup tx_rollup) - | None -> ( - match Sc_rollup_repr.Address.of_b58data data with - | Some sc_rollup -> Some (Sc_rollup sc_rollup) - | None -> - Contract_event_repr.of_b58data data - |> Option.map (fun c -> Event c))) + | None -> + Sc_rollup_repr.Address.of_b58data data + |> Option.map (fun sc_rollup -> Sc_rollup sc_rollup)) let of_b58check_opt s = Option.bind (Base58.decode s) of_b58data @@ -130,12 +122,6 @@ let encoding = ~title:"Sc_rollup" (function Sc_rollup k -> Some k | _ -> None) (fun k -> Sc_rollup k); - case - (Tag 4) - (Fixed.add_padding Contract_event_repr.Hash.encoding 1) - ~title:"Event sink" - (function Event k -> Some k | _ -> None) - (fun k -> Event k); ])) ~json: (conv @@ -153,7 +139,6 @@ let pp : Format.formatter -> t -> unit = | Contract k -> Contract_repr.pp fmt k | Tx_rollup k -> Tx_rollup_repr.pp fmt k | Sc_rollup k -> Sc_rollup_repr.pp fmt k - | Event k -> Contract_event_repr.pp fmt k let in_memory_size = let open Cache_memory_helpers in @@ -161,4 +146,3 @@ let in_memory_size = | Contract k -> h1w +! Contract_repr.in_memory_size k | Tx_rollup k -> h1w +! Tx_rollup_repr.in_memory_size k | Sc_rollup k -> h1w +! Sc_rollup_repr.in_memory_size k - | Event k -> h1w +! Contract_event_repr.in_memory_size k diff --git a/src/proto_alpha/lib_protocol/destination_repr.mli b/src/proto_alpha/lib_protocol/destination_repr.mli index e884a16f6a0dcdc1dac9735fa61e8dc2a54a1d42..2b0c3e57f0c58d1cc48db08b5d0718367c28badc 100644 --- a/src/proto_alpha/lib_protocol/destination_repr.mli +++ b/src/proto_alpha/lib_protocol/destination_repr.mli @@ -45,7 +45,6 @@ type t = | Contract of Contract_repr.t | Tx_rollup of Tx_rollup_repr.t | Sc_rollup of Sc_rollup_repr.t - | Event of Contract_event_repr.t include Compare.S with type t := t diff --git a/src/proto_alpha/lib_protocol/operation_repr.ml b/src/proto_alpha/lib_protocol/operation_repr.ml index 73dfe3d17d869a70eb310377825de0bebfbbdd49..c9f942bb91f65d83979265388594bf62ca7faf94 100644 --- a/src/proto_alpha/lib_protocol/operation_repr.ml +++ b/src/proto_alpha/lib_protocol/operation_repr.ml @@ -70,6 +70,8 @@ module Kind = struct type delegation = Delegation_kind + type event = Event_kind + type set_deposits_limit = Set_deposits_limit_kind type failing_noop = Failing_noop_kind @@ -120,6 +122,7 @@ module Kind = struct | Transaction_manager_kind : transaction manager | Origination_manager_kind : origination manager | Delegation_manager_kind : delegation manager + | Event_manager_kind : event manager | Register_global_constant_manager_kind : register_global_constant manager | Set_deposits_limit_manager_kind : set_deposits_limit manager | Tx_rollup_origination_manager_kind : tx_rollup_origination manager diff --git a/src/proto_alpha/lib_protocol/operation_repr.mli b/src/proto_alpha/lib_protocol/operation_repr.mli index 422f7a5596f6472431ac0befacc385d71786db10..394bd82a8c07b64a528b3b219c6efd8ae06f8d8b 100644 --- a/src/proto_alpha/lib_protocol/operation_repr.mli +++ b/src/proto_alpha/lib_protocol/operation_repr.mli @@ -99,6 +99,8 @@ module Kind : sig type delegation = Delegation_kind + type event = Event_kind + type set_deposits_limit = Set_deposits_limit_kind type failing_noop = Failing_noop_kind @@ -149,6 +151,7 @@ module Kind : sig | Transaction_manager_kind : transaction manager | Origination_manager_kind : origination manager | Delegation_manager_kind : delegation manager + | Event_manager_kind : event manager | Register_global_constant_manager_kind : register_global_constant manager | Set_deposits_limit_manager_kind : set_deposits_limit manager | Tx_rollup_origination_manager_kind : tx_rollup_origination manager diff --git a/src/proto_alpha/lib_protocol/script_interpreter.ml b/src/proto_alpha/lib_protocol/script_interpreter.ml index 75f62824c613e58c7cd4d10ea3fa9993bbd8590f..257f9ff67e5b1a6003c144333abd52677ede4048 100644 --- a/src/proto_alpha/lib_protocol/script_interpreter.ml +++ b/src/proto_alpha/lib_protocol/script_interpreter.ml @@ -514,7 +514,7 @@ and iview : type a b c d e f i o. (a, b, c, d, e, f, i, o) iview_type = (step [@ocaml.tailcall]) (ctxt, sc) gas k ks None stack in match addr.destination with - | Contract (Implicit _) | Tx_rollup _ | Sc_rollup _ | Event _ -> + | Contract (Implicit _) | Tx_rollup _ | Sc_rollup _ -> (return_none [@ocaml.tailcall]) ctxt | Contract (Originated contract_hash as c) -> ( Contract.get_script ctxt contract_hash >>=? fun (ctxt, script_opt) -> diff --git a/src/proto_alpha/lib_protocol/script_interpreter_defs.ml b/src/proto_alpha/lib_protocol/script_interpreter_defs.ml index 15655fe1757f30112d4bf3a1c1f025b4e88f2373..178a9e47b3773cb920d4bf918ef22a0f99d538eb 100644 --- a/src/proto_alpha/lib_protocol/script_interpreter_defs.ml +++ b/src/proto_alpha/lib_protocol/script_interpreter_defs.ml @@ -38,7 +38,7 @@ open Script_typed_ir open Script_ir_translator open Local_gas_counter -type error += Rollup_invalid_transaction_amount | Event_invalid_destination +type error += Rollup_invalid_transaction_amount let () = register_error_kind @@ -53,22 +53,7 @@ let () = Format.pp_print_string ppf "Transaction amount to a rollup must be zero.") Data_encoding.unit (function Rollup_invalid_transaction_amount -> Some () | _ -> None) - (fun () -> Rollup_invalid_transaction_amount) ; - register_error_kind - `Permanent - ~id:"operation.event_invalid_destination" - ~title:"Event sinks are invalid transaction destinations" - ~description: - "Event sinks are not real transaction destinations, and therefore \ - operations targeting an event sink are invalid. To emit events, use \ - EMIT instead." - ~pp:(fun ppf () -> - Format.pp_print_string - ppf - "Event sinks are invalid transaction destinations.") - Data_encoding.unit - (function Event_invalid_destination -> Some () | _ -> None) - (fun () -> Event_invalid_destination) + (fun () -> Rollup_invalid_transaction_amount) (* @@ -577,9 +562,7 @@ let emit_event (type t tc) (ctxt, sc) gas ~event_address Gas.consume ctxt (Script.strip_locations_cost unparsed_data) >>?= fun ctxt -> let unparsed_data = Micheline.strip_locations unparsed_data in fresh_internal_nonce ctxt >>?= fun (ctxt, nonce) -> - let operation = - Transaction_to_event {addr = event_address; tag; unparsed_data} - in + let operation = Event {addr = event_address; tag; unparsed_data} in let iop = {source = Contract.Originated sc.self; operation; nonce} in let res = {piop = Internal_operation iop; lazy_storage_diff} in let gas, ctxt = local_gas_counter_and_outdated_context ctxt in @@ -629,8 +612,7 @@ let transfer (ctxt, sc) gas amount location parameters_ty parameters ~amount ~entrypoint ~parameters_ty - ~parameters - | Event _ -> fail Event_invalid_destination) + ~parameters) >>=? fun (operation, ctxt) -> fresh_internal_nonce ctxt >>?= fun (ctxt, nonce) -> let iop = {source = Contract.Originated sc.self; operation; nonce} in diff --git a/src/proto_alpha/lib_protocol/script_ir_translator.ml b/src/proto_alpha/lib_protocol/script_ir_translator.ml index 15ff0c35128189fe791969f6e98ec0b49c4cd51f..153be876f8fe4ffe77f5f2de0917f188e1bbc224 100644 --- a/src/proto_alpha/lib_protocol/script_ir_translator.ml +++ b/src/proto_alpha/lib_protocol/script_ir_translator.ml @@ -2544,7 +2544,7 @@ let[@coq_axiom_with_reason "gadt"] rec parse_data : >>=? fun (({destination; entrypoint = _}, (contents, amount)), ctxt) -> match destination with | Contract ticketer -> return ({ticketer; contents; amount}, ctxt) - | Tx_rollup _ | Sc_rollup _ | Event _ -> + | Tx_rollup _ | Sc_rollup _ -> fail (Unexpected_ticket_owner destination) else traced_fail (Unexpected_forged_value (location expr)) (* Sets *) @@ -5007,7 +5007,6 @@ and[@coq_axiom_with_reason "complex mutually recursive definition"] parse_contra entrypoint_arg >|? fun (entrypoint, arg_ty) -> let address = {destination; entrypoint} in Typed_contract {arg_ty; address} )) - | Event _ -> return (error ctxt (fun _ -> No_such_entrypoint 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_repr.ml b/src/proto_alpha/lib_protocol/script_repr.ml index 681d6d7c627a54161e667a89f2aa46381efff12d..a730986fdd39bc167d03404f901861ccfbcf4801 100644 --- a/src/proto_alpha/lib_protocol/script_repr.ml +++ b/src/proto_alpha/lib_protocol/script_repr.ml @@ -302,13 +302,15 @@ let unit = let unit_parameter = lazy_expr unit +let is_unit v = + match Micheline.root v with + | Prim (_, Michelson_v1_primitives.D_Unit, [], []) -> true + | _ -> false + let is_unit_parameter = let unit_bytes = Data_encoding.force_bytes unit_parameter in Data_encoding.apply_lazy - ~fun_value:(fun v -> - match Micheline.root v with - | Prim (_, Michelson_v1_primitives.D_Unit, [], []) -> true - | _ -> false) + ~fun_value:is_unit ~fun_bytes:(fun b -> Compare.Bytes.equal b unit_bytes) ~fun_combine:(fun res _ -> res) diff --git a/src/proto_alpha/lib_protocol/script_repr.mli b/src/proto_alpha/lib_protocol/script_repr.mli index 386cd0761c3c3a8973ef9e537f03536ed5fc0dd1..f7586c95f55ae89a5ac128c53546be0d6e305deb 100644 --- a/src/proto_alpha/lib_protocol/script_repr.mli +++ b/src/proto_alpha/lib_protocol/script_repr.mli @@ -99,8 +99,12 @@ val force_bytes_cost : lazy_expr -> Gas_limit_repr.cost val force_bytes : lazy_expr -> bytes tzresult +val unit : expr + val unit_parameter : lazy_expr +val is_unit : expr -> bool + val is_unit_parameter : lazy_expr -> bool val strip_annotations : node -> node diff --git a/src/proto_alpha/lib_protocol/script_tc_errors.ml b/src/proto_alpha/lib_protocol/script_tc_errors.ml index 9b2b1edbc5d571a17816254da742ebd4480c8e77..1f0c39d222b8bda47d16e6cd30e5bca766cbb951 100644 --- a/src/proto_alpha/lib_protocol/script_tc_errors.ml +++ b/src/proto_alpha/lib_protocol/script_tc_errors.ml @@ -80,9 +80,6 @@ type error += Tx_rollup_addresses_disabled of Script.location type error += Sc_rollup_disabled of Script.location -(* Event errors *) -type error += Event_invalid_destination of Script.location - (* Instruction typing errors *) type error += Fail_not_in_tail_position of Script.location diff --git a/src/proto_alpha/lib_protocol/script_tc_errors_registration.ml b/src/proto_alpha/lib_protocol/script_tc_errors_registration.ml index 9ed007b23a80c42efa3a1d5ebedd2770eea9d711..70b586a528edb42f72d9a28b7fd7e8c357fefed5 100644 --- a/src/proto_alpha/lib_protocol/script_tc_errors_registration.ml +++ b/src/proto_alpha/lib_protocol/script_tc_errors_registration.ml @@ -273,17 +273,6 @@ let () = (obj1 (req "location" Script.location_encoding)) (function Sc_rollup_disabled loc -> Some loc | _ -> None) (fun loc -> Sc_rollup_disabled loc) ; - (* Event bad parameter *) - register_error_kind - `Permanent - ~id:"michelson_v1.event_invalid_destination" - ~title:"Event parameter is malformed" - ~description: - "An event address is not a valid destination to transfer any token to. \ - Events should be sent with EMIT instructions." - (obj1 (req "location" Script.location_encoding)) - (function Event_invalid_destination loc -> Some loc | _ -> None) - (fun loc -> Event_invalid_destination loc) ; (* Duplicate entrypoint *) register_error_kind `Permanent diff --git a/src/proto_alpha/lib_protocol/script_typed_ir.ml b/src/proto_alpha/lib_protocol/script_typed_ir.ml index cc5879aa236bfd5c8992b06f9d66e75cfd742d88..bc610e555d296dc106edcbcd9a022113ae95f2eb 100644 --- a/src/proto_alpha/lib_protocol/script_typed_ir.ml +++ b/src/proto_alpha/lib_protocol/script_typed_ir.ml @@ -1365,12 +1365,12 @@ and 'kind manager_operation = unparsed_parameters : Script.expr; } -> Kind.transaction manager_operation - | Transaction_to_event : { + | Event : { addr : Contract_event.t; tag : Entrypoint.t; unparsed_data : Script.expr; } - -> Kind.transaction manager_operation + -> Kind.event manager_operation | Origination : { delegate : Signature.Public_key_hash.t option; code : Script.expr; @@ -1427,7 +1427,7 @@ let manager_kind : type kind. kind manager_operation -> kind Kind.manager = | Transaction_to_contract _ -> Kind.Transaction_manager_kind | Transaction_to_tx_rollup _ -> Kind.Transaction_manager_kind | Transaction_to_sc_rollup _ -> Kind.Transaction_manager_kind - | Transaction_to_event _ -> Kind.Transaction_manager_kind + | Event _ -> Kind.Event_manager_kind | Origination _ -> Kind.Origination_manager_kind | Delegation _ -> Kind.Delegation_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 35eee3e9b30a72ab6d7f8f12ec0d169155bfb143..6eca7c5da34be7af90414313833d3f52b0fe3ef3 100644 --- a/src/proto_alpha/lib_protocol/script_typed_ir.mli +++ b/src/proto_alpha/lib_protocol/script_typed_ir.mli @@ -1501,12 +1501,12 @@ and 'kind manager_operation = unparsed_parameters : Script.expr; } -> Kind.transaction manager_operation - | Transaction_to_event : { + | Event : { addr : Contract_event.t; tag : Entrypoint.t; unparsed_data : Script.expr; } - -> Kind.transaction manager_operation + -> Kind.event manager_operation | Origination : { delegate : Signature.Public_key_hash.t option; code : Script.expr; diff --git a/src/proto_alpha/lib_protocol/test/helpers/block.ml b/src/proto_alpha/lib_protocol/test/helpers/block.ml index 7e7360be40b841463f5fb55059d3c822ad1c2903..e4cfc0ee191a7a94a101976a91f234432a5dfba0 100644 --- a/src/proto_alpha/lib_protocol/test/helpers/block.ml +++ b/src/proto_alpha/lib_protocol/test/helpers/block.ml @@ -792,7 +792,6 @@ let bake_n_with_all_balance_updates ?(baking_mode = Application) ?policy | Sc_rollup_timeout_result _ | Sc_rollup_execute_outbox_message_result _ | Sc_rollup_recover_bond_result _ - | Transaction_result (Transaction_to_event_result _) | Sc_rollup_dal_slot_subscribe_result _ -> balance_updates_rev | Transaction_result 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 1823b52adb918d20e64119250f9fbd1ecf57c9d0..fb4fbbe0714a88e40143d206b93656f679530644 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 @@ -85,53 +85,22 @@ let contract_test () = Internal_manager_operation_result ( { operation = - Transaction - { - entrypoint = tag1; - parameters = data1; - amount = amount1; - destination = Destination.Event addr1; - }; + Event {tag = tag1; payload = data1; addr = addr1}; _; }, - Applied - (ITransaction_result (Transaction_to_event_result _)) - ); + Applied (IEvent_result _) ); Internal_manager_operation_result ( { operation = - Transaction - { - entrypoint = tag2; - parameters = data2; - amount = amount2; - destination = Destination.Event addr2; - }; + Event {tag = tag2; payload = data2; addr = addr2}; _; }, - Applied - (ITransaction_result (Transaction_to_event_result _)) - ); + Applied (IEvent_result _) ); ]; _; }); }; ] -> - let ctxt = Gas.set_unlimited (Incremental.alpha_ctxt incr) in - let* data1, ctxt = - Lwt.return @@ Environment.wrap_tzresult - @@ Script.force_decode_in_context - ~consume_deserialization_gas:When_needed - ctxt - data1 - in - let* data2, _ = - Lwt.return @@ Environment.wrap_tzresult - @@ Script.force_decode_in_context - ~consume_deserialization_gas:When_needed - ctxt - data2 - in let open Micheline in ((match root data1 with | Prim (_, D_Right, [String (_, "right")], _) -> () @@ -146,8 +115,6 @@ let contract_test () = assert (Entrypoint.to_string tag2 = "tag2") ; assert (addr1 = "ev12m5E1yW14mc9rsrcdGAWVfDSdmRGuctykrVU55bHZBGv9kmdhW") ; assert (addr2 = "ev12m5E1yW14mc9rsrcdGAWVfDSdmRGuctykrVU55bHZBGv9kmdhW") ; - assert (Tez.(amount1 = zero)) ; - assert (Tez.(amount2 = zero)) ; return_unit | _ -> assert false diff --git a/src/proto_alpha/lib_protocol/test/unit/test_destination_repr.ml b/src/proto_alpha/lib_protocol/test/unit/test_destination_repr.ml index 51d2d1b23c746807634f01b94df671eaf5616d4d..6bb7638b99f2388a62d184df835bc627c4933ad4 100644 --- a/src/proto_alpha/lib_protocol/test/unit/test_destination_repr.ml +++ b/src/proto_alpha/lib_protocol/test/unit/test_destination_repr.ml @@ -81,9 +81,6 @@ let tx_rollup_address = "txr1YNMEtkj5Vkqsbdmt7xaxBTMRZjzS96UAi" *) let sc_rollup_address = "scr1HLXM32GacPNDrhHDLAssZG88eWqCUbyLF" -(* The following address has been extracted from [../integration/michelson/test_emit.ml]. *) -let event_address = "ev12m5E1yW14mc9rsrcdGAWVfDSdmRGuctykrVU55bHZBGv9kmdhW" - let assert_compat contract destination = match destination with | Destination_repr.Contract contract' @@ -183,13 +180,11 @@ let test_compare_destination () = let kt1 = !!(Destination_repr.of_b58check liquidity_baking_dex) in let txr1 = !!(Destination_repr.of_b58check tx_rollup_address) in let scr1 = !!(Destination_repr.of_b58check sc_rollup_address) in - let ev1 = !!(Destination_repr.of_b58check event_address) in assert (Destination_repr.(tz1 < kt1)) ; assert (Destination_repr.(kt1 < txr1)) ; assert (Destination_repr.(tz1 < txr1)) ; assert (Destination_repr.(txr1 < scr1)) ; - assert (Destination_repr.(scr1 < ev1)) ; return_unit diff --git a/src/proto_alpha/lib_protocol/ticket_operations_diff.ml b/src/proto_alpha/lib_protocol/ticket_operations_diff.ml index d965bb84155a86449fa4ce0089acbfc354428319..ec06da22e0352c213a784d8cb7630463fe1ad8b4 100644 --- a/src/proto_alpha/lib_protocol/ticket_operations_diff.ml +++ b/src/proto_alpha/lib_protocol/ticket_operations_diff.ml @@ -234,7 +234,7 @@ let tickets_of_operation ctxt ~allow_zero_amount_tickets ~preorigination ~storage_type ~storage - | Delegation _ | Transaction_to_event _ -> return (None, ctxt) + | Delegation _ | Event _ -> return (None, ctxt) let add_transfer_to_token_map ctxt token_map {destination; tickets} = List.fold_left_es diff --git a/tests_python/tests_alpha/_regtest_outputs/test_contract_opcodes.TestContractOpcodes::test_contract_input_output[emit.tz-Unit-Unit-Unit].out b/tests_python/tests_alpha/_regtest_outputs/test_contract_opcodes.TestContractOpcodes::test_contract_input_output[emit.tz-Unit-Unit-Unit].out index 3497655daa1ac26988a342bbfde2632b4db1f33c..c281318efaa184081fdcf81ce43799ed1f5bc7cb 100644 --- a/tests_python/tests_alpha/_regtest_outputs/test_contract_opcodes.TestContractOpcodes::test_contract_input_output[emit.tz-Unit-Unit-Unit].out +++ b/tests_python/tests_alpha/_regtest_outputs/test_contract_opcodes.TestContractOpcodes::test_contract_input_output[emit.tz-Unit-Unit-Unit].out @@ -3,18 +3,16 @@ tests_alpha/test_contract_opcodes.py::TestContractOpcodes::test_contract_input_o storage Unit emitted operations - Internal Transaction: - Amount: ꜩ0 + Internal Event: From: KT1BEqzn5Wx8uJrZNvuS9DVHmLvG9td3fDLi To: ev13o2yWTf9YocjZXWyyHhuTDzoeDuKKe2RmKp9sBnPFeywtpdFsp - Entrypoint: event - Parameter: (Left 10) - Internal Transaction: - Amount: ꜩ0 + Tag: event + Payload: (Left 10) + Internal Event: From: KT1BEqzn5Wx8uJrZNvuS9DVHmLvG9td3fDLi To: ev13o2yWTf9YocjZXWyyHhuTDzoeDuKKe2RmKp9sBnPFeywtpdFsp - Entrypoint: event - Parameter: (Right "lorem ipsum") + Tag: event + Payload: (Right "lorem ipsum") big_map diff trace @@ -31,44 +29,44 @@ trace [ (Left 10) Unit ] - location: 14 (remaining gas: 1039983.362 units remaining) - [ 0x011d23c1d3d2f8a4ea5e8784b8f7ecf2ad304c0fe6000000010004ac785bfba0f68d61a64f5baa2d45550f6494440a2831f1387df36f41dd770fdd00ffff056576656e74000000040505000a + [ 0x011d23c1d3d2f8a4ea5e8784b8f7ecf2ad304c0fe600000004ac785bfba0f68d61a64f5baa2d45550f6494440a2831f1387df36f41dd770fddffff056576656e74ff0505000a Unit ] - location: 18 (remaining gas: 1039983.352 units remaining) [ "lorem ipsum" - 0x011d23c1d3d2f8a4ea5e8784b8f7ecf2ad304c0fe6000000010004ac785bfba0f68d61a64f5baa2d45550f6494440a2831f1387df36f41dd770fdd00ffff056576656e74000000040505000a + 0x011d23c1d3d2f8a4ea5e8784b8f7ecf2ad304c0fe600000004ac785bfba0f68d61a64f5baa2d45550f6494440a2831f1387df36f41dd770fddffff056576656e74ff0505000a Unit ] - location: 21 (remaining gas: 1039983.342 units remaining) [ (Right "lorem ipsum") - 0x011d23c1d3d2f8a4ea5e8784b8f7ecf2ad304c0fe6000000010004ac785bfba0f68d61a64f5baa2d45550f6494440a2831f1387df36f41dd770fdd00ffff056576656e74000000040505000a + 0x011d23c1d3d2f8a4ea5e8784b8f7ecf2ad304c0fe600000004ac785bfba0f68d61a64f5baa2d45550f6494440a2831f1387df36f41dd770fddffff056576656e74ff0505000a Unit ] - location: 23 (remaining gas: 1039983.120 units remaining) - [ 0x011d23c1d3d2f8a4ea5e8784b8f7ecf2ad304c0fe6000001010004ac785bfba0f68d61a64f5baa2d45550f6494440a2831f1387df36f41dd770fdd00ffff056576656e74000000120508010000000b6c6f72656d20697073756d - 0x011d23c1d3d2f8a4ea5e8784b8f7ecf2ad304c0fe6000000010004ac785bfba0f68d61a64f5baa2d45550f6494440a2831f1387df36f41dd770fdd00ffff056576656e74000000040505000a + [ 0x011d23c1d3d2f8a4ea5e8784b8f7ecf2ad304c0fe600000104ac785bfba0f68d61a64f5baa2d45550f6494440a2831f1387df36f41dd770fddffff056576656e74ff0508010000000b6c6f72656d20697073756d + 0x011d23c1d3d2f8a4ea5e8784b8f7ecf2ad304c0fe600000004ac785bfba0f68d61a64f5baa2d45550f6494440a2831f1387df36f41dd770fddffff056576656e74ff0505000a Unit ] - location: 27 (remaining gas: 1039983.110 units remaining) [ {} - 0x011d23c1d3d2f8a4ea5e8784b8f7ecf2ad304c0fe6000001010004ac785bfba0f68d61a64f5baa2d45550f6494440a2831f1387df36f41dd770fdd00ffff056576656e74000000120508010000000b6c6f72656d20697073756d - 0x011d23c1d3d2f8a4ea5e8784b8f7ecf2ad304c0fe6000000010004ac785bfba0f68d61a64f5baa2d45550f6494440a2831f1387df36f41dd770fdd00ffff056576656e74000000040505000a + 0x011d23c1d3d2f8a4ea5e8784b8f7ecf2ad304c0fe600000104ac785bfba0f68d61a64f5baa2d45550f6494440a2831f1387df36f41dd770fddffff056576656e74ff0508010000000b6c6f72656d20697073756d + 0x011d23c1d3d2f8a4ea5e8784b8f7ecf2ad304c0fe600000004ac785bfba0f68d61a64f5baa2d45550f6494440a2831f1387df36f41dd770fddffff056576656e74ff0505000a Unit ] - location: 29 (remaining gas: 1039983.100 units remaining) - [ 0x011d23c1d3d2f8a4ea5e8784b8f7ecf2ad304c0fe6000001010004ac785bfba0f68d61a64f5baa2d45550f6494440a2831f1387df36f41dd770fdd00ffff056576656e74000000120508010000000b6c6f72656d20697073756d + [ 0x011d23c1d3d2f8a4ea5e8784b8f7ecf2ad304c0fe600000104ac785bfba0f68d61a64f5baa2d45550f6494440a2831f1387df36f41dd770fddffff056576656e74ff0508010000000b6c6f72656d20697073756d {} - 0x011d23c1d3d2f8a4ea5e8784b8f7ecf2ad304c0fe6000000010004ac785bfba0f68d61a64f5baa2d45550f6494440a2831f1387df36f41dd770fdd00ffff056576656e74000000040505000a + 0x011d23c1d3d2f8a4ea5e8784b8f7ecf2ad304c0fe600000004ac785bfba0f68d61a64f5baa2d45550f6494440a2831f1387df36f41dd770fddffff056576656e74ff0505000a Unit ] - location: 30 (remaining gas: 1039983.090 units remaining) - [ { 0x011d23c1d3d2f8a4ea5e8784b8f7ecf2ad304c0fe6000001010004ac785bfba0f68d61a64f5baa2d45550f6494440a2831f1387df36f41dd770fdd00ffff056576656e74000000120508010000000b6c6f72656d20697073756d } - 0x011d23c1d3d2f8a4ea5e8784b8f7ecf2ad304c0fe6000000010004ac785bfba0f68d61a64f5baa2d45550f6494440a2831f1387df36f41dd770fdd00ffff056576656e74000000040505000a + [ { 0x011d23c1d3d2f8a4ea5e8784b8f7ecf2ad304c0fe600000104ac785bfba0f68d61a64f5baa2d45550f6494440a2831f1387df36f41dd770fddffff056576656e74ff0508010000000b6c6f72656d20697073756d } + 0x011d23c1d3d2f8a4ea5e8784b8f7ecf2ad304c0fe600000004ac785bfba0f68d61a64f5baa2d45550f6494440a2831f1387df36f41dd770fddffff056576656e74ff0505000a Unit ] - location: 31 (remaining gas: 1039983.080 units remaining) - [ 0x011d23c1d3d2f8a4ea5e8784b8f7ecf2ad304c0fe6000000010004ac785bfba0f68d61a64f5baa2d45550f6494440a2831f1387df36f41dd770fdd00ffff056576656e74000000040505000a - { 0x011d23c1d3d2f8a4ea5e8784b8f7ecf2ad304c0fe6000001010004ac785bfba0f68d61a64f5baa2d45550f6494440a2831f1387df36f41dd770fdd00ffff056576656e74000000120508010000000b6c6f72656d20697073756d } + [ 0x011d23c1d3d2f8a4ea5e8784b8f7ecf2ad304c0fe600000004ac785bfba0f68d61a64f5baa2d45550f6494440a2831f1387df36f41dd770fddffff056576656e74ff0505000a + { 0x011d23c1d3d2f8a4ea5e8784b8f7ecf2ad304c0fe600000104ac785bfba0f68d61a64f5baa2d45550f6494440a2831f1387df36f41dd770fddffff056576656e74ff0508010000000b6c6f72656d20697073756d } Unit ] - location: 32 (remaining gas: 1039983.070 units remaining) - [ { 0x011d23c1d3d2f8a4ea5e8784b8f7ecf2ad304c0fe6000000010004ac785bfba0f68d61a64f5baa2d45550f6494440a2831f1387df36f41dd770fdd00ffff056576656e74000000040505000a ; - 0x011d23c1d3d2f8a4ea5e8784b8f7ecf2ad304c0fe6000001010004ac785bfba0f68d61a64f5baa2d45550f6494440a2831f1387df36f41dd770fdd00ffff056576656e74000000120508010000000b6c6f72656d20697073756d } + [ { 0x011d23c1d3d2f8a4ea5e8784b8f7ecf2ad304c0fe600000004ac785bfba0f68d61a64f5baa2d45550f6494440a2831f1387df36f41dd770fddffff056576656e74ff0505000a ; + 0x011d23c1d3d2f8a4ea5e8784b8f7ecf2ad304c0fe600000104ac785bfba0f68d61a64f5baa2d45550f6494440a2831f1387df36f41dd770fddffff056576656e74ff0508010000000b6c6f72656d20697073756d } Unit ] - location: 33 (remaining gas: 1039983.060 units remaining) - [ (Pair { 0x011d23c1d3d2f8a4ea5e8784b8f7ecf2ad304c0fe6000000010004ac785bfba0f68d61a64f5baa2d45550f6494440a2831f1387df36f41dd770fdd00ffff056576656e74000000040505000a ; - 0x011d23c1d3d2f8a4ea5e8784b8f7ecf2ad304c0fe6000001010004ac785bfba0f68d61a64f5baa2d45550f6494440a2831f1387df36f41dd770fdd00ffff056576656e74000000120508010000000b6c6f72656d20697073756d } + [ (Pair { 0x011d23c1d3d2f8a4ea5e8784b8f7ecf2ad304c0fe600000004ac785bfba0f68d61a64f5baa2d45550f6494440a2831f1387df36f41dd770fddffff056576656e74ff0505000a ; + 0x011d23c1d3d2f8a4ea5e8784b8f7ecf2ad304c0fe600000104ac785bfba0f68d61a64f5baa2d45550f6494440a2831f1387df36f41dd770fddffff056576656e74ff0508010000000b6c6f72656d20697073756d } Unit) ] diff --git a/tezt/tests/events.ml b/tezt/tests/events.ml index aad40dc8c9a7b13c1417d3b4c54dc1cb48eb11ec..584e237332b25be73979de93e8d101b989c7cc92 100644 --- a/tezt/tests/events.ml +++ b/tezt/tests/events.ml @@ -73,21 +73,21 @@ let test_emit_event protocol = in let event = events |=> 0 in assert ( - event |-> "destination" |> as_string + event |-> "addr" |> as_string = "ev12m5E1yW14mc9rsrcdGAWVfDSdmRGuctykrVU55bHZBGv9kmdhW") ; - let data = event |-> "parameters" |-> "value" in + let data = event |-> "payload" in assert (data |-> "prim" |> as_string = "Right") ; assert (data |-> "args" |=> 0 |-> "string" |> as_string = "right") ; - let tag = event |-> "parameters" |-> "entrypoint" |> as_string in + let tag = event |-> "tag" |> as_string in assert (tag = "tag1") ; let event = events |=> 1 in assert ( - event |-> "destination" |> as_string + event |-> "addr" |> as_string = "ev12m5E1yW14mc9rsrcdGAWVfDSdmRGuctykrVU55bHZBGv9kmdhW") ; - let data = event |-> "parameters" |-> "value" in + let data = event |-> "payload" in assert (data |-> "prim" |> as_string = "Left") ; assert (data |-> "args" |=> 0 |-> "int" |> as_string = "2") ; - let tag = event |-> "parameters" |-> "entrypoint" |> as_string in + let tag = event |-> "tag" |> as_string in assert (tag = "tag2") ; return ()