diff --git a/src/proto_alpha/lib_client/mockup.ml b/src/proto_alpha/lib_client/mockup.ml index 1954e48e552591f8b8bb8d7248d2f5eb0e45cd54..4a4eb116be244217402e3e65d11422719dde2a8b 100644 --- a/src/proto_alpha/lib_client/mockup.ml +++ b/src/proto_alpha/lib_client/mockup.ml @@ -76,6 +76,7 @@ module Protocol_constants_overrides = struct tx_rollup_origination_size : int option; tx_rollup_hard_size_limit_per_inbox : int option; tx_rollup_hard_size_limit_per_message : int option; + tx_rollup_min_batch_size : int option; tx_rollup_max_withdrawals_per_batch : int option; tx_rollup_commitment_bond : Tez.t option; tx_rollup_finality_period : int option; @@ -141,13 +142,14 @@ module Protocol_constants_overrides = struct c.tx_rollup_origination_size, c.tx_rollup_hard_size_limit_per_inbox, c.tx_rollup_hard_size_limit_per_message, + c.tx_rollup_min_batch_size, c.tx_rollup_max_withdrawals_per_batch, c.tx_rollup_commitment_bond, - c.tx_rollup_finality_period, - c.tx_rollup_max_unfinalized_levels, + c.tx_rollup_finality_period ), + ( c.tx_rollup_max_unfinalized_levels, c.tx_rollup_withdraw_period, - c.tx_rollup_max_messages_per_inbox ), - ( c.tx_rollup_max_finalized_levels, + c.tx_rollup_max_messages_per_inbox, + c.tx_rollup_max_finalized_levels, c.tx_rollup_cost_per_byte_ema_factor, c.tx_rollup_max_ticket_payload_size ) ), ( c.sc_rollup_enable, @@ -195,13 +197,14 @@ module Protocol_constants_overrides = struct tx_rollup_origination_size, tx_rollup_hard_size_limit_per_inbox, tx_rollup_hard_size_limit_per_message, + tx_rollup_min_batch_size, tx_rollup_max_withdrawals_per_batch, tx_rollup_commitment_bond, - tx_rollup_finality_period, - tx_rollup_max_unfinalized_levels, + tx_rollup_finality_period ), + ( tx_rollup_max_unfinalized_levels, tx_rollup_withdraw_period, - tx_rollup_max_messages_per_inbox ), - ( tx_rollup_max_finalized_levels, + tx_rollup_max_messages_per_inbox, + tx_rollup_max_finalized_levels, tx_rollup_cost_per_byte_ema_factor, tx_rollup_max_ticket_payload_size ) ), ( sc_rollup_enable, @@ -247,6 +250,7 @@ module Protocol_constants_overrides = struct tx_rollup_origination_size; tx_rollup_hard_size_limit_per_inbox; tx_rollup_hard_size_limit_per_message; + tx_rollup_min_batch_size; tx_rollup_max_withdrawals_per_batch; tx_rollup_commitment_bond; tx_rollup_finality_period; @@ -317,20 +321,21 @@ module Protocol_constants_overrides = struct (opt "cache_sampler_state_cycles" int8)) (merge_objs (merge_objs - (obj10 + (obj8 (opt "tx_rollup_enable" Data_encoding.bool) (opt "tx_rollup_origination_size" int31) (opt "tx_rollup_hard_size_limit_per_inbox" int31) (opt "tx_rollup_hard_size_limit_per_message" int31) + (opt "tx_rollup_min_batch_size" int31) (opt "tx_rollup_max_withdrawals_per_batch" int31) (opt "tx_rollup_commitment_bond" Tez.encoding) - (opt "tx_rollup_finality_period" int31) + (opt "tx_rollup_finality_period" int31)) + (obj6 (opt "tx_rollup_max_unfinalized_levels" int31) (opt "tx_rollup_withdraw_period" int31) - (opt "tx_rollup_max_messages_per_inbox" int31)) - (obj3 + (opt "tx_rollup_max_messages_per_inbox" int31) (opt "tx_rollup_max_finalized_levels" int31) (opt "tx_rollup_cost_per_byte_ema_factor" int31) (opt "tx_rollup_max_ticket_payload_size" int31))) @@ -406,6 +411,7 @@ module Protocol_constants_overrides = struct Some parametric.tx_rollup_hard_size_limit_per_inbox; tx_rollup_hard_size_limit_per_message = Some parametric.tx_rollup_hard_size_limit_per_message; + tx_rollup_min_batch_size = Some parametric.tx_rollup_min_batch_size; tx_rollup_max_withdrawals_per_batch = Some parametric.tx_rollup_max_withdrawals_per_batch; tx_rollup_commitment_bond = Some parametric.tx_rollup_commitment_bond; @@ -474,6 +480,7 @@ module Protocol_constants_overrides = struct tx_rollup_origination_size = None; tx_rollup_hard_size_limit_per_inbox = None; tx_rollup_hard_size_limit_per_message = None; + tx_rollup_min_batch_size = None; tx_rollup_max_withdrawals_per_batch = None; tx_rollup_commitment_bond = None; tx_rollup_finality_period = None; @@ -748,6 +755,12 @@ module Protocol_constants_overrides = struct override_value = o.tx_rollup_hard_size_limit_per_message; pp = pp_print_int; }; + O + { + name = "tx_rollup_min_batch_size"; + override_value = o.tx_rollup_min_batch_size; + pp = pp_print_int; + }; O { name = "tx_rollup_commitment_bond"; @@ -904,6 +917,10 @@ module Protocol_constants_overrides = struct Option.value ~default:c.tx_rollup_hard_size_limit_per_message o.tx_rollup_hard_size_limit_per_message; + tx_rollup_min_batch_size = + Option.value + ~default:c.tx_rollup_min_batch_size + o.tx_rollup_min_batch_size; tx_rollup_max_withdrawals_per_batch = Option.value ~default:c.tx_rollup_max_withdrawals_per_batch diff --git a/src/proto_alpha/lib_parameters/default_parameters.ml b/src/proto_alpha/lib_parameters/default_parameters.ml index 875646612a45ea659076b7e2a67e69fe0efabf64..459e01be4b841efc2f114037a70aad1c8010bf97 100644 --- a/src/proto_alpha/lib_parameters/default_parameters.ml +++ b/src/proto_alpha/lib_parameters/default_parameters.ml @@ -108,6 +108,9 @@ let constants_mainnet = (* Transaction rollup’s size limits are expressed in number of bytes *) tx_rollup_hard_size_limit_per_inbox = 100_000; tx_rollup_hard_size_limit_per_message = 5_000; + (* The smallest possible tx rollup batch: one transaction, signed *) + tx_rollup_min_batch_size = + 8 + Bls12_381.Signature.MinSig.signature_size_in_bytes; (* We limit the number of withdraws per message to avoid costly allocations/iterations in the accounting mechanism used for each withdraw claiming in L1 and cleaned when removing a commitment. *) diff --git a/src/proto_alpha/lib_protocol/alpha_context.mli b/src/proto_alpha/lib_protocol/alpha_context.mli index 65c1ca14bab9456f5f5a7dc133abaa48a17267d7..2a09a02905b87bd099d80b9738f28272311f7cd9 100644 --- a/src/proto_alpha/lib_protocol/alpha_context.mli +++ b/src/proto_alpha/lib_protocol/alpha_context.mli @@ -795,6 +795,7 @@ module Constants : sig tx_rollup_origination_size : int; tx_rollup_hard_size_limit_per_inbox : int; tx_rollup_hard_size_limit_per_message : int; + tx_rollup_min_batch_size : int; tx_rollup_max_withdrawals_per_batch : int; tx_rollup_commitment_bond : Tez.t; tx_rollup_finality_period : int; @@ -896,6 +897,8 @@ module Constants : sig val tx_rollup_hard_size_limit_per_message : context -> int + val tx_rollup_min_batch_size : context -> int + val tx_rollup_max_withdrawals_per_batch : context -> int val tx_rollup_commitment_bond : context -> Tez.t @@ -1883,7 +1886,7 @@ module Tx_rollup_errors : sig | Inbox_does_not_exist of Tx_rollup.t * Tx_rollup_level.t | Inbox_size_would_exceed_limit of Tx_rollup.t | Inbox_count_would_exceed_limit of Tx_rollup.t - | Message_size_exceeds_limit + | Message_size_exceeds_limit of {min : int; max : int; given : int} | Too_many_inboxes | Too_many_finalized_commitments | Wrong_batch_count diff --git a/src/proto_alpha/lib_protocol/apply.ml b/src/proto_alpha/lib_protocol/apply.ml index d03767acb89d81d83a09bee047d04d864a885a86..c1032c2f07aacdda5b3a9ffa408bbcb95112f002 100644 --- a/src/proto_alpha/lib_protocol/apply.ml +++ b/src/proto_alpha/lib_protocol/apply.ml @@ -1983,15 +1983,17 @@ let precheck_manager_contents (type kind) ctxt (op : kind Kind.manager contents) assert_tx_rollup_feature_enabled ctxt >|=? fun () -> ctxt | Tx_rollup_submit_batch {content; _} -> assert_tx_rollup_feature_enabled ctxt >>=? fun () -> - let size_limit = + let size_min = Alpha_context.Constants.tx_rollup_min_batch_size ctxt in + let size_max = Alpha_context.Constants.tx_rollup_hard_size_limit_per_message ctxt in let (_message, message_size) = Tx_rollup_message.make_batch content in Tx_rollup_gas.message_hash_cost message_size >>?= fun cost -> Alpha_context.Gas.consume ctxt cost >>?= fun ctxt -> fail_unless - Compare.Int.(message_size <= size_limit) - Tx_rollup_errors.Message_size_exceeds_limit + Compare.Int.(size_min <= message_size && message_size <= size_max) + (Tx_rollup_errors.Message_size_exceeds_limit + {min = size_min; max = size_max; given = message_size}) >>=? fun () -> return ctxt | Tx_rollup_commit {commitment; tx_rollup} -> assert_tx_rollup_feature_enabled ctxt >>=? fun () -> diff --git a/src/proto_alpha/lib_protocol/constants_repr.ml b/src/proto_alpha/lib_protocol/constants_repr.ml index c00b6e21c20ffad2737e2e81111902e02d5580ef..c7a2db042592c83a43314450dab8ccdd2e53effc 100644 --- a/src/proto_alpha/lib_protocol/constants_repr.ml +++ b/src/proto_alpha/lib_protocol/constants_repr.ml @@ -163,6 +163,7 @@ type parametric = { tx_rollup_origination_size : int; tx_rollup_hard_size_limit_per_inbox : int; tx_rollup_hard_size_limit_per_message : int; + tx_rollup_min_batch_size : int; tx_rollup_max_withdrawals_per_batch : int; tx_rollup_commitment_bond : Tez_repr.t; tx_rollup_finality_period : int; @@ -221,13 +222,14 @@ let parametric_encoding = c.tx_rollup_origination_size, c.tx_rollup_hard_size_limit_per_inbox, c.tx_rollup_hard_size_limit_per_message, + c.tx_rollup_min_batch_size, c.tx_rollup_max_withdrawals_per_batch, c.tx_rollup_commitment_bond, - c.tx_rollup_finality_period, - c.tx_rollup_withdraw_period, + c.tx_rollup_finality_period ), + ( c.tx_rollup_withdraw_period, c.tx_rollup_max_unfinalized_levels, - c.tx_rollup_max_messages_per_inbox ), - ( c.tx_rollup_max_finalized_levels, + c.tx_rollup_max_messages_per_inbox, + c.tx_rollup_max_finalized_levels, c.tx_rollup_cost_per_byte_ema_factor, c.tx_rollup_max_ticket_payload_size ) ), ( c.sc_rollup_enable, @@ -273,13 +275,14 @@ let parametric_encoding = tx_rollup_origination_size, tx_rollup_hard_size_limit_per_inbox, tx_rollup_hard_size_limit_per_message, + tx_rollup_min_batch_size, tx_rollup_max_withdrawals_per_batch, tx_rollup_commitment_bond, - tx_rollup_finality_period, - tx_rollup_withdraw_period, + tx_rollup_finality_period ), + ( tx_rollup_withdraw_period, tx_rollup_max_unfinalized_levels, - tx_rollup_max_messages_per_inbox ), - ( tx_rollup_max_finalized_levels, + tx_rollup_max_messages_per_inbox, + tx_rollup_max_finalized_levels, tx_rollup_cost_per_byte_ema_factor, tx_rollup_max_ticket_payload_size ) ), ( sc_rollup_enable, @@ -326,6 +329,7 @@ let parametric_encoding = tx_rollup_origination_size; tx_rollup_hard_size_limit_per_inbox; tx_rollup_hard_size_limit_per_message; + tx_rollup_min_batch_size; tx_rollup_max_withdrawals_per_batch; tx_rollup_commitment_bond; tx_rollup_finality_period; @@ -393,18 +397,19 @@ let parametric_encoding = (req "cache_sampler_state_cycles" int8)) (merge_objs (merge_objs - (obj10 + (obj8 (req "tx_rollup_enable" bool) (req "tx_rollup_origination_size" int31) (req "tx_rollup_hard_size_limit_per_inbox" int31) (req "tx_rollup_hard_size_limit_per_message" int31) + (req "tx_rollup_min_batch_size" int31) (req "tx_rollup_max_withdrawals_per_batch" int31) (req "tx_rollup_commitment_bond" Tez_repr.encoding) - (req "tx_rollup_finality_period" int31) + (req "tx_rollup_finality_period" int31)) + (obj6 (req "tx_rollup_withdraw_period" int31) (req "tx_rollup_max_unfinalized_levels" int31) - (req "tx_rollup_max_messages_per_inbox" int31)) - (obj3 + (req "tx_rollup_max_messages_per_inbox" int31) (req "tx_rollup_max_finalized_levels" int31) (req "tx_rollup_cost_per_byte_ema_factor" int31) (req "tx_rollup_max_ticket_payload_size" int31))) diff --git a/src/proto_alpha/lib_protocol/constants_repr.mli b/src/proto_alpha/lib_protocol/constants_repr.mli index 88341a113902408ed98752fe47f73890de5475f1..99fa7452c27f5bdd015f906c006d2420ad40a1af 100644 --- a/src/proto_alpha/lib_protocol/constants_repr.mli +++ b/src/proto_alpha/lib_protocol/constants_repr.mli @@ -128,6 +128,8 @@ type parametric = { tx_rollup_hard_size_limit_per_inbox : int; (* the maximum amount of bytes one batch can allocate in an inbox *) tx_rollup_hard_size_limit_per_message : int; + (* The minimum amount of bytes for a batch in an inbox *) + tx_rollup_min_batch_size : int; (* the maximum number of allowed "L2-to-L1" withdraws per batch *) tx_rollup_max_withdrawals_per_batch : int; (* the amount of tez to bond a tx rollup commitment *) diff --git a/src/proto_alpha/lib_protocol/constants_storage.ml b/src/proto_alpha/lib_protocol/constants_storage.ml index b431575429dd0ad7b61bfbb5d07a74776574ed8e..3dcd99d3ec3aa22770b453b1ed597b6f354e056f 100644 --- a/src/proto_alpha/lib_protocol/constants_storage.ml +++ b/src/proto_alpha/lib_protocol/constants_storage.ml @@ -162,6 +162,10 @@ let tx_rollup_hard_size_limit_per_message c = let constants = Raw_context.constants c in constants.tx_rollup_hard_size_limit_per_message +let tx_rollup_min_batch_size c = + let constants = Raw_context.constants c in + constants.tx_rollup_min_batch_size + let tx_rollup_max_withdrawals_per_batch c = let constants = Raw_context.constants c in constants.tx_rollup_max_withdrawals_per_batch diff --git a/src/proto_alpha/lib_protocol/constants_storage.mli b/src/proto_alpha/lib_protocol/constants_storage.mli index 0ac4f5b3e20e166458efe537c26e2c281b0b7427..b0f2b61159511c72d5b21b695399b3820cbab396 100644 --- a/src/proto_alpha/lib_protocol/constants_storage.mli +++ b/src/proto_alpha/lib_protocol/constants_storage.mli @@ -92,6 +92,8 @@ val tx_rollup_hard_size_limit_per_inbox : Raw_context.t -> int val tx_rollup_hard_size_limit_per_message : Raw_context.t -> int +val tx_rollup_min_batch_size : Raw_context.t -> int + val tx_rollup_max_withdrawals_per_batch : Raw_context.t -> int val tx_rollup_commitment_bond : Raw_context.t -> Tez_repr.t diff --git a/src/proto_alpha/lib_protocol/raw_context.ml b/src/proto_alpha/lib_protocol/raw_context.ml index fc27377f97c57dab661ef6da7c8813fff556b809..ea81d26251af6ce6ca047d41585306ee148e4f63 100644 --- a/src/proto_alpha/lib_protocol/raw_context.ml +++ b/src/proto_alpha/lib_protocol/raw_context.ml @@ -907,6 +907,9 @@ let prepare_first_block ~level ~timestamp ctxt = tx_rollup_origination_size = 60_000; tx_rollup_hard_size_limit_per_inbox = 100_000; tx_rollup_hard_size_limit_per_message = 5_000; + (* The smallest possible tx rollup batch: one transaction, + signed *) + tx_rollup_min_batch_size = 56; tx_rollup_max_withdrawals_per_batch = 255; tx_rollup_commitment_bond = Tez_repr.of_mutez_exn 10_000_000_000L; tx_rollup_finality_period = 2_000; diff --git a/src/proto_alpha/lib_protocol/test/integration/operations/test_tx_rollup.ml b/src/proto_alpha/lib_protocol/test/integration/operations/test_tx_rollup.ml index 6d81f87524cba9faa37ed7d6ba175fe023140fc4..6e33e27b75ec902411c3f09241f5ed6867fc0263 100644 --- a/src/proto_alpha/lib_protocol/test/integration/operations/test_tx_rollup.ml +++ b/src/proto_alpha/lib_protocol/test/integration/operations/test_tx_rollup.ml @@ -159,6 +159,7 @@ let context_init ?(tx_rollup_max_unfinalized_levels = 2100) tx_rollup_finality_period = 1; tx_rollup_withdraw_period = 1; tx_rollup_max_finalized_levels = 2; + tx_rollup_min_batch_size = 5; tx_rollup_max_unfinalized_levels; endorsing_reward_per_slot = Tez.zero; baking_reward_bonus_per_slot = Tez.zero; @@ -638,7 +639,35 @@ let test_batch_too_big () = Incremental.add_operation i ~expect_apply_failure: - (check_proto_error Tx_rollup_errors.Message_size_exceeds_limit) + (check_proto_error + (Tx_rollup_errors.Message_size_exceeds_limit + { + min = 5; + max = constant.parametric.tx_rollup_hard_size_limit_per_message; + given = + constant.parametric.tx_rollup_hard_size_limit_per_message + 1; + })) + op + >>=? fun _ -> return_unit + +(** Try to add a too-small batch in an inbox. *) +let test_batch_too_small () = + context_init1 () >>=? fun (b, contract) -> + originate b contract >>=? fun (b, tx_rollup) -> + Context.get_constants (B b) >>=? fun constant -> + let contents = "tiny" in + Incremental.begin_construction b >>=? fun i -> + Op.tx_rollup_submit_batch (I i) contract tx_rollup contents >>=? fun op -> + Incremental.add_operation + i + ~expect_apply_failure: + (check_proto_error + (Tx_rollup_errors.Message_size_exceeds_limit + { + min = 5; + max = constant.parametric.tx_rollup_hard_size_limit_per_message; + given = 4; + })) op >>=? fun _ -> return_unit @@ -1400,6 +1429,7 @@ let test_full_inbox () = baking_reward_fixed_portion = Tez.zero; tx_rollup_enable = true; tx_rollup_max_unfinalized_levels = 15; + tx_rollup_min_batch_size = 5; } in Context.init_with_constants constants 1 >>=? fun (b, contracts) -> diff --git a/src/proto_alpha/lib_protocol/test/unit/test_tx_rollup_l2.ml b/src/proto_alpha/lib_protocol/test/unit/test_tx_rollup_l2.ml index b5d9787447e10781d1a331a5db49ccee2beed296..c97a5c93724f457be26565661d23064b4affc058 100644 --- a/src/proto_alpha/lib_protocol/test/unit/test_tx_rollup_l2.ml +++ b/src/proto_alpha/lib_protocol/test/unit/test_tx_rollup_l2.ml @@ -553,7 +553,7 @@ module Test_batch_encodings = struct qty let test_l2_transaction_size () = - (* Assert the smallest operation_content size is 5 *) + (* Assert the smallest operation_content size is 4 *) let opc = Transfer { diff --git a/src/proto_alpha/lib_protocol/tx_rollup_errors_repr.ml b/src/proto_alpha/lib_protocol/tx_rollup_errors_repr.ml index d5b50ab9ea0e1586fb11b7d8f12fc1e717812602..228c77d4dae86aa80b7cab1e8a90a84128cbaf3b 100644 --- a/src/proto_alpha/lib_protocol/tx_rollup_errors_repr.ml +++ b/src/proto_alpha/lib_protocol/tx_rollup_errors_repr.ml @@ -33,7 +33,7 @@ type error += | Inbox_size_would_exceed_limit of Tx_rollup_repr.t | Inbox_count_would_exceed_limit of Tx_rollup_repr.t | No_uncommitted_inbox - | Message_size_exceeds_limit + | Message_size_exceeds_limit of {min : int; max : int; given : int} | Too_many_inboxes | Too_many_finalized_commitments | Wrong_batch_count @@ -159,7 +159,7 @@ let () = (function | Inbox_count_would_exceed_limit rollup -> Some rollup | _ -> None) (fun rollup -> Inbox_count_would_exceed_limit rollup) ; - (* Tx_rollup_message_size_exceed_limit *) + (* No_uncommitted_inbox *) register_error_kind `Temporary ~id:"tx_rollup_no_uncommitted_inbox" @@ -184,9 +184,11 @@ let () = ~title:"A message submitted to a transaction rollup inbox exceeds limit" ~description: "A message submitted to a transaction rollup inbox exceeds limit" - empty - (function Message_size_exceeds_limit -> Some () | _ -> None) - (fun () -> Message_size_exceeds_limit) ; + (obj3 (req "min" int31) (req "max" int31) (req "given" int31)) + (function + | Message_size_exceeds_limit {min; max; given} -> Some (min, max, given) + | _ -> None) + (fun (min, max, given) -> Message_size_exceeds_limit {min; max; given}) ; (* Tx_rollup_too_many_inboxes *) register_error_kind `Temporary diff --git a/tests_python/tests_alpha/test_mockup.py b/tests_python/tests_alpha/test_mockup.py index 8797d055309d926d7e975720411c8560743c5409..b1d723d48e044527af7d54b6af95a48b55a85ed6 100644 --- a/tests_python/tests_alpha/test_mockup.py +++ b/tests_python/tests_alpha/test_mockup.py @@ -659,6 +659,7 @@ def _test_create_mockup_init_show_roundtrip( "tx_rollup_origination_size": 30_000, "tx_rollup_hard_size_limit_per_inbox": 100_000, "tx_rollup_hard_size_limit_per_message": 5_000, + "tx_rollup_min_batch_size": 56, "tx_rollup_commitment_bond": "10000000000", "tx_rollup_finality_period": 2000, "tx_rollup_withdraw_period": 123456, diff --git a/tezt/_regressions/rpc/alpha.client.others.out b/tezt/_regressions/rpc/alpha.client.others.out index 79289afef72b68567c23c2777e8b1c50791b416f..9496aae9cd4ae0b17332e09143d04d67e5b6a51e 100644 --- a/tezt/_regressions/rpc/alpha.client.others.out +++ b/tezt/_regressions/rpc/alpha.client.others.out @@ -32,7 +32,7 @@ tezt/_regressions/rpc/alpha.client.others.out "tx_rollup_enable": false, "tx_rollup_origination_size": 60000, "tx_rollup_hard_size_limit_per_inbox": 100000, "tx_rollup_hard_size_limit_per_message": 5000, - "tx_rollup_max_withdrawals_per_batch": 255, + "tx_rollup_min_batch_size": 56, "tx_rollup_max_withdrawals_per_batch": 255, "tx_rollup_commitment_bond": "10000000000", "tx_rollup_finality_period": 2000, "tx_rollup_withdraw_period": 60000, "tx_rollup_max_unfinalized_levels": 2100, diff --git a/tezt/_regressions/rpc/alpha.light.others.out b/tezt/_regressions/rpc/alpha.light.others.out index 58f933c90d94b29d6df60f38eeffcacf80b70516..cd594c7ab580e8ad9f5120605dafcb99f5827e3e 100644 --- a/tezt/_regressions/rpc/alpha.light.others.out +++ b/tezt/_regressions/rpc/alpha.light.others.out @@ -32,7 +32,7 @@ tezt/_regressions/rpc/alpha.light.others.out "tx_rollup_enable": false, "tx_rollup_origination_size": 60000, "tx_rollup_hard_size_limit_per_inbox": 100000, "tx_rollup_hard_size_limit_per_message": 5000, - "tx_rollup_max_withdrawals_per_batch": 255, + "tx_rollup_min_batch_size": 56, "tx_rollup_max_withdrawals_per_batch": 255, "tx_rollup_commitment_bond": "10000000000", "tx_rollup_finality_period": 2000, "tx_rollup_withdraw_period": 60000, "tx_rollup_max_unfinalized_levels": 2100, diff --git a/tezt/_regressions/rpc/alpha.proxy.others.out b/tezt/_regressions/rpc/alpha.proxy.others.out index d581518fc2aba697e5d18684f9fe9a7569af80f1..e4c91621e05b119a45d5095c75601594d2e03aea 100644 --- a/tezt/_regressions/rpc/alpha.proxy.others.out +++ b/tezt/_regressions/rpc/alpha.proxy.others.out @@ -32,7 +32,7 @@ tezt/_regressions/rpc/alpha.proxy.others.out "tx_rollup_enable": false, "tx_rollup_origination_size": 60000, "tx_rollup_hard_size_limit_per_inbox": 100000, "tx_rollup_hard_size_limit_per_message": 5000, - "tx_rollup_max_withdrawals_per_batch": 255, + "tx_rollup_min_batch_size": 56, "tx_rollup_max_withdrawals_per_batch": 255, "tx_rollup_commitment_bond": "10000000000", "tx_rollup_finality_period": 2000, "tx_rollup_withdraw_period": 60000, "tx_rollup_max_unfinalized_levels": 2100, diff --git a/tezt/_regressions/rpc/alpha.proxy_server.others.out b/tezt/_regressions/rpc/alpha.proxy_server.others.out index 3434898536f612d17e4ceb491cb0c1f04e3352e7..ca1fe417e69a47d6bf8a683d73968689fcb3ad69 100644 --- a/tezt/_regressions/rpc/alpha.proxy_server.others.out +++ b/tezt/_regressions/rpc/alpha.proxy_server.others.out @@ -32,7 +32,7 @@ tezt/_regressions/rpc/alpha.proxy_server.others.out "tx_rollup_enable": false, "tx_rollup_origination_size": 60000, "tx_rollup_hard_size_limit_per_inbox": 100000, "tx_rollup_hard_size_limit_per_message": 5000, - "tx_rollup_max_withdrawals_per_batch": 255, + "tx_rollup_min_batch_size": 56, "tx_rollup_max_withdrawals_per_batch": 255, "tx_rollup_commitment_bond": "10000000000", "tx_rollup_finality_period": 2000, "tx_rollup_withdraw_period": 60000, "tx_rollup_max_unfinalized_levels": 2100, diff --git a/tezt/_regressions/tx_rollup_limit_empty_batch.out b/tezt/_regressions/tx_rollup_limit_empty_batch.out index 72eb78e78571b860f16169c6282c7a98d8c422ee..3f7477f4f95507c7faff331032559c290ab6a71b 100644 --- a/tezt/_regressions/tx_rollup_limit_empty_batch.out +++ b/tezt/_regressions/tx_rollup_limit_empty_batch.out @@ -31,27 +31,8 @@ This sequence of operations was run: ./tezos-client --wait none submit tx rollup batch to '[TX_ROLLUP_HASH]' from '[PUBLIC_KEY_HASH]' Node is bootstrapped. -Estimated gas: 2021.288 units (will add 100 for safety) -Estimated storage: no bytes added -Operation successfully injected in the node. -Operation hash is '[OPERATION_HASH]' -NOT waiting for the operation to be included. -Use command - tezos-client wait for [OPERATION_HASH] to be included --confirmations 1 --branch [BLOCK_HASH] -and/or an external block explorer to make sure that it has been included. -This sequence of operations was run: - Manager signed operations: - From: [PUBLIC_KEY_HASH] - Fee to the baker: ꜩ0.000462 - Expected counter: 2 - Gas limit: 2122 - Storage limit: 0 bytes - Balance updates: - [PUBLIC_KEY_HASH] ... -ꜩ0.000462 - payload fees(the block proposer) ....... +ꜩ0.000462 - Tx rollup transaction:[TX_ROLLUP_HASH], 0 bytes, From: [PUBLIC_KEY_HASH] - This tx rollup submit operation was successfully applied - Balance updates: - - Consumed gas: 2021.288 - +Error: + { "id": "proto.alpha.tx_rollup_message_size_exceeds_limit", + "description": + "A message submitted to a transaction rollup inbox exceeds limit", + "data": { "min": 4, "max": 5000, "given": 0 } } diff --git a/tezt/_regressions/tx_rollup_limit_maximum_size_batch.out b/tezt/_regressions/tx_rollup_limit_maximum_size_batch.out index 850cc88cb8f7e2e4b297fc576b612019b1a2f24b..c53a5985a9910d9f9b1380286d0d2984949cd28a 100644 --- a/tezt/_regressions/tx_rollup_limit_maximum_size_batch.out +++ b/tezt/_regressions/tx_rollup_limit_maximum_size_batch.out @@ -62,4 +62,4 @@ Error: { "id": "proto.alpha.tx_rollup_message_size_exceeds_limit", "description": "A message submitted to a transaction rollup inbox exceeds limit", - "data": {} } + "data": { "min": 4, "max": 5000, "given": 5001 } } diff --git a/tezt/lib_tezos/rollup.ml b/tezt/lib_tezos/rollup.ml index d9f253accb400c61c046d77eee10dc69293e6021..e5c0e1ba968d2c69264d653cad5d2e8654eaf613 100644 --- a/tezt/lib_tezos/rollup.ml +++ b/tezt/lib_tezos/rollup.ml @@ -186,6 +186,7 @@ module Tx_rollup = struct ( ["tx_rollup_withdraw_period"], Some (string_of_int parameters.withdraw_period) ); ] + @ [(["tx_rollup_min_batch_size"], Some "4")] in Protocol.write_parameter_file ~base:(Either.right (protocol, None)) args end diff --git a/tezt/tests/tx_rollup.ml b/tezt/tests/tx_rollup.ml index 192a1cdea55b361cffadb8331a2c7308fbd0934d..c6ac21c60de3dca8c1f1ab1f0a3cb5d1ab3c332c 100644 --- a/tezt/tests/tx_rollup.ml +++ b/tezt/tests/tx_rollup.ml @@ -340,8 +340,19 @@ module Regressions = struct @@ fun protocol -> let* state = init_with_tx_rollup ~protocol () in let batch = "" in - let* () = submit_batch ~batch state in - unit + let*? process = + Client.Tx_rollup.submit_batch + ~hooks + ~content:batch + ~rollup:state.rollup + ~src:Constant.bootstrap1.public_key_hash + state.client + in + Process.check_error + ~msg: + (rex + "A message submitted to a transaction rollup inbox exceeds limit") + process let submit_maximum_size_batch = Protocol.register_regression_test diff --git a/tezt/tests/tx_rollup_node.ml b/tezt/tests/tx_rollup_node.ml index d837aaf5572e974d8dd761a40d13f1d705039034..b5d5cd3f33b7519b4eafb8bb33fb3e92c28e13c8 100644 --- a/tezt/tests/tx_rollup_node.ml +++ b/tezt/tests/tx_rollup_node.ml @@ -67,9 +67,14 @@ let get_node_inbox ?(block = "head") node client = Rollup.compute_inbox_from_messages messages client let get_rollup_parameter_file ~protocol = - let enable_tx_rollup = [(["tx_rollup_enable"], Some "true")] in + let parameters = + [ + (["tx_rollup_enable"], Some "true"); + (["tx_rollup_min_batch_size"], Some "5"); + ] + in let base = Either.right (protocol, None) in - Protocol.write_parameter_file ~base enable_tx_rollup + Protocol.write_parameter_file ~base parameters (* Checks that the configuration is stored and that the required fields are present. *)