diff --git a/CHANGES.rst b/CHANGES.rst index 1659d94fdb2e58063eab1fcacd2e139b1fc6bc57..4efc744afa1f8b336b1ef3d79c90c0884eb4240b 100644 --- a/CHANGES.rst +++ b/CHANGES.rst @@ -248,6 +248,13 @@ Smart Rollup node - Support ``remote`` signer scheme and check remote signer available on startup. (MR :gl:`!16651`) +- Add a new RPC ``/local/outbox/pending`` to fetch all known outbox messages + with their status. (MR :gl:`!16831`) + + +- Use correct constant to determine executable or lost outbox messages for RPCs + ``/local/outbox/pending`` and ``/local/outbox/pending/executable``. (MR + :gl:`!17279`) Smart Rollup WASM Debugger -------------------------- diff --git a/src/lib_smart_rollup/rollup_constants.ml b/src/lib_smart_rollup/rollup_constants.ml index 37d1b96bac6c0ae0fb30d837251a6348352c16a9..93f74b15501b8fa22932a8cddf86511f8530d229 100644 --- a/src/lib_smart_rollup/rollup_constants.ml +++ b/src/lib_smart_rollup/rollup_constants.ml @@ -45,6 +45,7 @@ type sc_rollup_constants = { commitment_period_in_blocks : int; reveal_activation_level : reveal_activation_level option; max_number_of_stored_cemented_commitments : int; + max_active_outbox_levels : int; } type protocol_constants = { @@ -100,6 +101,7 @@ let encoding = commitment_period_in_blocks; reveal_activation_level; max_number_of_stored_cemented_commitments; + max_active_outbox_levels; }; dal = { @@ -114,7 +116,8 @@ let encoding = ( challenge_window_in_blocks, commitment_period_in_blocks, reveal_activation_level, - max_number_of_stored_cemented_commitments ), + max_number_of_stored_cemented_commitments, + max_active_outbox_levels ), (feature_enable, attestation_lag, number_of_slots, cryptobox_parameters) )) (fun ( minimal_block_delay, @@ -122,7 +125,8 @@ let encoding = ( challenge_window_in_blocks, commitment_period_in_blocks, reveal_activation_level, - max_number_of_stored_cemented_commitments ), + max_number_of_stored_cemented_commitments, + max_active_outbox_levels ), ( feature_enable, attestation_lag, number_of_slots, @@ -136,6 +140,7 @@ let encoding = commitment_period_in_blocks; reveal_activation_level; max_number_of_stored_cemented_commitments; + max_active_outbox_levels; }; dal = { @@ -150,11 +155,12 @@ let encoding = (req "delay_increment_per_round" int64) (req "sc_rollup" - (obj4 + (obj5 (req "challenge_window_in_blocks" int31) (req "commitment_period_in_blocks" int31) (opt "reveal_activation_level" reveal_activation_level_encoding) - (req "max_number_of_stored_cemented_commitments" int31))) + (req "max_number_of_stored_cemented_commitments" int31) + (req "max_active_outbox_levels" int31))) (req "dal" (obj4 diff --git a/src/lib_smart_rollup_node/node_context.ml b/src/lib_smart_rollup_node/node_context.ml index 43386829bac5d192b8c376cccdb916e307e32528..2931af12b77136c0f4caea3dd9858007bd7fa982 100644 --- a/src/lib_smart_rollup_node/node_context.ml +++ b/src/lib_smart_rollup_node/node_context.ml @@ -672,11 +672,10 @@ let get_executable_pending_outbox_messages {store; lcc; current_protocol; _} = let max_level = (Reference.get lcc).level in let constants = (Reference.get current_protocol).constants.sc_rollup in let min_level = - Int32.sub - max_level - (Int32.of_int - (constants.max_number_of_stored_cemented_commitments - * constants.commitment_period_in_blocks)) + Int32.sub max_level (Int32.of_int constants.max_active_outbox_levels) + |> Int32.succ + (* Protocol uses strict inequality, see function [validate_outbox_level] in + src/proto_alpha/lib_protocol/sc_rollup_operations.ml. *) in Store.Outbox_messages.pending store ~min_level ~max_level diff --git a/src/lib_smart_rollup_node/node_context_loader.ml b/src/lib_smart_rollup_node/node_context_loader.ml index 7817449db7c000e616571a40803dd7231405c3cf..cb6c5888f03abf6dbc77958df42c606d6cef1977 100644 --- a/src/lib_smart_rollup_node/node_context_loader.ml +++ b/src/lib_smart_rollup_node/node_context_loader.ml @@ -459,6 +459,7 @@ module Internal_for_tests = struct dal_attested_slots_validity_lag = Int32.max_int; }; max_number_of_stored_cemented_commitments = 0; + max_active_outbox_levels = 0; }; dal = { diff --git a/src/lib_smart_rollup_node/test/helpers/helpers.ml b/src/lib_smart_rollup_node/test/helpers/helpers.ml index d48eba01faec437a91d2a484880963d95dd18760..656f5a81ab270da5c1cb9eb58f12afd5f6ac99ae 100644 --- a/src/lib_smart_rollup_node/test/helpers/helpers.ml +++ b/src/lib_smart_rollup_node/test/helpers/helpers.ml @@ -42,38 +42,49 @@ let make_block_hash level messages = let default_constants = (* Same as default test constants for alpha excepted for commitment_period_in_block. *) + let open Tezos_protocol_alpha.Protocol.Alpha_context in + let Constants.Parametric. + { + minimal_block_delay; + delay_increment_per_round; + sc_rollup = + { + challenge_window_in_blocks; + reveal_activation_level; + max_number_of_stored_cemented_commitments; + max_active_outbox_levels; + _; + }; + dal = + { + feature_enable; + attestation_lag; + number_of_slots; + cryptobox_parameters; + _; + }; + _; + } = + Tezos_protocol_alpha_parameters.Default_parameters.constants_test + in Rollup_constants. { - minimal_block_delay = 1L; - delay_increment_per_round = 1L; + minimal_block_delay = Period.to_seconds minimal_block_delay; + delay_increment_per_round = Period.to_seconds delay_increment_per_round; sc_rollup = { - challenge_window_in_blocks = 4032; + challenge_window_in_blocks; commitment_period_in_blocks = 3; reveal_activation_level = Some - { - blake2B = 0l; - metadata = 0l; - dal_page = 0l; - dal_parameters = 0l; - dal_attested_slots_validity_lag = Int32.max_int; - }; - max_number_of_stored_cemented_commitments = 5; + (Tezos_smart_rollup_layer2_alpha.Sc_rollup_proto_types.Constants + .reveal_activation_level_to_octez + reveal_activation_level); + max_number_of_stored_cemented_commitments; + max_active_outbox_levels = Int32.to_int max_active_outbox_levels; }; dal = - { - feature_enable = false; - attestation_lag = 4; - number_of_slots = 16; - cryptobox_parameters = - { - redundancy_factor = 8; - page_size = 4096; - slot_size = 32768; - number_of_shards = 64; - }; - }; + {feature_enable; attestation_lag; number_of_slots; cryptobox_parameters}; } let add_l2_genesis_block (node_ctxt : _ Node_context.t) ~boot_sector = diff --git a/src/proto_017_PtNairob/lib_sc_rollup_node/layer1_helpers.ml b/src/proto_017_PtNairob/lib_sc_rollup_node/layer1_helpers.ml index cf87e038cf28c382d78b5e6092f1b49957647e04..fc7cdd3563089d40d6f8d564d4f527056c8b4f4e 100644 --- a/src/proto_017_PtNairob/lib_sc_rollup_node/layer1_helpers.ml +++ b/src/proto_017_PtNairob/lib_sc_rollup_node/layer1_helpers.ml @@ -135,6 +135,7 @@ let constants_of_parametric challenge_window_in_blocks; commitment_period_in_blocks; max_number_of_stored_cemented_commitments; + max_active_outbox_levels; _; }; dal = @@ -158,6 +159,7 @@ let constants_of_parametric commitment_period_in_blocks; reveal_activation_level = None; max_number_of_stored_cemented_commitments; + max_active_outbox_levels = Int32.to_int max_active_outbox_levels; }; dal = {feature_enable; attestation_lag; number_of_slots; cryptobox_parameters}; diff --git a/src/proto_018_Proxford/lib_sc_rollup_node/layer1_helpers.ml b/src/proto_018_Proxford/lib_sc_rollup_node/layer1_helpers.ml index 69fbaad853c199687c33f164ee8b115c8675574f..42537b7c44b24bec293bea848b12832421e23263 100644 --- a/src/proto_018_Proxford/lib_sc_rollup_node/layer1_helpers.ml +++ b/src/proto_018_Proxford/lib_sc_rollup_node/layer1_helpers.ml @@ -136,6 +136,7 @@ let constants_of_parametric commitment_period_in_blocks; reveal_activation_level; max_number_of_stored_cemented_commitments; + max_active_outbox_levels; _; }; dal = @@ -162,6 +163,7 @@ let constants_of_parametric (Sc_rollup_proto_types.Constants.reveal_activation_level_to_octez reveal_activation_level); max_number_of_stored_cemented_commitments; + max_active_outbox_levels = Int32.to_int max_active_outbox_levels; }; dal = {feature_enable; attestation_lag; number_of_slots; cryptobox_parameters}; diff --git a/src/proto_019_PtParisB/lib_sc_rollup_node/layer1_helpers.ml b/src/proto_019_PtParisB/lib_sc_rollup_node/layer1_helpers.ml index 69fbaad853c199687c33f164ee8b115c8675574f..42537b7c44b24bec293bea848b12832421e23263 100644 --- a/src/proto_019_PtParisB/lib_sc_rollup_node/layer1_helpers.ml +++ b/src/proto_019_PtParisB/lib_sc_rollup_node/layer1_helpers.ml @@ -136,6 +136,7 @@ let constants_of_parametric commitment_period_in_blocks; reveal_activation_level; max_number_of_stored_cemented_commitments; + max_active_outbox_levels; _; }; dal = @@ -162,6 +163,7 @@ let constants_of_parametric (Sc_rollup_proto_types.Constants.reveal_activation_level_to_octez reveal_activation_level); max_number_of_stored_cemented_commitments; + max_active_outbox_levels = Int32.to_int max_active_outbox_levels; }; dal = {feature_enable; attestation_lag; number_of_slots; cryptobox_parameters}; diff --git a/src/proto_020_PsParisC/lib_sc_rollup_node/layer1_helpers.ml b/src/proto_020_PsParisC/lib_sc_rollup_node/layer1_helpers.ml index be34d0530273bc66c97dab912cd06445987e1846..3781c46aac9921f1f95e359f1cc1ab590a0d5ff0 100644 --- a/src/proto_020_PsParisC/lib_sc_rollup_node/layer1_helpers.ml +++ b/src/proto_020_PsParisC/lib_sc_rollup_node/layer1_helpers.ml @@ -136,6 +136,7 @@ let constants_of_parametric commitment_period_in_blocks; reveal_activation_level; max_number_of_stored_cemented_commitments; + max_active_outbox_levels; _; }; dal = @@ -162,6 +163,7 @@ let constants_of_parametric (Sc_rollup_proto_types.Constants.reveal_activation_level_to_octez reveal_activation_level); max_number_of_stored_cemented_commitments; + max_active_outbox_levels = Int32.to_int max_active_outbox_levels; }; dal = {feature_enable; attestation_lag; number_of_slots; cryptobox_parameters}; diff --git a/src/proto_021_PsQuebec/lib_sc_rollup_node/layer1_helpers.ml b/src/proto_021_PsQuebec/lib_sc_rollup_node/layer1_helpers.ml index 51a92aaf69715c35fc74b42b6eb49e9d914c5067..2a1a85e1d0478a0c7c3ead5740bdb6fcd274e152 100644 --- a/src/proto_021_PsQuebec/lib_sc_rollup_node/layer1_helpers.ml +++ b/src/proto_021_PsQuebec/lib_sc_rollup_node/layer1_helpers.ml @@ -136,6 +136,7 @@ let constants_of_parametric commitment_period_in_blocks; reveal_activation_level; max_number_of_stored_cemented_commitments; + max_active_outbox_levels; _; }; dal = @@ -162,6 +163,7 @@ let constants_of_parametric (Sc_rollup_proto_types.Constants.reveal_activation_level_to_octez reveal_activation_level); max_number_of_stored_cemented_commitments; + max_active_outbox_levels = Int32.to_int max_active_outbox_levels; }; dal = {feature_enable; attestation_lag; number_of_slots; cryptobox_parameters}; diff --git a/src/proto_022_PsRiotum/lib_sc_rollup_node/layer1_helpers.ml b/src/proto_022_PsRiotum/lib_sc_rollup_node/layer1_helpers.ml index 51a92aaf69715c35fc74b42b6eb49e9d914c5067..2a1a85e1d0478a0c7c3ead5740bdb6fcd274e152 100644 --- a/src/proto_022_PsRiotum/lib_sc_rollup_node/layer1_helpers.ml +++ b/src/proto_022_PsRiotum/lib_sc_rollup_node/layer1_helpers.ml @@ -136,6 +136,7 @@ let constants_of_parametric commitment_period_in_blocks; reveal_activation_level; max_number_of_stored_cemented_commitments; + max_active_outbox_levels; _; }; dal = @@ -162,6 +163,7 @@ let constants_of_parametric (Sc_rollup_proto_types.Constants.reveal_activation_level_to_octez reveal_activation_level); max_number_of_stored_cemented_commitments; + max_active_outbox_levels = Int32.to_int max_active_outbox_levels; }; dal = {feature_enable; attestation_lag; number_of_slots; cryptobox_parameters}; diff --git a/src/proto_alpha/lib_sc_rollup_node/layer1_helpers.ml b/src/proto_alpha/lib_sc_rollup_node/layer1_helpers.ml index 3fce20a4ca9d16dd9c486b53841a1e438610c66c..0c642f498080cd99f914530f6bbf9f3dafe8c5ed 100644 --- a/src/proto_alpha/lib_sc_rollup_node/layer1_helpers.ml +++ b/src/proto_alpha/lib_sc_rollup_node/layer1_helpers.ml @@ -136,6 +136,7 @@ let constants_of_parametric commitment_period_in_blocks; reveal_activation_level; max_number_of_stored_cemented_commitments; + max_active_outbox_levels; _; }; dal = @@ -162,6 +163,7 @@ let constants_of_parametric (Sc_rollup_proto_types.Constants.reveal_activation_level_to_octez reveal_activation_level); max_number_of_stored_cemented_commitments; + max_active_outbox_levels = Int32.to_int max_active_outbox_levels; }; dal = {feature_enable; attestation_lag; number_of_slots; cryptobox_parameters};