From 00d24f4b3bc6ed3017b1cbb0691dcb2fd5085b94 Mon Sep 17 00:00:00 2001 From: Corneliu Hoffman Date: Tue, 31 May 2022 20:57:04 +0100 Subject: [PATCH 1/4] Proto: new manager operation sc-rollup-atomic-batch --- .../lib_client/client_proto_args.ml | 10 ++ .../lib_client/client_proto_args.mli | 2 + .../lib_client/client_proto_context.ml | 42 ++++++++ .../lib_client/client_proto_context.mli | 30 ++++++ src/proto_alpha/lib_client/injection.ml | 6 +- .../lib_client/operation_result.ml | 51 ++++++++- .../client_proto_context_commands.ml | 100 ++++++++++++++++++ src/proto_alpha/lib_injector/l1_operation.ml | 2 + .../lib_protocol/alpha_context.mli | 17 +++ src/proto_alpha/lib_protocol/apply.ml | 40 ++++++- src/proto_alpha/lib_protocol/apply_results.ml | 83 +++++++++++++++ .../lib_protocol/apply_results.mli | 6 ++ .../lib_protocol/operation_repr.ml | 76 +++++++++++++ .../lib_protocol/operation_repr.mli | 26 +++++ .../lib_protocol/sc_rollup_operations.ml | 29 ++++- .../lib_protocol/sc_rollup_operations.mli | 14 ++- 16 files changed, 527 insertions(+), 7 deletions(-) diff --git a/src/proto_alpha/lib_client/client_proto_args.ml b/src/proto_alpha/lib_client/client_proto_args.ml index 0dae91164860..5d44f1f3f02c 100644 --- a/src/proto_alpha/lib_client/client_proto_args.ml +++ b/src/proto_alpha/lib_client/client_proto_args.ml @@ -340,6 +340,16 @@ let level_arg = ~doc:"Set the level to be returned by the LEVEL instruction" level_kind +let raw_level_parameter = + parameter (fun _ s -> + match Int32.of_string_opt s with + | Some i when i >= 0l -> + Lwt.return @@ Environment.wrap_tzresult (Raw_level.of_int32 i) + | _ -> + failwith + "'%s' is not a valid level (should be a non-negative int32 value)" + s) + let timestamp_parameter = parameter (fun _ s -> match Script_timestamp.of_string s with diff --git a/src/proto_alpha/lib_client/client_proto_args.mli b/src/proto_alpha/lib_client/client_proto_args.mli index 519df20744ba..4efa1d3837dc 100644 --- a/src/proto_alpha/lib_client/client_proto_args.mli +++ b/src/proto_alpha/lib_client/client_proto_args.mli @@ -145,6 +145,8 @@ val json_parameter : (Data_encoding.Json.t, full) Clic.parameter val data_parameter : (Michelson_v1_parser.parsed, full) Clic.parameter +val raw_level_parameter : (Raw_level.t, full) Clic.parameter + val unparsing_mode_arg : default:string -> (Script_ir_translator.unparsing_mode, full) Clic.arg diff --git a/src/proto_alpha/lib_client/client_proto_context.ml b/src/proto_alpha/lib_client/client_proto_context.ml index e1e2baad06b7..49111fcc74e3 100644 --- a/src/proto_alpha/lib_client/client_proto_context.ml +++ b/src/proto_alpha/lib_client/client_proto_context.ml @@ -1268,3 +1268,45 @@ let sc_rollup_publish (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_atomic_batch (cctxt : #full) ~chain ~block ?confirmations ?dry_run + ?verbose_signing ?simulation ?fee ?gas_limit ?storage_limit ?counter ~source + ~rollup ~cemented_commitment ~outbox_level ~message_index ~inclusion_proof + ~atomic_transaction_batch ~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_atomic_batch + { + rollup; + cemented_commitment; + outbox_level; + message_index; + inclusion_proof; + atomic_transaction_batch; + })) + 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 e4fe99e770b3..97951466bf00 100644 --- a/src/proto_alpha/lib_client/client_proto_context.mli +++ b/src/proto_alpha/lib_client/client_proto_context.mli @@ -765,3 +765,33 @@ val sc_rollup_publish : * Kind.sc_rollup_publish Kind.manager Apply_results.contents_result) tzresult Lwt.t + +val sc_rollup_atomic_batch : + #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:Sc_rollup.t -> + cemented_commitment:Sc_rollup.Commitment.Hash.t -> + outbox_level:Raw_level.t -> + message_index:int -> + inclusion_proof:string -> + atomic_transaction_batch:string -> + src_pk:public_key -> + src_sk:Client_keys.sk_uri -> + fee_parameter:Injection.fee_parameter -> + unit -> + ( Operation_hash.t + * Kind.sc_rollup_atomic_batch Kind.manager contents + * Kind.sc_rollup_atomic_batch Kind.manager Apply_results.contents_result, + tztrace ) + result + Lwt.t diff --git a/src/proto_alpha/lib_client/injection.ml b/src/proto_alpha/lib_client/injection.ml index c1ae74b26d7f..11e8eb18027b 100644 --- a/src/proto_alpha/lib_client/injection.ml +++ b/src/proto_alpha/lib_client/injection.ml @@ -337,6 +337,8 @@ let estimated_gas_single (type kind) | Applied (Sc_rollup_publish_result {consumed_gas; _}) -> Ok consumed_gas | Applied (Sc_rollup_refute_result {consumed_gas; _}) -> Ok consumed_gas | Applied (Sc_rollup_timeout_result {consumed_gas; _}) -> Ok consumed_gas + | Applied (Sc_rollup_atomic_batch_result {consumed_gas; _}) -> + Ok consumed_gas | Skipped _ -> Ok Gas.Arith.zero (* there must be another error for this to happen *) | Backtracked (_, None) -> @@ -378,7 +380,8 @@ let estimated_storage_single (type kind) ~tx_rollup_origination_size Ok size_of_constant | Applied (Set_deposits_limit_result _) -> Ok Z.zero | Applied (Tx_rollup_origination_result _) -> Ok tx_rollup_origination_size - | Applied (Tx_rollup_submit_batch_result {paid_storage_size_diff; _}) -> + | Applied (Tx_rollup_submit_batch_result {paid_storage_size_diff; _}) + | Applied (Sc_rollup_atomic_batch_result {paid_storage_size_diff; _}) -> Ok paid_storage_size_diff | Applied (Tx_rollup_commit_result _) -> Ok Z.zero | Applied (Tx_rollup_return_bond_result _) -> Ok Z.zero @@ -466,6 +469,7 @@ let originated_contracts_single (type kind) | Applied (Sc_rollup_publish_result _) -> Ok [] | Applied (Sc_rollup_refute_result _) -> Ok [] | Applied (Sc_rollup_timeout_result _) -> Ok [] + | Applied (Sc_rollup_atomic_batch_result _) -> Ok [] | Skipped _ -> Ok [] (* there must be another error for this to happen *) | 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 e1bddab339d5..ad2d57872ff3 100644 --- a/src/proto_alpha/lib_client/operation_result.ml +++ b/src/proto_alpha/lib_client/operation_result.ml @@ -328,7 +328,34 @@ let pp_manager_operation_content (type kind) source pp_result ppf Sc_rollup.Staker.pp (snd stakers) Sc_rollup.Address.pp - rollup) ; + rollup + | Sc_rollup_atomic_batch + { + rollup; + cemented_commitment; + outbox_level; + message_index; + inclusion_proof; + atomic_transaction_batch; + } -> + (* TODO #3125 + Improve pretty-printing of this content and sc operations above. + Should avoid printing on a single line and use indentation. + *) + Format.fprintf + ppf + "Execute the atomic transaction batch from the smart contract rollup \ + at address %a, with cemented commit %a, outbox level %a, message \ + index %d, inclusion proof %s for the atomic batch of transactions %s" + Sc_rollup.Address.pp + rollup + Sc_rollup.Commitment.Hash.pp + cemented_commitment + Raw_level.pp + outbox_level + message_index + inclusion_proof + atomic_transaction_batch) ; Format.fprintf ppf "%a@]@]" pp_result result @@ -706,6 +733,17 @@ let pp_manager_operation_contents_and_result ppf Sc_rollup.Game.pp_status status in + let pp_sc_rollup_atomic_batch_result + (Sc_rollup_atomic_batch_result + {balance_updates; consumed_gas; paid_storage_size_diff}) = + if paid_storage_size_diff <> Z.zero then + Format.fprintf + ppf + "@,Paid storage size diff: %s bytes" + (Z.to_string paid_storage_size_diff) ; + Format.fprintf ppf "@,Consumed gas: %a" Gas.Arith.pp consumed_gas ; + pp_balance_updates_opt ppf balance_updates + in let pp_result (type kind) ppf (result : kind manager_operation_result) = Format.fprintf ppf "@," ; match result with @@ -940,6 +978,17 @@ let pp_manager_operation_contents_and_result ppf rollup by timeout was BACKTRACKED, its expected effects (as follow) \ were NOT applied.@]" ; pp_sc_rollup_timeout_result op + | Applied (Sc_rollup_atomic_batch_result _ as op) -> + Format.fprintf + ppf + "This sc rollup atomic batch operation was successfully applied." ; + pp_sc_rollup_atomic_batch_result op + | Backtracked ((Sc_rollup_atomic_batch_result _ as op), _err) -> + Format.fprintf + ppf + "@[This sc rollup atomic batch operation was BACKTRACKED, its \ + expected effects (as follow) were NOT applied.@]" ; + pp_sc_rollup_atomic_batch_result op in Format.fprintf diff --git a/src/proto_alpha/lib_client_commands/client_proto_context_commands.ml b/src/proto_alpha/lib_client_commands/client_proto_context_commands.ml index a0b8b2d53736..7ace7e77ed5c 100644 --- a/src/proto_alpha/lib_client_commands/client_proto_context_commands.ml +++ b/src/proto_alpha/lib_client_commands/client_proto_context_commands.ml @@ -135,6 +135,8 @@ let rollup_address_param = name | Some addr -> return addr) +let unchecked_payload_param = file_or_text_parameter ~from_text:return () + let group = { Clic.name = "context"; @@ -2771,6 +2773,104 @@ let commands_rw () = (fun addr -> cctxt#message "%s" (Sc_rollup.Address.to_b58check addr)) rollups >>= fun () -> return_unit); + command + ~group + ~desc: + "Execute an atomic batch of transactions. The transactions are part of \ + the smart-contract rollup's outbox of a cemented commitment." + (args7 + fee_arg + dry_run_switch + verbose_signing_switch + simulate_switch + fee_parameter_args + storage_limit_arg + counter_arg) + (prefixes ["execute"; "transactions"; "of"; "sc"; "rollup"] + @@ param + ~name:"rollup" + ~desc: + "The address of the sc rollup where the atomic batch of \ + transactions resides." + rollup_address_param + @@ prefix "from" + @@ ContractAlias.destination_param + ~name:"source" + ~desc:"The account used for executing the batch of transactions." + @@ prefixes ["for"; "commitment"; "hash"] + @@ param + ~name:"last cemented commitment" + ~desc:"The hash of the last cemented commitment of the rollup." + commitment_hash_param + @@ prefixes ["for"; "the"; "outbox"; "level"] + @@ param + ~name:"outbox level" + ~desc:"The level of the rollup's outbox." + raw_level_parameter + @@ prefixes ["for"; "the"; "message"; "at"; "index"] + @@ param + ~name:"message index" + ~desc: + "The index of the rollup's outbox message containing the batch of \ + transactions." + non_negative_param + @@ prefixes ["and"; "inclusion"; "proof"] + @@ param + ~name:"inclusion proof" + ~desc:"The inclusion proof for the atomic batch of transactions." + unchecked_payload_param + @@ prefixes ["and"; "atomic"; "transaction"; "batch"] + @@ param + ~name:"atomic transaction batch" + ~desc:"The atomic batch of transactions to be executed." + unchecked_payload_param + @@ stop) + (fun ( fee, + dry_run, + verbose_signing, + simulation, + fee_parameter, + storage_limit, + counter ) + rollup + source + cemented_commitment + outbox_level + message_index + inclusion_proof + atomic_transaction_batch + cctxt -> + (match source with + | Originated _ -> + failwith + "Only implicit accounts can execute an sc rollup batch of \ + transactions" + | Implicit source -> return source) + >>=? fun source -> + Client_keys.get_key cctxt source >>=? fun (_, src_pk, src_sk) -> + sc_rollup_atomic_batch + cctxt + ~chain:cctxt#chain + ~block:cctxt#block + ~dry_run + ~verbose_signing + ?fee + ?storage_limit + ?counter + ?confirmations:cctxt#confirmations + ~simulation + ~source + ~rollup + ~cemented_commitment + ~outbox_level + ~message_index + ~inclusion_proof + ~atomic_transaction_batch + ~src_pk + ~src_sk + ~fee_parameter + () + >>=? fun _res -> return_unit); ] let commands network () = diff --git a/src/proto_alpha/lib_injector/l1_operation.ml b/src/proto_alpha/lib_injector/l1_operation.ml index 53ee27416bf6..b0aef6cc2142 100644 --- a/src/proto_alpha/lib_injector/l1_operation.ml +++ b/src/proto_alpha/lib_injector/l1_operation.ml @@ -65,6 +65,7 @@ module Manager_operation = struct make sc_rollup_publish_case; make sc_rollup_refute_case; make sc_rollup_timeout_case; + make sc_rollup_atomic_batch_case; ] let get_case : @@ -94,6 +95,7 @@ module Manager_operation = struct | Sc_rollup_publish _ -> sc_rollup_publish_case | Sc_rollup_refute _ -> sc_rollup_refute_case | Sc_rollup_timeout _ -> sc_rollup_timeout_case + | Sc_rollup_atomic_batch _ -> sc_rollup_atomic_batch_case let pp_kind ppf op = let open Operation.Encoding.Manager_operations in diff --git a/src/proto_alpha/lib_protocol/alpha_context.mli b/src/proto_alpha/lib_protocol/alpha_context.mli index 332549e2def5..d32e6023936b 100644 --- a/src/proto_alpha/lib_protocol/alpha_context.mli +++ b/src/proto_alpha/lib_protocol/alpha_context.mli @@ -2920,6 +2920,8 @@ module Kind : sig type sc_rollup_timeout = Sc_rollup_timeout_kind + type sc_rollup_atomic_batch = Sc_rollup_atomic_batch_kind + type 'a manager = | Reveal_manager_kind : reveal manager | Transaction_manager_kind : transaction manager @@ -2945,6 +2947,7 @@ module Kind : sig | Sc_rollup_publish_manager_kind : sc_rollup_publish manager | Sc_rollup_refute_manager_kind : sc_rollup_refute manager | Sc_rollup_timeout_manager_kind : sc_rollup_timeout manager + | Sc_rollup_atomic_batch_manager_kind : sc_rollup_atomic_batch manager end type 'a consensus_operation_type = @@ -3149,6 +3152,15 @@ and _ manager_operation = stakers : Sc_rollup.Staker.t * Sc_rollup.Staker.t; } -> Kind.sc_rollup_timeout manager_operation + | Sc_rollup_atomic_batch : { + rollup : Sc_rollup.t; + cemented_commitment : Sc_rollup.Commitment.Hash.t; + outbox_level : Raw_level.t; + message_index : int; + inclusion_proof : string; + atomic_transaction_batch : string; + } + -> Kind.sc_rollup_atomic_batch manager_operation and counter = Z.t @@ -3314,6 +3326,9 @@ module Operation : sig val sc_rollup_timeout_case : Kind.sc_rollup_timeout Kind.manager case + val sc_rollup_atomic_batch_case : + Kind.sc_rollup_atomic_batch Kind.manager case + module Manager_operations : sig type 'b case = | MCase : { @@ -3369,6 +3384,8 @@ module Operation : sig val sc_rollup_refute_case : Kind.sc_rollup_refute case val sc_rollup_timeout_case : Kind.sc_rollup_timeout case + + val sc_rollup_atomic_batch_case : Kind.sc_rollup_atomic_batch case end end diff --git a/src/proto_alpha/lib_protocol/apply.ml b/src/proto_alpha/lib_protocol/apply.ml index 822db50fca38..183dfb0524c7 100644 --- a/src/proto_alpha/lib_protocol/apply.ml +++ b/src/proto_alpha/lib_protocol/apply.ml @@ -1792,6 +1792,25 @@ let apply_external_manager_operation_content : let consumed_gas = Gas.consumed ~since:before_operation ~until:ctxt in let result = Sc_rollup_timeout_result {status; consumed_gas} in return (ctxt, result, []) + | Sc_rollup_atomic_batch + { + rollup; + cemented_commitment; + outbox_level; + message_index; + inclusion_proof; + atomic_transaction_batch; + } -> + Sc_rollup_operations.atomic_batch + ctxt + rollup + cemented_commitment + ~outbox_level + ~message_index + ~inclusion_proof + ~atomic_transaction_batch + >>=? fun _ctxt -> + failwith "Sc_rolup_atomic_batch operation is not yet supported." type success_or_failure = Success of context | Failure @@ -1991,7 +2010,8 @@ let precheck_manager_contents (type kind) ctxt (op : kind Kind.manager contents) ~count_limit:tx_rollup_max_messages_per_inbox >>?= fun () -> return ctxt | Sc_rollup_originate _ | Sc_rollup_add_messages _ | Sc_rollup_cement _ - | Sc_rollup_publish _ | Sc_rollup_refute _ | Sc_rollup_timeout _ -> + | Sc_rollup_publish _ | Sc_rollup_refute _ | Sc_rollup_timeout _ + | Sc_rollup_atomic_batch _ -> assert_sc_rollup_feature_enabled ctxt >|=? fun () -> ctxt) >>=? fun ctxt -> Contract.increment_counter ctxt source >>=? fun ctxt -> @@ -2161,6 +2181,15 @@ let burn_manager_storage_fees : | Sc_rollup_publish_result _ -> return (ctxt, storage_limit, smopr) | Sc_rollup_refute_result _ -> return (ctxt, storage_limit, smopr) | Sc_rollup_timeout_result _ -> return (ctxt, storage_limit, smopr) + | Sc_rollup_atomic_batch_result + ({paid_storage_size_diff; balance_updates; _} as payload) -> + let consumed = paid_storage_size_diff in + Fees.burn_storage_fees ctxt ~storage_limit ~payer consumed + >|=? fun (ctxt, storage_limit, storage_bus) -> + let balance_updates = storage_bus @ balance_updates in + ( ctxt, + storage_limit, + Sc_rollup_atomic_batch_result {payload with balance_updates} ) (** [burn_internal_storage_fees ctxt smopr storage_limit payer] burns the storage fees associated to an internal operation result [smopr]. @@ -2253,6 +2282,15 @@ let burn_internal_storage_fees : | Sc_rollup_publish_result _ -> return (ctxt, storage_limit, smopr) | Sc_rollup_refute_result _ -> return (ctxt, storage_limit, smopr) | Sc_rollup_timeout_result _ -> return (ctxt, storage_limit, smopr) + | Sc_rollup_atomic_batch_result + ({balance_updates; paid_storage_size_diff; _} as payload) -> + Fees.burn_storage_fees ctxt ~storage_limit ~payer paid_storage_size_diff + >>=? fun (ctxt, storage_limit, storage_bus) -> + let balance_updates = storage_bus @ balance_updates in + return + ( ctxt, + storage_limit, + Sc_rollup_atomic_batch_result {payload with balance_updates} ) 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 129465b789d1..0eeb36942f7d 100644 --- a/src/proto_alpha/lib_protocol/apply_results.ml +++ b/src/proto_alpha/lib_protocol/apply_results.ml @@ -245,6 +245,12 @@ type _ successful_manager_operation_result = status : Sc_rollup.Game.status; } -> Kind.sc_rollup_timeout successful_manager_operation_result + | Sc_rollup_atomic_batch_result : { + balance_updates : Receipt.balance_updates; + consumed_gas : Gas.Arith.fp; + paid_storage_size_diff : Z.t; + } + -> Kind.sc_rollup_atomic_batch successful_manager_operation_result let migration_origination_result_to_successful_manager_operation_result ({ @@ -1019,6 +1025,41 @@ module Manager_result = struct ~inj:(fun (consumed_gas, consumed_milligas, status) -> assert (Gas.Arith.(equal (ceil consumed_milligas) consumed_gas)) ; Sc_rollup_timeout_result {consumed_gas = consumed_milligas; status}) + + let sc_rollup_atomic_batch_case = + make + ~op_case:Operation.Encoding.Manager_operations.sc_rollup_atomic_batch_case + ~encoding: + Data_encoding.( + obj4 + (req "balance_updates" Receipt.balance_updates_encoding) + (dft "consumed_gas" Gas.Arith.n_integral_encoding Gas.Arith.zero) + (dft "consumed_milligas" Gas.Arith.n_fp_encoding Gas.Arith.zero) + (dft "paid_storage_size_diff" z Z.zero)) + ~select:(function + | Successful_manager_result (Sc_rollup_atomic_batch_result _ as op) -> + Some op + | _ -> None) + ~kind:Kind.Sc_rollup_atomic_batch_manager_kind + ~proj:(function + | Sc_rollup_atomic_batch_result + {balance_updates; consumed_gas; paid_storage_size_diff} -> + ( balance_updates, + Gas.Arith.ceil consumed_gas, + consumed_gas, + paid_storage_size_diff )) + ~inj: + (fun ( balance_updates, + consumed_gas, + consumed_milligas, + paid_storage_size_diff ) -> + assert (Gas.Arith.(equal (ceil consumed_milligas) consumed_gas)) ; + Sc_rollup_atomic_batch_result + { + balance_updates; + consumed_gas = consumed_milligas; + paid_storage_size_diff; + }) end type 'kind iselect = @@ -1513,6 +1554,10 @@ let equal_manager_kind : | Kind.Sc_rollup_timeout_manager_kind, Kind.Sc_rollup_timeout_manager_kind -> Some Eq | Kind.Sc_rollup_timeout_manager_kind, _ -> None + | ( Kind.Sc_rollup_atomic_batch_manager_kind, + Kind.Sc_rollup_atomic_batch_manager_kind ) -> + Some Eq + | Kind.Sc_rollup_atomic_batch_manager_kind, _ -> None module Encoding = struct type 'kind case = @@ -2031,6 +2076,17 @@ module Encoding = struct -> Some (op, res) | _ -> None) + + let[@coq_axiom_with_reason "gadt"] sc_rollup_atomic_batch_case = + make_manager_case + Operation.Encoding.sc_rollup_atomic_batch_case + Manager_result.sc_rollup_atomic_batch_case + (function + | Contents_and_result + ( (Manager_operation {operation = Sc_rollup_atomic_batch _; _} as op), + res ) -> + Some (op, res) + | _ -> None) end let contents_result_encoding = @@ -2082,6 +2138,7 @@ let contents_result_encoding = make sc_rollup_publish_case; make sc_rollup_refute_case; make sc_rollup_timeout_case; + make sc_rollup_atomic_batch_case; ] let contents_and_result_encoding = @@ -2814,6 +2871,32 @@ let kind_equal : } ) -> Some Eq | Manager_operation {operation = Sc_rollup_timeout _; _}, _ -> None + | ( Manager_operation {operation = Sc_rollup_atomic_batch _; _}, + Manager_operation_result + {operation_result = Applied (Sc_rollup_atomic_batch_result _); _} ) -> + Some Eq + | ( Manager_operation {operation = Sc_rollup_atomic_batch _; _}, + Manager_operation_result + {operation_result = Backtracked (Sc_rollup_atomic_batch_result _, _); _} + ) -> + Some Eq + | ( Manager_operation {operation = Sc_rollup_atomic_batch _; _}, + Manager_operation_result + { + operation_result = + Failed (Alpha_context.Kind.Sc_rollup_atomic_batch_manager_kind, _); + _; + } ) -> + Some Eq + | ( Manager_operation {operation = Sc_rollup_atomic_batch _; _}, + Manager_operation_result + { + operation_result = + Skipped Alpha_context.Kind.Sc_rollup_atomic_batch_manager_kind; + _; + } ) -> + Some Eq + | Manager_operation {operation = Sc_rollup_atomic_batch _; _}, _ -> 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 941b22741d51..69822f79d6dd 100644 --- a/src/proto_alpha/lib_protocol/apply_results.mli +++ b/src/proto_alpha/lib_protocol/apply_results.mli @@ -288,6 +288,12 @@ and _ successful_manager_operation_result = status : Sc_rollup.Game.status; } -> Kind.sc_rollup_timeout successful_manager_operation_result + | Sc_rollup_atomic_batch_result : { + balance_updates : Receipt.balance_updates; + consumed_gas : Gas.Arith.fp; + paid_storage_size_diff : Z.t; + } + -> Kind.sc_rollup_atomic_batch 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 ea3cde9b4c1f..a45d1e4a03ad 100644 --- a/src/proto_alpha/lib_protocol/operation_repr.ml +++ b/src/proto_alpha/lib_protocol/operation_repr.ml @@ -102,6 +102,8 @@ module Kind = struct type sc_rollup_timeout = Sc_rollup_timeout_kind + type sc_rollup_atomic_batch = Sc_rollup_atomic_batch_kind + type 'a manager = | Reveal_manager_kind : reveal manager | Transaction_manager_kind : transaction manager @@ -127,6 +129,7 @@ module Kind = struct | Sc_rollup_publish_manager_kind : sc_rollup_publish manager | Sc_rollup_refute_manager_kind : sc_rollup_refute manager | Sc_rollup_timeout_manager_kind : sc_rollup_timeout manager + | Sc_rollup_atomic_batch_manager_kind : sc_rollup_atomic_batch manager end type 'a consensus_operation_type = @@ -391,6 +394,15 @@ and _ manager_operation = stakers : Sc_rollup_repr.Staker.t * Sc_rollup_repr.Staker.t; } -> Kind.sc_rollup_timeout manager_operation + | Sc_rollup_atomic_batch : { + rollup : Sc_rollup_repr.t; + cemented_commitment : Sc_rollup_commitment_repr.Hash.t; + outbox_level : Raw_level_repr.t; + message_index : int; + inclusion_proof : string; + atomic_transaction_batch : string; + } + -> Kind.sc_rollup_atomic_batch manager_operation and counter = Z.t @@ -419,6 +431,7 @@ let manager_kind : type kind. kind manager_operation -> kind Kind.manager = | Sc_rollup_publish _ -> Kind.Sc_rollup_publish_manager_kind | Sc_rollup_refute _ -> Kind.Sc_rollup_refute_manager_kind | Sc_rollup_timeout _ -> Kind.Sc_rollup_timeout_manager_kind + | Sc_rollup_atomic_batch _ -> Kind.Sc_rollup_atomic_batch_manager_kind type packed_manager_operation = | Manager : 'kind manager_operation -> packed_manager_operation @@ -506,6 +519,8 @@ let sc_rollup_operation_refute_tag = sc_rollup_operation_tag_offset + 4 let sc_rollup_operation_timeout_tag = sc_rollup_operation_tag_offset + 5 +let sc_rollup_operation_atomic_batch_tag = sc_rollup_operation_tag_offset + 6 + module Encoding = struct open Data_encoding @@ -1026,6 +1041,59 @@ module Encoding = struct | Sc_rollup_timeout {rollup; stakers} -> (rollup, stakers)); inj = (fun (rollup, stakers) -> Sc_rollup_timeout {rollup; stakers}); } + + let[@coq_axiom_with_reason "gadt"] sc_rollup_atomic_batch_case = + MCase + { + tag = sc_rollup_operation_atomic_batch_tag; + name = "sc_rollup_atomic_batch"; + encoding = + obj6 + (req "rollup" Sc_rollup_repr.encoding) + (req + "cemented_commitment" + Sc_rollup_commitment_repr.Hash.encoding) + (req "outbox_level" Raw_level_repr.encoding) + (req "message_index" Data_encoding.int31) + (req "inclusion proof" Data_encoding.string) + (req "atomic_transaction_batch" Data_encoding.string); + select = + (function + | Manager (Sc_rollup_atomic_batch _ as op) -> Some op | _ -> None); + proj = + (function + | Sc_rollup_atomic_batch + { + rollup; + cemented_commitment; + outbox_level; + message_index; + inclusion_proof; + atomic_transaction_batch; + } -> + ( rollup, + cemented_commitment, + outbox_level, + message_index, + inclusion_proof, + atomic_transaction_batch )); + inj = + (fun ( rollup, + cemented_commitment, + outbox_level, + message_index, + inclusion_proof, + atomic_transaction_batch ) -> + Sc_rollup_atomic_batch + { + rollup; + cemented_commitment; + outbox_level; + message_index; + inclusion_proof; + atomic_transaction_batch; + }); + } end type 'b case = @@ -1396,6 +1464,11 @@ module Encoding = struct sc_rollup_operation_timeout_tag Manager_operations.sc_rollup_timeout_case + let sc_rollup_atomic_batch_case = + make_manager_case + sc_rollup_operation_atomic_batch_tag + Manager_operations.sc_rollup_atomic_batch_case + let contents_encoding = let make (Case {tag; name; encoding; select; proj; inj}) = case @@ -1439,6 +1512,7 @@ module Encoding = struct make sc_rollup_publish_case; make sc_rollup_refute_case; make sc_rollup_timeout_case; + make sc_rollup_atomic_batch_case; ] let contents_list_encoding = @@ -1655,6 +1729,8 @@ let equal_manager_operation_kind : | Sc_rollup_refute _, _ -> None | Sc_rollup_timeout _, Sc_rollup_timeout _ -> Some Eq | Sc_rollup_timeout _, _ -> None + | Sc_rollup_atomic_batch _, Sc_rollup_atomic_batch _ -> Some Eq + | Sc_rollup_atomic_batch _, _ -> None let equal_contents_kind : type a b. a contents -> b contents -> (a, b) eq option = diff --git a/src/proto_alpha/lib_protocol/operation_repr.mli b/src/proto_alpha/lib_protocol/operation_repr.mli index ac7dd3202b2d..63a179cf3944 100644 --- a/src/proto_alpha/lib_protocol/operation_repr.mli +++ b/src/proto_alpha/lib_protocol/operation_repr.mli @@ -131,6 +131,8 @@ module Kind : sig type sc_rollup_timeout = Sc_rollup_timeout_kind + type sc_rollup_atomic_batch = Sc_rollup_atomic_batch_kind + type 'a manager = | Reveal_manager_kind : reveal manager | Transaction_manager_kind : transaction manager @@ -156,6 +158,7 @@ module Kind : sig | Sc_rollup_publish_manager_kind : sc_rollup_publish manager | Sc_rollup_refute_manager_kind : sc_rollup_refute manager | Sc_rollup_timeout_manager_kind : sc_rollup_timeout manager + | Sc_rollup_atomic_batch_manager_kind : sc_rollup_atomic_batch manager end type 'a consensus_operation_type = @@ -460,6 +463,24 @@ and _ manager_operation = stakers : Sc_rollup_repr.Staker.t * Sc_rollup_repr.Staker.t; } -> Kind.sc_rollup_timeout manager_operation + (* [Sc_rollup_atomic_batch] executes an atomic batch of transactions + corresponding to a message in the rollup's outbox. Transactions are + smart-contract calls and may include any valid payload including ticket + transfers. *) + | Sc_rollup_atomic_batch : { + rollup : Sc_rollup_repr.t; (** The smart-contract rollup. *) + cemented_commitment : Sc_rollup_commitment_repr.Hash.t; + (** The hash of the last cemented commitment that the proof refers to. *) + outbox_level : Raw_level_repr.t; + (** The level of the outbox containing transaction batch message. *) + message_index : int; + (** The index of the message in the outbox at that level. *) + inclusion_proof : string; + (** A proof that the message is included in the outbox. *) + atomic_transaction_batch : string; + (** The bytes corresponding to a serialized batch of transactions. *) + } + -> Kind.sc_rollup_atomic_batch manager_operation (** Counters are used as anti-replay protection mechanism in manager operations: each manager account stores a counter and @@ -605,6 +626,9 @@ module Encoding : sig val sc_rollup_timeout_case : Kind.sc_rollup_timeout Kind.manager case + val sc_rollup_atomic_batch_case : + Kind.sc_rollup_atomic_batch Kind.manager case + module Manager_operations : sig type 'b case = | MCase : { @@ -659,5 +683,7 @@ module Encoding : sig val sc_rollup_refute_case : Kind.sc_rollup_refute case val sc_rollup_timeout_case : Kind.sc_rollup_timeout case + + val sc_rollup_atomic_batch_case : Kind.sc_rollup_atomic_batch case end end diff --git a/src/proto_alpha/lib_protocol/sc_rollup_operations.ml b/src/proto_alpha/lib_protocol/sc_rollup_operations.ml index d46ba2429521..7fb0efb0f6d1 100644 --- a/src/proto_alpha/lib_protocol/sc_rollup_operations.ml +++ b/src/proto_alpha/lib_protocol/sc_rollup_operations.ml @@ -26,19 +26,33 @@ open Alpha_context -type error += (* Temporary *) Sc_rollup_invalid_parameters_type +type error += + | (* Permanent *) Sc_rollup_invalid_parameters_type + | (* Permanent *) Sc_rollup_invalid_atomic_batch let () = let description = "Invalid parameters type for rollup" in register_error_kind - `Temporary + `Permanent ~id:"Sc_rollup_invalid_parameters_type" ~title:"Invalid parameters type" ~description ~pp:(fun fmt () -> Format.fprintf fmt "%s" description) Data_encoding.unit (function Sc_rollup_invalid_parameters_type -> Some () | _ -> None) - (fun () -> Sc_rollup_invalid_parameters_type) + (fun () -> Sc_rollup_invalid_parameters_type) ; + let description = + "Smart-contract rollup atomic batch operation is not yet supported" + in + register_error_kind + `Permanent + ~id:"Sc_rollup_invalid_atomic_batch" + ~title:description + ~description + ~pp:(fun ppf () -> Format.fprintf ppf "%s" description) + Data_encoding.empty + (function Sc_rollup_invalid_atomic_batch -> Some () | _ -> None) + (fun () -> Sc_rollup_invalid_atomic_batch) type origination_result = {address : Sc_rollup.Address.t; size : Z.t} @@ -140,3 +154,12 @@ let originate ctxt ~kind ~boot_sector ~parameters_ty = Sc_rollup.originate ctxt ~kind ~boot_sector ~parameters_ty in ({address; size}, ctxt) + +let atomic_batch _ctx _rollup _last_cemented_commitment ~outbox_level:_ + ~message_index:_ ~inclusion_proof:_ ~atomic_transaction_batch:_ = + (* TODO: 3106 + Implement business logic. + Involves validate inclusion proofs, transferring tickets and outputting + operations etc. + *) + fail Sc_rollup_invalid_atomic_batch diff --git a/src/proto_alpha/lib_protocol/sc_rollup_operations.mli b/src/proto_alpha/lib_protocol/sc_rollup_operations.mli index f9d92a4371f8..814114f58ebc 100644 --- a/src/proto_alpha/lib_protocol/sc_rollup_operations.mli +++ b/src/proto_alpha/lib_protocol/sc_rollup_operations.mli @@ -26,7 +26,9 @@ (** High-level operations over smart contract rollups. *) open Alpha_context -type error += (* Temporary *) Sc_rollup_invalid_parameters_type +type error += + | (* Permanent *) Sc_rollup_invalid_parameters_type + | (* Permanent *) Sc_rollup_invalid_atomic_batch type origination_result = private {address : Sc_rollup.Address.t; size : Z.t} @@ -38,3 +40,13 @@ val originate : boot_sector:string -> parameters_ty:Script_repr.lazy_expr -> (origination_result * context) tzresult Lwt.t + +val atomic_batch : + context -> + Sc_rollup.t -> + Sc_rollup.Commitment.Hash.t -> + outbox_level:Raw_level.t -> + message_index:int -> + inclusion_proof:string -> + atomic_transaction_batch:string -> + context tzresult Lwt.t -- GitLab From bb37a35682f6e57b55ac7e41f0a95d1dacd848c1 Mon Sep 17 00:00:00 2001 From: Corneliu Hoffman Date: Tue, 31 May 2022 21:01:07 +0100 Subject: [PATCH 2/4] Test: amend proto tests --- src/proto_alpha/lib_protocol/test/helpers/block.ml | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/proto_alpha/lib_protocol/test/helpers/block.ml b/src/proto_alpha/lib_protocol/test/helpers/block.ml index 9e35b868f7f9..21b2a26c38b0 100644 --- a/src/proto_alpha/lib_protocol/test/helpers/block.ml +++ b/src/proto_alpha/lib_protocol/test/helpers/block.ml @@ -751,7 +751,8 @@ let bake_n_with_all_balance_updates ?(baking_mode = Application) ?policy | Tx_rollup_dispatch_tickets_result _ | Sc_rollup_originate_result _ | Sc_rollup_add_messages_result _ | Sc_rollup_cement_result _ | Sc_rollup_publish_result _ - | Sc_rollup_refute_result _ | Sc_rollup_timeout_result _ -> + | Sc_rollup_refute_result _ | Sc_rollup_timeout_result _ + | Sc_rollup_atomic_batch_result _ -> balance_updates_rev | Transaction_result (Transaction_to_contract_result {balance_updates; _}) @@ -796,7 +797,8 @@ let bake_n_with_origination_results ?(baking_mode = Application) ?policy n b = | Successful_manager_result (Sc_rollup_cement_result _) | Successful_manager_result (Sc_rollup_publish_result _) | Successful_manager_result (Sc_rollup_refute_result _) - | Successful_manager_result (Sc_rollup_timeout_result _) -> + | Successful_manager_result (Sc_rollup_timeout_result _) + | Successful_manager_result (Sc_rollup_atomic_batch_result _) -> origination_results_rev | Successful_manager_result (Origination_result x) -> Origination_result x :: origination_results_rev) -- GitLab From 7a04a2efa6b7390e7ab95fe096e1bb93475cbb64 Mon Sep 17 00:00:00 2001 From: Corneliu Hoffman Date: Tue, 31 May 2022 21:02:25 +0100 Subject: [PATCH 3/4] Test: dummy test for atomic-batch --- .../lib_protocol/test/helpers/op.ml | 23 ++++++++++ .../lib_protocol/test/helpers/op.mli | 15 +++++++ .../integration/operations/test_sc_rollup.ml | 43 +++++++++++++++++++ 3 files changed, 81 insertions(+) diff --git a/src/proto_alpha/lib_protocol/test/helpers/op.ml b/src/proto_alpha/lib_protocol/test/helpers/op.ml index 03d325e1b154..4e02fb0c3780 100644 --- a/src/proto_alpha/lib_protocol/test/helpers/op.ml +++ b/src/proto_alpha/lib_protocol/test/helpers/op.ml @@ -701,3 +701,26 @@ let sc_rollup_cement ?counter ?fee ?gas_limit ?storage_limit ctxt >>=? fun to_sign_op -> Context.Contract.manager ctxt src >|=? fun account -> sign account.sk ctxt to_sign_op + +let sc_rollup_atomic_batch ?counter ?fee ?gas_limit ?storage_limit ctxt + (src : Contract.t) rollup cemented_commitment ~outbox_level ~message_index + ~inclusion_proof ~atomic_transaction_batch = + manager_operation + ?counter + ?fee + ?gas_limit + ?storage_limit + ~source:src + ctxt + (Sc_rollup_atomic_batch + { + rollup; + cemented_commitment; + outbox_level; + message_index; + inclusion_proof; + atomic_transaction_batch; + }) + >>=? fun to_sign_op -> + Context.Contract.manager ctxt src >|=? fun account -> + sign account.sk ctxt to_sign_op diff --git a/src/proto_alpha/lib_protocol/test/helpers/op.mli b/src/proto_alpha/lib_protocol/test/helpers/op.mli index 849570249e93..1888cb9fd424 100644 --- a/src/proto_alpha/lib_protocol/test/helpers/op.mli +++ b/src/proto_alpha/lib_protocol/test/helpers/op.mli @@ -392,3 +392,18 @@ val sc_rollup_cement : Sc_rollup.t -> Sc_rollup.Commitment.Hash.t -> Operation.packed tzresult Lwt.t + +val sc_rollup_atomic_batch : + ?counter:counter -> + ?fee:Tez.t -> + ?gas_limit:Gas.Arith.integral -> + ?storage_limit:counter -> + Context.t -> + Contract.t -> + Sc_rollup.t -> + Sc_rollup.Commitment.Hash.t -> + outbox_level:Raw_level.t -> + message_index:int -> + inclusion_proof:string -> + atomic_transaction_batch:string -> + (packed_operation, tztrace) result Lwt.t diff --git a/src/proto_alpha/lib_protocol/test/integration/operations/test_sc_rollup.ml b/src/proto_alpha/lib_protocol/test/integration/operations/test_sc_rollup.ml index 1b1dc6981704..9699ecdc7304 100644 --- a/src/proto_alpha/lib_protocol/test/integration/operations/test_sc_rollup.ml +++ b/src/proto_alpha/lib_protocol/test/integration/operations/test_sc_rollup.ml @@ -398,6 +398,45 @@ let test_originating_with_valid_type () = ] |> List.iter_es assert_parameters_ty +let test_atomic_batch_fails () = + let* ctxt, contracts, rollup = init_and_originate Context.T2 "unit" in + let _, contract = contracts in + let* i = Incremental.begin_construction ctxt in + let* c = dummy_commitment i rollup in + let* operation = Op.sc_rollup_publish (B ctxt) contract rollup c in + let* i = Incremental.add_operation i operation in + let* b = Incremental.finalize_block i in + let* constants = Context.get_constants (B b) in + let* b = + Block.bake_n constants.parametric.sc_rollup_challenge_window_in_blocks b + in + let* i = Incremental.begin_construction b in + let hash = Sc_rollup.Commitment.hash c in + let* cement_op = Op.sc_rollup_cement (I i) contract rollup hash in + let* _ = Incremental.add_operation i cement_op in + let* batch_op = + Op.sc_rollup_atomic_batch + (I i) + contract + rollup + hash + ~outbox_level:(Raw_level.of_int32_exn 0l) + ~message_index:0 + ~inclusion_proof:"xyz" + ~atomic_transaction_batch:"xyz" + in + let expect_failure = function + | Environment.Ecoproto_error + (Sc_rollup_operations.Sc_rollup_invalid_atomic_batch as e) + :: _ -> + Assert.test_error_encodings e ; + return_unit + | _ -> failwith "For some reason in did not fail with the right error" + in + let* _ = Incremental.add_operation ~expect_failure i batch_op in + + return_unit + let tests = [ Tztest.tztest @@ -432,4 +471,8 @@ let tests = "originating with valid type" `Quick test_originating_with_valid_type; + Tztest.tztest + "the atomic batch test will fail for now" + `Quick + test_atomic_batch_fails; ] -- GitLab From f5be492261d4698933b6e58a2ae1b4e0b28b558a Mon Sep 17 00:00:00 2001 From: Corneliu Hoffman Date: Tue, 31 May 2022 21:02:59 +0100 Subject: [PATCH 4/4] Test: fix regressions --- .../_regressions/rpc/alpha.client.mempool.out | 284 ++++++++++++++++++ tezt/_regressions/rpc/alpha.proxy.mempool.out | 284 ++++++++++++++++++ 2 files changed, 568 insertions(+) diff --git a/tezt/_regressions/rpc/alpha.client.mempool.out b/tezt/_regressions/rpc/alpha.client.mempool.out index cec142591f8c..252bdc0ec972 100644 --- a/tezt/_regressions/rpc/alpha.client.mempool.out +++ b/tezt/_regressions/rpc/alpha.client.mempool.out @@ -3462,6 +3462,70 @@ curl -s 'http://localhost:[PORT]/describe/chains/main/mempool?recurse=yes' "kind" ], "additionalProperties": false + }, + { + "title": "Sc_rollup_atomic_batch", + "type": "object", + "properties": { + "kind": { + "type": "string", + "enum": [ + "sc_rollup_atomic_batch" + ] + }, + "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" + }, + "cemented_commitment": { + "$ref": "#/definitions/commitment_hash" + }, + "outbox_level": { + "type": "integer", + "minimum": -2147483648, + "maximum": 2147483647 + }, + "message_index": { + "type": "integer", + "minimum": -1073741824, + "maximum": 1073741823 + }, + "inclusion proof": { + "$ref": "#/definitions/unistring" + }, + "atomic_transaction_batch": { + "$ref": "#/definitions/unistring" + } + }, + "required": [ + "atomic_transaction_batch", + "inclusion proof", + "message_index", + "outbox_level", + "cemented_commitment", + "rollup", + "storage_limit", + "gas_limit", + "counter", + "fee", + "source", + "kind" + ], + "additionalProperties": false } ] }, @@ -6712,6 +6776,162 @@ curl -s 'http://localhost:[PORT]/describe/chains/main/mempool?recurse=yes' } ], "name": "Sc_rollup_timeout" + }, + { + "tag": 206, + "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": "cemented_commitment", + "layout": { + "kind": "Bytes" + }, + "data_kind": { + "size": 32, + "kind": "Float" + }, + "kind": "named" + }, + { + "name": "outbox_level", + "layout": { + "size": "Int32", + "kind": "Int" + }, + "data_kind": { + "size": 4, + "kind": "Float" + }, + "kind": "named" + }, + { + "name": "message_index", + "layout": { + "min": -1073741824, + "max": 1073741823, + "kind": "RangedInt" + }, + "data_kind": { + "size": 4, + "kind": "Float" + }, + "kind": "named" + }, + { + "kind": "dyn", + "num_fields": 1, + "size": "Uint30" + }, + { + "name": "inclusion proof", + "layout": { + "kind": "String" + }, + "data_kind": { + "kind": "Variable" + }, + "kind": "named" + }, + { + "kind": "dyn", + "num_fields": 1, + "size": "Uint30" + }, + { + "name": "atomic_transaction_batch", + "layout": { + "kind": "String" + }, + "data_kind": { + "kind": "Variable" + }, + "kind": "named" + } + ], + "name": "Sc_rollup_atomic_batch" } ] } @@ -13709,6 +13929,70 @@ curl -s 'http://localhost:[PORT]/describe/chains/main/mempool?recurse=yes' "kind" ], "additionalProperties": false + }, + { + "title": "Sc_rollup_atomic_batch", + "type": "object", + "properties": { + "kind": { + "type": "string", + "enum": [ + "sc_rollup_atomic_batch" + ] + }, + "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" + }, + "cemented_commitment": { + "$ref": "#/definitions/commitment_hash" + }, + "outbox_level": { + "type": "integer", + "minimum": -2147483648, + "maximum": 2147483647 + }, + "message_index": { + "type": "integer", + "minimum": -1073741824, + "maximum": 1073741823 + }, + "inclusion proof": { + "$ref": "#/definitions/unistring" + }, + "atomic_transaction_batch": { + "$ref": "#/definitions/unistring" + } + }, + "required": [ + "atomic_transaction_batch", + "inclusion proof", + "message_index", + "outbox_level", + "cemented_commitment", + "rollup", + "storage_limit", + "gas_limit", + "counter", + "fee", + "source", + "kind" + ], + "additionalProperties": false } ] }, diff --git a/tezt/_regressions/rpc/alpha.proxy.mempool.out b/tezt/_regressions/rpc/alpha.proxy.mempool.out index 97e4634b8fb5..c0f381b6079f 100644 --- a/tezt/_regressions/rpc/alpha.proxy.mempool.out +++ b/tezt/_regressions/rpc/alpha.proxy.mempool.out @@ -3483,6 +3483,70 @@ curl -s 'http://localhost:[PORT]/describe/chains/main/mempool?recurse=yes' "kind" ], "additionalProperties": false + }, + { + "title": "Sc_rollup_atomic_batch", + "type": "object", + "properties": { + "kind": { + "type": "string", + "enum": [ + "sc_rollup_atomic_batch" + ] + }, + "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" + }, + "cemented_commitment": { + "$ref": "#/definitions/commitment_hash" + }, + "outbox_level": { + "type": "integer", + "minimum": -2147483648, + "maximum": 2147483647 + }, + "message_index": { + "type": "integer", + "minimum": -1073741824, + "maximum": 1073741823 + }, + "inclusion proof": { + "$ref": "#/definitions/unistring" + }, + "atomic_transaction_batch": { + "$ref": "#/definitions/unistring" + } + }, + "required": [ + "atomic_transaction_batch", + "inclusion proof", + "message_index", + "outbox_level", + "cemented_commitment", + "rollup", + "storage_limit", + "gas_limit", + "counter", + "fee", + "source", + "kind" + ], + "additionalProperties": false } ] }, @@ -6733,6 +6797,162 @@ curl -s 'http://localhost:[PORT]/describe/chains/main/mempool?recurse=yes' } ], "name": "Sc_rollup_timeout" + }, + { + "tag": 206, + "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": "cemented_commitment", + "layout": { + "kind": "Bytes" + }, + "data_kind": { + "size": 32, + "kind": "Float" + }, + "kind": "named" + }, + { + "name": "outbox_level", + "layout": { + "size": "Int32", + "kind": "Int" + }, + "data_kind": { + "size": 4, + "kind": "Float" + }, + "kind": "named" + }, + { + "name": "message_index", + "layout": { + "min": -1073741824, + "max": 1073741823, + "kind": "RangedInt" + }, + "data_kind": { + "size": 4, + "kind": "Float" + }, + "kind": "named" + }, + { + "kind": "dyn", + "num_fields": 1, + "size": "Uint30" + }, + { + "name": "inclusion proof", + "layout": { + "kind": "String" + }, + "data_kind": { + "kind": "Variable" + }, + "kind": "named" + }, + { + "kind": "dyn", + "num_fields": 1, + "size": "Uint30" + }, + { + "name": "atomic_transaction_batch", + "layout": { + "kind": "String" + }, + "data_kind": { + "kind": "Variable" + }, + "kind": "named" + } + ], + "name": "Sc_rollup_atomic_batch" } ] } @@ -13730,6 +13950,70 @@ curl -s 'http://localhost:[PORT]/describe/chains/main/mempool?recurse=yes' "kind" ], "additionalProperties": false + }, + { + "title": "Sc_rollup_atomic_batch", + "type": "object", + "properties": { + "kind": { + "type": "string", + "enum": [ + "sc_rollup_atomic_batch" + ] + }, + "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" + }, + "cemented_commitment": { + "$ref": "#/definitions/commitment_hash" + }, + "outbox_level": { + "type": "integer", + "minimum": -2147483648, + "maximum": 2147483647 + }, + "message_index": { + "type": "integer", + "minimum": -1073741824, + "maximum": 1073741823 + }, + "inclusion proof": { + "$ref": "#/definitions/unistring" + }, + "atomic_transaction_batch": { + "$ref": "#/definitions/unistring" + } + }, + "required": [ + "atomic_transaction_batch", + "inclusion proof", + "message_index", + "outbox_level", + "cemented_commitment", + "rollup", + "storage_limit", + "gas_limit", + "counter", + "fee", + "source", + "kind" + ], + "additionalProperties": false } ] }, -- GitLab