diff --git a/manifest/main.ml b/manifest/main.ml index 236348723486582ceb1ea0b341904f64a29a43f6..eaaa2f31107760a474ccc6b2175a52f71c2a15d5 100644 --- a/manifest/main.ml +++ b/manifest/main.ml @@ -7460,6 +7460,9 @@ let octez_scoru_sequencer = Protocol.(octez_sc_rollup_layer2 alpha |> if_some |> open_); Protocol.(main alpha) |> open_; Protocol.(octez_sc_rollup_node alpha) |> if_some; + octez_workers |> open_; + octez_smart_rollup_node_lib |> open_; + octez_smart_rollup_lib |> open_; octez_rpc; octez_rpc_http; octez_rpc_http_server; diff --git a/opam/octez-smart-rollup-sequencer.opam b/opam/octez-smart-rollup-sequencer.opam index df4f31b4c742faefddeebdeb22d09e31a8a73f19..3cd84df45810df3727c58f6601b9e6418e966d39 100644 --- a/opam/octez-smart-rollup-sequencer.opam +++ b/opam/octez-smart-rollup-sequencer.opam @@ -14,6 +14,9 @@ depends: [ "tezos-smart-rollup-layer2-alpha" "tezos-protocol-alpha" "octez-smart-rollup-node-alpha" + "tezos-workers" + "octez-smart-rollup-node" + "octez-smart-rollup" "tezos-rpc" "tezos-rpc-http" "tezos-rpc-http-server" diff --git a/src/lib_scoru_sequencer/components.ml b/src/lib_scoru_sequencer/components.ml index 262fb6eb637ff49a653f02434e22d8296d13a594..7f85ba370b99be07560a2edc42492590eee72eb3 100644 --- a/src/lib_scoru_sequencer/components.ml +++ b/src/lib_scoru_sequencer/components.ml @@ -26,7 +26,7 @@ module Sc_rollup_node = Octez_smart_rollup_node_alpha -module Daemon_components = struct - module Batcher = Sc_rollup_node.Batcher - module RPC_server = Sc_rollup_node.RPC_server +module Daemon_components : Sc_rollup_node.Daemon_components.S = struct + module Batcher = Seq_batcher + module RPC_server = Rpc_server end diff --git a/src/lib_scoru_sequencer/dune b/src/lib_scoru_sequencer/dune index e6f40c06adf28d3092ff0c73a843812097389749..e15cae69fa9a7b6aca214a6899006191241ed8e9 100644 --- a/src/lib_scoru_sequencer/dune +++ b/src/lib_scoru_sequencer/dune @@ -10,6 +10,9 @@ tezos-smart-rollup-layer2-alpha tezos-protocol-alpha octez_smart_rollup_node_alpha + tezos-workers + octez-smart-rollup-node + octez-smart-rollup tezos-rpc tezos-rpc-http tezos-rpc-http-server) @@ -19,4 +22,7 @@ -open Tezos_base.TzPervasives -open Tezos_base.TzPervasives.Error_monad.Legacy_monad_globals -open Tezos_smart_rollup_layer2_alpha - -open Tezos_protocol_alpha)) + -open Tezos_protocol_alpha + -open Tezos_workers + -open Octez_smart_rollup_node + -open Octez_smart_rollup)) diff --git a/src/lib_scoru_sequencer/kernel_durable.ml b/src/lib_scoru_sequencer/kernel_durable.ml new file mode 100644 index 0000000000000000000000000000000000000000..ac5ed0a68c84a8772f151fbbc23ae927c9fc5abf --- /dev/null +++ b/src/lib_scoru_sequencer/kernel_durable.ml @@ -0,0 +1,39 @@ +(*****************************************************************************) +(* *) +(* Open Source License *) +(* Copyright (c) 2022-2023 TriliTech *) +(* *) +(* 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. *) +(* *) +(*****************************************************************************) + +let sequencer_prefix = "/__sequencer" + +let delayed_inbox_prefix = String.concat "/" [sequencer_prefix; "delayed-inbox"] + +module Delayed_inbox_pointer = struct + let path = String.concat "/" [delayed_inbox_prefix; "pointer"] + + type t = {head : int32; tail : int32} + + let encoding = + let open Data_encoding in + conv (fun {head; tail} -> (head, tail)) (fun (head, tail) -> {head; tail}) + @@ obj2 (req "head" int32) (req "tail" int32) +end diff --git a/src/lib_scoru_sequencer/rpc_server.ml b/src/lib_scoru_sequencer/rpc_server.ml index 94ad50b7077ac268d93eb9487b051365b7a3449b..597802619e5b76f6d29404cc755698a6c933c8ec 100644 --- a/src/lib_scoru_sequencer/rpc_server.ml +++ b/src/lib_scoru_sequencer/rpc_server.ml @@ -27,11 +27,12 @@ open Tezos_rpc_http_server open RPC_directory_helpers open Octez_smart_rollup_node +module Sc_rollup_node = Octez_smart_rollup_node_alpha module Local_directory = Make_directory (struct include Sc_rollup_services.Local - type context = unit + type context = Sc_rollup_node.Node_context.rw type subcontext = unit @@ -43,22 +44,22 @@ let () = let open Protocol.Alpha_context.Sc_rollup in ( Local_directory.register0 (Sequencer_services.Local.durable_state_value Kind.Wasm_2_0_0) - @@ fun () _key () -> failwith "Not implemented" ) ; + @@ fun () {key} () -> Seq_batcher.get_simulated_state_value key ) ; ( Local_directory.register0 (Sequencer_services.Local.durable_state_subkeys Kind.Wasm_2_0_0) - @@ fun () _key () -> failwith "Not implemented" ) ; + @@ fun () {key} () -> Seq_batcher.get_simulated_state_subkeys key ) ; Local_directory.register0 Sc_rollup_services.Local.injection - @@ fun _node_ctxt () _messages -> failwith "Not implemented" + @@ fun _node_ctxt () messages -> Seq_batcher.register_messages messages -let register node_ctxt = +let register (node_ctxt : _ Sc_rollup_node.Node_context.t) = List.fold_left (fun dir f -> Tezos_rpc.Directory.merge dir (f node_ctxt)) Tezos_rpc.Directory.empty [Local_directory.build_directory] -let start node_ctxt configuration = +let start (node_ctxt : _ Sc_rollup_node.Node_context.t) configuration = let open Lwt_result_syntax in let Configuration.{rpc_addr; rpc_port; _} = configuration in let rpc_addr = P2p_addr.of_string_exn rpc_addr in diff --git a/src/lib_scoru_sequencer/rpc_server.mli b/src/lib_scoru_sequencer/rpc_server.mli index 209af654624d62e829733eb93e1b8435a59177f6..01665304fd0f8aeecc78ff24283595c3f885d180 100644 --- a/src/lib_scoru_sequencer/rpc_server.mli +++ b/src/lib_scoru_sequencer/rpc_server.mli @@ -23,13 +23,4 @@ (* *) (*****************************************************************************) -open Tezos_rpc_http_server -open Octez_smart_rollup_node - -(** [start node_ctxt config] starts an RPC server listening for requests on the - port [config.rpc_port] and address [config.rpc_addr]. *) -val start : unit -> Configuration.t -> RPC_server.server tzresult Lwt.t - -(** Shutdown a running RPC server. When this function is called, the rollup node - will stop listening to incoming requests. *) -val shutdown : RPC_server.server -> unit Lwt.t +include Octez_smart_rollup_node_alpha.Daemon_components.RPC_server_sig diff --git a/src/lib_scoru_sequencer/seq_batcher.ml b/src/lib_scoru_sequencer/seq_batcher.ml new file mode 100644 index 0000000000000000000000000000000000000000..cdb44abfaa6cda04ed65aef99fdc1f1987773f9a --- /dev/null +++ b/src/lib_scoru_sequencer/seq_batcher.ml @@ -0,0 +1,375 @@ +(*****************************************************************************) +(* *) +(* Open Source License *) +(* Copyright (c) 2022 Nomadic Labs, *) +(* Copyright (c) 2022-2023 TriliTech *) +(* *) +(* 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 +open Octez_smart_rollup_node_alpha +open Octez_smart_rollup_node_alpha.Batcher_worker_types +module Message_queue = Hash_queue.Make (L2_message.Hash) (L2_message) +module Durable_state = Wasm_2_0_0_pvm.Durable_state + +let worker_name = "seq_batcher" + +module Batcher_events = Batcher_events.Declare (struct + let worker_name = worker_name +end) + +module L2_batched_message = struct + type t = {content : string; l1_hash : Injector.Inj_operation.hash} +end + +module Batched_messages = Hash_queue.Make (L2_message.Hash) (L2_batched_message) + +module Sequencer = struct + type msg = Sequence of string + + let msg_content (Sequence cnt) = cnt + + let sequence_message_overhead_size messages_num = + 64 (* 64 bytes for signature *) + 4 + (* 4 bytes for delayed inbox size *) + + (4 * messages_num) + (* each message prepended with its size *) + + let make_sequence_message (_delayed_messages : int) + (_l2_messages : L2_message.t list) : msg = + Sequence "" +end + +type state = { + node_ctxt : Node_context.ro; + signer : Signature.public_key_hash; + messages : Message_queue.t; + batched : Batched_messages.t; + mutable simulation_ctxt : Simulation.t option; +} + +(* Takes sequencer message to inject and L2 messages included into it *) +let inject_sequence state (sequencer_message, l2_messages) = + let open Lwt_result_syntax in + let operation = + L1_operation.Add_messages + {messages = [Sequencer.msg_content sequencer_message]} + in + let+ l1_hash = + Injector.add_pending_operation ~source:state.signer operation + in + List.iter + (fun msg -> + let content = L2_message.content msg in + let hash = L2_message.hash msg in + Batched_messages.replace state.batched hash {content; l1_hash}) + l2_messages + +let inject_batches state = List.iter_es (inject_sequence state) + +let get_previous_delayed_inbox_size node_ctxt (head : Layer1.head) = + let open Lwt_result_syntax in + let*? level = Environment.wrap_tzresult @@ Raw_level.of_int32 head.level in + let*? () = + error_unless + Raw_level.(level >= node_ctxt.Node_context.genesis_info.level) + (Exn (Failure "Cannot obtain delayed inbox before origination level")) + in + let* previous_head = Node_context.get_predecessor node_ctxt head in + let*? previous_level = + Environment.wrap_tzresult @@ Raw_level.of_int32 previous_head.level + in + let first_inbox_level = Raw_level.succ node_ctxt.genesis_info.level in + let* ctxt = + if Raw_level.(previous_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 previous_head.hash + in + let* _ctxt, state = Interpreter.state_of_head node_ctxt ctxt previous_head in + let open Kernel_durable in + let*! pointer_bytes = Durable_state.lookup state Delayed_inbox_pointer.path in + match pointer_bytes with + | None -> return 0 + | Some pointer_bytes -> + return + @@ Option.fold ~none:0 ~some:(fun x -> + Int32.(to_int @@ succ @@ sub x.Delayed_inbox_pointer.tail x.head)) + @@ Data_encoding.Binary.of_bytes_opt + Delayed_inbox_pointer.encoding + pointer_bytes + +let get_batch_sequences state head = + let open Lwt_result_syntax in + let+ delayed_inbox_size = + get_previous_delayed_inbox_size state.node_ctxt head + in + (* Assuming at the moment that all the registered messages fit into a single L2 message. + This logic will be extended later. + *) + let l2_messages = Message_queue.elements state.messages in + ( [ + ( Sequencer.make_sequence_message delayed_inbox_size l2_messages, + l2_messages ); + ], + delayed_inbox_size ) + +let produce_batch_sequences state head = + let open Lwt_result_syntax in + let* batches, total_delayed_inbox_sizes = get_batch_sequences state head in + match batches with + | [] -> return_unit + | _ -> + let* () = inject_batches state batches in + let*! () = + Batcher_events.(emit batched) + (* As we add ALL the messages to the Sequence for now, + the number of messages is equal to length of state.messages *) + ( List.length batches, + total_delayed_inbox_sizes + Message_queue.length state.messages ) + in + Message_queue.clear state.messages ; + return_unit + +let simulate node_ctxt simulation_ctxt (messages : L2_message.t list) = + let open Lwt_result_syntax in + let*? ext_messages = + List.map_e + (fun m -> + Sc_rollup.Inbox_message.(serialize (External (L2_message.content m)))) + messages + |> Environment.wrap_tzresult + in + let+ simulation_ctxt, _ticks = + Simulation.simulate_messages node_ctxt simulation_ctxt ext_messages + in + simulation_ctxt + +(* Maximum size of single L2 message. + If L2 message size exceeds it, it means we won't be able to form a Sequence with solely this message +*) +let max_single_l2_msg_size = + Protocol.Constants_repr.sc_rollup_message_size_limit + - Sequencer.sequence_message_overhead_size 1 + - 4 (* each L2 message prepended with it size *) + +let get_simulation_context state = + let open Lwt_result_syntax in + match state.simulation_ctxt with + | None -> failwith "Simulation context of sequencer not initialized" + | Some simulation_ctxt -> return simulation_ctxt + +(*** HANDLERS IMPLEMENTATION ***) +let on_register_messages state (messages : string list) = + let open Lwt_result_syntax in + let*? messages = + List.mapi_e + (fun i message -> + if String.length message > max_single_l2_msg_size then + error_with + "Message %d is too large (max size is %d)" + i + max_single_l2_msg_size + else Ok (L2_message.make message)) + messages + in + let* simulation_ctxt = get_simulation_context state in + let* advanced_simulation_ctxt = + simulate state.node_ctxt simulation_ctxt messages + in + state.simulation_ctxt <- Some advanced_simulation_ctxt ; + let*! () = Batcher_events.(emit queue) (List.length messages) in + let hashes = + List.map + (fun message -> + let msg_hash = L2_message.hash message in + Message_queue.replace state.messages msg_hash message ; + msg_hash) + messages + in + return hashes + +let on_new_head state head = + let open Lwt_result_syntax in + let* () = produce_batch_sequences state head in + when_ (head.level >= Raw_level.to_int32 state.node_ctxt.genesis_info.level) + @@ fun () -> + let* simulation_ctxt = + Simulation.start_simulation ~reveal_map:None state.node_ctxt head + in + state.simulation_ctxt <- Some simulation_ctxt ; + return_unit + +let init_batcher_state node_ctxt ~signer = + Lwt.return + { + node_ctxt; + signer; + messages = Message_queue.create 100_000 (* ~ 400MB *); + batched = Batched_messages.create 100_000 (* ~ 400MB *); + simulation_ctxt = None; + } + +module Types = struct + type nonrec state = state + + type parameters = { + node_ctxt : Node_context.ro; + signer : Signature.public_key_hash; + } +end + +module Name = struct + (* We only have a single batcher in the node *) + type t = unit + + let encoding = Data_encoding.unit + + let base = [Protocol.name; "sc_sequencer_node"; worker_name; "worker"] + + let pp _ _ = () + + let equal () () = true +end + +module Worker = Worker.MakeSingle (Name) (Request) (Types) + +type worker = Worker.infinite Worker.queue Worker.t + +module Handlers = struct + type self = worker + + let on_request : + type r request_error. + worker -> (r, request_error) Request.t -> (r, request_error) result Lwt.t + = + fun w request -> + let state = Worker.state w in + match request with + | Request.Register messages -> + protect @@ fun () -> on_register_messages state messages + | Request.New_head head -> protect @@ fun () -> on_new_head state head + + type launch_error = error trace + + let on_launch _w () Types.{node_ctxt; signer} = + let open Lwt_result_syntax in + let*! state = init_batcher_state node_ctxt ~signer in + return state + + let on_error (type a b) _w st (r : (a, b) Request.t) (errs : b) : + unit tzresult Lwt.t = + let open Lwt_result_syntax in + let request_view = Request.view r in + let emit_and_return_errors errs = + let*! () = + Batcher_events.(emit Worker.request_failed) (request_view, st, errs) + in + return_unit + in + match r with + | Request.Register _ -> emit_and_return_errors errs + | Request.New_head _ -> emit_and_return_errors errs + + let on_completion _w r _ st = + match Request.view r with + | Request.View (Register _ | New_head _) -> + Batcher_events.(emit Worker.request_completed_debug) (Request.view r, st) + + let on_no_request _ = Lwt.return_unit + + let on_close _w = Lwt.return_unit +end + +let table = Worker.create_table Queue + +let worker_promise, worker_waker = Lwt.task () + +let init _conf ~signer node_ctxt = + let open Lwt_result_syntax in + let node_ctxt = Node_context.readonly node_ctxt in + let+ worker = Worker.launch table () {node_ctxt; signer} (module Handlers) in + Lwt.wakeup worker_waker worker + +(* This is a batcher worker for a single scoru *) +let worker = + lazy + (match Lwt.state worker_promise with + | Lwt.Return worker -> ok worker + | Lwt.Fail _ | Lwt.Sleep -> error Sc_rollup_node_errors.No_batcher) + +let handle_request_error rq = + let open Lwt_syntax in + let* rq in + match rq with + | Ok res -> return_ok res + | Error (Worker.Request_error errs) -> Lwt.return_error errs + | Error (Closed None) -> Lwt.return_error [Worker_types.Terminated] + | Error (Closed (Some errs)) -> Lwt.return_error errs + | Error (Any exn) -> Lwt.return_error [Exn exn] + +let register_messages messages = + let open Lwt_result_syntax in + let*? w = Lazy.force worker in + Worker.Queue.push_request_and_wait w (Request.Register messages) + |> handle_request_error + +let new_head b = + let open Lwt_result_syntax in + let w = Lazy.force worker in + match w with + | Error _ -> + (* There is no batcher, nothing to do *) + return_unit + | Ok w -> + let*! (_pushed : bool) = + Worker.Queue.push_request w (Request.New_head b) + in + return_unit + +let shutdown () = + let w = Lazy.force worker in + match w with + | Error _ -> + (* There is no batcher, nothing to do *) + Lwt.return_unit + | Ok w -> Worker.shutdown w + +let get_simulation_state () = + let open Lwt_result_syntax in + let*? w = Lazy.force worker in + let state = Worker.state w in + let+ simulation_ctxt = get_simulation_context state in + simulation_ctxt.state + +let get_simulated_state_value key = + let open Lwt_result_syntax in + let* sim_state = get_simulation_state () in + let*! result = Durable_state.lookup sim_state key in + return result + +let get_simulated_state_subkeys key = + let open Lwt_result_syntax in + let* sim_state = get_simulation_state () in + let*! result = Durable_state.list sim_state key in + return result diff --git a/src/lib_scoru_sequencer/seq_batcher.mli b/src/lib_scoru_sequencer/seq_batcher.mli new file mode 100644 index 0000000000000000000000000000000000000000..0a5909c95a687bfd27daf0f7504832984167eb00 --- /dev/null +++ b/src/lib_scoru_sequencer/seq_batcher.mli @@ -0,0 +1,38 @@ +(*****************************************************************************) +(* *) +(* Open Source License *) +(* Copyright (c) 2022 Nomadic Labs, *) +(* Copyright (c) 2022-2023 TriliTech *) +(* *) +(* 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. *) +(* *) +(*****************************************************************************) + +include Octez_smart_rollup_node_alpha.Daemon_components.Batcher_sig + +(** [register_messages messages] registers new L2 [messages] in the queue of the + batcher for future injection on L1. The messages are evaluated the batcher's incremental + simulation context. *) +val register_messages : string list -> L2_message.hash list tzresult Lwt.t + +(** [get_simulated_state_value key] returns simulated value of durable storage *) +val get_simulated_state_value : string -> bytes option tzresult Lwt.t + +(** [get_optimistic_state_subkeys key] returns simulated subkeys of durable storage *) +val get_simulated_state_subkeys : string -> string list tzresult Lwt.t diff --git a/src/proto_016_PtMumbai/lib_sc_rollup_node/batcher.ml b/src/proto_016_PtMumbai/lib_sc_rollup_node/batcher.ml index aef2a4b610ac6b00ddf9330f6ab3ffc91ffc6c73..cf41999670092d19794e9cd9c70067cb5ffaa3f8 100644 --- a/src/proto_016_PtMumbai/lib_sc_rollup_node/batcher.ml +++ b/src/proto_016_PtMumbai/lib_sc_rollup_node/batcher.ml @@ -28,6 +28,10 @@ open Alpha_context open Batcher_worker_types module Message_queue = Hash_queue.Make (L2_message.Hash) (L2_message) +module Batcher_events = Batcher_events.Declare (struct + let worker_name = "batcher" +end) + module L2_batched_message = struct type t = {content : string; l1_hash : Injector.Inj_operation.hash} end @@ -146,8 +150,6 @@ let produce_batches state ~only_full = to_remove ; return_unit -let on_batch state = produce_batches state ~only_full:false - let simulate node_ctxt simulation_ctxt (messages : L2_message.t list) = let open Lwt_result_syntax in let*? ext_messages = @@ -203,6 +205,8 @@ let on_register state (messages : string list) = let on_new_head state head = let open Lwt_result_syntax in + (* Produce batches first *) + let* () = produce_batches state ~only_full:false in let* simulation_ctxt = Simulation.start_simulation ~reveal_map:None state.node_ctxt head in @@ -288,7 +292,6 @@ module Handlers = struct match request with | Request.Register messages -> protect @@ fun () -> on_register state messages - | Request.Batch -> protect @@ fun () -> on_batch state | Request.New_head head -> protect @@ fun () -> on_new_head state head type launch_error = error trace @@ -310,16 +313,12 @@ module Handlers = struct in match r with | Request.Register _ -> emit_and_return_errors errs - | Request.Batch -> emit_and_return_errors errs | Request.New_head _ -> emit_and_return_errors errs let on_completion _w r _ st = match Request.view r with | Request.View (Register _ | New_head _) -> Batcher_events.(emit Worker.request_completed_debug) (Request.view r, st) - | View Batch -> - Batcher_events.(emit Worker.request_completed_notice) - (Request.view r, st) let on_no_request _ = Lwt.return_unit @@ -378,15 +377,6 @@ let register_messages messages = Worker.Queue.push_request_and_wait w (Request.Register messages) |> handle_request_error -let batch () = - let w = Lazy.force worker in - match w with - | Error _ -> - (* There is no batcher, nothing to do *) - return_unit - | Ok w -> - Worker.Queue.push_request_and_wait w Request.Batch |> handle_request_error - let new_head b = let open Lwt_result_syntax in let w = Lazy.force worker in @@ -395,10 +385,8 @@ let new_head b = (* There is no batcher, nothing to do *) return_unit | Ok w -> - let*! (_pushed : bool) = - Worker.Queue.push_request w (Request.New_head b) - in - return_unit + Worker.Queue.push_request_and_wait w (Request.New_head b) + |> handle_request_error let shutdown () = let w = Lazy.force worker in diff --git a/src/proto_016_PtMumbai/lib_sc_rollup_node/batcher_events.ml b/src/proto_016_PtMumbai/lib_sc_rollup_node/batcher_events.ml index da9ad33fa984124015ca8c1663e77cd5c9bedee5..abe012a2dd0d266f6970b8f12980736f4f22a7c3 100644 --- a/src/proto_016_PtMumbai/lib_sc_rollup_node/batcher_events.ml +++ b/src/proto_016_PtMumbai/lib_sc_rollup_node/batcher_events.ml @@ -23,64 +23,69 @@ (* *) (*****************************************************************************) -include Internal_event.Simple +module Declare (WORKER : sig + val worker_name : string +end) = +struct + include Internal_event.Simple -let section = [Protocol.name; "sc_rollup_node"; "batcher"] + let section = [Protocol.name; "sc_rollup_node"; WORKER.worker_name] -let queue = - declare_1 - ~section - ~name:"queue" - ~msg:"adding {nb_messages} to queue" - ~level:Notice - ("nb_messages", Data_encoding.int31) - -let batched = - declare_2 - ~section - ~name:"batched" - ~msg:"batched {nb_messages} messages into {nb_batches} batches" - ~level:Notice - ("nb_batches", Data_encoding.int31) - ("nb_messages", Data_encoding.int31) - -module Worker = struct - open Batcher_worker_types - - let section = section @ ["worker"] - - let request_failed = - declare_3 + let queue = + declare_1 ~section - ~name:"request_failed" - ~msg:"request {view} failed ({worker_status}): {errors}" - ~level:Warning - ("view", Request.encoding) - ~pp1:Request.pp - ("worker_status", Worker_types.request_status_encoding) - ~pp2:Worker_types.pp_status - ("errors", Error_monad.trace_encoding) - ~pp3:Error_monad.pp_print_trace + ~name:"queue" + ~msg:"adding {nb_messages} to queue" + ~level:Notice + ("nb_messages", Data_encoding.int31) - let request_completed_notice = + let batched = declare_2 ~section - ~name:"request_completed_notice" - ~msg:"{view} {worker_status}" + ~name:"batched" + ~msg:"batched {nb_messages} messages into {nb_batches} batches" ~level:Notice - ("view", Request.encoding) - ("worker_status", Worker_types.request_status_encoding) - ~pp1:Request.pp - ~pp2:Worker_types.pp_status + ("nb_batches", Data_encoding.int31) + ("nb_messages", Data_encoding.int31) - let request_completed_debug = - declare_2 - ~section - ~name:"request_completed_debug" - ~msg:"{view} {worker_status}" - ~level:Debug - ("view", Request.encoding) - ("worker_status", Worker_types.request_status_encoding) - ~pp1:Request.pp - ~pp2:Worker_types.pp_status + module Worker = struct + open Batcher_worker_types + + let section = section @ ["worker"] + + let request_failed = + declare_3 + ~section + ~name:"request_failed" + ~msg:"request {view} failed ({worker_status}): {errors}" + ~level:Warning + ("view", Request.encoding) + ~pp1:Request.pp + ("worker_status", Worker_types.request_status_encoding) + ~pp2:Worker_types.pp_status + ("errors", Error_monad.trace_encoding) + ~pp3:Error_monad.pp_print_trace + + let request_completed_notice = + declare_2 + ~section + ~name:"request_completed_notice" + ~msg:"{view} {worker_status}" + ~level:Notice + ("view", Request.encoding) + ("worker_status", Worker_types.request_status_encoding) + ~pp1:Request.pp + ~pp2:Worker_types.pp_status + + let request_completed_debug = + declare_2 + ~section + ~name:"request_completed_debug" + ~msg:"{view} {worker_status}" + ~level:Debug + ("view", Request.encoding) + ("worker_status", Worker_types.request_status_encoding) + ~pp1:Request.pp + ~pp2:Worker_types.pp_status + end end diff --git a/src/proto_016_PtMumbai/lib_sc_rollup_node/batcher_worker_types.ml b/src/proto_016_PtMumbai/lib_sc_rollup_node/batcher_worker_types.ml index c0fe7350814c9ede1c17f9c55265cdb6e075447f..f7ab4535c26b164841fd61fb10f6d4dd0134ad54 100644 --- a/src/proto_016_PtMumbai/lib_sc_rollup_node/batcher_worker_types.ml +++ b/src/proto_016_PtMumbai/lib_sc_rollup_node/batcher_worker_types.ml @@ -27,7 +27,6 @@ module Request = struct type ('a, 'b) t = | Register : string list -> (L2_message.hash list, error trace) t | New_head : Layer1.head -> (unit, error trace) t - | Batch : (unit, error trace) t type view = View : _ t -> view @@ -54,12 +53,6 @@ module Request = struct (req "block" Layer1.head_encoding)) (function View (New_head b) -> Some ((), b) | _ -> None) (fun ((), b) -> View (New_head b)); - case - (Tag 2) - ~title:"Batch" - (obj1 (req "request" (constant "batch"))) - (function View Batch -> Some () | _ -> None) - (fun () -> View Batch); ] let pp ppf (View r) = @@ -73,5 +66,4 @@ module Request = struct Block_hash.pp hash level - | Batch -> Format.pp_print_string ppf "batch" end diff --git a/src/proto_016_PtMumbai/lib_sc_rollup_node/batcher_worker_types.mli b/src/proto_016_PtMumbai/lib_sc_rollup_node/batcher_worker_types.mli index d3a3fd2c09e963cb9b9655a92c2d411893aa8343..fd6ba038ada187a063446a07044418a5b878cb0a 100644 --- a/src/proto_016_PtMumbai/lib_sc_rollup_node/batcher_worker_types.mli +++ b/src/proto_016_PtMumbai/lib_sc_rollup_node/batcher_worker_types.mli @@ -33,7 +33,6 @@ module Request : sig (** Request to register new L2 messages in the queue. *) | New_head : Layer1.head -> (unit, error trace) t (** Request to handle a new L1 head. *) - | Batch : (unit, error trace) t (** Request to produce batches. *) type view = View : _ t -> view diff --git a/src/proto_016_PtMumbai/lib_sc_rollup_node/daemon.ml b/src/proto_016_PtMumbai/lib_sc_rollup_node/daemon.ml index b8c9d40c8540acb842b5353a4b0b733234e23394..03ee630ad4a43b61468b4372c47cde2568a6e6fa 100644 --- a/src/proto_016_PtMumbai/lib_sc_rollup_node/daemon.ml +++ b/src/proto_016_PtMumbai/lib_sc_rollup_node/daemon.ml @@ -529,7 +529,6 @@ let on_layer_1_head (daemon_components : (module Daemon_components.S)) node_ctxt let* () = Publisher.cement_commitments () in let*! () = Daemon_event.new_heads_processed reorg.new_chain in let* () = Refutation_coordinator.process stripped_head in - let* () = Components.Batcher.batch () in let* () = Components.Batcher.new_head stripped_head in let*! () = Injector.inject ~header:head.header () in let* () = exit_after_proto_migration node_ctxt head in diff --git a/src/proto_016_PtMumbai/lib_sc_rollup_node/daemon_components.ml b/src/proto_016_PtMumbai/lib_sc_rollup_node/daemon_components.ml index 8b951410f4faafc20bc2a7a069f2955729bd0d5c..c94bfd0e5dc1d61a342ceca5ff5e48d684bb45f3 100644 --- a/src/proto_016_PtMumbai/lib_sc_rollup_node/daemon_components.ml +++ b/src/proto_016_PtMumbai/lib_sc_rollup_node/daemon_components.ml @@ -38,12 +38,10 @@ module type Batcher_sig = sig _ Node_context.t -> unit tzresult Lwt.t - (** Create L2 batches of operations from the queue and pack them in an L1 batch - operation. The batch operation is queued in the injector for injection on - the Tezos node. *) - val batch : unit -> unit tzresult Lwt.t - - (** Notify a new L2 head to the batcher worker. *) + (** Create L2 batches of operations from the queue and pack each batch in an L1 + operation. The L1 operations (i.e. L2 batches) are queued in the injector for + injection on the Tezos node. + *) val new_head : Layer1.head -> unit tzresult Lwt.t (** Shutdown the batcher, waiting for the ongoing request to be processed. *) diff --git a/src/proto_016_PtMumbai/lib_sc_rollup_node/wasm_2_0_0_pvm.ml b/src/proto_016_PtMumbai/lib_sc_rollup_node/wasm_2_0_0_pvm.ml index 2f076863ca3dbd98d4f352a0e8cc2e5bbd8e664c..3f7d14535184a7b9b2d88c424a35dedaf416c2cd 100644 --- a/src/proto_016_PtMumbai/lib_sc_rollup_node/wasm_2_0_0_pvm.ml +++ b/src/proto_016_PtMumbai/lib_sc_rollup_node/wasm_2_0_0_pvm.ml @@ -123,13 +123,10 @@ module Make_durable_state Tezos_scoru_wasm.Durable.list durable key end -module type S = sig - module Durable_state : Durable_state with type state = Context.tree +module Durable_state = + Make_durable_state (Make_wrapped_tree (Wasm_2_0_0_proof_format.Tree)) - include Pvm.S -end - -module Impl : S = struct +module Impl : Pvm.S = struct module PVM = Sc_rollup.Wasm_2_0_0PVM.Make (Make_backend) (Wasm_2_0_0_proof_format) include PVM @@ -139,8 +136,6 @@ module Impl : S = struct let new_dissection = Game_helpers.Wasm.new_dissection module State = Context.PVMState - module Durable_state = - Make_durable_state (Make_wrapped_tree (Wasm_2_0_0_proof_format.Tree)) module Inspect_durable_state = struct let lookup state keys = diff --git a/src/proto_017_PtNairob/lib_sc_rollup_node/batcher.ml b/src/proto_017_PtNairob/lib_sc_rollup_node/batcher.ml index aef2a4b610ac6b00ddf9330f6ab3ffc91ffc6c73..cf41999670092d19794e9cd9c70067cb5ffaa3f8 100644 --- a/src/proto_017_PtNairob/lib_sc_rollup_node/batcher.ml +++ b/src/proto_017_PtNairob/lib_sc_rollup_node/batcher.ml @@ -28,6 +28,10 @@ open Alpha_context open Batcher_worker_types module Message_queue = Hash_queue.Make (L2_message.Hash) (L2_message) +module Batcher_events = Batcher_events.Declare (struct + let worker_name = "batcher" +end) + module L2_batched_message = struct type t = {content : string; l1_hash : Injector.Inj_operation.hash} end @@ -146,8 +150,6 @@ let produce_batches state ~only_full = to_remove ; return_unit -let on_batch state = produce_batches state ~only_full:false - let simulate node_ctxt simulation_ctxt (messages : L2_message.t list) = let open Lwt_result_syntax in let*? ext_messages = @@ -203,6 +205,8 @@ let on_register state (messages : string list) = let on_new_head state head = let open Lwt_result_syntax in + (* Produce batches first *) + let* () = produce_batches state ~only_full:false in let* simulation_ctxt = Simulation.start_simulation ~reveal_map:None state.node_ctxt head in @@ -288,7 +292,6 @@ module Handlers = struct match request with | Request.Register messages -> protect @@ fun () -> on_register state messages - | Request.Batch -> protect @@ fun () -> on_batch state | Request.New_head head -> protect @@ fun () -> on_new_head state head type launch_error = error trace @@ -310,16 +313,12 @@ module Handlers = struct in match r with | Request.Register _ -> emit_and_return_errors errs - | Request.Batch -> emit_and_return_errors errs | Request.New_head _ -> emit_and_return_errors errs let on_completion _w r _ st = match Request.view r with | Request.View (Register _ | New_head _) -> Batcher_events.(emit Worker.request_completed_debug) (Request.view r, st) - | View Batch -> - Batcher_events.(emit Worker.request_completed_notice) - (Request.view r, st) let on_no_request _ = Lwt.return_unit @@ -378,15 +377,6 @@ let register_messages messages = Worker.Queue.push_request_and_wait w (Request.Register messages) |> handle_request_error -let batch () = - let w = Lazy.force worker in - match w with - | Error _ -> - (* There is no batcher, nothing to do *) - return_unit - | Ok w -> - Worker.Queue.push_request_and_wait w Request.Batch |> handle_request_error - let new_head b = let open Lwt_result_syntax in let w = Lazy.force worker in @@ -395,10 +385,8 @@ let new_head b = (* There is no batcher, nothing to do *) return_unit | Ok w -> - let*! (_pushed : bool) = - Worker.Queue.push_request w (Request.New_head b) - in - return_unit + Worker.Queue.push_request_and_wait w (Request.New_head b) + |> handle_request_error let shutdown () = let w = Lazy.force worker in diff --git a/src/proto_017_PtNairob/lib_sc_rollup_node/batcher_events.ml b/src/proto_017_PtNairob/lib_sc_rollup_node/batcher_events.ml index da9ad33fa984124015ca8c1663e77cd5c9bedee5..abe012a2dd0d266f6970b8f12980736f4f22a7c3 100644 --- a/src/proto_017_PtNairob/lib_sc_rollup_node/batcher_events.ml +++ b/src/proto_017_PtNairob/lib_sc_rollup_node/batcher_events.ml @@ -23,64 +23,69 @@ (* *) (*****************************************************************************) -include Internal_event.Simple +module Declare (WORKER : sig + val worker_name : string +end) = +struct + include Internal_event.Simple -let section = [Protocol.name; "sc_rollup_node"; "batcher"] + let section = [Protocol.name; "sc_rollup_node"; WORKER.worker_name] -let queue = - declare_1 - ~section - ~name:"queue" - ~msg:"adding {nb_messages} to queue" - ~level:Notice - ("nb_messages", Data_encoding.int31) - -let batched = - declare_2 - ~section - ~name:"batched" - ~msg:"batched {nb_messages} messages into {nb_batches} batches" - ~level:Notice - ("nb_batches", Data_encoding.int31) - ("nb_messages", Data_encoding.int31) - -module Worker = struct - open Batcher_worker_types - - let section = section @ ["worker"] - - let request_failed = - declare_3 + let queue = + declare_1 ~section - ~name:"request_failed" - ~msg:"request {view} failed ({worker_status}): {errors}" - ~level:Warning - ("view", Request.encoding) - ~pp1:Request.pp - ("worker_status", Worker_types.request_status_encoding) - ~pp2:Worker_types.pp_status - ("errors", Error_monad.trace_encoding) - ~pp3:Error_monad.pp_print_trace + ~name:"queue" + ~msg:"adding {nb_messages} to queue" + ~level:Notice + ("nb_messages", Data_encoding.int31) - let request_completed_notice = + let batched = declare_2 ~section - ~name:"request_completed_notice" - ~msg:"{view} {worker_status}" + ~name:"batched" + ~msg:"batched {nb_messages} messages into {nb_batches} batches" ~level:Notice - ("view", Request.encoding) - ("worker_status", Worker_types.request_status_encoding) - ~pp1:Request.pp - ~pp2:Worker_types.pp_status + ("nb_batches", Data_encoding.int31) + ("nb_messages", Data_encoding.int31) - let request_completed_debug = - declare_2 - ~section - ~name:"request_completed_debug" - ~msg:"{view} {worker_status}" - ~level:Debug - ("view", Request.encoding) - ("worker_status", Worker_types.request_status_encoding) - ~pp1:Request.pp - ~pp2:Worker_types.pp_status + module Worker = struct + open Batcher_worker_types + + let section = section @ ["worker"] + + let request_failed = + declare_3 + ~section + ~name:"request_failed" + ~msg:"request {view} failed ({worker_status}): {errors}" + ~level:Warning + ("view", Request.encoding) + ~pp1:Request.pp + ("worker_status", Worker_types.request_status_encoding) + ~pp2:Worker_types.pp_status + ("errors", Error_monad.trace_encoding) + ~pp3:Error_monad.pp_print_trace + + let request_completed_notice = + declare_2 + ~section + ~name:"request_completed_notice" + ~msg:"{view} {worker_status}" + ~level:Notice + ("view", Request.encoding) + ("worker_status", Worker_types.request_status_encoding) + ~pp1:Request.pp + ~pp2:Worker_types.pp_status + + let request_completed_debug = + declare_2 + ~section + ~name:"request_completed_debug" + ~msg:"{view} {worker_status}" + ~level:Debug + ("view", Request.encoding) + ("worker_status", Worker_types.request_status_encoding) + ~pp1:Request.pp + ~pp2:Worker_types.pp_status + end end diff --git a/src/proto_017_PtNairob/lib_sc_rollup_node/batcher_worker_types.ml b/src/proto_017_PtNairob/lib_sc_rollup_node/batcher_worker_types.ml index c0fe7350814c9ede1c17f9c55265cdb6e075447f..f7ab4535c26b164841fd61fb10f6d4dd0134ad54 100644 --- a/src/proto_017_PtNairob/lib_sc_rollup_node/batcher_worker_types.ml +++ b/src/proto_017_PtNairob/lib_sc_rollup_node/batcher_worker_types.ml @@ -27,7 +27,6 @@ module Request = struct type ('a, 'b) t = | Register : string list -> (L2_message.hash list, error trace) t | New_head : Layer1.head -> (unit, error trace) t - | Batch : (unit, error trace) t type view = View : _ t -> view @@ -54,12 +53,6 @@ module Request = struct (req "block" Layer1.head_encoding)) (function View (New_head b) -> Some ((), b) | _ -> None) (fun ((), b) -> View (New_head b)); - case - (Tag 2) - ~title:"Batch" - (obj1 (req "request" (constant "batch"))) - (function View Batch -> Some () | _ -> None) - (fun () -> View Batch); ] let pp ppf (View r) = @@ -73,5 +66,4 @@ module Request = struct Block_hash.pp hash level - | Batch -> Format.pp_print_string ppf "batch" end diff --git a/src/proto_017_PtNairob/lib_sc_rollup_node/batcher_worker_types.mli b/src/proto_017_PtNairob/lib_sc_rollup_node/batcher_worker_types.mli index d3a3fd2c09e963cb9b9655a92c2d411893aa8343..fd6ba038ada187a063446a07044418a5b878cb0a 100644 --- a/src/proto_017_PtNairob/lib_sc_rollup_node/batcher_worker_types.mli +++ b/src/proto_017_PtNairob/lib_sc_rollup_node/batcher_worker_types.mli @@ -33,7 +33,6 @@ module Request : sig (** Request to register new L2 messages in the queue. *) | New_head : Layer1.head -> (unit, error trace) t (** Request to handle a new L1 head. *) - | Batch : (unit, error trace) t (** Request to produce batches. *) type view = View : _ t -> view diff --git a/src/proto_017_PtNairob/lib_sc_rollup_node/daemon.ml b/src/proto_017_PtNairob/lib_sc_rollup_node/daemon.ml index f748c83dcff64de841b951a6013beaeccc58cca9..7a2dca4673b346a1550cdc6570c1452989f3223e 100644 --- a/src/proto_017_PtNairob/lib_sc_rollup_node/daemon.ml +++ b/src/proto_017_PtNairob/lib_sc_rollup_node/daemon.ml @@ -525,7 +525,6 @@ let on_layer_1_head (daemon_components : (module Daemon_components.S)) node_ctxt let* () = Publisher.cement_commitments () in let*! () = Daemon_event.new_heads_processed reorg.new_chain in let* () = Refutation_coordinator.process stripped_head in - let* () = Components.Batcher.batch () in let* () = Components.Batcher.new_head stripped_head in let*! () = Injector.inject ~header:head.header () in let* () = exit_after_proto_migration node_ctxt head in diff --git a/src/proto_017_PtNairob/lib_sc_rollup_node/daemon_components.ml b/src/proto_017_PtNairob/lib_sc_rollup_node/daemon_components.ml index 8b951410f4faafc20bc2a7a069f2955729bd0d5c..c94bfd0e5dc1d61a342ceca5ff5e48d684bb45f3 100644 --- a/src/proto_017_PtNairob/lib_sc_rollup_node/daemon_components.ml +++ b/src/proto_017_PtNairob/lib_sc_rollup_node/daemon_components.ml @@ -38,12 +38,10 @@ module type Batcher_sig = sig _ Node_context.t -> unit tzresult Lwt.t - (** Create L2 batches of operations from the queue and pack them in an L1 batch - operation. The batch operation is queued in the injector for injection on - the Tezos node. *) - val batch : unit -> unit tzresult Lwt.t - - (** Notify a new L2 head to the batcher worker. *) + (** Create L2 batches of operations from the queue and pack each batch in an L1 + operation. The L1 operations (i.e. L2 batches) are queued in the injector for + injection on the Tezos node. + *) val new_head : Layer1.head -> unit tzresult Lwt.t (** Shutdown the batcher, waiting for the ongoing request to be processed. *) diff --git a/src/proto_017_PtNairob/lib_sc_rollup_node/wasm_2_0_0_pvm.ml b/src/proto_017_PtNairob/lib_sc_rollup_node/wasm_2_0_0_pvm.ml index c8d47b073c73467221800cb4cde709ab983fbbae..58d6d46968a1979d65e8564e9dba7923770277ec 100644 --- a/src/proto_017_PtNairob/lib_sc_rollup_node/wasm_2_0_0_pvm.ml +++ b/src/proto_017_PtNairob/lib_sc_rollup_node/wasm_2_0_0_pvm.ml @@ -120,13 +120,10 @@ module Make_durable_state Tezos_scoru_wasm.Durable.list durable key end -module type S = sig - module Durable_state : Durable_state with type state = Context.tree +module Durable_state = + Make_durable_state (Make_wrapped_tree (Wasm_2_0_0_proof_format.Tree)) - include Pvm.S -end - -module Impl : S = struct +module Impl : Pvm.S = struct module PVM = Sc_rollup.Wasm_2_0_0PVM.Make (Make_backend) (Wasm_2_0_0_proof_format) include PVM @@ -136,8 +133,6 @@ module Impl : S = struct let new_dissection = Game_helpers.Wasm.new_dissection module State = Context.PVMState - module Durable_state = - Make_durable_state (Make_wrapped_tree (Wasm_2_0_0_proof_format.Tree)) module Inspect_durable_state = struct let lookup state keys = diff --git a/src/proto_018_Proxford/lib_sc_rollup_node/batcher.ml b/src/proto_018_Proxford/lib_sc_rollup_node/batcher.ml index aef2a4b610ac6b00ddf9330f6ab3ffc91ffc6c73..cf41999670092d19794e9cd9c70067cb5ffaa3f8 100644 --- a/src/proto_018_Proxford/lib_sc_rollup_node/batcher.ml +++ b/src/proto_018_Proxford/lib_sc_rollup_node/batcher.ml @@ -28,6 +28,10 @@ open Alpha_context open Batcher_worker_types module Message_queue = Hash_queue.Make (L2_message.Hash) (L2_message) +module Batcher_events = Batcher_events.Declare (struct + let worker_name = "batcher" +end) + module L2_batched_message = struct type t = {content : string; l1_hash : Injector.Inj_operation.hash} end @@ -146,8 +150,6 @@ let produce_batches state ~only_full = to_remove ; return_unit -let on_batch state = produce_batches state ~only_full:false - let simulate node_ctxt simulation_ctxt (messages : L2_message.t list) = let open Lwt_result_syntax in let*? ext_messages = @@ -203,6 +205,8 @@ let on_register state (messages : string list) = let on_new_head state head = let open Lwt_result_syntax in + (* Produce batches first *) + let* () = produce_batches state ~only_full:false in let* simulation_ctxt = Simulation.start_simulation ~reveal_map:None state.node_ctxt head in @@ -288,7 +292,6 @@ module Handlers = struct match request with | Request.Register messages -> protect @@ fun () -> on_register state messages - | Request.Batch -> protect @@ fun () -> on_batch state | Request.New_head head -> protect @@ fun () -> on_new_head state head type launch_error = error trace @@ -310,16 +313,12 @@ module Handlers = struct in match r with | Request.Register _ -> emit_and_return_errors errs - | Request.Batch -> emit_and_return_errors errs | Request.New_head _ -> emit_and_return_errors errs let on_completion _w r _ st = match Request.view r with | Request.View (Register _ | New_head _) -> Batcher_events.(emit Worker.request_completed_debug) (Request.view r, st) - | View Batch -> - Batcher_events.(emit Worker.request_completed_notice) - (Request.view r, st) let on_no_request _ = Lwt.return_unit @@ -378,15 +377,6 @@ let register_messages messages = Worker.Queue.push_request_and_wait w (Request.Register messages) |> handle_request_error -let batch () = - let w = Lazy.force worker in - match w with - | Error _ -> - (* There is no batcher, nothing to do *) - return_unit - | Ok w -> - Worker.Queue.push_request_and_wait w Request.Batch |> handle_request_error - let new_head b = let open Lwt_result_syntax in let w = Lazy.force worker in @@ -395,10 +385,8 @@ let new_head b = (* There is no batcher, nothing to do *) return_unit | Ok w -> - let*! (_pushed : bool) = - Worker.Queue.push_request w (Request.New_head b) - in - return_unit + Worker.Queue.push_request_and_wait w (Request.New_head b) + |> handle_request_error let shutdown () = let w = Lazy.force worker in diff --git a/src/proto_018_Proxford/lib_sc_rollup_node/batcher.mli b/src/proto_018_Proxford/lib_sc_rollup_node/batcher.mli index baac151308971d85936cd756ef5b531d32f19602..f38610bade8e27745ce4bdab2d7f0bfdb09ce572 100644 --- a/src/proto_018_Proxford/lib_sc_rollup_node/batcher.mli +++ b/src/proto_018_Proxford/lib_sc_rollup_node/batcher.mli @@ -23,25 +23,7 @@ (* *) (*****************************************************************************) -(** [init config ~signer node_ctxt] initializes and starts the batcher for - [signer]. If [config.simulation] is [true] (the default), messages added to - the batcher are simulated in an incremental simulation context. *) -val init : - Configuration.batcher -> - signer:Signature.public_key_hash -> - _ Node_context.t -> - unit tzresult Lwt.t - -(** Create L2 batches of operations from the queue and pack them in an L1 batch - operation. The batch operation is queued in the injector for injection on - the Tezos node. *) -val batch : unit -> unit tzresult Lwt.t - -(** Notify a new L2 head to the batcher worker. *) -val new_head : Layer1.head -> unit tzresult Lwt.t - -(** Shutdown the batcher, waiting for the ongoing request to be processed. *) -val shutdown : unit -> unit Lwt.t +include Daemon_components.Batcher_sig (** The type for the status of messages in the batcher. *) type status = diff --git a/src/proto_018_Proxford/lib_sc_rollup_node/batcher_events.ml b/src/proto_018_Proxford/lib_sc_rollup_node/batcher_events.ml index da9ad33fa984124015ca8c1663e77cd5c9bedee5..abe012a2dd0d266f6970b8f12980736f4f22a7c3 100644 --- a/src/proto_018_Proxford/lib_sc_rollup_node/batcher_events.ml +++ b/src/proto_018_Proxford/lib_sc_rollup_node/batcher_events.ml @@ -23,64 +23,69 @@ (* *) (*****************************************************************************) -include Internal_event.Simple +module Declare (WORKER : sig + val worker_name : string +end) = +struct + include Internal_event.Simple -let section = [Protocol.name; "sc_rollup_node"; "batcher"] + let section = [Protocol.name; "sc_rollup_node"; WORKER.worker_name] -let queue = - declare_1 - ~section - ~name:"queue" - ~msg:"adding {nb_messages} to queue" - ~level:Notice - ("nb_messages", Data_encoding.int31) - -let batched = - declare_2 - ~section - ~name:"batched" - ~msg:"batched {nb_messages} messages into {nb_batches} batches" - ~level:Notice - ("nb_batches", Data_encoding.int31) - ("nb_messages", Data_encoding.int31) - -module Worker = struct - open Batcher_worker_types - - let section = section @ ["worker"] - - let request_failed = - declare_3 + let queue = + declare_1 ~section - ~name:"request_failed" - ~msg:"request {view} failed ({worker_status}): {errors}" - ~level:Warning - ("view", Request.encoding) - ~pp1:Request.pp - ("worker_status", Worker_types.request_status_encoding) - ~pp2:Worker_types.pp_status - ("errors", Error_monad.trace_encoding) - ~pp3:Error_monad.pp_print_trace + ~name:"queue" + ~msg:"adding {nb_messages} to queue" + ~level:Notice + ("nb_messages", Data_encoding.int31) - let request_completed_notice = + let batched = declare_2 ~section - ~name:"request_completed_notice" - ~msg:"{view} {worker_status}" + ~name:"batched" + ~msg:"batched {nb_messages} messages into {nb_batches} batches" ~level:Notice - ("view", Request.encoding) - ("worker_status", Worker_types.request_status_encoding) - ~pp1:Request.pp - ~pp2:Worker_types.pp_status + ("nb_batches", Data_encoding.int31) + ("nb_messages", Data_encoding.int31) - let request_completed_debug = - declare_2 - ~section - ~name:"request_completed_debug" - ~msg:"{view} {worker_status}" - ~level:Debug - ("view", Request.encoding) - ("worker_status", Worker_types.request_status_encoding) - ~pp1:Request.pp - ~pp2:Worker_types.pp_status + module Worker = struct + open Batcher_worker_types + + let section = section @ ["worker"] + + let request_failed = + declare_3 + ~section + ~name:"request_failed" + ~msg:"request {view} failed ({worker_status}): {errors}" + ~level:Warning + ("view", Request.encoding) + ~pp1:Request.pp + ("worker_status", Worker_types.request_status_encoding) + ~pp2:Worker_types.pp_status + ("errors", Error_monad.trace_encoding) + ~pp3:Error_monad.pp_print_trace + + let request_completed_notice = + declare_2 + ~section + ~name:"request_completed_notice" + ~msg:"{view} {worker_status}" + ~level:Notice + ("view", Request.encoding) + ("worker_status", Worker_types.request_status_encoding) + ~pp1:Request.pp + ~pp2:Worker_types.pp_status + + let request_completed_debug = + declare_2 + ~section + ~name:"request_completed_debug" + ~msg:"{view} {worker_status}" + ~level:Debug + ("view", Request.encoding) + ("worker_status", Worker_types.request_status_encoding) + ~pp1:Request.pp + ~pp2:Worker_types.pp_status + end end diff --git a/src/proto_018_Proxford/lib_sc_rollup_node/batcher_worker_types.ml b/src/proto_018_Proxford/lib_sc_rollup_node/batcher_worker_types.ml index c0fe7350814c9ede1c17f9c55265cdb6e075447f..f7ab4535c26b164841fd61fb10f6d4dd0134ad54 100644 --- a/src/proto_018_Proxford/lib_sc_rollup_node/batcher_worker_types.ml +++ b/src/proto_018_Proxford/lib_sc_rollup_node/batcher_worker_types.ml @@ -27,7 +27,6 @@ module Request = struct type ('a, 'b) t = | Register : string list -> (L2_message.hash list, error trace) t | New_head : Layer1.head -> (unit, error trace) t - | Batch : (unit, error trace) t type view = View : _ t -> view @@ -54,12 +53,6 @@ module Request = struct (req "block" Layer1.head_encoding)) (function View (New_head b) -> Some ((), b) | _ -> None) (fun ((), b) -> View (New_head b)); - case - (Tag 2) - ~title:"Batch" - (obj1 (req "request" (constant "batch"))) - (function View Batch -> Some () | _ -> None) - (fun () -> View Batch); ] let pp ppf (View r) = @@ -73,5 +66,4 @@ module Request = struct Block_hash.pp hash level - | Batch -> Format.pp_print_string ppf "batch" end diff --git a/src/proto_018_Proxford/lib_sc_rollup_node/batcher_worker_types.mli b/src/proto_018_Proxford/lib_sc_rollup_node/batcher_worker_types.mli index d3a3fd2c09e963cb9b9655a92c2d411893aa8343..fd6ba038ada187a063446a07044418a5b878cb0a 100644 --- a/src/proto_018_Proxford/lib_sc_rollup_node/batcher_worker_types.mli +++ b/src/proto_018_Proxford/lib_sc_rollup_node/batcher_worker_types.mli @@ -33,7 +33,6 @@ module Request : sig (** Request to register new L2 messages in the queue. *) | New_head : Layer1.head -> (unit, error trace) t (** Request to handle a new L1 head. *) - | Batch : (unit, error trace) t (** Request to produce batches. *) type view = View : _ t -> view diff --git a/src/proto_018_Proxford/lib_sc_rollup_node/daemon.ml b/src/proto_018_Proxford/lib_sc_rollup_node/daemon.ml index 17d3c733c5810ef251af9f0e329d9122ca27def9..78c9bc577c5ab9e303eda96249b24b4652f23098 100644 --- a/src/proto_018_Proxford/lib_sc_rollup_node/daemon.ml +++ b/src/proto_018_Proxford/lib_sc_rollup_node/daemon.ml @@ -526,7 +526,6 @@ let on_layer_1_head (daemon_components : (module Daemon_components.S)) node_ctxt let* () = Publisher.cement_commitments () in let*! () = Daemon_event.new_heads_processed reorg.new_chain in let* () = Refutation_coordinator.process stripped_head in - let* () = Components.Batcher.batch () in let* () = Components.Batcher.new_head stripped_head in let*! () = Injector.inject ~header:head.header () in let* () = exit_after_proto_migration node_ctxt head in diff --git a/src/proto_018_Proxford/lib_sc_rollup_node/daemon_components.ml b/src/proto_018_Proxford/lib_sc_rollup_node/daemon_components.ml index 8b951410f4faafc20bc2a7a069f2955729bd0d5c..c94bfd0e5dc1d61a342ceca5ff5e48d684bb45f3 100644 --- a/src/proto_018_Proxford/lib_sc_rollup_node/daemon_components.ml +++ b/src/proto_018_Proxford/lib_sc_rollup_node/daemon_components.ml @@ -38,12 +38,10 @@ module type Batcher_sig = sig _ Node_context.t -> unit tzresult Lwt.t - (** Create L2 batches of operations from the queue and pack them in an L1 batch - operation. The batch operation is queued in the injector for injection on - the Tezos node. *) - val batch : unit -> unit tzresult Lwt.t - - (** Notify a new L2 head to the batcher worker. *) + (** Create L2 batches of operations from the queue and pack each batch in an L1 + operation. The L1 operations (i.e. L2 batches) are queued in the injector for + injection on the Tezos node. + *) val new_head : Layer1.head -> unit tzresult Lwt.t (** Shutdown the batcher, waiting for the ongoing request to be processed. *) diff --git a/src/proto_018_Proxford/lib_sc_rollup_node/wasm_2_0_0_pvm.ml b/src/proto_018_Proxford/lib_sc_rollup_node/wasm_2_0_0_pvm.ml index c8d47b073c73467221800cb4cde709ab983fbbae..58d6d46968a1979d65e8564e9dba7923770277ec 100644 --- a/src/proto_018_Proxford/lib_sc_rollup_node/wasm_2_0_0_pvm.ml +++ b/src/proto_018_Proxford/lib_sc_rollup_node/wasm_2_0_0_pvm.ml @@ -120,13 +120,10 @@ module Make_durable_state Tezos_scoru_wasm.Durable.list durable key end -module type S = sig - module Durable_state : Durable_state with type state = Context.tree +module Durable_state = + Make_durable_state (Make_wrapped_tree (Wasm_2_0_0_proof_format.Tree)) - include Pvm.S -end - -module Impl : S = struct +module Impl : Pvm.S = struct module PVM = Sc_rollup.Wasm_2_0_0PVM.Make (Make_backend) (Wasm_2_0_0_proof_format) include PVM @@ -136,8 +133,6 @@ module Impl : S = struct let new_dissection = Game_helpers.Wasm.new_dissection module State = Context.PVMState - module Durable_state = - Make_durable_state (Make_wrapped_tree (Wasm_2_0_0_proof_format.Tree)) module Inspect_durable_state = struct let lookup state keys = diff --git a/src/proto_alpha/lib_sc_rollup_node/batcher.ml b/src/proto_alpha/lib_sc_rollup_node/batcher.ml index aef2a4b610ac6b00ddf9330f6ab3ffc91ffc6c73..cf41999670092d19794e9cd9c70067cb5ffaa3f8 100644 --- a/src/proto_alpha/lib_sc_rollup_node/batcher.ml +++ b/src/proto_alpha/lib_sc_rollup_node/batcher.ml @@ -28,6 +28,10 @@ open Alpha_context open Batcher_worker_types module Message_queue = Hash_queue.Make (L2_message.Hash) (L2_message) +module Batcher_events = Batcher_events.Declare (struct + let worker_name = "batcher" +end) + module L2_batched_message = struct type t = {content : string; l1_hash : Injector.Inj_operation.hash} end @@ -146,8 +150,6 @@ let produce_batches state ~only_full = to_remove ; return_unit -let on_batch state = produce_batches state ~only_full:false - let simulate node_ctxt simulation_ctxt (messages : L2_message.t list) = let open Lwt_result_syntax in let*? ext_messages = @@ -203,6 +205,8 @@ let on_register state (messages : string list) = let on_new_head state head = let open Lwt_result_syntax in + (* Produce batches first *) + let* () = produce_batches state ~only_full:false in let* simulation_ctxt = Simulation.start_simulation ~reveal_map:None state.node_ctxt head in @@ -288,7 +292,6 @@ module Handlers = struct match request with | Request.Register messages -> protect @@ fun () -> on_register state messages - | Request.Batch -> protect @@ fun () -> on_batch state | Request.New_head head -> protect @@ fun () -> on_new_head state head type launch_error = error trace @@ -310,16 +313,12 @@ module Handlers = struct in match r with | Request.Register _ -> emit_and_return_errors errs - | Request.Batch -> emit_and_return_errors errs | Request.New_head _ -> emit_and_return_errors errs let on_completion _w r _ st = match Request.view r with | Request.View (Register _ | New_head _) -> Batcher_events.(emit Worker.request_completed_debug) (Request.view r, st) - | View Batch -> - Batcher_events.(emit Worker.request_completed_notice) - (Request.view r, st) let on_no_request _ = Lwt.return_unit @@ -378,15 +377,6 @@ let register_messages messages = Worker.Queue.push_request_and_wait w (Request.Register messages) |> handle_request_error -let batch () = - let w = Lazy.force worker in - match w with - | Error _ -> - (* There is no batcher, nothing to do *) - return_unit - | Ok w -> - Worker.Queue.push_request_and_wait w Request.Batch |> handle_request_error - let new_head b = let open Lwt_result_syntax in let w = Lazy.force worker in @@ -395,10 +385,8 @@ let new_head b = (* There is no batcher, nothing to do *) return_unit | Ok w -> - let*! (_pushed : bool) = - Worker.Queue.push_request w (Request.New_head b) - in - return_unit + Worker.Queue.push_request_and_wait w (Request.New_head b) + |> handle_request_error let shutdown () = let w = Lazy.force worker in diff --git a/src/proto_alpha/lib_sc_rollup_node/batcher_events.ml b/src/proto_alpha/lib_sc_rollup_node/batcher_events.ml index da9ad33fa984124015ca8c1663e77cd5c9bedee5..abe012a2dd0d266f6970b8f12980736f4f22a7c3 100644 --- a/src/proto_alpha/lib_sc_rollup_node/batcher_events.ml +++ b/src/proto_alpha/lib_sc_rollup_node/batcher_events.ml @@ -23,64 +23,69 @@ (* *) (*****************************************************************************) -include Internal_event.Simple +module Declare (WORKER : sig + val worker_name : string +end) = +struct + include Internal_event.Simple -let section = [Protocol.name; "sc_rollup_node"; "batcher"] + let section = [Protocol.name; "sc_rollup_node"; WORKER.worker_name] -let queue = - declare_1 - ~section - ~name:"queue" - ~msg:"adding {nb_messages} to queue" - ~level:Notice - ("nb_messages", Data_encoding.int31) - -let batched = - declare_2 - ~section - ~name:"batched" - ~msg:"batched {nb_messages} messages into {nb_batches} batches" - ~level:Notice - ("nb_batches", Data_encoding.int31) - ("nb_messages", Data_encoding.int31) - -module Worker = struct - open Batcher_worker_types - - let section = section @ ["worker"] - - let request_failed = - declare_3 + let queue = + declare_1 ~section - ~name:"request_failed" - ~msg:"request {view} failed ({worker_status}): {errors}" - ~level:Warning - ("view", Request.encoding) - ~pp1:Request.pp - ("worker_status", Worker_types.request_status_encoding) - ~pp2:Worker_types.pp_status - ("errors", Error_monad.trace_encoding) - ~pp3:Error_monad.pp_print_trace + ~name:"queue" + ~msg:"adding {nb_messages} to queue" + ~level:Notice + ("nb_messages", Data_encoding.int31) - let request_completed_notice = + let batched = declare_2 ~section - ~name:"request_completed_notice" - ~msg:"{view} {worker_status}" + ~name:"batched" + ~msg:"batched {nb_messages} messages into {nb_batches} batches" ~level:Notice - ("view", Request.encoding) - ("worker_status", Worker_types.request_status_encoding) - ~pp1:Request.pp - ~pp2:Worker_types.pp_status + ("nb_batches", Data_encoding.int31) + ("nb_messages", Data_encoding.int31) - let request_completed_debug = - declare_2 - ~section - ~name:"request_completed_debug" - ~msg:"{view} {worker_status}" - ~level:Debug - ("view", Request.encoding) - ("worker_status", Worker_types.request_status_encoding) - ~pp1:Request.pp - ~pp2:Worker_types.pp_status + module Worker = struct + open Batcher_worker_types + + let section = section @ ["worker"] + + let request_failed = + declare_3 + ~section + ~name:"request_failed" + ~msg:"request {view} failed ({worker_status}): {errors}" + ~level:Warning + ("view", Request.encoding) + ~pp1:Request.pp + ("worker_status", Worker_types.request_status_encoding) + ~pp2:Worker_types.pp_status + ("errors", Error_monad.trace_encoding) + ~pp3:Error_monad.pp_print_trace + + let request_completed_notice = + declare_2 + ~section + ~name:"request_completed_notice" + ~msg:"{view} {worker_status}" + ~level:Notice + ("view", Request.encoding) + ("worker_status", Worker_types.request_status_encoding) + ~pp1:Request.pp + ~pp2:Worker_types.pp_status + + let request_completed_debug = + declare_2 + ~section + ~name:"request_completed_debug" + ~msg:"{view} {worker_status}" + ~level:Debug + ("view", Request.encoding) + ("worker_status", Worker_types.request_status_encoding) + ~pp1:Request.pp + ~pp2:Worker_types.pp_status + end end diff --git a/src/proto_alpha/lib_sc_rollup_node/batcher_worker_types.ml b/src/proto_alpha/lib_sc_rollup_node/batcher_worker_types.ml index c0fe7350814c9ede1c17f9c55265cdb6e075447f..f7ab4535c26b164841fd61fb10f6d4dd0134ad54 100644 --- a/src/proto_alpha/lib_sc_rollup_node/batcher_worker_types.ml +++ b/src/proto_alpha/lib_sc_rollup_node/batcher_worker_types.ml @@ -27,7 +27,6 @@ module Request = struct type ('a, 'b) t = | Register : string list -> (L2_message.hash list, error trace) t | New_head : Layer1.head -> (unit, error trace) t - | Batch : (unit, error trace) t type view = View : _ t -> view @@ -54,12 +53,6 @@ module Request = struct (req "block" Layer1.head_encoding)) (function View (New_head b) -> Some ((), b) | _ -> None) (fun ((), b) -> View (New_head b)); - case - (Tag 2) - ~title:"Batch" - (obj1 (req "request" (constant "batch"))) - (function View Batch -> Some () | _ -> None) - (fun () -> View Batch); ] let pp ppf (View r) = @@ -73,5 +66,4 @@ module Request = struct Block_hash.pp hash level - | Batch -> Format.pp_print_string ppf "batch" end diff --git a/src/proto_alpha/lib_sc_rollup_node/batcher_worker_types.mli b/src/proto_alpha/lib_sc_rollup_node/batcher_worker_types.mli index d3a3fd2c09e963cb9b9655a92c2d411893aa8343..fd6ba038ada187a063446a07044418a5b878cb0a 100644 --- a/src/proto_alpha/lib_sc_rollup_node/batcher_worker_types.mli +++ b/src/proto_alpha/lib_sc_rollup_node/batcher_worker_types.mli @@ -33,7 +33,6 @@ module Request : sig (** Request to register new L2 messages in the queue. *) | New_head : Layer1.head -> (unit, error trace) t (** Request to handle a new L1 head. *) - | Batch : (unit, error trace) t (** Request to produce batches. *) type view = View : _ t -> view diff --git a/src/proto_alpha/lib_sc_rollup_node/daemon.ml b/src/proto_alpha/lib_sc_rollup_node/daemon.ml index 17d3c733c5810ef251af9f0e329d9122ca27def9..78c9bc577c5ab9e303eda96249b24b4652f23098 100644 --- a/src/proto_alpha/lib_sc_rollup_node/daemon.ml +++ b/src/proto_alpha/lib_sc_rollup_node/daemon.ml @@ -526,7 +526,6 @@ let on_layer_1_head (daemon_components : (module Daemon_components.S)) node_ctxt let* () = Publisher.cement_commitments () in let*! () = Daemon_event.new_heads_processed reorg.new_chain in let* () = Refutation_coordinator.process stripped_head in - let* () = Components.Batcher.batch () in let* () = Components.Batcher.new_head stripped_head in let*! () = Injector.inject ~header:head.header () in let* () = exit_after_proto_migration node_ctxt head in diff --git a/src/proto_alpha/lib_sc_rollup_node/daemon_components.ml b/src/proto_alpha/lib_sc_rollup_node/daemon_components.ml index 8b951410f4faafc20bc2a7a069f2955729bd0d5c..c94bfd0e5dc1d61a342ceca5ff5e48d684bb45f3 100644 --- a/src/proto_alpha/lib_sc_rollup_node/daemon_components.ml +++ b/src/proto_alpha/lib_sc_rollup_node/daemon_components.ml @@ -38,12 +38,10 @@ module type Batcher_sig = sig _ Node_context.t -> unit tzresult Lwt.t - (** Create L2 batches of operations from the queue and pack them in an L1 batch - operation. The batch operation is queued in the injector for injection on - the Tezos node. *) - val batch : unit -> unit tzresult Lwt.t - - (** Notify a new L2 head to the batcher worker. *) + (** Create L2 batches of operations from the queue and pack each batch in an L1 + operation. The L1 operations (i.e. L2 batches) are queued in the injector for + injection on the Tezos node. + *) val new_head : Layer1.head -> unit tzresult Lwt.t (** Shutdown the batcher, waiting for the ongoing request to be processed. *) diff --git a/src/proto_alpha/lib_sc_rollup_node/wasm_2_0_0_pvm.ml b/src/proto_alpha/lib_sc_rollup_node/wasm_2_0_0_pvm.ml index e3c97ef4d4f545cfe958f6d6c1ffb51c55fc1f08..7b53be26ebdee706054dc30baa0fd6d69683635a 100644 --- a/src/proto_alpha/lib_sc_rollup_node/wasm_2_0_0_pvm.ml +++ b/src/proto_alpha/lib_sc_rollup_node/wasm_2_0_0_pvm.ml @@ -120,13 +120,10 @@ module Make_durable_state Tezos_scoru_wasm.Durable.list durable key end -module type S = sig - module Durable_state : Durable_state with type state = Context.tree +module Durable_state = + Make_durable_state (Make_wrapped_tree (Wasm_2_0_0_proof_format.Tree)) - include Pvm.S -end - -module Impl : S = struct +module Impl : Pvm.S = struct module PVM = Sc_rollup.Wasm_2_0_0PVM.Make (Make_backend) (Wasm_2_0_0_proof_format) include PVM @@ -136,8 +133,6 @@ module Impl : S = struct let new_dissection = Game_helpers.Wasm.new_dissection module State = Context.PVMState - module Durable_state = - Make_durable_state (Make_wrapped_tree (Wasm_2_0_0_proof_format.Tree)) module Inspect_durable_state = struct let lookup state keys =