From aa09046e89689fdc2f30afeec6c9a334963db396 Mon Sep 17 00:00:00 2001 From: David Turner Date: Mon, 21 Mar 2022 10:45:19 -0400 Subject: [PATCH] Proto,tx_rollup: min batch size --- src/proto_alpha/lib_client/mockup.ml | 41 +++++++++++++------ .../lib_parameters/default_parameters.ml | 3 ++ .../lib_protocol/alpha_context.mli | 5 ++- src/proto_alpha/lib_protocol/apply.ml | 8 ++-- .../lib_protocol/constants_repr.ml | 29 +++++++------ .../lib_protocol/constants_repr.mli | 2 + .../lib_protocol/constants_storage.ml | 4 ++ .../lib_protocol/constants_storage.mli | 2 + src/proto_alpha/lib_protocol/raw_context.ml | 3 ++ .../integration/operations/test_tx_rollup.ml | 32 ++++++++++++++- .../test/unit/test_tx_rollup_l2.ml | 2 +- .../lib_protocol/tx_rollup_errors_repr.ml | 12 +++--- tests_python/tests_alpha/test_mockup.py | 1 + tezt/_regressions/rpc/alpha.client.others.out | 2 +- tezt/_regressions/rpc/alpha.light.others.out | 2 +- tezt/_regressions/rpc/alpha.proxy.others.out | 2 +- .../rpc/alpha.proxy_server.others.out | 2 +- .../tx_rollup_limit_empty_batch.out | 29 +++---------- .../tx_rollup_limit_maximum_size_batch.out | 2 +- tezt/lib_tezos/rollup.ml | 1 + tezt/tests/tx_rollup.ml | 15 ++++++- tezt/tests/tx_rollup_node.ml | 9 +++- 22 files changed, 140 insertions(+), 68 deletions(-) diff --git a/src/proto_alpha/lib_client/mockup.ml b/src/proto_alpha/lib_client/mockup.ml index 1954e48e5525..4a4eb116be24 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 875646612a45..459e01be4b84 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 65c1ca14bab9..2a09a02905b8 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 d03767acb89d..c1032c2f07aa 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 c00b6e21c20f..c7a2db042592 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 88341a113902..99fa7452c27f 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 b431575429dd..3dcd99d3ec3a 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 0ac4f5b3e20e..b0f2b6115951 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 fc27377f97c5..ea81d26251af 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 6d81f87524cb..6e33e27b75ec 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 b5d9787447e1..c97a5c93724f 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 d5b50ab9ea0e..228c77d4dae8 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 8797d055309d..b1d723d48e04 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 79289afef72b..9496aae9cd4a 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 58f933c90d94..cd594c7ab580 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 d581518fc2ab..e4c91621e05b 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 3434898536f6..ca1fe417e69a 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 72eb78e78571..3f7477f4f955 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 850cc88cb8f7..c53a5985a991 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 d9f253accb40..e5c0e1ba968d 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 192a1cdea55b..c6ac21c60de3 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 d837aaf5572e..b5d5cd3f33b7 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. *) -- GitLab