diff --git a/src/proto_alpha/lib_sc_rollup_node/simulation.ml b/src/lib_smart_rollup_node/simulation.ml similarity index 82% rename from src/proto_alpha/lib_sc_rollup_node/simulation.ml rename to src/lib_smart_rollup_node/simulation.ml index dd39c830ed3dfa35783dc3bac85d31f1f1a79951..b611936cbd584318824acaaaf41630e693d33d88 100644 --- a/src/proto_alpha/lib_sc_rollup_node/simulation.ml +++ b/src/lib_smart_rollup_node/simulation.ml @@ -23,14 +23,10 @@ (* *) (*****************************************************************************) -open Protocol -open Alpha_context -module Fueled_pvm = Fueled_pvm.Free - type level_position = Start | Middle | End type info_per_level = { - predecessor_timestamp : Timestamp.time; + predecessor_timestamp : Time.Protocol.t; predecessor : Block_hash.t; } @@ -42,18 +38,22 @@ type t = { nb_messages_inbox : int; level_position : level_position; info_per_level : info_per_level; + plugin : (module Protocol_plugin_sig.S); } let simulate_info_per_level (node_ctxt : [`Read] Node_context.t) predecessor = let open Lwt_result_syntax in - let* block_info = - Layer1_helpers.fetch_tezos_block node_ctxt.l1_ctxt predecessor + let* pred_header = + Layer1.fetch_tezos_shell_header node_ctxt.l1_ctxt predecessor in - let predecessor_timestamp = block_info.header.shell.timestamp in + let predecessor_timestamp = pred_header.timestamp in return {predecessor_timestamp; predecessor} let start_simulation node_ctxt ~reveal_map (Layer1.{hash; level} as head) = let open Lwt_result_syntax in + let inbox_level = Int32.succ level in + let* plugin = Protocol_plugins.proto_plugin_for_level node_ctxt inbox_level in + let module Plugin = (val plugin) in let*? () = error_unless (level >= node_ctxt.Node_context.genesis_info.level) @@ -67,9 +67,8 @@ let start_simulation node_ctxt ~reveal_map (Layer1.{hash; level} as head) = return (Context.empty node_ctxt.context) else Node_context.checkout_context node_ctxt hash in - let* ctxt, state = Interpreter.state_of_head node_ctxt ctxt head in + let* ctxt, state = Plugin.Interpreter.state_of_head node_ctxt ctxt head in let+ info_per_level = simulate_info_per_level node_ctxt hash in - let inbox_level = Int32.succ level in { ctxt; inbox_level; @@ -78,6 +77,7 @@ let start_simulation node_ctxt ~reveal_map (Layer1.{hash; level} as head) = nb_messages_inbox = 0; level_position = Start; info_per_level; + plugin; } let simulate_messages_no_checks (node_ctxt : Node_context.ro) @@ -87,19 +87,20 @@ let simulate_messages_no_checks (node_ctxt : Node_context.ro) inbox_level; reveal_map; nb_messages_inbox; + plugin; level_position = _; info_per_level = _; } as sim) messages = let open Lwt_result_syntax in - let module PVM = (val Pvm.of_kind node_ctxt.kind) in - let*! state_hash = PVM.state_hash state in - let*! tick = PVM.get_tick state in + let open (val plugin) in + let*! state_hash = Pvm.state_hash node_ctxt.kind state in + let*! tick = Pvm.get_tick node_ctxt.kind state in let eval_state = Pvm_plugin_sig. { state; - state_hash = Sc_rollup_proto_types.State_hash.to_octez state_hash; - tick = Sc_rollup.Tick.to_z tick; + state_hash; + tick; inbox_level; message_counter_offset = nb_messages_inbox; remaining_fuel = Fuel.Free.of_ticks 0L; @@ -108,17 +109,18 @@ let simulate_messages_no_checks (node_ctxt : Node_context.ro) in (* Build new state *) let* eval_result = - Fueled_pvm.eval_messages ?reveal_map node_ctxt eval_state + Pvm.Fueled.Free.eval_messages ?reveal_map node_ctxt eval_state in let Pvm_plugin_sig.{state = {state; _}; num_ticks; num_messages; _} = Delayed_write_monad.ignore eval_result in - let*! ctxt = PVM.State.set ctxt state in + let*! ctxt = Context.PVMState.set ctxt state in let nb_messages_inbox = nb_messages_inbox + num_messages in return ({sim with ctxt; state; nb_messages_inbox}, num_ticks) let simulate_messages (node_ctxt : Node_context.ro) sim messages = let open Lwt_result_syntax in + let open (val sim.plugin) in (* Build new inbox *) let*? () = error_when @@ -128,10 +130,8 @@ let simulate_messages (node_ctxt : Node_context.ro) sim messages = let messages = if sim.level_position = Start then let {predecessor_timestamp; predecessor} = sim.info_per_level in - let open Sc_rollup_inbox_message_repr in - unsafe_to_string start_of_level_serialized - :: unsafe_to_string - (info_per_level_serialized ~predecessor ~predecessor_timestamp) + Pvm.start_of_level_serialized + :: Pvm.info_per_level_serialized ~predecessor ~predecessor_timestamp :: messages else messages in @@ -140,15 +140,13 @@ let simulate_messages (node_ctxt : Node_context.ro) sim messages = let end_simulation node_ctxt sim = let open Lwt_result_syntax in + let open (val sim.plugin) in let*? () = error_when (sim.level_position = End) (Exn (Failure "Level for simulation is ended")) in let+ sim, num_ticks = - simulate_messages_no_checks - node_ctxt - sim - [Sc_rollup_inbox_message_repr.(unsafe_to_string end_of_level_serialized)] + simulate_messages_no_checks node_ctxt sim [Pvm.end_of_level_serialized] in ({sim with level_position = End}, num_ticks) diff --git a/src/proto_alpha/lib_sc_rollup_node/simulation.mli b/src/lib_smart_rollup_node/simulation.mli similarity index 96% rename from src/proto_alpha/lib_sc_rollup_node/simulation.mli rename to src/lib_smart_rollup_node/simulation.mli index 745ead3df5624cee2fdf4fc84c4486a0c554c18f..5d5e2aba44b715fa75dbe238dc93f32761f030d0 100644 --- a/src/proto_alpha/lib_sc_rollup_node/simulation.mli +++ b/src/lib_smart_rollup_node/simulation.mli @@ -23,13 +23,10 @@ (* *) (*****************************************************************************) -open Protocol.Alpha_context -module Fueled_pvm = Fueled_pvm.Free - type level_position = Start | Middle | End type info_per_level = { - predecessor_timestamp : Timestamp.time; + predecessor_timestamp : Time.Protocol.t; predecessor : Block_hash.t; } @@ -42,6 +39,7 @@ type t = { nb_messages_inbox : int; level_position : level_position; info_per_level : info_per_level; + plugin : (module Protocol_plugin_sig.S); } (** [start_simulation node_ctxt reveal_source block] starts a new simulation {e diff --git a/src/proto_016_PtMumbai/lib_sc_rollup_node/simulation.ml b/src/proto_016_PtMumbai/lib_sc_rollup_node/simulation.ml deleted file mode 100644 index 1b578613831f06448b0c3fd8605ac0bbc3db0d78..0000000000000000000000000000000000000000 --- a/src/proto_016_PtMumbai/lib_sc_rollup_node/simulation.ml +++ /dev/null @@ -1,159 +0,0 @@ -(*****************************************************************************) -(* *) -(* Open Source License *) -(* Copyright (c) 2022 Nomadic Labs, *) -(* *) -(* Permission is hereby granted, free of charge, to any person obtaining a *) -(* copy of this software and associated documentation files (the "Software"),*) -(* to deal in the Software without restriction, including without limitation *) -(* the rights to use, copy, modify, merge, publish, distribute, sublicense, *) -(* and/or sell copies of the Software, and to permit persons to whom the *) -(* Software is furnished to do so, subject to the following conditions: *) -(* *) -(* The above copyright notice and this permission notice shall be included *) -(* in all copies or substantial portions of the Software. *) -(* *) -(* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR*) -(* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, *) -(* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL *) -(* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER*) -(* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING *) -(* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER *) -(* DEALINGS IN THE SOFTWARE. *) -(* *) -(*****************************************************************************) - -open Protocol -open Alpha_context -module Fueled_pvm = Fueled_pvm.Free - -type level_position = Start | Middle | End - -type info_per_level = { - predecessor_timestamp : Timestamp.time; - predecessor : Block_hash.t; -} - -type t = { - ctxt : Context.ro; - inbox_level : int32; - state : Context.tree; - reveal_map : string Utils.Reveal_hash_map.t option; - nb_messages_inbox : int; - level_position : level_position; - info_per_level : info_per_level; -} - -let simulate_info_per_level (node_ctxt : [`Read] Node_context.t) predecessor = - let open Lwt_result_syntax in - let* block_info = - Layer1_helpers.fetch_tezos_block node_ctxt.l1_ctxt predecessor - in - let predecessor_timestamp = block_info.header.shell.timestamp in - return {predecessor_timestamp; predecessor} - -let start_simulation node_ctxt ~reveal_map (Layer1.{hash; level} as head) = - let open Lwt_result_syntax in - let*? () = - error_unless - (level >= node_ctxt.Node_context.genesis_info.level) - (Exn (Failure "Cannot simulate before origination level")) - in - let first_inbox_level = Int32.succ node_ctxt.genesis_info.level in - let* ctxt = - if level < first_inbox_level then - (* This is before we have interpreted the boot sector, so we start - with an empty context in genesis *) - return (Context.empty node_ctxt.context) - else Node_context.checkout_context node_ctxt hash - in - let* ctxt, state = Interpreter.state_of_head node_ctxt ctxt head in - let+ info_per_level = simulate_info_per_level node_ctxt hash in - let inbox_level = Int32.succ level in - { - ctxt; - inbox_level; - state; - reveal_map; - nb_messages_inbox = 0; - level_position = Start; - info_per_level; - } - -let simulate_messages_no_checks (node_ctxt : Node_context.ro) - ({ - ctxt; - state; - inbox_level; - reveal_map; - nb_messages_inbox; - level_position = _; - info_per_level = _; - } as sim) messages = - let open Lwt_result_syntax in - let module PVM = (val Pvm.of_kind node_ctxt.kind) in - let*! state_hash = PVM.state_hash state in - let*! tick = PVM.get_tick state in - let eval_state = - Pvm_plugin_sig. - { - state; - state_hash = Sc_rollup_proto_types.State_hash.to_octez state_hash; - tick = Sc_rollup.Tick.to_z tick; - inbox_level; - message_counter_offset = nb_messages_inbox; - remaining_fuel = Fuel.Free.of_ticks 0L; - remaining_messages = messages; - } - in - (* Build new state *) - let* eval_result = - Fueled_pvm.eval_messages ?reveal_map node_ctxt eval_state - in - let Pvm_plugin_sig.{state = {state; _}; num_ticks; num_messages; _} = - Delayed_write_monad.ignore eval_result - in - let*! ctxt = PVM.State.set ctxt state in - let nb_messages_inbox = nb_messages_inbox + num_messages in - return ({sim with ctxt; state; nb_messages_inbox}, num_ticks) - -let simulate_messages (node_ctxt : Node_context.ro) sim messages = - let open Lwt_result_syntax in - (* Build new inbox *) - let*? () = - error_when - (sim.level_position = End) - (Exn (Failure "Level for simulation is ended")) - in - let*? messages = - let open Result_syntax in - if sim.level_position = Start then - let {predecessor_timestamp; predecessor} = sim.info_per_level in - let open Sc_rollup_inbox_message_repr in - let+ info_per_level = - Environment.wrap_tzresult - @@ serialize - (Internal (Info_per_level {predecessor; predecessor_timestamp})) - in - unsafe_to_string start_of_level_serialized - :: unsafe_to_string info_per_level - :: messages - else return messages - in - let+ sim, num_ticks = simulate_messages_no_checks node_ctxt sim messages in - ({sim with level_position = Middle}, num_ticks) - -let end_simulation node_ctxt sim = - let open Lwt_result_syntax in - let*? () = - error_when - (sim.level_position = End) - (Exn (Failure "Level for simulation is ended")) - in - let+ sim, num_ticks = - simulate_messages_no_checks - node_ctxt - sim - [Sc_rollup_inbox_message_repr.(unsafe_to_string end_of_level_serialized)] - in - ({sim with level_position = End}, num_ticks) diff --git a/src/proto_016_PtMumbai/lib_sc_rollup_node/simulation.mli b/src/proto_016_PtMumbai/lib_sc_rollup_node/simulation.mli deleted file mode 100644 index 745ead3df5624cee2fdf4fc84c4486a0c554c18f..0000000000000000000000000000000000000000 --- a/src/proto_016_PtMumbai/lib_sc_rollup_node/simulation.mli +++ /dev/null @@ -1,64 +0,0 @@ -(*****************************************************************************) -(* *) -(* Open Source License *) -(* Copyright (c) 2022 Nomadic Labs, *) -(* *) -(* Permission is hereby granted, free of charge, to any person obtaining a *) -(* copy of this software and associated documentation files (the "Software"),*) -(* to deal in the Software without restriction, including without limitation *) -(* the rights to use, copy, modify, merge, publish, distribute, sublicense, *) -(* and/or sell copies of the Software, and to permit persons to whom the *) -(* Software is furnished to do so, subject to the following conditions: *) -(* *) -(* The above copyright notice and this permission notice shall be included *) -(* in all copies or substantial portions of the Software. *) -(* *) -(* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR*) -(* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, *) -(* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL *) -(* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER*) -(* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING *) -(* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER *) -(* DEALINGS IN THE SOFTWARE. *) -(* *) -(*****************************************************************************) - -open Protocol.Alpha_context -module Fueled_pvm = Fueled_pvm.Free - -type level_position = Start | Middle | End - -type info_per_level = { - predecessor_timestamp : Timestamp.time; - predecessor : Block_hash.t; -} - -(** Type of the state for a simulation. *) -type t = { - ctxt : Context.ro; - inbox_level : int32; - state : Context.tree; - reveal_map : string Utils.Reveal_hash_map.t option; - nb_messages_inbox : int; - level_position : level_position; - info_per_level : info_per_level; -} - -(** [start_simulation node_ctxt reveal_source block] starts a new simulation {e - on top} of [block], i.e. for an hypothetical new inbox (level). *) -val start_simulation : - Node_context.ro -> - reveal_map:string Utils.Reveal_hash_map.t option -> - Layer1.head -> - t tzresult Lwt.t - -(** [simulate_messages node_ctxt sim messages] runs a simulation of new - [messages] in the given simulation (state) [sim] and returns a new - simulation state, the remaining fuel (when [?fuel] is provided) and the - number of ticks that happened. *) -val simulate_messages : - Node_context.ro -> t -> string list -> (t * Z.t) tzresult Lwt.t - -(** [end_simulation node_ctxt sim] adds and [End_of_level] message and marks the - simulation as ended. *) -val end_simulation : Node_context.ro -> t -> (t * Z.t) tzresult Lwt.t diff --git a/src/proto_017_PtNairob/lib_sc_rollup_node/simulation.ml b/src/proto_017_PtNairob/lib_sc_rollup_node/simulation.ml deleted file mode 100644 index dd39c830ed3dfa35783dc3bac85d31f1f1a79951..0000000000000000000000000000000000000000 --- a/src/proto_017_PtNairob/lib_sc_rollup_node/simulation.ml +++ /dev/null @@ -1,154 +0,0 @@ -(*****************************************************************************) -(* *) -(* Open Source License *) -(* Copyright (c) 2022 Nomadic Labs, *) -(* *) -(* Permission is hereby granted, free of charge, to any person obtaining a *) -(* copy of this software and associated documentation files (the "Software"),*) -(* to deal in the Software without restriction, including without limitation *) -(* the rights to use, copy, modify, merge, publish, distribute, sublicense, *) -(* and/or sell copies of the Software, and to permit persons to whom the *) -(* Software is furnished to do so, subject to the following conditions: *) -(* *) -(* The above copyright notice and this permission notice shall be included *) -(* in all copies or substantial portions of the Software. *) -(* *) -(* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR*) -(* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, *) -(* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL *) -(* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER*) -(* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING *) -(* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER *) -(* DEALINGS IN THE SOFTWARE. *) -(* *) -(*****************************************************************************) - -open Protocol -open Alpha_context -module Fueled_pvm = Fueled_pvm.Free - -type level_position = Start | Middle | End - -type info_per_level = { - predecessor_timestamp : Timestamp.time; - predecessor : Block_hash.t; -} - -type t = { - ctxt : Context.ro; - inbox_level : int32; - state : Context.tree; - reveal_map : string Utils.Reveal_hash_map.t option; - nb_messages_inbox : int; - level_position : level_position; - info_per_level : info_per_level; -} - -let simulate_info_per_level (node_ctxt : [`Read] Node_context.t) predecessor = - let open Lwt_result_syntax in - let* block_info = - Layer1_helpers.fetch_tezos_block node_ctxt.l1_ctxt predecessor - in - let predecessor_timestamp = block_info.header.shell.timestamp in - return {predecessor_timestamp; predecessor} - -let start_simulation node_ctxt ~reveal_map (Layer1.{hash; level} as head) = - let open Lwt_result_syntax in - let*? () = - error_unless - (level >= node_ctxt.Node_context.genesis_info.level) - (Exn (Failure "Cannot simulate before origination level")) - in - let first_inbox_level = Int32.succ node_ctxt.genesis_info.level in - let* ctxt = - if level < first_inbox_level then - (* This is before we have interpreted the boot sector, so we start - with an empty context in genesis *) - return (Context.empty node_ctxt.context) - else Node_context.checkout_context node_ctxt hash - in - let* ctxt, state = Interpreter.state_of_head node_ctxt ctxt head in - let+ info_per_level = simulate_info_per_level node_ctxt hash in - let inbox_level = Int32.succ level in - { - ctxt; - inbox_level; - state; - reveal_map; - nb_messages_inbox = 0; - level_position = Start; - info_per_level; - } - -let simulate_messages_no_checks (node_ctxt : Node_context.ro) - ({ - ctxt; - state; - inbox_level; - reveal_map; - nb_messages_inbox; - level_position = _; - info_per_level = _; - } as sim) messages = - let open Lwt_result_syntax in - let module PVM = (val Pvm.of_kind node_ctxt.kind) in - let*! state_hash = PVM.state_hash state in - let*! tick = PVM.get_tick state in - let eval_state = - Pvm_plugin_sig. - { - state; - state_hash = Sc_rollup_proto_types.State_hash.to_octez state_hash; - tick = Sc_rollup.Tick.to_z tick; - inbox_level; - message_counter_offset = nb_messages_inbox; - remaining_fuel = Fuel.Free.of_ticks 0L; - remaining_messages = messages; - } - in - (* Build new state *) - let* eval_result = - Fueled_pvm.eval_messages ?reveal_map node_ctxt eval_state - in - let Pvm_plugin_sig.{state = {state; _}; num_ticks; num_messages; _} = - Delayed_write_monad.ignore eval_result - in - let*! ctxt = PVM.State.set ctxt state in - let nb_messages_inbox = nb_messages_inbox + num_messages in - return ({sim with ctxt; state; nb_messages_inbox}, num_ticks) - -let simulate_messages (node_ctxt : Node_context.ro) sim messages = - let open Lwt_result_syntax in - (* Build new inbox *) - let*? () = - error_when - (sim.level_position = End) - (Exn (Failure "Level for simulation is ended")) - in - let messages = - if sim.level_position = Start then - let {predecessor_timestamp; predecessor} = sim.info_per_level in - let open Sc_rollup_inbox_message_repr in - unsafe_to_string start_of_level_serialized - :: unsafe_to_string - (info_per_level_serialized ~predecessor ~predecessor_timestamp) - :: messages - else messages - in - let+ sim, num_ticks = simulate_messages_no_checks node_ctxt sim messages in - ({sim with level_position = Middle}, num_ticks) - -let end_simulation node_ctxt sim = - let open Lwt_result_syntax in - let*? () = - error_when - (sim.level_position = End) - (Exn (Failure "Level for simulation is ended")) - in - let+ sim, num_ticks = - simulate_messages_no_checks - node_ctxt - sim - [Sc_rollup_inbox_message_repr.(unsafe_to_string end_of_level_serialized)] - in - ({sim with level_position = End}, num_ticks) diff --git a/src/proto_017_PtNairob/lib_sc_rollup_node/simulation.mli b/src/proto_017_PtNairob/lib_sc_rollup_node/simulation.mli deleted file mode 100644 index 745ead3df5624cee2fdf4fc84c4486a0c554c18f..0000000000000000000000000000000000000000 --- a/src/proto_017_PtNairob/lib_sc_rollup_node/simulation.mli +++ /dev/null @@ -1,64 +0,0 @@ -(*****************************************************************************) -(* *) -(* Open Source License *) -(* Copyright (c) 2022 Nomadic Labs, *) -(* *) -(* Permission is hereby granted, free of charge, to any person obtaining a *) -(* copy of this software and associated documentation files (the "Software"),*) -(* to deal in the Software without restriction, including without limitation *) -(* the rights to use, copy, modify, merge, publish, distribute, sublicense, *) -(* and/or sell copies of the Software, and to permit persons to whom the *) -(* Software is furnished to do so, subject to the following conditions: *) -(* *) -(* The above copyright notice and this permission notice shall be included *) -(* in all copies or substantial portions of the Software. *) -(* *) -(* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR*) -(* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, *) -(* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL *) -(* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER*) -(* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING *) -(* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER *) -(* DEALINGS IN THE SOFTWARE. *) -(* *) -(*****************************************************************************) - -open Protocol.Alpha_context -module Fueled_pvm = Fueled_pvm.Free - -type level_position = Start | Middle | End - -type info_per_level = { - predecessor_timestamp : Timestamp.time; - predecessor : Block_hash.t; -} - -(** Type of the state for a simulation. *) -type t = { - ctxt : Context.ro; - inbox_level : int32; - state : Context.tree; - reveal_map : string Utils.Reveal_hash_map.t option; - nb_messages_inbox : int; - level_position : level_position; - info_per_level : info_per_level; -} - -(** [start_simulation node_ctxt reveal_source block] starts a new simulation {e - on top} of [block], i.e. for an hypothetical new inbox (level). *) -val start_simulation : - Node_context.ro -> - reveal_map:string Utils.Reveal_hash_map.t option -> - Layer1.head -> - t tzresult Lwt.t - -(** [simulate_messages node_ctxt sim messages] runs a simulation of new - [messages] in the given simulation (state) [sim] and returns a new - simulation state, the remaining fuel (when [?fuel] is provided) and the - number of ticks that happened. *) -val simulate_messages : - Node_context.ro -> t -> string list -> (t * Z.t) tzresult Lwt.t - -(** [end_simulation node_ctxt sim] adds and [End_of_level] message and marks the - simulation as ended. *) -val end_simulation : Node_context.ro -> t -> (t * Z.t) tzresult Lwt.t