diff --git a/src/proto_alpha/lib_client/client_proto_context.ml b/src/proto_alpha/lib_client/client_proto_context.ml index db7d8f18145ca0b0026f24a14e7d21b187b1bc37..6b77650193f73f2bcdcb0757e140a5378ec70bef 100644 --- a/src/proto_alpha/lib_client/client_proto_context.ml +++ b/src/proto_alpha/lib_client/client_proto_context.ml @@ -1093,3 +1093,36 @@ let sc_rollup_add_messages (cctxt : #full) ~chain ~block ?confirmations ?dry_run match Apply_results.pack_contents_list op result with | Apply_results.Single_and_result ((Manager_operation _ as op), result) -> return (oph, op, result) + +let sc_rollup_cement (cctxt : #full) ~chain ~block ?confirmations ?dry_run + ?verbose_signing ?simulation ?fee ?gas_limit ?storage_limit ?counter ~source + ~rollup ~commitment ~src_pk ~src_sk ~fee_parameter () = + let op = + Annotated_manager_operation.Single_manager + (Injection.prepare_manager_operation + ~fee:(Limit.of_option fee) + ~gas_limit:(Limit.of_option gas_limit) + ~storage_limit:(Limit.of_option storage_limit) + (Sc_rollup_cement {rollup; commitment})) + in + Injection.inject_manager_operation + cctxt + ~chain + ~block + ?confirmations + ?dry_run + ?verbose_signing + ?simulation + ?counter + ~source + ~fee:(Limit.of_option fee) + ~storage_limit:(Limit.of_option storage_limit) + ~gas_limit:(Limit.of_option gas_limit) + ~src_pk + ~src_sk + ~fee_parameter + op + >>=? fun (oph, op, result) -> + match Apply_results.pack_contents_list op result with + | Apply_results.Single_and_result ((Manager_operation _ as op), result) -> + return (oph, op, result) diff --git a/src/proto_alpha/lib_client/client_proto_context.mli b/src/proto_alpha/lib_client/client_proto_context.mli index 81a15ebbf2a7bdef5260052cffab5b744db17cd8..7a6ef427ba44f572369e25c2ef9d013ef43b6337 100644 --- a/src/proto_alpha/lib_client/client_proto_context.mli +++ b/src/proto_alpha/lib_client/client_proto_context.mli @@ -621,3 +621,28 @@ val sc_rollup_add_messages : * Kind.sc_rollup_add_messages Kind.manager Apply_results.contents_result) tzresult Lwt.t + +val sc_rollup_cement : + #Protocol_client_context.full -> + chain:Chain_services.chain -> + block:Block_services.block -> + ?confirmations:int -> + ?dry_run:bool -> + ?verbose_signing:bool -> + ?simulation:bool -> + ?fee:Tez.t -> + ?gas_limit:Gas.Arith.integral -> + ?storage_limit:counter -> + ?counter:counter -> + source:public_key_hash -> + rollup:Alpha_context.Sc_rollup.t -> + commitment:Alpha_context.Sc_rollup.Commitment_hash.t -> + src_pk:public_key -> + src_sk:Client_keys.sk_uri -> + fee_parameter:Injection.fee_parameter -> + unit -> + (Operation_hash.t + * Kind.sc_rollup_cement Kind.manager contents + * Kind.sc_rollup_cement Kind.manager Apply_results.contents_result) + tzresult + Lwt.t diff --git a/src/proto_alpha/lib_client/injection.ml b/src/proto_alpha/lib_client/injection.ml index d2fda0d10911fecf68918e47b6d427206bf1ce2b..5f40ddf5920da8d3397147b94f303dd08525c1ce 100644 --- a/src/proto_alpha/lib_client/injection.ml +++ b/src/proto_alpha/lib_client/injection.ml @@ -338,6 +338,7 @@ let estimated_gas_single (type kind) | Applied (Sc_rollup_originate_result {consumed_gas; _}) -> Ok consumed_gas | Applied (Sc_rollup_add_messages_result {consumed_gas; _}) -> Ok consumed_gas + | Applied (Sc_rollup_cement_result {consumed_gas; _}) -> Ok consumed_gas | Skipped _ -> assert false | Backtracked (_, None) -> Ok Gas.Arith.zero (* there must be another error for this to happen *) @@ -390,6 +391,7 @@ let estimated_storage_single (type kind) ~tx_rollup_origination_size | Applied (Tx_rollup_rejection_result _) -> Ok Z.zero | Applied (Sc_rollup_originate_result {size; _}) -> Ok size | Applied (Sc_rollup_add_messages_result _) -> Ok Z.zero + | Applied (Sc_rollup_cement_result _) -> Ok Z.zero | Skipped _ -> assert false | Backtracked (_, None) -> Ok Z.zero (* there must be another error for this to happen *) @@ -448,6 +450,7 @@ let originated_contracts_single (type kind) | Applied (Tx_rollup_rejection_result _) -> Ok [] | Applied (Sc_rollup_originate_result _) -> Ok [] | Applied (Sc_rollup_add_messages_result _) -> Ok [] + | Applied (Sc_rollup_cement_result _) -> Ok [] | Skipped _ -> assert false | Backtracked (_, None) -> Ok [] (* there must be another error for this to happen *) diff --git a/src/proto_alpha/lib_client/operation_result.ml b/src/proto_alpha/lib_client/operation_result.ml index 60853e22dd9562d5b27de7685f65e1d0ef910f68..d449b7169a065d57c9e9f84cbd20457df1766c22 100644 --- a/src/proto_alpha/lib_client/operation_result.ml +++ b/src/proto_alpha/lib_client/operation_result.ml @@ -269,6 +269,17 @@ let pp_manager_operation_content (type kind) source internal pp_result ppf Sc_rollup.Address.pp rollup pp_result + result + | Sc_rollup_cement {rollup; commitment} -> + Format.fprintf + ppf + "@[Cement the commitment %a in the smart contract rollup at \ + address %a%a@]" + Sc_rollup.Commitment_hash.pp + commitment + Sc_rollup.Address.pp + rollup + pp_result result) ; Format.fprintf ppf "@]" @@ -569,6 +580,9 @@ let pp_manager_operation_contents_and_result ppf Sc_rollup.Inbox.pp inbox_after in + let pp_sc_rollup_cement_result (Sc_rollup_cement_result {consumed_gas}) = + Format.fprintf ppf "@,Consumed gas: %a" Gas.Arith.pp consumed_gas + in let pp_result (type kind) ppf (result : kind manager_operation_result) = Format.fprintf ppf "@," ; match result with @@ -729,6 +743,19 @@ let pp_manager_operation_contents_and_result ppf was BACKTRACKED, its expected effects (as follow) were NOT \ applied.@]" ; pp_sc_rollup_add_messages_result op + | Applied (Sc_rollup_cement_result _ as op) -> + Format.fprintf + ppf + "This operation cementing a commitment on a smart contract rollup \ + was successfully applied" ; + pp_sc_rollup_cement_result op + | Backtracked ((Sc_rollup_cement_result _ as op), _errs) -> + Format.fprintf + ppf + "@[This operation cementing a commitment on a smart contract \ + rollup was BACKTRACKED, its expected effects (as follow) were NOT \ + applied.@]" ; + pp_sc_rollup_cement_result op in Format.fprintf diff --git a/src/proto_alpha/lib_protocol/alpha_context.mli b/src/proto_alpha/lib_protocol/alpha_context.mli index 41977fe65629db0f31e05f735181a28deb5f50fd..af687adbea80143b5c286d4ba303f18a708a2193 100644 --- a/src/proto_alpha/lib_protocol/alpha_context.mli +++ b/src/proto_alpha/lib_protocol/alpha_context.mli @@ -2495,6 +2495,8 @@ module Kind : sig type sc_rollup_add_messages = Sc_rollup_add_messages_kind + type sc_rollup_cement = Sc_rollup_cement_kind + type 'a manager = | Reveal_manager_kind : reveal manager | Transaction_manager_kind : transaction manager @@ -2513,6 +2515,7 @@ module Kind : sig | Tx_rollup_rejection_manager_kind : tx_rollup_rejection manager | Sc_rollup_originate_manager_kind : sc_rollup_originate manager | Sc_rollup_add_messages_manager_kind : sc_rollup_add_messages manager + | Sc_rollup_cement_manager_kind : sc_rollup_cement manager end type 'a consensus_operation_type = @@ -2672,6 +2675,11 @@ and _ manager_operation = messages : string list; } -> Kind.sc_rollup_add_messages manager_operation + | Sc_rollup_cement : { + rollup : Sc_rollup.t; + commitment : Sc_rollup.Commitment_hash.t; + } + -> Kind.sc_rollup_cement manager_operation and counter = Z.t @@ -2838,6 +2846,8 @@ module Operation : sig val sc_rollup_add_messages_case : Kind.sc_rollup_add_messages Kind.manager case + val sc_rollup_cement_case : Kind.sc_rollup_cement Kind.manager case + module Manager_operations : sig type 'b case = | MCase : { @@ -2881,6 +2891,8 @@ module Operation : sig val sc_rollup_originate_case : Kind.sc_rollup_originate case val sc_rollup_add_messages_case : Kind.sc_rollup_add_messages case + + val sc_rollup_cement_case : Kind.sc_rollup_cement case end end diff --git a/src/proto_alpha/lib_protocol/apply.ml b/src/proto_alpha/lib_protocol/apply.ml index f5e078668d820f33707a7298b3fefd70a1465550..309b847b96c307c0b507e4116d65433854940cf3 100644 --- a/src/proto_alpha/lib_protocol/apply.ml +++ b/src/proto_alpha/lib_protocol/apply.ml @@ -1433,6 +1433,12 @@ let apply_manager_operation_content : let consumed_gas = Gas.consumed ~since:before_operation ~until:ctxt in let result = Sc_rollup_add_messages_result {consumed_gas; inbox_after} in return (ctxt, result, []) + | Sc_rollup_cement {rollup; commitment} -> + let level = (Level.current ctxt).level in + Sc_rollup.cement_commitment ctxt rollup level commitment >>=? fun ctxt -> + let consumed_gas = Gas.consumed ~since:before_operation ~until:ctxt in + let result = Sc_rollup_cement_result {consumed_gas} in + return (ctxt, result, []) type success_or_failure = Success of context | Failure @@ -1573,7 +1579,7 @@ let precheck_manager_contents (type kind) ctxt (op : kind Kind.manager contents) | Tx_rollup_return_bond _ | Tx_rollup_finalize_commitment _ | Tx_rollup_remove_commitment _ | Tx_rollup_rejection _ -> assert_tx_rollup_feature_enabled ctxt >|=? fun () -> ctxt - | Sc_rollup_originate _ | Sc_rollup_add_messages _ -> + | Sc_rollup_originate _ | Sc_rollup_add_messages _ | Sc_rollup_cement _ -> assert_sc_rollup_feature_enabled ctxt >|=? fun () -> ctxt) >>=? fun ctxt -> Contract.increment_counter ctxt source >>=? fun ctxt -> @@ -1696,6 +1702,7 @@ let burn_storage_fees : let result = Sc_rollup_originate_result {payload with balance_updates} in return (ctxt, storage_limit, result) | Sc_rollup_add_messages_result _ -> return (ctxt, storage_limit, smopr) + | Sc_rollup_cement_result _ -> return (ctxt, storage_limit, smopr) let apply_manager_contents (type kind) ctxt mode chain_id ~gas_consumed_in_precheck (op : kind Kind.manager contents) : diff --git a/src/proto_alpha/lib_protocol/apply_results.ml b/src/proto_alpha/lib_protocol/apply_results.ml index 25d4ac2bd2ec1b7299f2de7ed460127fefb33c1f..062942918a8da06ae6c751a623d8fa86ca8e86a2 100644 --- a/src/proto_alpha/lib_protocol/apply_results.ml +++ b/src/proto_alpha/lib_protocol/apply_results.ml @@ -145,6 +145,10 @@ type _ successful_manager_operation_result = inbox_after : Sc_rollup.Inbox.t; } -> Kind.sc_rollup_add_messages successful_manager_operation_result + | Sc_rollup_cement_result : { + consumed_gas : Gas.Arith.fp; + } + -> Kind.sc_rollup_cement successful_manager_operation_result let migration_origination_result_to_successful_manager_operation_result ({ @@ -800,6 +804,29 @@ module Manager_result = struct assert (Gas.Arith.(equal (ceil consumed_milligas) consumed_gas)) ; Sc_rollup_add_messages_result {consumed_gas = consumed_milligas; inbox_after}) + + let sc_rollup_cement_case = + make + ~op_case:Operation.Encoding.Manager_operations.sc_rollup_cement_case + ~encoding: + (obj2 + (req "consumed_gas" Gas.Arith.n_integral_encoding) + (dft "consumed_milligas" Gas.Arith.n_fp_encoding Gas.Arith.zero)) + ~iselect:(function + | Internal_operation_result + (({operation = Sc_rollup_cement _; _} as op), res) -> + Some (op, res) + | _ -> None) + ~select:(function + | Successful_manager_result (Sc_rollup_cement_result _ as op) -> Some op + | _ -> None) + ~proj:(function + | Sc_rollup_cement_result {consumed_gas} -> + (Gas.Arith.ceil consumed_gas, consumed_gas)) + ~kind:Kind.Sc_rollup_cement_manager_kind + ~inj:(fun (consumed_gas, consumed_milligas) -> + assert (Gas.Arith.(equal (ceil consumed_milligas) consumed_gas)) ; + Sc_rollup_cement_result {consumed_gas = consumed_milligas}) end let internal_operation_result_encoding : @@ -840,6 +867,7 @@ let internal_operation_result_encoding : make Manager_result.tx_rollup_submit_batch_case; make Manager_result.sc_rollup_originate_case; make Manager_result.sc_rollup_add_messages_case; + make Manager_result.sc_rollup_cement_case; ] let successful_manager_operation_result_encoding : @@ -972,6 +1000,9 @@ let equal_manager_kind : Kind.Sc_rollup_add_messages_manager_kind ) -> Some Eq | (Kind.Sc_rollup_add_messages_manager_kind, _) -> None + | (Kind.Sc_rollup_cement_manager_kind, Kind.Sc_rollup_cement_manager_kind) -> + Some Eq + | (Kind.Sc_rollup_cement_manager_kind, _) -> None module Encoding = struct type 'kind case = @@ -1423,6 +1454,17 @@ module Encoding = struct res ) -> Some (op, res) | _ -> None) + + let[@coq_axiom_with_reason "gadt"] sc_rollup_cement_case = + make_manager_case + Operation.Encoding.sc_rollup_cement_case + Manager_result.sc_rollup_cement_case + (function + | Contents_and_result + ((Manager_operation {operation = Sc_rollup_cement _; _} as op), res) + -> + Some (op, res) + | _ -> None) end let contents_result_encoding = @@ -1468,6 +1510,7 @@ let contents_result_encoding = make tx_rollup_rejection_case; make sc_rollup_originate_case; make sc_rollup_add_messages_case; + make sc_rollup_cement_case; ] let contents_and_result_encoding = @@ -1518,6 +1561,7 @@ let contents_and_result_encoding = make tx_rollup_rejection_case; make sc_rollup_originate_case; make sc_rollup_add_messages_case; + make sc_rollup_cement_case; ] type 'kind contents_result_list = @@ -2041,6 +2085,31 @@ let kind_equal : } ) -> Some Eq | (Manager_operation {operation = Sc_rollup_add_messages _; _}, _) -> None + | ( Manager_operation {operation = Sc_rollup_cement _; _}, + Manager_operation_result + {operation_result = Applied (Sc_rollup_cement_result _); _} ) -> + Some Eq + | ( Manager_operation {operation = Sc_rollup_cement _; _}, + Manager_operation_result + {operation_result = Backtracked (Sc_rollup_cement_result _, _); _} ) -> + Some Eq + | ( Manager_operation {operation = Sc_rollup_cement _; _}, + Manager_operation_result + { + operation_result = + Failed (Alpha_context.Kind.Sc_rollup_cement_manager_kind, _); + _; + } ) -> + Some Eq + | ( Manager_operation {operation = Sc_rollup_cement _; _}, + Manager_operation_result + { + operation_result = + Skipped Alpha_context.Kind.Sc_rollup_cement_manager_kind; + _; + } ) -> + Some Eq + | (Manager_operation {operation = Sc_rollup_cement _; _}, _) -> None let rec kind_equal_list : type kind kind2. diff --git a/src/proto_alpha/lib_protocol/apply_results.mli b/src/proto_alpha/lib_protocol/apply_results.mli index 5b43155afec45fc3b8b58a5942f48101c84a8281..cfe57099a9a3dc1d625a0363cf79726b8e52cf24 100644 --- a/src/proto_alpha/lib_protocol/apply_results.mli +++ b/src/proto_alpha/lib_protocol/apply_results.mli @@ -222,6 +222,10 @@ and _ successful_manager_operation_result = inbox_after : Sc_rollup.Inbox.t; } -> Kind.sc_rollup_add_messages successful_manager_operation_result + | Sc_rollup_cement_result : { + consumed_gas : Gas.Arith.fp; + } + -> Kind.sc_rollup_cement successful_manager_operation_result and packed_successful_manager_operation_result = | Successful_manager_result : diff --git a/src/proto_alpha/lib_protocol/operation_repr.ml b/src/proto_alpha/lib_protocol/operation_repr.ml index d14b32d7a9f6d1e931bb31177d2e8d9a63b524e8..1cbd619a07246228ae0bd9a13935608b9e9f0b24 100644 --- a/src/proto_alpha/lib_protocol/operation_repr.ml +++ b/src/proto_alpha/lib_protocol/operation_repr.ml @@ -89,6 +89,8 @@ module Kind = struct type sc_rollup_add_messages = Sc_rollup_add_messages_kind + type sc_rollup_cement = Sc_rollup_cement_kind + type 'a manager = | Reveal_manager_kind : reveal manager | Transaction_manager_kind : transaction manager @@ -107,6 +109,7 @@ module Kind = struct | Tx_rollup_rejection_manager_kind : tx_rollup_rejection manager | Sc_rollup_originate_manager_kind : sc_rollup_originate manager | Sc_rollup_add_messages_manager_kind : sc_rollup_add_messages manager + | Sc_rollup_cement_manager_kind : sc_rollup_cement manager end type 'a consensus_operation_type = @@ -326,6 +329,11 @@ and _ manager_operation = messages : string list; } -> Kind.sc_rollup_add_messages manager_operation + | Sc_rollup_cement : { + rollup : Sc_rollup_repr.t; + commitment : Sc_rollup_repr.Commitment_hash.t; + } + -> Kind.sc_rollup_cement manager_operation and counter = Z.t @@ -348,6 +356,7 @@ let manager_kind : type kind. kind manager_operation -> kind Kind.manager = | Tx_rollup_rejection _ -> Kind.Tx_rollup_rejection_manager_kind | Sc_rollup_originate _ -> Kind.Sc_rollup_originate_manager_kind | Sc_rollup_add_messages _ -> Kind.Sc_rollup_add_messages_manager_kind + | Sc_rollup_cement _ -> Kind.Sc_rollup_cement_manager_kind type 'kind internal_operation = { source : Contract_repr.contract; @@ -431,6 +440,8 @@ let sc_rollup_operation_origination_tag = sc_rollup_operation_tag_offset + 0 let sc_rollup_operation_add_message_tag = sc_rollup_operation_tag_offset + 1 +let sc_rollup_operation_cement_tag = sc_rollup_operation_tag_offset + 2 + module Encoding = struct open Data_encoding @@ -741,6 +752,25 @@ module Encoding = struct Sc_rollup_add_messages {rollup; messages}); } + let[@coq_axiom_with_reason "gadt"] sc_rollup_cement_case = + MCase + { + tag = sc_rollup_operation_cement_tag; + name = "sc_rollup_cement"; + encoding = + obj2 + (req "rollup" Sc_rollup_repr.encoding) + (req "commitment" Sc_rollup_repr.Commitment_hash.encoding); + select = + (function + | Manager (Sc_rollup_cement _ as op) -> Some op | _ -> None); + proj = + (function + | Sc_rollup_cement {rollup; commitment} -> (rollup, commitment)); + inj = + (fun (rollup, commitment) -> Sc_rollup_cement {rollup; commitment}); + } + let encoding = let make (MCase {tag; name; encoding; select; proj; inj}) = case @@ -769,6 +799,7 @@ module Encoding = struct make tx_rollup_rejection_case; make sc_rollup_originate_case; make sc_rollup_add_messages_case; + make sc_rollup_cement_case; ] end @@ -1110,6 +1141,11 @@ module Encoding = struct sc_rollup_operation_add_message_tag Manager_operations.sc_rollup_add_messages_case + let sc_rollup_cement_case = + make_manager_case + sc_rollup_operation_cement_tag + Manager_operations.sc_rollup_cement_case + let contents_encoding = let make (Case {tag; name; encoding; select; proj; inj}) = case @@ -1147,6 +1183,7 @@ module Encoding = struct make tx_rollup_rejection_case; make sc_rollup_originate_case; make sc_rollup_add_messages_case; + make sc_rollup_cement_case; ] let contents_list_encoding = @@ -1365,6 +1402,8 @@ let equal_manager_operation_kind : | (Sc_rollup_originate _, _) -> None | (Sc_rollup_add_messages _, Sc_rollup_add_messages _) -> Some Eq | (Sc_rollup_add_messages _, _) -> None + | (Sc_rollup_cement _, Sc_rollup_cement _) -> Some Eq + | (Sc_rollup_cement _, _) -> None let equal_contents_kind : type a b. a contents -> b contents -> (a, b) eq option = @@ -1458,6 +1497,7 @@ let internal_manager_operation_size (type a) (op : a manager_operation) = pkh_opt ) | Sc_rollup_originate _ -> (Nodes.zero, h2w) | Sc_rollup_add_messages _ -> (Nodes.zero, h2w) + | Sc_rollup_cement _ -> (Nodes.zero, h2w) | Reveal _ -> (* Reveals can't occur as internal operations *) assert false diff --git a/src/proto_alpha/lib_protocol/operation_repr.mli b/src/proto_alpha/lib_protocol/operation_repr.mli index c6355e7b41b2b7d21abb9d2dce40b80fefdb5da4..38b8012836183b7dbc98eaee70fda28797323dee 100644 --- a/src/proto_alpha/lib_protocol/operation_repr.mli +++ b/src/proto_alpha/lib_protocol/operation_repr.mli @@ -115,6 +115,8 @@ module Kind : sig type sc_rollup_add_messages = Sc_rollup_add_messages_kind + type sc_rollup_cement = Sc_rollup_cement_kind + type 'a manager = | Reveal_manager_kind : reveal manager | Transaction_manager_kind : transaction manager @@ -133,6 +135,7 @@ module Kind : sig | Tx_rollup_rejection_manager_kind : tx_rollup_rejection manager | Sc_rollup_originate_manager_kind : sc_rollup_originate manager | Sc_rollup_add_messages_manager_kind : sc_rollup_add_messages manager + | Sc_rollup_cement_manager_kind : sc_rollup_cement manager end type 'a consensus_operation_type = @@ -374,6 +377,11 @@ and _ manager_operation = messages : string list; } -> Kind.sc_rollup_add_messages manager_operation + | Sc_rollup_cement : { + rollup : Sc_rollup_repr.t; + commitment : Sc_rollup_repr.Commitment_hash.t; + } + -> Kind.sc_rollup_cement manager_operation (** Counters are used as anti-replay protection mechanism in manager operations: each manager account stores a counter and @@ -520,6 +528,8 @@ module Encoding : sig val sc_rollup_add_messages_case : Kind.sc_rollup_add_messages Kind.manager case + val sc_rollup_cement_case : Kind.sc_rollup_cement Kind.manager case + module Manager_operations : sig type 'b case = | MCase : { @@ -562,5 +572,7 @@ module Encoding : sig val sc_rollup_originate_case : Kind.sc_rollup_originate case val sc_rollup_add_messages_case : Kind.sc_rollup_add_messages case + + val sc_rollup_cement_case : Kind.sc_rollup_cement case end end diff --git a/src/proto_alpha/lib_protocol/test/helpers/block.ml b/src/proto_alpha/lib_protocol/test/helpers/block.ml index c12de97beeab5b961d8b456bfa963cf32c666595..2675d0df0f798f8736c30d8a85ce1d4a8ae3945f 100644 --- a/src/proto_alpha/lib_protocol/test/helpers/block.ml +++ b/src/proto_alpha/lib_protocol/test/helpers/block.ml @@ -705,7 +705,7 @@ let bake_n_with_all_balance_updates ?(baking_mode = Application) ?policy | Tx_rollup_finalize_commitment_result _ | Tx_rollup_remove_commitment_result _ | Tx_rollup_rejection_result _ | Sc_rollup_originate_result _ - | Sc_rollup_add_messages_result _ -> + | Sc_rollup_add_messages_result _ | Sc_rollup_cement_result _ -> balance_updates_rev | Transaction_result (Transaction_to_contract_result {balance_updates; _}) @@ -744,7 +744,8 @@ let bake_n_with_origination_results ?(baking_mode = Application) ?policy n b = | Successful_manager_result (Tx_rollup_remove_commitment_result _) | Successful_manager_result (Tx_rollup_rejection_result _) | Successful_manager_result (Sc_rollup_originate_result _) - | Successful_manager_result (Sc_rollup_add_messages_result _) -> + | Successful_manager_result (Sc_rollup_add_messages_result _) + | Successful_manager_result (Sc_rollup_cement_result _) -> origination_results_rev | Successful_manager_result (Origination_result x) -> Origination_result x :: origination_results_rev) diff --git a/src/proto_alpha/lib_protocol/test/integration/michelson/test_ticket_operations_diff.ml b/src/proto_alpha/lib_protocol/test/integration/michelson/test_ticket_operations_diff.ml index adadc5dea93cbc5e8570f129be938640fe6df170..be01f2945f6e5579ebd3147d479c0150dbb21748 100644 --- a/src/proto_alpha/lib_protocol/test/integration/michelson/test_ticket_operations_diff.ml +++ b/src/proto_alpha/lib_protocol/test/integration/michelson/test_ticket_operations_diff.ml @@ -288,6 +288,12 @@ let sc_rollup_add_message ~src = nonce = 1; } +let sc_rollup_cement ~src = + let rollup = Sc_rollup.Address.hash_string ["Dummy"] in + let commitment = Sc_rollup.Commitment_hash.hash_string ["Dummy"] in + Internal_operation + {source = src; operation = Sc_rollup_cement {rollup; commitment}; nonce = 1} + let tx_rollup_originate_operation ~src = Internal_operation {source = src; operation = Tx_rollup_origination; nonce = 1} @@ -360,6 +366,7 @@ let test_non_ticket_operations () = set_deposits_limit_operation ~src; tx_rollup_originate_operation ~src; sc_rollup_add_message ~src; + sc_rollup_cement ~src; sc_rollup_origination_operation ~src; ] in diff --git a/src/proto_alpha/lib_protocol/ticket_operations_diff.ml b/src/proto_alpha/lib_protocol/ticket_operations_diff.ml index fc1364ef96538502f0d9d02c1e13cd148d4b9830..49953bc63b1af7f8719d282edfbe3e3388584cc6 100644 --- a/src/proto_alpha/lib_protocol/ticket_operations_diff.ml +++ b/src/proto_alpha/lib_protocol/ticket_operations_diff.ml @@ -272,8 +272,9 @@ let tickets_of_operation ctxt | Tx_rollup_finalize_commitment _ -> return (None, ctxt) | Tx_rollup_remove_commitment _ -> return (None, ctxt) | Tx_rollup_rejection _ -> return (None, ctxt) - | Sc_rollup_originate {kind = _; boot_sector = _} -> return (None, ctxt) - | Sc_rollup_add_messages {rollup = _; messages = _} -> return (None, ctxt) + | Sc_rollup_originate _ -> return (None, ctxt) + | Sc_rollup_add_messages _ -> return (None, ctxt) + | Sc_rollup_cement _ -> return (None, ctxt) let add_transfer_to_token_map ctxt token_map {destination; tickets} = List.fold_left_es diff --git a/tezt/_regressions/rpc/alpha.client.mempool.out b/tezt/_regressions/rpc/alpha.client.mempool.out index b5c256f9592719394ae8e769c2129e5dd21fb547..c29117352c5670bd8aee4c1815d9ba80a2f974fa 100644 --- a/tezt/_regressions/rpc/alpha.client.mempool.out +++ b/tezt/_regressions/rpc/alpha.client.mempool.out @@ -2367,6 +2367,50 @@ curl -s 'http://localhost:[PORT]/describe/chains/main/mempool?recurse=yes' "kind" ], "additionalProperties": false + }, + { + "title": "Sc_rollup_cement", + "type": "object", + "properties": { + "kind": { + "type": "string", + "enum": [ + "sc_rollup_cement" + ] + }, + "source": { + "$ref": "#/definitions/Signature.Public_key_hash" + }, + "fee": { + "$ref": "#/definitions/alpha.mutez" + }, + "counter": { + "$ref": "#/definitions/positive_bignum" + }, + "gas_limit": { + "$ref": "#/definitions/positive_bignum" + }, + "storage_limit": { + "$ref": "#/definitions/positive_bignum" + }, + "rollup": { + "$ref": "#/definitions/alpha.rollup_address" + }, + "commitment": { + "$ref": "#/definitions/commitment_hash" + } + }, + "required": [ + "commitment", + "rollup", + "storage_limit", + "gas_limit", + "counter", + "fee", + "source", + "kind" + ], + "additionalProperties": false } ] }, @@ -2558,6 +2602,10 @@ curl -s 'http://localhost:[PORT]/describe/chains/main/mempool?recurse=yes' "title": "A block identifier (Base58Check-encoded)", "$ref": "#/definitions/unistring" }, + "commitment_hash": { + "title": "The hash of a commitment of a smart contract rollup (Base58Check-encoded)", + "$ref": "#/definitions/unistring" + }, "cycle_nonce": { "title": "A nonce hash (Base58Check-encoded)", "$ref": "#/definitions/unistring" @@ -6217,6 +6265,107 @@ curl -s 'http://localhost:[PORT]/describe/chains/main/mempool?recurse=yes' } ], "name": "Sc_rollup_add_messages" + }, + { + "tag": 202, + "fields": [ + { + "name": "Tag", + "layout": { + "size": "Uint8", + "kind": "Int" + }, + "data_kind": { + "size": 1, + "kind": "Float" + }, + "kind": "named" + }, + { + "name": "source", + "layout": { + "name": "public_key_hash", + "kind": "Ref" + }, + "data_kind": { + "size": 21, + "kind": "Float" + }, + "kind": "named" + }, + { + "name": "fee", + "layout": { + "name": "N.t", + "kind": "Ref" + }, + "data_kind": { + "kind": "Dynamic" + }, + "kind": "named" + }, + { + "name": "counter", + "layout": { + "name": "N.t", + "kind": "Ref" + }, + "data_kind": { + "kind": "Dynamic" + }, + "kind": "named" + }, + { + "name": "gas_limit", + "layout": { + "name": "N.t", + "kind": "Ref" + }, + "data_kind": { + "kind": "Dynamic" + }, + "kind": "named" + }, + { + "name": "storage_limit", + "layout": { + "name": "N.t", + "kind": "Ref" + }, + "data_kind": { + "kind": "Dynamic" + }, + "kind": "named" + }, + { + "kind": "dyn", + "name": "alpha.rollup_address", + "num_fields": 1, + "size": "Uint30" + }, + { + "name": "rollup", + "layout": { + "kind": "String" + }, + "data_kind": { + "kind": "Variable" + }, + "kind": "named" + }, + { + "name": "commitment", + "layout": { + "kind": "Bytes" + }, + "data_kind": { + "size": 32, + "kind": "Float" + }, + "kind": "named" + } + ], + "name": "Sc_rollup_cement" } ] } @@ -8643,6 +8792,50 @@ curl -s 'http://localhost:[PORT]/describe/chains/main/mempool?recurse=yes' "kind" ], "additionalProperties": false + }, + { + "title": "Sc_rollup_cement", + "type": "object", + "properties": { + "kind": { + "type": "string", + "enum": [ + "sc_rollup_cement" + ] + }, + "source": { + "$ref": "#/definitions/Signature.Public_key_hash" + }, + "fee": { + "$ref": "#/definitions/alpha.mutez" + }, + "counter": { + "$ref": "#/definitions/positive_bignum" + }, + "gas_limit": { + "$ref": "#/definitions/positive_bignum" + }, + "storage_limit": { + "$ref": "#/definitions/positive_bignum" + }, + "rollup": { + "$ref": "#/definitions/alpha.rollup_address" + }, + "commitment": { + "$ref": "#/definitions/commitment_hash" + } + }, + "required": [ + "commitment", + "rollup", + "storage_limit", + "gas_limit", + "counter", + "fee", + "source", + "kind" + ], + "additionalProperties": false } ] }, @@ -8834,6 +9027,10 @@ curl -s 'http://localhost:[PORT]/describe/chains/main/mempool?recurse=yes' "title": "A block identifier (Base58Check-encoded)", "$ref": "#/definitions/unistring" }, + "commitment_hash": { + "title": "The hash of a commitment of a smart contract rollup (Base58Check-encoded)", + "$ref": "#/definitions/unistring" + }, "cycle_nonce": { "title": "A nonce hash (Base58Check-encoded)", "$ref": "#/definitions/unistring" diff --git a/tezt/_regressions/rpc/alpha.proxy.mempool.out b/tezt/_regressions/rpc/alpha.proxy.mempool.out index 27016fb8a18ac05785c379b7d6fe2562c5232ae8..fe58e3b08d42efff8ee9ddfb277dadd282cca7d4 100644 --- a/tezt/_regressions/rpc/alpha.proxy.mempool.out +++ b/tezt/_regressions/rpc/alpha.proxy.mempool.out @@ -2388,6 +2388,50 @@ curl -s 'http://localhost:[PORT]/describe/chains/main/mempool?recurse=yes' "kind" ], "additionalProperties": false + }, + { + "title": "Sc_rollup_cement", + "type": "object", + "properties": { + "kind": { + "type": "string", + "enum": [ + "sc_rollup_cement" + ] + }, + "source": { + "$ref": "#/definitions/Signature.Public_key_hash" + }, + "fee": { + "$ref": "#/definitions/alpha.mutez" + }, + "counter": { + "$ref": "#/definitions/positive_bignum" + }, + "gas_limit": { + "$ref": "#/definitions/positive_bignum" + }, + "storage_limit": { + "$ref": "#/definitions/positive_bignum" + }, + "rollup": { + "$ref": "#/definitions/alpha.rollup_address" + }, + "commitment": { + "$ref": "#/definitions/commitment_hash" + } + }, + "required": [ + "commitment", + "rollup", + "storage_limit", + "gas_limit", + "counter", + "fee", + "source", + "kind" + ], + "additionalProperties": false } ] }, @@ -2579,6 +2623,10 @@ curl -s 'http://localhost:[PORT]/describe/chains/main/mempool?recurse=yes' "title": "A block identifier (Base58Check-encoded)", "$ref": "#/definitions/unistring" }, + "commitment_hash": { + "title": "The hash of a commitment of a smart contract rollup (Base58Check-encoded)", + "$ref": "#/definitions/unistring" + }, "cycle_nonce": { "title": "A nonce hash (Base58Check-encoded)", "$ref": "#/definitions/unistring" @@ -6238,6 +6286,107 @@ curl -s 'http://localhost:[PORT]/describe/chains/main/mempool?recurse=yes' } ], "name": "Sc_rollup_add_messages" + }, + { + "tag": 202, + "fields": [ + { + "name": "Tag", + "layout": { + "size": "Uint8", + "kind": "Int" + }, + "data_kind": { + "size": 1, + "kind": "Float" + }, + "kind": "named" + }, + { + "name": "source", + "layout": { + "name": "public_key_hash", + "kind": "Ref" + }, + "data_kind": { + "size": 21, + "kind": "Float" + }, + "kind": "named" + }, + { + "name": "fee", + "layout": { + "name": "N.t", + "kind": "Ref" + }, + "data_kind": { + "kind": "Dynamic" + }, + "kind": "named" + }, + { + "name": "counter", + "layout": { + "name": "N.t", + "kind": "Ref" + }, + "data_kind": { + "kind": "Dynamic" + }, + "kind": "named" + }, + { + "name": "gas_limit", + "layout": { + "name": "N.t", + "kind": "Ref" + }, + "data_kind": { + "kind": "Dynamic" + }, + "kind": "named" + }, + { + "name": "storage_limit", + "layout": { + "name": "N.t", + "kind": "Ref" + }, + "data_kind": { + "kind": "Dynamic" + }, + "kind": "named" + }, + { + "kind": "dyn", + "name": "alpha.rollup_address", + "num_fields": 1, + "size": "Uint30" + }, + { + "name": "rollup", + "layout": { + "kind": "String" + }, + "data_kind": { + "kind": "Variable" + }, + "kind": "named" + }, + { + "name": "commitment", + "layout": { + "kind": "Bytes" + }, + "data_kind": { + "size": 32, + "kind": "Float" + }, + "kind": "named" + } + ], + "name": "Sc_rollup_cement" } ] } @@ -8664,6 +8813,50 @@ curl -s 'http://localhost:[PORT]/describe/chains/main/mempool?recurse=yes' "kind" ], "additionalProperties": false + }, + { + "title": "Sc_rollup_cement", + "type": "object", + "properties": { + "kind": { + "type": "string", + "enum": [ + "sc_rollup_cement" + ] + }, + "source": { + "$ref": "#/definitions/Signature.Public_key_hash" + }, + "fee": { + "$ref": "#/definitions/alpha.mutez" + }, + "counter": { + "$ref": "#/definitions/positive_bignum" + }, + "gas_limit": { + "$ref": "#/definitions/positive_bignum" + }, + "storage_limit": { + "$ref": "#/definitions/positive_bignum" + }, + "rollup": { + "$ref": "#/definitions/alpha.rollup_address" + }, + "commitment": { + "$ref": "#/definitions/commitment_hash" + } + }, + "required": [ + "commitment", + "rollup", + "storage_limit", + "gas_limit", + "counter", + "fee", + "source", + "kind" + ], + "additionalProperties": false } ] }, @@ -8855,6 +9048,10 @@ curl -s 'http://localhost:[PORT]/describe/chains/main/mempool?recurse=yes' "title": "A block identifier (Base58Check-encoded)", "$ref": "#/definitions/unistring" }, + "commitment_hash": { + "title": "The hash of a commitment of a smart contract rollup (Base58Check-encoded)", + "$ref": "#/definitions/unistring" + }, "cycle_nonce": { "title": "A nonce hash (Base58Check-encoded)", "$ref": "#/definitions/unistring"