diff --git a/manifest/main.ml b/manifest/main.ml index 3cd3e34e9a2e73e25b21f1e0c1dac21727a9bd8d..d4543c2543cf953d11da6e7c4a09bffca26bea1a 100644 --- a/manifest/main.ml +++ b/manifest/main.ml @@ -3681,6 +3681,7 @@ end = struct sc_rollup |> if_some |> if_ N.(number >= 016) |> open_; octez_crypto_dal |> if_ N.(number >= 016) |> open_; octez_base_test_helpers |> if_ N.(number >= 016) |> open_; + parameters |> if_some |> if_ N.(number >= 016) |> open_; ] ~dune in @@ -3698,7 +3699,7 @@ end = struct octez_micheline |> open_; client |> if_some |> open_; octez_client_base; - parameters |> if_some; + parameters |> if_some |> open_if N.(number >= 016); octez_protocol_environment; octez_stdlib_unix; main |> open_; @@ -4713,6 +4714,7 @@ module Protocol = Protocol ringo_lwt; injector |> if_some |> open_; octez_scoru_wasm; + octez_crypto_dal |> if_ N.(number >= 016) |> open_; ] in let tx_rollup = diff --git a/opam/octez-sc-rollup-node-alpha.opam b/opam/octez-sc-rollup-node-alpha.opam index fc64c63c42b162349b84c997cd4446c0e8f7a138..1f7eec94396241b65a8715d0629d554a092d5a85 100644 --- a/opam/octez-sc-rollup-node-alpha.opam +++ b/opam/octez-sc-rollup-node-alpha.opam @@ -34,6 +34,7 @@ depends: [ "ringo-lwt" { >= "0.9" } "tezos-injector-alpha" "tezos-scoru-wasm" + "tezos-crypto-dal" ] build: [ ["rm" "-r" "vendors"] diff --git a/src/proto_alpha/bin_sc_rollup_node/dal_pages_request.ml b/src/proto_alpha/bin_sc_rollup_node/dal_pages_request.ml new file mode 100644 index 0000000000000000000000000000000000000000..a9832cd13564f19491f6ce4c44e610d1c73f3039 --- /dev/null +++ b/src/proto_alpha/bin_sc_rollup_node/dal_pages_request.ml @@ -0,0 +1,103 @@ +(*****************************************************************************) +(* *) +(* 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 + +(** If a slot, published at some level L, is expected to be confirmed at level + L+D then, once the confirmation level is over, the rollup node is supposed to: + - Download and save the content of the slot's pages in the store, if the slot + is confirmed and the rollup is subscribed to it; + - Add entries [None] for the slot's pages in the store, if the slot + is not confirmed and the rollup is subscribed to it; + - Do nothing, if the rollup node is not subscribed to that slot. *) + +type error += Dal_slot_not_found_in_store of Dal.Slot.Header.id + +let () = + register_error_kind + `Temporary + ~id:"dal_pages_request.dal_slot_not_found_in_store" + ~title:"Dal slot not found in store" + ~description:"The Dal slot whose ID is given is not found in the store" + ~pp:(fun ppf -> + Format.fprintf ppf "Dal slot not found in store %a" Dal.Slot.Header.pp_id) + Data_encoding.(obj1 (req "slot_id" Dal.Slot.Header.id_encoding)) + (function Dal_slot_not_found_in_store slot_id -> Some slot_id | _ -> None) + (fun slot_id -> Dal_slot_not_found_in_store slot_id) + +let store_entry_from_published_level ~dal_endorsement_lag ~published_level store + = + State.hash_of_level store + @@ Int32.( + add (of_int dal_endorsement_lag) (Raw_level.to_int32 published_level)) + +let slot_pages ~dal_endorsement_lag store + (Dal.Slot.Header.{published_level; index} as slot_id) = + let open Lwt_result_syntax in + let*! pages = + let*! confirmed_in_block_hash = + store_entry_from_published_level + ~dal_endorsement_lag + ~published_level + store + in + Store.Dal_slot_pages.list_secondary_keys_with_values + store + ~primary_key:confirmed_in_block_hash + in + let pages = + List.filter + (fun ((slot_idx, _page_idx), _v) -> Dal.Slot_index.equal index slot_idx) + pages + in + let* () = + fail_when (List.is_empty pages) (Dal_slot_not_found_in_store slot_id) + in + (* FIXME/DAL: https://gitlab.com/tezos/tezos/-/issues/4033 + This could be simplified with a simpler interface to store data. + Otherwise, we should ideally check that we only have [Some ] or only + [None] in the list. (i.e., all the pages of the slot are confirmed, or none + is confirmed). *) + List.fold_left + (fun acc (_, v) -> match v with None -> acc | Some v -> v :: acc) + [] + (List.rev pages) + |> return + +let page_content ~dal_endorsement_lag store page_id = + let open Lwt_result_syntax in + let Dal.Page.{slot_id; page_index} = page_id in + let Dal.Slot.Header.{published_level; index} = slot_id in + let*! confirmed_in_block_hash = + store_entry_from_published_level ~dal_endorsement_lag ~published_level store + in + Store.Dal_slot_pages.find + store + ~primary_key:confirmed_in_block_hash + ~secondary_key:(index, page_index) + >|= Option.fold + ~some:(fun v -> Ok v) + ~none:(error (Dal_slot_not_found_in_store slot_id)) diff --git a/src/proto_alpha/bin_sc_rollup_node/dal_pages_request.mli b/src/proto_alpha/bin_sc_rollup_node/dal_pages_request.mli new file mode 100644 index 0000000000000000000000000000000000000000..40faa7068a8c8870f87e7fbcd739d543bd1009f2 --- /dev/null +++ b/src/proto_alpha/bin_sc_rollup_node/dal_pages_request.mli @@ -0,0 +1,75 @@ +(*****************************************************************************) +(* *) +(* 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 + +(** Access DAL slots and pages content. + + This module is a wrapper on top of {!Store.Dal_slot_pages} module to + access DAL slots and pages' data that have been previously fetched by + the rollup node. +*) + +(** This error is returned when a slot, identified by its ID, is not found in + the store. *) +type error += Dal_slot_not_found_in_store of Dal.Slot.Header.id + +(** Retrieve the pages' content of the given slot ID's from the store. + + The function returns [Dal_slot_not_found_in_store] if no entry is found in + the store for the given ID (i.e. no page is registered with or without content). + + If the returned list is not empty, the slot whose ID is given is supposed to + be confirmed. + + The function relies on {!Store.Dal_slot_pages}'s invariants to guarantee that: + - the pages are returned in increasing order w.r.t. their indexes in the slot; + - the size of the list, in case it is not empty, is equal to the expected + number of pages in a slot. + + [dal_endorsement_lag] is used to retrieve the correct entry in [store]. +*) +val slot_pages : + dal_endorsement_lag:int -> + Store.t -> + Dal.slot_id -> + Dal.Page.content list tzresult Lwt.t + +(** Retrieve the content of the page identified by the given ID from the store. + + The function returns [Dal_slot_not_found_in_store] if no entry is found in + the store for the given ID. It + returns [None] in case the entry is found, but the slot is not confirmed. Said + otherwise, some content is only returned for confirmed pages (slots) for + which the content has already been downloaded and saved to the store. + + [dal_endorsement_lag] is used to retrieve the correct entry in [store]. +*) +val page_content : + dal_endorsement_lag:int -> + Store.t -> + Dal.Page.t -> + Dal.Page.content option tzresult Lwt.t diff --git a/src/proto_alpha/bin_sc_rollup_node/dal_slots_tracker.ml b/src/proto_alpha/bin_sc_rollup_node/dal_slots_tracker.ml index eabf13ed0045d21d089ccd1cfb9d643c6b6f7043..4a48e7c3a69a94f27de3f485dde560f37bf6f2c9 100644 --- a/src/proto_alpha/bin_sc_rollup_node/dal_slots_tracker.ml +++ b/src/proto_alpha/bin_sc_rollup_node/dal_slots_tracker.ml @@ -444,3 +444,8 @@ let process_head node_ctxt (Layer1.{hash = head_hash; _} as head) = confirmation_info in Confirmed_slots_history.update node_ctxt head confirmation_info + +let slots_history_of_hash = Confirmed_slots_history.slots_history_of_hash + +let slots_history_cache_of_hash = + Confirmed_slots_history.slots_history_cache_of_hash diff --git a/src/proto_alpha/bin_sc_rollup_node/dal_slots_tracker.mli b/src/proto_alpha/bin_sc_rollup_node/dal_slots_tracker.mli index 8849542988c5931beab8a67c7d224d470658f583..e63149169211394a41165d83b3b9daa26de2f578 100644 --- a/src/proto_alpha/bin_sc_rollup_node/dal_slots_tracker.mli +++ b/src/proto_alpha/bin_sc_rollup_node/dal_slots_tracker.mli @@ -44,3 +44,17 @@ type error += Cannot_read_block_metadata of Block_hash.t [Store.Dal_confirmed_slots].} } *) val process_head : Node_context.t -> Layer1.head -> unit tzresult Lwt.t + +(** [slots_history_of_hash node_ctxt block_hash] returns the DAL confirmed slots + history at the end of the given [block_hash] validation. *) +val slots_history_of_hash : + Node_context.t -> + Layer1.head -> + Protocol.Alpha_context.Dal.Slots_history.t tzresult Lwt.t + +(** [slots_history_cache_of_hash node_ctxt block_hash] returns the DAL confirmed + slots history cache at the end of the given [block_hash] validation. *) +val slots_history_cache_of_hash : + Node_context.t -> + Layer1.head -> + Protocol.Alpha_context.Dal.Slots_history.History_cache.t tzresult Lwt.t diff --git a/src/proto_alpha/bin_sc_rollup_node/dune b/src/proto_alpha/bin_sc_rollup_node/dune index 86951d5f54e101f7e9b4d3f6cb3e3c6d13e56a16..096fc83532abf4bab4ba03813f9f5bb92344cd0e 100644 --- a/src/proto_alpha/bin_sc_rollup_node/dune +++ b/src/proto_alpha/bin_sc_rollup_node/dune @@ -34,7 +34,8 @@ ringo ringo-lwt tezos-injector-alpha - tezos-scoru-wasm) + tezos-scoru-wasm + tezos-crypto-dal) (link_flags (:standard) (:include %{workspace_root}/static-link-flags.sexp)) @@ -55,4 +56,5 @@ -open Tezos_sc_rollup_alpha -open Tezos_layer2_utils_alpha -open Tezos_layer2_store - -open Tezos_injector_alpha)) + -open Tezos_injector_alpha + -open Tezos_crypto_dal)) diff --git a/src/proto_alpha/bin_sc_rollup_node/interpreter.ml b/src/proto_alpha/bin_sc_rollup_node/interpreter.ml index 6f55237e26ed495e3da14d57fef782152f8fcd20..2680c606856f2cfe0c88a20656bd604be6a6a3f0 100644 --- a/src/proto_alpha/bin_sc_rollup_node/interpreter.ml +++ b/src/proto_alpha/bin_sc_rollup_node/interpreter.ml @@ -75,8 +75,8 @@ module Make (PVM : Pvm.S) : S with module PVM = PVM = struct some [message_index] at a given [level] and this is the [start_tick] of this message processing. If some [failing_ticks] are planned by the loser mode, they will be made. *) - let eval_until_input ~metadata data_dir level message_index ~fuel start_tick - failing_ticks state = + let eval_until_input ~metadata ~dal_endorsement_lag data_dir store level + message_index ~fuel start_tick failing_ticks state = let open Lwt_result_syntax in let eval_tick fuel_left tick failing_ticks state = let max_steps = @@ -139,7 +139,23 @@ module Make (PVM : Pvm.S) : S with module PVM = PVM = struct (Int64.succ current_tick) failing_ticks next_state - | _ -> return (state, fuel_left, current_tick, failing_ticks)) + | Needs_reveal (Request_dal_page page_id) -> + let* content_opt = + Dal_pages_request.page_content + ~dal_endorsement_lag + store + page_id + in + let*! next_state = + PVM.set_input (Reveal (Dal_page content_opt)) state + in + go + (consume_fuel 1L fuel) + (Int64.succ current_tick) + failing_ticks + next_state + | Initial | First_after _ -> + return (state, fuel, current_tick, failing_ticks)) in go fuel start_tick failing_ticks state @@ -154,13 +170,15 @@ module Make (PVM : Pvm.S) : S with module PVM = PVM = struct step that requires an input. This function is controlled by some [fuel] and may introduce intended failures at some given [failing_ticks]. *) - let feed_input ~metadata data_dir level message_index ~fuel ~failing_ticks - state input = + let feed_input ~metadata ~dal_endorsement_lag data_dir store level + message_index ~fuel ~failing_ticks state input = let open Lwt_result_syntax in let* state, fuel, tick, failing_ticks = eval_until_input ~metadata + ~dal_endorsement_lag data_dir + store level message_index ~fuel @@ -188,7 +206,9 @@ module Make (PVM : Pvm.S) : S with module PVM = PVM = struct let* state, fuel, _tick, _failing_ticks = eval_until_input ~metadata + ~dal_endorsement_lag data_dir + store level message_index ~fuel @@ -198,7 +218,7 @@ module Make (PVM : Pvm.S) : S with module PVM = PVM = struct in return (state, fuel) - let eval_block_inbox ~metadata ?fuel + let eval_block_inbox ~metadata ~dal_endorsement_lag ?fuel Node_context.{data_dir; store; loser_mode; _} hash state = let open Lwt_result_syntax in (* Obtain inbox and its messages for this block. *) @@ -242,7 +262,9 @@ module Make (PVM : Pvm.S) : S with module PVM = PVM = struct let* state, fuel = feed_input ~metadata + ~dal_endorsement_lag data_dir + store level message_counter ~fuel @@ -290,8 +312,16 @@ module Make (PVM : Pvm.S) : S with module PVM = PVM = struct (* Retrieve the previous PVM state from store. *) let* ctxt, predecessor_state = state_of_head node_ctxt ctxt predecessor in let metadata = metadata node_ctxt in + let dal_endorsement_lag = + node_ctxt.protocol_constants.parametric.dal.endorsement_lag + in let* state, num_messages, inbox_level, _fuel = - eval_block_inbox ~metadata node_ctxt hash predecessor_state + eval_block_inbox + ~metadata + ~dal_endorsement_lag + node_ctxt + hash + predecessor_state in (* Write final state to store. *) @@ -381,8 +411,17 @@ module Make (PVM : Pvm.S) : S with module PVM = PVM = struct Layer1.{hash = predecessor_hash; level = pred_level} in let metadata = metadata node_ctxt in + let dal_endorsement_lag = + node_ctxt.protocol_constants.parametric.dal.endorsement_lag + in let* state, _counter, _level, _fuel = - eval_block_inbox ~metadata ~fuel:tick_distance node_ctxt hash state + eval_block_inbox + ~metadata + ~dal_endorsement_lag + ~fuel:tick_distance + node_ctxt + hash + state in return state diff --git a/src/proto_alpha/bin_sc_rollup_node/refutation_game.ml b/src/proto_alpha/bin_sc_rollup_node/refutation_game.ml index 836e0f650bd8f14e0d234f958ab514ff936c81eb..a793438277fd3707283727fcb118a7763847c6ac 100644 --- a/src/proto_alpha/bin_sc_rollup_node/refutation_game.ml +++ b/src/proto_alpha/bin_sc_rollup_node/refutation_game.ml @@ -83,12 +83,102 @@ module Make (Interpreter : Interpreter.S) : in Injector.add_pending_operation ~source refute_operation + (** This function computes the inclusion/membership proof of the page + identified by [page_id] in the slot whose data are provided in + [slot_data]. *) + let page_membership_proof params page_index slot_data = + (* FIXME/DAL: https://gitlab.com/tezos/tezos/-/issues/4048 + Rely on DAL node to compute page membership proof and drop + the dal-crypto dependency from the rollup node. *) + let proof = + let open Result_syntax in + (* The computation of the page's proof below can be a bit costly. In fact, + it involves initialising a cryptobox environment and some non-trivial + crypto processing. *) + let* dal = Cryptobox.make params in + let* polynomial = Cryptobox.polynomial_from_slot dal slot_data in + Cryptobox.prove_page dal polynomial page_index + in + let open Lwt_result_syntax in + match proof with + | Ok proof -> return proof + | Error e -> + failwith + "%s" + (match e with + | `Fail s -> "Fail " ^ s + | `Segment_index_out_of_range -> "Segment_index_out_of_range" + | `Slot_wrong_size s -> "Slot_wrong_size: " ^ s) + + (** When the PVM is waiting for a Dal page input, this function attempts to + retrieve the page's content from the store, the data of its slot. Then it + computes the proof that the page is part of the slot and returns the + content along with the proof. + + If the PVM is not waiting for a Dal page input, or if the slot is known to + be unconfirmed on L1, this function returns [None]. If the data of the + slot are not saved to the store, the function returns a failure + in the error monad. *) + let page_info_from_pvm_state store ~dal_endorsement_lag + (dal_params : Dal.parameters) start_state = + let open Lwt_result_syntax in + let*! input_request = PVM.is_input_state start_state in + match input_request with + | Sc_rollup.(Needs_reveal (Request_dal_page page_id)) -> ( + let Dal.Page.{slot_id; page_index} = page_id in + let* pages = + Dal_pages_request.slot_pages ~dal_endorsement_lag store slot_id + in + if List.is_empty pages then (* The slot is not confirmed *) + return_none + else + let pages_per_slot = dal_params.slot_size / dal_params.page_size in + (* check invariant that pages' length is correct. *) + (* FIXME/DAL: https://gitlab.com/tezos/tezos/-/issues/4031 + It's better to do the check when the slots are saved into disk. *) + (* FIXME/DAL: https://gitlab.com/tezos/tezos/-/issues/3997 + This check is not resilient to dal parameters change. *) + (* FIXME/DAL: https://gitlab.com/tezos/tezos/-/issues/4033 + This check would be useless if we guarantee atomicity (at least in + the interface) when retrieveing a slot's pages: all the pages, or + nothing. *) + if List.compare_length_with pages pages_per_slot <> 0 then + failwith + "Unexpected number of pages for slot %a. Got %d instead of %d" + Dal.Slot.Header.pp_id + slot_id + (List.length pages) + pages_per_slot + else + match List.nth_opt pages page_index with + | Some content -> + let* page_proof = + page_membership_proof dal_params page_index + @@ Bytes.concat Bytes.empty pages + in + return_some (content, page_proof) + | None -> + failwith + "Page index %d too big or negative.\n\ + Number of pages in a slot is %d." + page_index + pages_per_slot) + | _ -> return_none + let generate_proof node_ctxt game start_state = let open Lwt_result_syntax in + (* NOTE: [snapshot_level] and [snapshot_hash] below refer to the level + before the refutation game starts. In fact, snapshotting of inbox and Dal + slots histories at [game.start_level] takes the state of the skip list + at [pred game.start_level]. *) + let snapshot_level_int32 = + Int32.pred Raw_level.(to_int32 game.start_level) + in let*! snapshot_hash = - State.hash_of_level - node_ctxt.Node_context.store - (Int32.pred Raw_level.(to_int32 game.start_level)) + State.hash_of_level node_ctxt.Node_context.store snapshot_level_int32 + in + let snapshot_head = + Layer1.{hash = snapshot_hash; level = snapshot_level_int32} in let* snapshot_inbox = Inbox.inbox_of_hash node_ctxt snapshot_hash in let* snapshot_history = Inbox.history_of_hash node_ctxt snapshot_hash in @@ -105,6 +195,31 @@ module Make (Interpreter : Interpreter.S) : snapshot_messages_tree >|= Environment.wrap_tzresult in + let* dal_slots_history = + Dal_slots_tracker.slots_history_of_hash node_ctxt snapshot_head + in + let* dal_slots_history_cache = + Dal_slots_tracker.slots_history_cache_of_hash node_ctxt snapshot_head + in + (* We fetch the value of protocol constants at block snapshot_hash + where the game started. *) + let* parametric_constants = + let cctxt = node_ctxt.cctxt in + Protocol.Constants_services.parametric + cctxt + (cctxt#chain, `Hash (snapshot_hash, 0)) + in + let dal_l1_parameters = parametric_constants.dal in + let dal_parameters = dal_l1_parameters.cryptobox_parameters in + let dal_endorsement_lag = dal_l1_parameters.endorsement_lag in + + let* page_info = + page_info_from_pvm_state + ~dal_endorsement_lag + node_ctxt.store + dal_parameters + start_state + in let module P = struct include PVM @@ -122,6 +237,18 @@ module Make (Interpreter : Interpreter.S) : let inbox = snapshot end + + module Dal_with_history = struct + let confirmed_slots_history = dal_slots_history + + let history_cache = dal_slots_history_cache + + let dal_endorsement_lag = dal_endorsement_lag + + let dal_parameters = dal_parameters + + let page_info = page_info + end end in let metadata = Interpreter.metadata node_ctxt in let* proof = @@ -136,6 +263,9 @@ module Make (Interpreter : Interpreter.S) : ~metadata snapshot game.inbox_level + dal_slots_history + dal_parameters + ~dal_endorsement_lag ~pvm_name:game.pvm_name proof >|= Environment.wrap_tzresult diff --git a/src/proto_alpha/bin_sc_rollup_node/wasm_2_0_0_pvm.ml b/src/proto_alpha/bin_sc_rollup_node/wasm_2_0_0_pvm.ml index a0cabf7e24457ae0bc507373f0a14215205c9c81..ce756990da53ec044a97ce65e8ba8e765c01f81f 100644 --- a/src/proto_alpha/bin_sc_rollup_node/wasm_2_0_0_pvm.ml +++ b/src/proto_alpha/bin_sc_rollup_node/wasm_2_0_0_pvm.ml @@ -75,6 +75,8 @@ module Impl : Pvm.S = struct Sc_rollup.Reveal_hash.pp hash | Waiting_for_reveal Sc_rollup.Reveal_metadata -> "Waiting for metadata" + | Waiting_for_reveal (Sc_rollup.Request_dal_page page_id) -> + Format.asprintf "Waiting for page data %a" Dal.Page.pp page_id | Computing -> "Computing" module Backend = Make_backend (Wasm_2_0_0_proof_format.Tree) diff --git a/src/proto_alpha/lib_protocol/TEZOS_PROTOCOL b/src/proto_alpha/lib_protocol/TEZOS_PROTOCOL index 83bf16e25dd939c74403a527638a33f6f1458959..00bf18b7e7e791eb3b387d230d96de3041625e28 100644 --- a/src/proto_alpha/lib_protocol/TEZOS_PROTOCOL +++ b/src/proto_alpha/lib_protocol/TEZOS_PROTOCOL @@ -16,6 +16,9 @@ "Tx_rollup_prefixes", "Merkle_list", "Bitset", + "Bounded_history_repr", + "Skip_list_repr", + "Michelson_v1_primitives", "Slot_repr", @@ -44,7 +47,10 @@ "Contract_repr", "Indexable", "Entrypoint_repr", - "Bounded_history_repr", + + "Dal_slot_repr", + "Dal_endorsement_repr", + "Sc_rollup_repr", "Sc_rollup_metadata_repr", "Sc_rollup_tick_repr", @@ -54,7 +60,6 @@ "Sc_rollup_arith", "Sc_rollup_wasm", "Sc_rollups", - "Skip_list_repr", "Sc_rollup_data_version_sig", "Sc_rollup_inbox_repr", "Sc_rollup_commitment_repr", @@ -78,8 +83,6 @@ "Tx_rollup_errors_repr", "Tx_rollup_state_repr", - "Dal_slot_repr", - "Dal_endorsement_repr", "Dal_errors_repr", "Zk_rollup_scalar", @@ -172,10 +175,10 @@ "Sc_rollup_outbox_storage", "Sc_rollup_stake_storage", "Sc_rollup_storage", + "Dal_slot_storage", "Sc_rollup_refutation_storage", "Zk_rollup_errors", - "Dal_slot_storage", "Alpha_context", "Script_string", diff --git a/src/proto_alpha/lib_protocol/alpha_context.ml b/src/proto_alpha/lib_protocol/alpha_context.ml index 2e60209824c16fa5c2c5862cfd55cc7da1e07810..40e163c86ab0f4f6914d18953c1290df0406f777 100644 --- a/src/proto_alpha/lib_protocol/alpha_context.ml +++ b/src/proto_alpha/lib_protocol/alpha_context.ml @@ -108,6 +108,11 @@ module Dal = struct include Raw_context.Dal end + type slot_id = Dal_slot_repr.Header.id = { + published_level : Raw_level_repr.t; + index : Dal_slot_repr.Index.t; + } + module Page = struct include Dal_slot_repr.Page end diff --git a/src/proto_alpha/lib_protocol/alpha_context.mli b/src/proto_alpha/lib_protocol/alpha_context.mli index 8c838787e5225fb35cd81f82b03b92737ffe1bd0..0c768a7f18d7ac7728e6a711218536ea329c3b87 100644 --- a/src/proto_alpha/lib_protocol/alpha_context.mli +++ b/src/proto_alpha/lib_protocol/alpha_context.mli @@ -2804,6 +2804,8 @@ module Dal : sig val to_int : t -> int val compare : t -> t -> int + + val equal : t -> t -> bool end (** This module re-exports definitions from {!Dal_endorsement_repr} and @@ -2826,6 +2828,8 @@ module Dal : sig val record_available_shards : context -> t -> int list -> context end + type slot_id = {published_level : Raw_level.t; index : Slot_index.t} + module Page : sig type content = bytes @@ -2843,7 +2847,7 @@ module Dal : sig val equal : int -> int -> bool end - type t + type t = {slot_id : slot_id; page_index : Index.t} val content_encoding : content Data_encoding.t @@ -2869,12 +2873,16 @@ module Dal : sig end module Header : sig - type id = {published_level : Raw_level.t; index : Slot_index.t} + type id = slot_id = {published_level : Raw_level.t; index : Slot_index.t} type t = {id : id; commitment : Commitment.t} + val id_encoding : id Data_encoding.t + val encoding : t Data_encoding.t + val pp_id : Format.formatter -> id -> unit + val pp : Format.formatter -> t -> unit val equal : t -> t -> bool @@ -3037,7 +3045,10 @@ module Sc_rollup : sig payload : Inbox_message.serialized; } - type reveal_data = Raw_data of string | Metadata of Metadata.t + type reveal_data = + | Raw_data of string + | Metadata of Metadata.t + | Dal_page of Dal.Page.content option type input = Inbox_message of inbox_message | Reveal of reveal_data @@ -3055,7 +3066,10 @@ module Sc_rollup : sig module Reveal_hash : S.HASH - type reveal = Reveal_raw_data of Reveal_hash.t | Reveal_metadata + type reveal = + | Reveal_raw_data of Reveal_hash.t + | Reveal_metadata + | Request_dal_page of Dal.Page.t type input_request = | No_input_required @@ -3557,7 +3571,13 @@ module Sc_rollup : sig val wrapped_proof_module : wrapped_proof -> (module PVM_with_proof) module Proof : sig - type reveal_proof = Raw_data_proof of string | Metadata_proof + type reveal_proof = + | Raw_data_proof of string + | Metadata_proof + | Dal_page_proof of { + page_id : Dal.Page.t; + proof : Dal.Slots_history.proof; + } type input_proof = | Inbox_proof of { @@ -3588,6 +3608,18 @@ module Sc_rollup : sig val history : Inbox.History.t end + + module Dal_with_history : sig + val confirmed_slots_history : Dal.Slots_history.t + + val history_cache : Dal.Slots_history.History_cache.t + + val page_info : (Dal.Page.content * Dal.Page.proof) option + + val dal_parameters : Dal.parameters + + val dal_endorsement_lag : int + end end type error += Sc_rollup_proof_check of string @@ -3596,6 +3628,9 @@ module Sc_rollup : sig metadata:Metadata.t -> Inbox.history_proof -> Raw_level.t -> + Dal.Slots_history.t -> + Dal.parameters -> + dal_endorsement_lag:int -> pvm_name:string -> t -> (input option * input_request) tzresult Lwt.t @@ -3637,6 +3672,7 @@ module Sc_rollup : sig type t = { turn : player; inbox_snapshot : Inbox.history_proof; + dal_snapshot : Dal.Slots_history.t; start_level : Raw_level.t; inbox_level : Raw_level.t; pvm_name : string; @@ -3689,6 +3725,7 @@ module Sc_rollup : sig val initial : Inbox.history_proof -> + Dal.Slots_history.t -> start_level:Raw_level.t -> pvm_name:string -> parent:Commitment.t -> @@ -3699,6 +3736,8 @@ module Sc_rollup : sig t val play : + Dal.parameters -> + dal_endorsement_lag:int -> stakers:Index.t -> Metadata.t -> t -> diff --git a/src/proto_alpha/lib_protocol/dal_apply.ml b/src/proto_alpha/lib_protocol/dal_apply.ml index bec17e6d796636290835b802d1c7e57d07babc0d..4ab9ec5145e5c9d08e1a061e72035185f5441c28 100644 --- a/src/proto_alpha/lib_protocol/dal_apply.ml +++ b/src/proto_alpha/lib_protocol/dal_apply.ml @@ -87,5 +87,20 @@ let dal_finalisation ctxt = ~default:(fun ctxt -> return (ctxt, None)) (fun ctxt -> Dal.Slot.finalize_current_slot_headers ctxt >>= fun ctxt -> + (* The fact that slots confirmation is done at finalization is very + important for the assumptions made by the Dal refutation game. In fact: + - {!Dal.Slot.finalize_current_slot_headers} updates the Dal skip list + at block finalization, by inserting newly confirmed slots; + - {!Sc_rollup.Game.initial}, called when applying a manager operation + that starts a refutation game, makes a snapshot of the Dal skip list + to use it as a reference if the refutation proof involves a Dal input. + + If confirmed Dal slots are inserted into the skip list during operations + application, adapting how refutation games are made might be needed + to e.g., + - use the same snapshotted skip list as a reference by L1 and rollup-node; + - disallow proofs involving pages of slots that have been confirmed at the + level where the game started. + *) Dal.Slot.finalize_pending_slot_headers ctxt >|=? fun (ctxt, slot_availability) -> (ctxt, Some slot_availability)) diff --git a/src/proto_alpha/lib_protocol/dal_slot_repr.ml b/src/proto_alpha/lib_protocol/dal_slot_repr.ml index bb7d89917a92405e012a3070d88d580a6d39a991..a3c3dba0b2c2a1c15af278a6a01564c0f552d33a 100644 --- a/src/proto_alpha/lib_protocol/dal_slot_repr.ml +++ b/src/proto_alpha/lib_protocol/dal_slot_repr.ml @@ -98,28 +98,33 @@ module Header = struct let zero = {id = zero_id; commitment = Commitment.zero} - let encoding = + let id_encoding = let open Data_encoding in conv - (fun {id = {published_level; index}; commitment} -> - (published_level, index, commitment)) - (fun (published_level, index, commitment) -> - {id = {published_level; index}; commitment}) - (obj3 + (fun {published_level; index} -> (published_level, index)) + (fun (published_level, index) -> {published_level; index}) + (obj2 (req "level" Raw_level_repr.encoding) - (req "index" Data_encoding.uint8) - (req "commitment" Commitment.encoding)) + (req "index" Data_encoding.uint8)) - let pp fmt {id = {published_level; index}; commitment} = + let encoding = + let open Data_encoding in + conv + (fun {id; commitment} -> (id, commitment)) + (fun (id, commitment) -> {id; commitment}) + (merge_objs id_encoding (obj1 (req "commitment" Commitment.encoding))) + + let pp_id fmt {published_level; index} = Format.fprintf fmt - "published_level: %a index: %a commitment: %a" + "published_level: %a, index: %a" Raw_level_repr.pp published_level Format.pp_print_int index - Commitment.pp - commitment + + let pp fmt {id; commitment = c} = + Format.fprintf fmt "id:(%a), commitment: %a" pp_id id Commitment.pp c end module Slot_index = Index diff --git a/src/proto_alpha/lib_protocol/dal_slot_repr.mli b/src/proto_alpha/lib_protocol/dal_slot_repr.mli index a17d2d713a2a714038c32800343962189d4eb439..9166a89848763ef7f6597f11784b057dae363a92 100644 --- a/src/proto_alpha/lib_protocol/dal_slot_repr.mli +++ b/src/proto_alpha/lib_protocol/dal_slot_repr.mli @@ -98,18 +98,27 @@ module Index : sig end module Header : sig - (** For Layer-1, a slot is described by the level at which it is published, - the slot's index (in the list of slots), and the slot's header - (KATE commitment hash). *) + (** For Layer-1, a slot is identified by the level at which it is published + and the slot's index. *) type id = {published_level : Raw_level_repr.t; index : Index.t} + (** For Layer-1, a slot is described by its slot {!id} and the slot's KATE + commitment hash. *) type t = {id : id; commitment : Commitment.t} - (** The encoding ensures the slot is always a non-negative number. *) + (** encoding for values of type {!id}. *) + val id_encoding : id Data_encoding.t + + (** encoding for values of type {!t}. *) val encoding : t Data_encoding.t + (** pretty-printer for values of type {!id}. *) + val pp_id : Format.formatter -> id -> unit + + (** pretty-printer for values of type {!t}. *) val pp : Format.formatter -> t -> unit + (** equal function for values of type {!t}. *) val equal : t -> t -> bool end @@ -141,18 +150,22 @@ module Page : sig (** Encoding for page contents. *) val content_encoding : content Data_encoding.t - (** A page is identified by its slot id and by its own index in the list + (** A page is identified by its slot ID and by its own index in the list of pages of the slot. *) type t = {slot_id : Header.id; page_index : Index.t} type proof = Dal.page_proof + (** equal function for values of type {!t}. *) val equal : t -> t -> bool + (** encoding for values of type {!t}. *) val encoding : t Data_encoding.t + (** encoding for values of type {!proof}. *) val proof_encoding : proof Data_encoding.t + (** pretty-printer for values of type {!t}. *) val pp : Format.formatter -> t -> unit end diff --git a/src/proto_alpha/lib_protocol/dune b/src/proto_alpha/lib_protocol/dune index 71eca07e7f03153f898fe01d1779bc4645401e43..65a9fe15d97539f3bfc335c7eba269ceb1ddc3fb 100644 --- a/src/proto_alpha/lib_protocol/dune +++ b/src/proto_alpha/lib_protocol/dune @@ -46,6 +46,8 @@ Tx_rollup_prefixes Merkle_list Bitset + Bounded_history_repr + Skip_list_repr Michelson_v1_primitives Slot_repr Tez_repr @@ -73,7 +75,8 @@ Contract_repr Indexable Entrypoint_repr - Bounded_history_repr + Dal_slot_repr + Dal_endorsement_repr Sc_rollup_repr Sc_rollup_metadata_repr Sc_rollup_tick_repr @@ -83,7 +86,6 @@ Sc_rollup_arith Sc_rollup_wasm Sc_rollups - Skip_list_repr Sc_rollup_data_version_sig Sc_rollup_inbox_repr Sc_rollup_commitment_repr @@ -106,8 +108,6 @@ Tx_rollup_commitment_repr Tx_rollup_errors_repr Tx_rollup_state_repr - Dal_slot_repr - Dal_endorsement_repr Dal_errors_repr Zk_rollup_scalar Zk_rollup_repr @@ -189,9 +189,9 @@ Sc_rollup_outbox_storage Sc_rollup_stake_storage Sc_rollup_storage + Dal_slot_storage Sc_rollup_refutation_storage Zk_rollup_errors - Dal_slot_storage Alpha_context Script_string Script_timestamp @@ -312,6 +312,8 @@ tx_rollup_prefixes.ml tx_rollup_prefixes.mli merkle_list.ml merkle_list.mli bitset.ml bitset.mli + bounded_history_repr.ml bounded_history_repr.mli + skip_list_repr.ml skip_list_repr.mli michelson_v1_primitives.ml michelson_v1_primitives.mli slot_repr.ml slot_repr.mli tez_repr.ml tez_repr.mli @@ -340,7 +342,8 @@ contract_repr.ml contract_repr.mli indexable.ml indexable.mli entrypoint_repr.ml entrypoint_repr.mli - bounded_history_repr.ml bounded_history_repr.mli + dal_slot_repr.ml dal_slot_repr.mli + dal_endorsement_repr.ml dal_endorsement_repr.mli sc_rollup_repr.ml sc_rollup_repr.mli sc_rollup_metadata_repr.ml sc_rollup_metadata_repr.mli sc_rollup_tick_repr.ml sc_rollup_tick_repr.mli @@ -350,7 +353,6 @@ sc_rollup_arith.ml sc_rollup_arith.mli sc_rollup_wasm.ml sc_rollup_wasm.mli sc_rollups.ml sc_rollups.mli - skip_list_repr.ml skip_list_repr.mli sc_rollup_data_version_sig.ml sc_rollup_inbox_repr.ml sc_rollup_inbox_repr.mli sc_rollup_commitment_repr.ml sc_rollup_commitment_repr.mli @@ -374,8 +376,6 @@ tx_rollup_commitment_repr.ml tx_rollup_commitment_repr.mli tx_rollup_errors_repr.ml tx_rollup_state_repr.ml tx_rollup_state_repr.mli - dal_slot_repr.ml dal_slot_repr.mli - dal_endorsement_repr.ml dal_endorsement_repr.mli dal_errors_repr.ml zk_rollup_scalar.ml zk_rollup_scalar.mli zk_rollup_repr.ml zk_rollup_repr.mli @@ -458,9 +458,9 @@ sc_rollup_outbox_storage.ml sc_rollup_outbox_storage.mli sc_rollup_stake_storage.ml sc_rollup_stake_storage.mli sc_rollup_storage.ml sc_rollup_storage.mli + dal_slot_storage.ml dal_slot_storage.mli sc_rollup_refutation_storage.ml sc_rollup_refutation_storage.mli zk_rollup_errors.ml - dal_slot_storage.ml dal_slot_storage.mli alpha_context.ml alpha_context.mli script_string.ml script_string.mli script_timestamp.ml script_timestamp.mli @@ -561,6 +561,8 @@ tx_rollup_prefixes.ml tx_rollup_prefixes.mli merkle_list.ml merkle_list.mli bitset.ml bitset.mli + bounded_history_repr.ml bounded_history_repr.mli + skip_list_repr.ml skip_list_repr.mli michelson_v1_primitives.ml michelson_v1_primitives.mli slot_repr.ml slot_repr.mli tez_repr.ml tez_repr.mli @@ -589,7 +591,8 @@ contract_repr.ml contract_repr.mli indexable.ml indexable.mli entrypoint_repr.ml entrypoint_repr.mli - bounded_history_repr.ml bounded_history_repr.mli + dal_slot_repr.ml dal_slot_repr.mli + dal_endorsement_repr.ml dal_endorsement_repr.mli sc_rollup_repr.ml sc_rollup_repr.mli sc_rollup_metadata_repr.ml sc_rollup_metadata_repr.mli sc_rollup_tick_repr.ml sc_rollup_tick_repr.mli @@ -599,7 +602,6 @@ sc_rollup_arith.ml sc_rollup_arith.mli sc_rollup_wasm.ml sc_rollup_wasm.mli sc_rollups.ml sc_rollups.mli - skip_list_repr.ml skip_list_repr.mli sc_rollup_data_version_sig.ml sc_rollup_inbox_repr.ml sc_rollup_inbox_repr.mli sc_rollup_commitment_repr.ml sc_rollup_commitment_repr.mli @@ -623,8 +625,6 @@ tx_rollup_commitment_repr.ml tx_rollup_commitment_repr.mli tx_rollup_errors_repr.ml tx_rollup_state_repr.ml tx_rollup_state_repr.mli - dal_slot_repr.ml dal_slot_repr.mli - dal_endorsement_repr.ml dal_endorsement_repr.mli dal_errors_repr.ml zk_rollup_scalar.ml zk_rollup_scalar.mli zk_rollup_repr.ml zk_rollup_repr.mli @@ -707,9 +707,9 @@ sc_rollup_outbox_storage.ml sc_rollup_outbox_storage.mli sc_rollup_stake_storage.ml sc_rollup_stake_storage.mli sc_rollup_storage.ml sc_rollup_storage.mli + dal_slot_storage.ml dal_slot_storage.mli sc_rollup_refutation_storage.ml sc_rollup_refutation_storage.mli zk_rollup_errors.ml - dal_slot_storage.ml dal_slot_storage.mli alpha_context.ml alpha_context.mli script_string.ml script_string.mli script_timestamp.ml script_timestamp.mli @@ -815,6 +815,8 @@ tx_rollup_prefixes.ml tx_rollup_prefixes.mli merkle_list.ml merkle_list.mli bitset.ml bitset.mli + bounded_history_repr.ml bounded_history_repr.mli + skip_list_repr.ml skip_list_repr.mli michelson_v1_primitives.ml michelson_v1_primitives.mli slot_repr.ml slot_repr.mli tez_repr.ml tez_repr.mli @@ -843,7 +845,8 @@ contract_repr.ml contract_repr.mli indexable.ml indexable.mli entrypoint_repr.ml entrypoint_repr.mli - bounded_history_repr.ml bounded_history_repr.mli + dal_slot_repr.ml dal_slot_repr.mli + dal_endorsement_repr.ml dal_endorsement_repr.mli sc_rollup_repr.ml sc_rollup_repr.mli sc_rollup_metadata_repr.ml sc_rollup_metadata_repr.mli sc_rollup_tick_repr.ml sc_rollup_tick_repr.mli @@ -853,7 +856,6 @@ sc_rollup_arith.ml sc_rollup_arith.mli sc_rollup_wasm.ml sc_rollup_wasm.mli sc_rollups.ml sc_rollups.mli - skip_list_repr.ml skip_list_repr.mli sc_rollup_data_version_sig.ml sc_rollup_inbox_repr.ml sc_rollup_inbox_repr.mli sc_rollup_commitment_repr.ml sc_rollup_commitment_repr.mli @@ -877,8 +879,6 @@ tx_rollup_commitment_repr.ml tx_rollup_commitment_repr.mli tx_rollup_errors_repr.ml tx_rollup_state_repr.ml tx_rollup_state_repr.mli - dal_slot_repr.ml dal_slot_repr.mli - dal_endorsement_repr.ml dal_endorsement_repr.mli dal_errors_repr.ml zk_rollup_scalar.ml zk_rollup_scalar.mli zk_rollup_repr.ml zk_rollup_repr.mli @@ -961,9 +961,9 @@ sc_rollup_outbox_storage.ml sc_rollup_outbox_storage.mli sc_rollup_stake_storage.ml sc_rollup_stake_storage.mli sc_rollup_storage.ml sc_rollup_storage.mli + dal_slot_storage.ml dal_slot_storage.mli sc_rollup_refutation_storage.ml sc_rollup_refutation_storage.mli zk_rollup_errors.ml - dal_slot_storage.ml dal_slot_storage.mli alpha_context.ml alpha_context.mli script_string.ml script_string.mli script_timestamp.ml script_timestamp.mli diff --git a/src/proto_alpha/lib_protocol/sc_rollup_PVM_sig.ml b/src/proto_alpha/lib_protocol/sc_rollup_PVM_sig.ml index 95ba78817cdb33e9540edd1b1c6674a6089357ce..624a02387cc9e5bda3c36eeebbcd02d3f2f90719 100644 --- a/src/proto_alpha/lib_protocol/sc_rollup_PVM_sig.ml +++ b/src/proto_alpha/lib_protocol/sc_rollup_PVM_sig.ml @@ -63,7 +63,10 @@ type inbox_message = { payload : Sc_rollup_inbox_message_repr.serialized; } -type reveal_data = Raw_data of string | Metadata of Sc_rollup_metadata_repr.t +type reveal_data = + | Raw_data of string + | Metadata of Sc_rollup_metadata_repr.t + | Dal_page of Dal_slot_repr.Page.content option type input = Inbox_message of inbox_message | Reveal of reveal_data @@ -79,6 +82,12 @@ let pp_inbox_message fmt {inbox_level; message_counter; _} = let pp_reveal_data fmt = function | Raw_data _ -> Format.pp_print_string fmt "raw data" | Metadata metadata -> Sc_rollup_metadata_repr.pp fmt metadata + | Dal_page content_opt -> + Format.pp_print_option + ~none:(fun fmt () -> Format.pp_print_string fmt "") + (fun fmt _a -> Format.fprintf fmt "") + fmt + content_opt let pp_input fmt = function | Inbox_message msg -> @@ -123,7 +132,17 @@ let reveal_data_encoding = (function Metadata md -> Some ((), md) | _ -> None) (fun ((), md) -> Metadata md) in - union [case_raw_data; case_metadata] + let case_dal_page = + case + ~title:"dal page" + (Tag 2) + (obj2 + (req "reveal_data_kind" (constant "dal_page")) + (req "dal_page_content" (option bytes))) + (function Dal_page p -> Some ((), p) | _ -> None) + (fun ((), p) -> Dal_page p) + in + union [case_raw_data; case_metadata; case_dal_page] let input_encoding = let open Data_encoding in @@ -162,6 +181,8 @@ let reveal_data_equal a b = | Raw_data _, _ -> false | Metadata a, Metadata b -> Sc_rollup_metadata_repr.equal a b | Metadata _, _ -> false + | Dal_page a, Dal_page b -> Option.equal Bytes.equal a b + | Dal_page _, _ -> false let input_equal a b = match (a, b) with @@ -198,7 +219,10 @@ module Reveal_hash = let size = Some 32 end) -type reveal = Reveal_raw_data of Reveal_hash.t | Reveal_metadata +type reveal = + | Reveal_raw_data of Reveal_hash.t + | Reveal_metadata + | Request_dal_page of Dal_slot_repr.Page.t let reveal_encoding = let open Data_encoding in @@ -219,7 +243,17 @@ let reveal_encoding = (function Reveal_metadata -> Some () | _ -> None) (fun () -> Reveal_metadata) in - union [case_raw_data; case_metadata] + let case_dal_page = + case + ~title:"Request_dal_page" + (Tag 2) + (obj2 + (req "reveal_kind" (constant "request_dal_page")) + (req "page_id" Dal_slot_repr.Page.encoding)) + (function Request_dal_page s -> Some ((), s) | _ -> None) + (fun ((), s) -> Request_dal_page s) + in + union [case_raw_data; case_metadata; case_dal_page] (** The PVM's current input expectations: - [No_input_required] if the machine is busy and has no need for new input. @@ -281,6 +315,7 @@ let input_request_encoding = let pp_reveal fmt = function | Reveal_raw_data hash -> Reveal_hash.pp fmt hash | Reveal_metadata -> Format.pp_print_string fmt "Reveal metadata" + | Request_dal_page id -> Dal_slot_repr.Page.pp fmt id (** [pp_input_request fmt i] pretty prints the given input [i] to the formatter [fmt]. *) @@ -302,9 +337,9 @@ let pp_input_request fmt request = let reveal_equal p1 p2 = match (p1, p2) with | Reveal_raw_data h1, Reveal_raw_data h2 -> Reveal_hash.equal h1 h2 - | Reveal_raw_data _, _ -> false | Reveal_metadata, Reveal_metadata -> true - | Reveal_metadata, _ -> false + | Request_dal_page a, Request_dal_page b -> Dal_slot_repr.Page.equal a b + | (Reveal_raw_data _ | Reveal_metadata | Request_dal_page _), _ -> false (** [input_request_equal i1 i2] return whether [i1] and [i2] are equal. *) let input_request_equal a b = diff --git a/src/proto_alpha/lib_protocol/sc_rollup_arith.ml b/src/proto_alpha/lib_protocol/sc_rollup_arith.ml index b05aa743d47392a2b5668e0b239199bc1b321520..03b63b573a837602a269b890d08c44694492463c 100644 --- a/src/proto_alpha/lib_protocol/sc_rollup_arith.ml +++ b/src/proto_alpha/lib_protocol/sc_rollup_arith.ml @@ -602,18 +602,18 @@ module Make (Context : P) : end) module Required_reveal = Make_var (struct - type t = PS.Reveal_hash.t option + type t = PS.reveal option let initial = None - let encoding = Data_encoding.option PS.Reveal_hash.encoding + let encoding = Data_encoding.option PS.reveal_encoding - let name = "required_pre_image_hash" + let name = "required_reveal" let pp fmt v = match v with | None -> Format.fprintf fmt "" - | Some h -> PS.Reveal_hash.pp fmt h + | Some h -> PS.pp_reveal fmt h end) module Metadata = Make_var (struct @@ -883,10 +883,10 @@ module Make (Context : P) : | Some n -> return (PS.First_after (level, n)) | None -> return PS.Initial) | Waiting_for_reveal -> ( - let* h = Required_reveal.get in - match h with + let* r = Required_reveal.get in + match r with | None -> internal_error "Internal error: Reveal invariant broken" - | Some h -> return (PS.Needs_reveal (Reveal_raw_data h))) + | Some reveal -> return (PS.Needs_reveal reveal)) | Waiting_for_metadata -> return PS.(Needs_reveal Reveal_metadata) | Halted | Parsing | Evaluating -> return PS.No_input_required @@ -976,6 +976,18 @@ module Make (Context : P) : let* () = Metadata.set (Some metadata) in let* () = Status.set Waiting_for_input_message in return () + | PS.Dal_page None -> + (* FIXME/DAL: https://gitlab.com/tezos/tezos/-/issues/3995 + Below, we set the status to [Waiting_for_input_message] because the + inbox is the only source of automatically fetched data. + Once the issue above is handled (auto-fetch of Dal pages with EOL/SOL), + the implementation should be adapted. *) + let* () = Status.set Waiting_for_input_message in + return () + | PS.Dal_page (Some data) -> + let* () = Next_message.set (Some (Bytes.to_string data)) in + let* () = start_parsing in + return () let ticked m = let open Monad.Syntax in @@ -1168,6 +1180,85 @@ module Make (Context : P) : return (destination, entrypoint)) | [] -> fail + let evaluate_preimage_request hash = + let open Monad.Syntax in + match PS.Reveal_hash.of_b58check_opt hash with + | None -> stop_evaluating false + | Some hash -> + let* () = Required_reveal.set (Some (Reveal_raw_data hash)) in + let* () = Status.set Waiting_for_reveal in + return () + + let evaluate_dal_page_request = + (* FIXME/DAL: https://gitlab.com/tezos/tezos/-/issues/3997 + - We should rather provide DAL parameters to PVM via metadata (and handle + the case where parameters are updated on L1). + - It's better to use EOL/SOL to request DAL pages once unique inbox MR + is merged. *) + (* The parameters below are those of mainnet in protocol constants, divided + by 16. *) + let endorsement_lag = 1l in + let page_size = 4096 / 64 in + let slot_size = (1 lsl 20) / 64 in + let number_of_slots = 256 / 64 in + let number_of_pages = slot_size / page_size in + let mk_slot_index slot_str = + let open Option_syntax in + let* index = Option.map Int32.to_int @@ Int32.of_string_opt slot_str in + if Compare.Int.(index < 0 || index >= number_of_slots) then None + else Dal_slot_repr.Index.of_int index + in + let mk_page_index page_str = + let open Option_syntax in + let* index = Option.map Int32.to_int @@ Int32.of_string_opt page_str in + if Compare.Int.(index < 0 || index >= number_of_pages) then None + else Some index + in + fun raw_page_id -> + let mk_page_id current_lvl = + (* Dal pages import directive is [dal:::]. See mli file.*) + let open Option_syntax in + match String.split_on_char ':' raw_page_id with + | [lvl; slot; page] -> + let* lvl = Int32.of_string_opt lvl in + let* lvl = Bounded.Non_negative_int32.of_value lvl in + let published_level = Raw_level_repr.of_int32_non_negative lvl in + let delta = Raw_level_repr.diff current_lvl published_level in + (* FIXME/DAL: https://gitlab.com/tezos/tezos/-/issues/3995 + Putting delta > 0l doesn't work here because of the way the node + currently fetches blocks' data and calls the PVM. + This will be changed, in particular once EOL is used to fetch DAL + data. + + More generally, the whole condition below will be reworked. *) + if + Compare.Int32.( + delta > 1l && delta <= Int32.mul 2l endorsement_lag) + then + let* index = mk_slot_index slot in + let* page_index = mk_page_index page in + let slot_id = Dal_slot_repr.Header.{published_level; index} in + Some Dal_slot_repr.Page.{slot_id; page_index} + else None + | _ -> None + in + let open Monad.Syntax in + let* current_lvl = Current_level.get in + match mk_page_id current_lvl with + | Some page_id -> + let* () = Required_reveal.set (Some (Request_dal_page page_id)) in + let* () = Status.set Waiting_for_reveal in + return () + | None -> stop_evaluating false + + let remove_prefix prefix input input_len = + let prefix_len = String.length prefix in + if + Compare.Int.(input_len > prefix_len) + && String.(equal (sub input 0 prefix_len) prefix) + then Some (String.sub input prefix_len (input_len - prefix_len)) + else None + let evaluate = let open Monad.Syntax in let* i = Code.pop in @@ -1175,24 +1266,28 @@ module Make (Context : P) : | None -> stop_evaluating true | Some (IPush x) -> Stack.push x | Some (IStore x) -> ( + (* When evaluating an instruction [IStore x], we start by checking if [x] + is a reserved directive: + - "hash:", to import a DAC data; + - "dal:::", to request a Dal page; + - "out" or "%", to add a message in the outbox. + Otherwise, the instruction is interpreted as a directive to store the + top of the PVM's stack into the variable [x]. + *) let len = String.length x in - if Compare.Int.(len > 5) && Compare.String.(String.sub x 0 5 = "hash:") - then - let hash = String.sub x 5 (len - 5) in - match PS.Reveal_hash.of_b58check_opt hash with - | None -> stop_evaluating false - | Some hash -> - let* () = Required_reveal.set (Some hash) in - let* () = Status.set Waiting_for_reveal in - return () - else - let* v = Stack.top in - match v with - | None -> stop_evaluating false - | Some v -> ( - match identifies_target_contract x with - | Some contract_entrypoint -> output contract_entrypoint v - | None -> Vars.set x v)) + match remove_prefix "hash:" x len with + | Some hash -> evaluate_preimage_request hash + | None -> ( + match remove_prefix "dal:" x len with + | Some pid -> evaluate_dal_page_request pid + | None -> ( + let* v = Stack.top in + match v with + | None -> stop_evaluating false + | Some v -> ( + match identifies_target_contract x with + | Some contract_entrypoint -> output contract_entrypoint v + | None -> Vars.set x v)))) | Some IAdd -> ( let* v = Stack.pop in match v with @@ -1233,38 +1328,35 @@ module Make (Context : P) : let step_transition input_given state = let open Lwt_syntax in let* request = is_input_state state in + let error msg = state_of (internal_error msg) state in let* state = - match request with - | PS.No_input_required -> eval state - | PS.Initial | PS.First_after _ -> ( - match input_given with - | Some (PS.Inbox_message _ as input_given) -> - set_input input_given state - | None | Some (PS.Reveal _) -> - state_of - (internal_error - "Invalid set_input: expecting inbox message, got a reveal.") - state) - | PS.Needs_reveal (Reveal_raw_data _hash) -> ( - match input_given with - | Some (PS.Reveal (Raw_data _) as input_given) -> - set_input input_given state - | None | Some (PS.Inbox_message _) | Some (PS.Reveal (Metadata _)) -> - state_of - (internal_error - "Invalid set_input: expecting a raw data reveal, got an \ - inbox message or a reveal metadata.") - state) - | PS.Needs_reveal Reveal_metadata -> ( - match input_given with - | Some (PS.Reveal (Metadata _) as metadata) -> - set_input metadata state - | None | Some (PS.Reveal (Raw_data _)) | Some (PS.Inbox_message _) -> - state_of - (internal_error - "Invalid set_input: expecting a metadata reveal, got an \ - inbox message or a raw data reveal.") - state) + match (request, input_given) with + | PS.No_input_required, None -> eval state + | PS.No_input_required, Some _ -> + error "Invalid set_input: expecting no input message but got one." + | (PS.Initial | PS.First_after _), Some (PS.Inbox_message _ as input) + | ( PS.Needs_reveal (Reveal_raw_data _), + Some (PS.Reveal (Raw_data _) as input) ) + | PS.Needs_reveal Reveal_metadata, Some (PS.Reveal (Metadata _) as input) + | ( PS.Needs_reveal (PS.Request_dal_page _), + Some (PS.Reveal (Dal_page _) as input) ) -> + (* For all the cases above, the input request matches the given input, so + we proceed by setting the input. *) + set_input input state + | (PS.Initial | PS.First_after _), _ -> + error "Invalid set_input: expecting inbox message, got a reveal." + | PS.Needs_reveal (Reveal_raw_data _hash), _ -> + error + "Invalid set_input: expecting a raw data reveal, got an inbox \ + message or a reveal metadata." + | PS.Needs_reveal Reveal_metadata, _ -> + error + "Invalid set_input: expecting a metadata reveal, got an inbox \ + message or a raw data reveal." + | PS.Needs_reveal (PS.Request_dal_page _), _ -> + error + "Invalid set_input: expecting a dal page reveal, got an inbox \ + message or a raw data reveal." in return (state, request) diff --git a/src/proto_alpha/lib_protocol/sc_rollup_arith.mli b/src/proto_alpha/lib_protocol/sc_rollup_arith.mli index 6b06c302cf9ed5909127e00b909a6875c6ae6733..6105e6dc0b01b0a966d26181289c02cb19cfa1ee 100644 --- a/src/proto_alpha/lib_protocol/sc_rollup_arith.mli +++ b/src/proto_alpha/lib_protocol/sc_rollup_arith.mli @@ -25,6 +25,11 @@ (** This module provides a temporary toy rollup to be used as a demo. *) +(* + FIXME/DAL: https://gitlab.com/tezos/tezos/-/issues/3995 + Use EOL/SOL once merged to import Dal pages. +*) + (** This rollup is a stack machine equipped with addition. @@ -45,6 +50,13 @@ - a symbol [+] pops two integers [x] and [y] and pushes [x + y] on the stack ; + - an input [hash:] is interpreted as a directive to request the DAC + data whose hash is ; + + - an input [dal:::] is interpreted as a directive to request + the DAL page whose index is belonging to slot index confirmed + at level (i.e published at level LVL - endorsement_lag) ; + If a message is not syntactically correct or does not evaluate correctly, the machine stops its evaluation and waits for the next message. @@ -58,7 +70,6 @@ The machine exposes extra operations to be used in the rollup node. *) - module type S = sig include Sc_rollup_PVM_sig.S diff --git a/src/proto_alpha/lib_protocol/sc_rollup_game_repr.ml b/src/proto_alpha/lib_protocol/sc_rollup_game_repr.ml index 3505668811bb4580498ec642b315d9ec95126362..9a3223f557b7b1868e2cec14d8d0c0ef5a81a6e6 100644 --- a/src/proto_alpha/lib_protocol/sc_rollup_game_repr.ml +++ b/src/proto_alpha/lib_protocol/sc_rollup_game_repr.ml @@ -386,6 +386,7 @@ module V1 = struct type t = { turn : player; inbox_snapshot : Sc_rollup_inbox_repr.history_proof; + dal_snapshot : Dal_slot_repr.History.t; start_level : Raw_level_repr.t; inbox_level : Raw_level_repr.t; pvm_name : string; @@ -454,27 +455,21 @@ module V1 = struct let equal { - turn = turn1; - inbox_snapshot = inbox_snapshot1; - start_level = start_level1; - inbox_level = inbox_level1; - pvm_name = pvm_name1; - game_state = game_state1; - } - { - turn = turn2; - inbox_snapshot = inbox_snapshot2; - start_level = start_level2; - inbox_level = inbox_level2; - pvm_name = pvm_name2; - game_state = game_state2; - } = - player_equal turn1 turn2 - && Sc_rollup_inbox_repr.equal_history_proof inbox_snapshot1 inbox_snapshot2 - && Raw_level_repr.equal start_level1 start_level2 - && Raw_level_repr.equal inbox_level1 inbox_level2 - && String.equal pvm_name1 pvm_name2 - && game_state_equal game_state1 game_state2 + turn; + inbox_snapshot; + dal_snapshot; + start_level; + inbox_level; + pvm_name; + game_state; + } g2 = + player_equal turn g2.turn + && Sc_rollup_inbox_repr.equal_history_proof inbox_snapshot g2.inbox_snapshot + && Dal_slot_repr.History.equal dal_snapshot g2.dal_snapshot + && Raw_level_repr.equal start_level g2.start_level + && Raw_level_repr.equal inbox_level g2.inbox_level + && String.equal pvm_name g2.pvm_name + && game_state_equal game_state g2.game_state let string_of_player = function Alice -> "alice" | Bob -> "bob" @@ -535,18 +530,39 @@ module V1 = struct (fun { turn; inbox_snapshot; + dal_snapshot; start_level; inbox_level; pvm_name; game_state; } -> - (turn, inbox_snapshot, start_level, inbox_level, pvm_name, game_state)) - (fun (turn, inbox_snapshot, start_level, inbox_level, pvm_name, game_state) - -> - {turn; inbox_snapshot; start_level; inbox_level; pvm_name; game_state}) - (obj6 + ( turn, + inbox_snapshot, + dal_snapshot, + start_level, + inbox_level, + pvm_name, + game_state )) + (fun ( turn, + inbox_snapshot, + dal_snapshot, + start_level, + inbox_level, + pvm_name, + game_state ) -> + { + turn; + inbox_snapshot; + dal_snapshot; + start_level; + inbox_level; + pvm_name; + game_state; + }) + (obj7 (req "turn" player_encoding) (req "inbox_snapshot" Sc_rollup_inbox_repr.history_proof_encoding) + (req "dal_snapshot" Dal_slot_repr.History.encoding) (req "start_level" Raw_level_repr.encoding) (req "inbox_level" Raw_level_repr.encoding) (req "pvm_name" string) @@ -671,7 +687,8 @@ end let make_chunk state_hash tick = {state_hash; tick} -let initial inbox ~start_level ~pvm_name ~(parent : Sc_rollup_commitment_repr.t) +let initial inbox dal_snapshot ~start_level ~pvm_name + ~(parent : Sc_rollup_commitment_repr.t) ~(child : Sc_rollup_commitment_repr.t) ~refuter ~defender ~default_number_of_sections = let ({alice; _} : Index.t) = Index.make refuter defender in @@ -702,6 +719,7 @@ let initial inbox ~start_level ~pvm_name ~(parent : Sc_rollup_commitment_repr.t) { turn = (if alice_to_play then Alice else Bob); inbox_snapshot = inbox; + dal_snapshot; start_level; inbox_level = child.inbox_level; pvm_name; @@ -979,16 +997,22 @@ let check_proof_refute_stop_state ~stop_state input input_request proof = check_proof_stop_state ~stop_state input input_request proof false (** Returns the validity of the first final move on top of a dissection. *) -let validity_final_move ~first_move ~metadata ~proof ~game ~start_chunk - ~stop_chunk = +let validity_final_move dal_parameters ~dal_endorsement_lag ~first_move + ~metadata ~proof ~game ~start_chunk ~stop_chunk = let open Lwt_result_syntax in let*! res = - let {inbox_snapshot; inbox_level; pvm_name; _} = game in + let {inbox_snapshot; inbox_level; pvm_name; dal_snapshot; _} = game in let*! valid = + (* FIXME/DAL: https://gitlab.com/tezos/tezos/-/issues/3997 + This function is not resilient to dal parameters changes + (cryptobox parameters or dal_endorsement_lag for instance). *) Sc_rollup_proof_repr.valid ~metadata inbox_snapshot inbox_level + dal_snapshot + dal_parameters + ~dal_endorsement_lag ~pvm_name proof in @@ -1031,8 +1055,11 @@ let validity_final_move ~first_move ~metadata ~proof ~game ~start_chunk - The proof stop on the state different than the refuted one. - The proof is correctly verified. *) -let validity_first_final_move ~metadata ~proof ~game ~start_chunk ~stop_chunk = +let validity_first_final_move dal_parameters ~dal_endorsement_lag ~metadata + ~proof ~game ~start_chunk ~stop_chunk = validity_final_move + dal_parameters + ~dal_endorsement_lag ~first_move:true ~metadata ~proof @@ -1047,9 +1074,11 @@ let validity_first_final_move ~metadata ~proof ~game ~start_chunk ~stop_chunk = - The proof stop on the state validates the refuted one. - The proof is correctly verified. *) -let validity_second_final_move ~metadata ~agreed_start_chunk ~refuted_stop_chunk - ~game ~proof = +let validity_second_final_move dal_parameters ~dal_endorsement_lag ~metadata + ~agreed_start_chunk ~refuted_stop_chunk ~game ~proof = validity_final_move + dal_parameters + ~dal_endorsement_lag ~first_move:false ~metadata ~proof @@ -1064,7 +1093,7 @@ let loser_of_results ~alice_result ~bob_result = | false, true -> Some Alice | true, false -> Some Bob -let play ~stakers metadata game refutation = +let play dal_parameters ~dal_endorsement_lag ~stakers metadata game refutation = let open Lwt_tzresult_syntax in let mk_loser loser = let loser = Index.staker stakers loser in @@ -1090,6 +1119,7 @@ let play ~stakers metadata game refutation = { turn = opponent game.turn; inbox_snapshot = game.inbox_snapshot; + dal_snapshot = game.dal_snapshot; start_level = game.start_level; inbox_level = game.inbox_level; pvm_name = game.pvm_name; @@ -1102,6 +1132,8 @@ let play ~stakers metadata game refutation = in let*! player_result = validity_first_final_move + dal_parameters + ~dal_endorsement_lag ~proof ~metadata ~game @@ -1120,6 +1152,7 @@ let play ~stakers metadata game refutation = { turn = opponent game.turn; inbox_snapshot = game.inbox_snapshot; + dal_snapshot = game.dal_snapshot; start_level = game.start_level; inbox_level = game.inbox_level; pvm_name = game.pvm_name; @@ -1128,6 +1161,8 @@ let play ~stakers metadata game refutation = | Proof proof, Final_move {agreed_start_chunk; refuted_stop_chunk} -> let*! player_result = validity_second_final_move + dal_parameters + ~dal_endorsement_lag ~metadata ~agreed_start_chunk ~refuted_stop_chunk diff --git a/src/proto_alpha/lib_protocol/sc_rollup_game_repr.mli b/src/proto_alpha/lib_protocol/sc_rollup_game_repr.mli index 66cd672b0e0a2c546e845bebf61e3cf378dd7f84..8207b6ae1544fa1a62622b10ae854cb1e12e0be3 100644 --- a/src/proto_alpha/lib_protocol/sc_rollup_game_repr.mli +++ b/src/proto_alpha/lib_protocol/sc_rollup_game_repr.mli @@ -240,6 +240,12 @@ module V1 : sig otherwise they would have a 'moving target' because the actual inbox may be updated continuously. + - [dal_snapshot], a snapshot of the DAL's confirmed slots history at the + moment the game is created. In fact, since the confirmed slots history at + initialization would likely evolve during the game, we need a (fixed) + reference w.r.t. which Dal input proofs would be produced and verified if + needed. + - [level], the inbox level of the commitment the game is refuting. This is only used when checking [Blocked_step] proofs---the proof will show that the next message available in [inbox_snapshot] is @@ -259,11 +265,12 @@ module V1 : sig that size. The initial game dissection will be 3 values except in the case of a zero-tick commit when it will have 2 values.) - the first state hash value in [dissection] must not be [None] - - [inbox_snapshot] never changes once the game is created + - [inbox_snapshot] and [dal_snapshot] never change once the game is created *) type t = { turn : player; inbox_snapshot : Sc_rollup_inbox_repr.history_proof; + dal_snapshot : Dal_slot_repr.History.t; start_level : Raw_level_repr.t; inbox_level : Raw_level_repr.t; pvm_name : string; @@ -323,9 +330,10 @@ end (** To begin a game, first the conflict point in the commit tree is found, and then this function is applied. - [initial inbox ~start_level ~pvm_name ~parent ~child ~refuter ~defender - ~default_number_of_sections] will construct an initial game where [refuter] - is next to play. The game has [dissection] with three states: + [initial inbox dal_slots_history ~start_level ~pvm_name + ~parent ~child ~refuter ~defender ~default_number_of_sections] will construct + an initial game where [refuter] is next to play. The game has [dissection] + with three states: - firstly, the state (with tick zero) of [parent], the commitment that both stakers agree on. @@ -344,6 +352,7 @@ end increment from that state to its successor. *) val initial : Sc_rollup_inbox_repr.history_proof -> + Dal_slot_repr.History.t -> start_level:Raw_level_repr.t -> pvm_name:string -> parent:Sc_rollup_commitment_repr.t -> @@ -407,8 +416,17 @@ val loser_of_results : alice_result:bool -> bob_result:bool -> player option In the case of the game continuing, this swaps the current player and returns a [Ongoing] status. Otherwise, it returns a [Ended ] status. + + The provided DAL parameters and [dal_endorsement_lag] are used in case the + game needs to check that a page's content is part of a slot (using the + slot's commitment). *) val play : + (* FIXME/DAL: https://gitlab.com/tezos/tezos/-/issues/3997 + Providing DAL parameters here is not resilient to their change during + protocol upgrade. *) + Dal_slot_repr.parameters -> + dal_endorsement_lag:int -> stakers:Index.t -> Sc_rollup_metadata_repr.t -> t -> diff --git a/src/proto_alpha/lib_protocol/sc_rollup_proof_repr.ml b/src/proto_alpha/lib_protocol/sc_rollup_proof_repr.ml index 74cbef2802336f1ed55209900a717579957677db..09fa697e29c06f9865055548184c4a7c179beb1d 100644 --- a/src/proto_alpha/lib_protocol/sc_rollup_proof_repr.ml +++ b/src/proto_alpha/lib_protocol/sc_rollup_proof_repr.ml @@ -49,7 +49,13 @@ let () = (function Sc_rollup_invalid_serialized_inbox_proof -> Some () | _ -> None) (fun () -> Sc_rollup_invalid_serialized_inbox_proof) -type reveal_proof = Raw_data_proof of string | Metadata_proof +type reveal_proof = + | Raw_data_proof of string + | Metadata_proof + | Dal_page_proof of { + page_id : Dal_slot_repr.Page.t; + proof : Dal_slot_repr.History.proof; + } let reveal_proof_encoding = let open Data_encoding in @@ -72,7 +78,20 @@ let reveal_proof_encoding = (function Metadata_proof -> Some () | _ -> None) (fun () -> Metadata_proof) in - union [case_raw_data; case_metadata_proof] + let case_dal_page = + case + ~title:"dal page proof" + (Tag 2) + (obj3 + (req "reveal_proof_kind" (constant "dal_page_proof")) + (req "dal_page_id" Dal_slot_repr.Page.encoding) + (req "dal_proof" Dal_slot_repr.History.proof_encoding)) + (function + | Dal_page_proof {page_id; proof} -> Some ((), page_id, proof) + | _ -> None) + (fun ((), page_id, proof) -> Dal_page_proof {page_id; proof}) + in + union [case_raw_data; case_metadata_proof; case_dal_page] type input_proof = | Inbox_proof of { @@ -176,7 +195,81 @@ let check_inbox_proof snapshot serialized_inbox_proof (level, counter) = | Some inbox_proof -> Sc_rollup_inbox_repr.verify_proof (level, counter) snapshot inbox_proof -let valid ~metadata snapshot commit_level ~pvm_name proof = +module Dal_proofs = struct + (* FIXME/DAL: https://gitlab.com/tezos/tezos/-/issues/3997 + The current DAL refutation integration is not resilient to DAL parameters + changes when upgrading the protocol. The code needs to be adapted. *) + (** Given a page, identified by its ID, we accept to produce or verify a + proof for it if, and only if, the page's level [page_published_level] + is in the following boundaries: + - page_published_level > origination_level: this means that the slot + of the page was published after the rollup origination ; + - page_published_level + dal_endorsement_lag < commit_level: this + means that the slot of the page has been confirmed before the + [commit_level]. According to the definition in + {!Sc_rollup_commitment_repr}, [commit_level] (aka inbox_level + in that module) is the level (excluded) up to which the PVM consumed + all messages and DAL/DAC inputs before producing the related commitment. + *) + let page_level_is_valid ~dal_endorsement_lag ~origination_level ~commit_level + page_id = + (* [dal_endorsement_lag] is supposed to be positive. *) + let page_published_level = + Dal_slot_repr.(page_id.Page.slot_id.Header.published_level) + in + let open Raw_level_repr in + let not_too_old = page_published_level > origination_level in + let not_too_recent = + add page_published_level dal_endorsement_lag < commit_level + in + not_too_old && not_too_recent + + let verify ~metadata ~dal_endorsement_lag ~commit_level dal_parameters page_id + dal_snapshot proof = + let open Lwt_tzresult_syntax in + if + page_level_is_valid + ~origination_level:metadata.Sc_rollup_metadata_repr.origination_level + ~dal_endorsement_lag + ~commit_level + page_id + then + let* input = + Dal_slot_repr.History.verify_proof + dal_parameters + page_id + dal_snapshot + proof + in + return_some (Sc_rollup_PVM_sig.Reveal (Dal_page input)) + else return_none + + let produce ~metadata ~dal_endorsement_lag ~commit_level dal_parameters + page_id ~page_info confirmed_slots_history history_cache = + let open Lwt_tzresult_syntax in + if + page_level_is_valid + ~origination_level:metadata.Sc_rollup_metadata_repr.origination_level + ~dal_endorsement_lag + ~commit_level + page_id + then + let* proof, content_opt = + Dal_slot_repr.History.produce_proof + dal_parameters + page_id + ~page_info + confirmed_slots_history + history_cache + in + return + ( Some (Reveal_proof (Dal_page_proof {proof; page_id})), + Some (Sc_rollup_PVM_sig.Reveal (Dal_page content_opt)) ) + else return (None, None) +end + +let valid ~metadata snapshot commit_level dal_snapshot dal_parameters + ~dal_endorsement_lag ~pvm_name proof = let open Lwt_tzresult_syntax in let (module P) = Sc_rollups.wrapped_proof_module proof.pvm_step in let* () = check (String.equal P.name pvm_name) "Incorrect PVM kind" in @@ -202,6 +295,15 @@ let valid ~metadata snapshot commit_level ~pvm_name proof = return_some (Sc_rollup_PVM_sig.Reveal (Raw_data data)) | Some (Reveal_proof Metadata_proof) -> return_some (Sc_rollup_PVM_sig.Reveal (Metadata metadata)) + | Some (Reveal_proof (Dal_page_proof {proof; page_id})) -> + Dal_proofs.verify + ~metadata + dal_parameters + ~dal_endorsement_lag + ~commit_level + page_id + dal_snapshot + proof in let input = Option.bind input (cut_at_level ~origination_level ~commit_level) @@ -228,7 +330,16 @@ let valid ~metadata snapshot commit_level ~pvm_name proof = "Invalid reveal" | Some (Reveal_proof Metadata_proof), Needs_reveal Reveal_metadata -> return_unit - | _ -> proof_error "Inbox proof and input request are dissociated." + | ( Some (Reveal_proof (Dal_page_proof {page_id; proof = _})), + Needs_reveal (Request_dal_page pid) ) -> + check + (Dal_slot_repr.Page.equal page_id pid) + "Dal proof's page ID is not the one expected in input request." + | None, (Initial | First_after _ | Needs_reveal _) + | Some _, No_input_required + | Some (Inbox_proof _), Needs_reveal _ + | _ -> + proof_error "Inbox proof and input request are dissociated." in return (input, input_requested) @@ -252,6 +363,19 @@ module type PVM_with_context_and_state = sig val history : Sc_rollup_inbox_repr.History.t end + + module Dal_with_history : sig + val confirmed_slots_history : Dal_slot_repr.History.t + + val history_cache : Dal_slot_repr.History.History_cache.t + + val page_info : + (Dal_slot_repr.Page.content * Dal_slot_repr.Page.proof) option + + val dal_parameters : Dal_slot_repr.parameters + + val dal_endorsement_lag : int + end end let produce ~metadata pvm_and_state commit_level = @@ -308,6 +432,17 @@ let produce ~metadata pvm_and_state commit_level = return ( Some (Reveal_proof Metadata_proof), Some Sc_rollup_PVM_sig.(Reveal (Metadata metadata)) ) + | Needs_reveal (Request_dal_page page_id) -> + let open Dal_with_history in + Dal_proofs.produce + ~metadata + dal_parameters + ~dal_endorsement_lag + ~commit_level + page_id + ~page_info + confirmed_slots_history + history_cache in let input_given = Option.bind input_given (cut_at_level ~origination_level ~commit_level) diff --git a/src/proto_alpha/lib_protocol/sc_rollup_proof_repr.mli b/src/proto_alpha/lib_protocol/sc_rollup_proof_repr.mli index 7f7d97f5b55fbcfa2a9720a889f34992ac3ebdf5..ba90592e0725bd56be739a85f225831023ad08bd 100644 --- a/src/proto_alpha/lib_protocol/sc_rollup_proof_repr.mli +++ b/src/proto_alpha/lib_protocol/sc_rollup_proof_repr.mli @@ -49,8 +49,14 @@ open Sc_rollup_repr type reveal_proof = | Raw_data_proof of string (** The existence of reveal for a given hash when the - [input_requested] is the [Needs_for_reveal]. *) + [input_requested] is the [Needs_reveal Reveal_raw_data]. *) | Metadata_proof + | Dal_page_proof of { + page_id : Dal_slot_repr.Page.t; + proof : Dal_slot_repr.History.proof; + } + (** The existence or not of a confirmed slot for a given page ID when the + [input_requested] is the [Needs_reveal Request_dal_page]. *) (** A PVM proof [pvm_step] is combined with an [input_proof] to provide the proof necessary to validate a single step in the refutation @@ -109,12 +115,19 @@ val stop : t -> State_hash.t This function requires a few bits of data (available from the refutation game record in the storage): - - a snapshot of the inbox, that may be used by the [input] proof ; + - a snapshot of the inbox, that may be used by the [input] proof in case + it's an inbox message ; + + - a snapshot of the DAL confirmed slots structure, that may be used by + the [input] proof in case the input is a DAL page ; - the inbox level of the commitment, used to determine if an output from the [input] proof is too recent to be allowed into the PVM proof ; + - DAL parameters and [dal_endorsement_lag], to be able to check the page + content membership to a slot if needed ; + - the [pvm_name], used to check that the proof given has the right PVM kind. @@ -125,6 +138,9 @@ val valid : metadata:Sc_rollup_metadata_repr.t -> Sc_rollup_inbox_repr.history_proof -> Raw_level_repr.t -> + Dal_slot_repr.History.t -> + Dal_slot_repr.parameters -> + dal_endorsement_lag:int -> pvm_name:string -> t -> (Sc_rollup_PVM_sig.input option * Sc_rollup_PVM_sig.input_request) tzresult @@ -150,6 +166,40 @@ module type PVM_with_context_and_state = sig val history : Sc_rollup_inbox_repr.History.t end + + (* FIXME/DAL: https://gitlab.com/tezos/tezos/-/issues/3997 + This interface might not be resilient to dal parameters changes + (cryptobox parameters or dal_endorsement_lag for instance). *) + module Dal_with_history : sig + (** The reference/snapshot cell of the DAL skip list that stores + confirmed slots. *) + val confirmed_slots_history : Dal_slot_repr.History.t + + (** A bounded cache of Dal confirmed slots skip list's cells. Used to + to build inclusion proofs. *) + val history_cache : Dal_slot_repr.History.History_cache.t + + (** In case we expect to generate an input proof that is a DAL page + confirmation, we should provide via [page_info] the information of the + page. That is: its content and the proof that the page is part of a + confirmed slot whose ID is part of the page's ID. + + In case we expect to generate an input proof to justify that a DAL page + is not confirmed, the value of [page_info] should be [None]. + + In case the proof doesn't involve DAL inputs, the value of [page_info] + is [None]. *) + val page_info : + (Dal_slot_repr.Page.content * Dal_slot_repr.Page.proof) option + + (** Some parameters of the DAL. Needed when checking a page's proof against + a slot's {!val: Dal_slot_repr.commitment}. *) + val dal_parameters : Dal_slot_repr.parameters + + (** The lag between the time an endorsement is published on L1 + (its published_level) and the level it should be confirmed. *) + val dal_endorsement_lag : int + end end (** [produce ~metadata pvm_and_state inbox_context inbox_history commit_level] @@ -160,9 +210,9 @@ end the input requested is a reveal the proof production will also fail. - This will fail if any of the [context], [inbox_context] or - [inbox_history] given don't have enough data to make the proof. For - example, the 'protocol implementation' version of each PVM won't be + This will fail if any of the [context], [inbox_context], [inbox_history] or + [dal_slots_history_cache] given doesn't have enough data to make the proof. + For example, the 'protocol implementation' version of each PVM won't be able to run this function. Similarly, the version of the inbox stored in the L1 won't be enough because it forgets old levels. diff --git a/src/proto_alpha/lib_protocol/sc_rollup_refutation_storage.ml b/src/proto_alpha/lib_protocol/sc_rollup_refutation_storage.ml index 210acb3762131ec6f4cc1b96a56e9d31ef08e762..38f9bbf0230a1371237cfa09881e5d352ae418f7 100644 --- a/src/proto_alpha/lib_protocol/sc_rollup_refutation_storage.ml +++ b/src/proto_alpha/lib_protocol/sc_rollup_refutation_storage.ml @@ -256,11 +256,15 @@ let start_game ctxt rollup ~player:refuter ~opponent:defender = let default_number_of_sections = Constants_storage.sc_rollup_number_of_sections_in_dissection ctxt in + let* slots_history_snapshot = + Dal_slot_storage.get_slot_headers_history ctxt + in let current_level = (Raw_context.current_level ctxt).level in let game = Sc_rollup_game_repr.initial ~start_level:current_level (Sc_rollup_inbox_repr.take_snapshot inbox) + slots_history_snapshot ~pvm_name:(Sc_rollups.Kind.name_of kind) ~parent:parent_info ~child:child_info @@ -288,8 +292,15 @@ let game_move ctxt rollup ~player ~opponent refutation = Sc_rollup_wrong_turn in let* ctxt, metadata = Sc_rollup_storage.get_metadata ctxt rollup in + let dal = (Constants_storage.parametric ctxt).dal in let* move_result = - Sc_rollup_game_repr.play ~stakers metadata game refutation + Sc_rollup_game_repr.play + dal.cryptobox_parameters + ~dal_endorsement_lag:dal.endorsement_lag + ~stakers + metadata + game + refutation in match move_result with | Either.Left game_result -> return (Some game_result, ctxt) diff --git a/src/proto_alpha/lib_protocol/sc_rollup_wasm.ml b/src/proto_alpha/lib_protocol/sc_rollup_wasm.ml index 8ae8f7b517aa16df1b1e7f1dc9982ea351ba09f2..3eaf256a2dbaad746f278a3e70231d7eed92dbfe 100644 --- a/src/proto_alpha/lib_protocol/sc_rollup_wasm.ml +++ b/src/proto_alpha/lib_protocol/sc_rollup_wasm.ml @@ -312,6 +312,10 @@ module V2_0_0 = struct let* s = get in let* s = lift (WASM_machine.reveal_step metadata_bytes s) in set s + | PS.Reveal (PS.Dal_page _content_opt) -> + (* FIXME/DAL: https://gitlab.com/tezos/tezos/-/issues/3927. + Handle DAL pages in wasm PVM. *) + assert false let set_input input = state_of @@ set_input_state input diff --git a/src/proto_alpha/lib_protocol/test/pbt/dune b/src/proto_alpha/lib_protocol/test/pbt/dune index 480c21df3a3c36d31b1dd4d55676f2c836139bd1..749dc5103b288413635a507e7b454574ada5bff4 100644 --- a/src/proto_alpha/lib_protocol/test/pbt/dune +++ b/src/proto_alpha/lib_protocol/test/pbt/dune @@ -34,7 +34,8 @@ tezos-benchmark-type-inference-alpha tezos-sc-rollup-alpha tezos-crypto-dal - tezos-base-test-helpers) + tezos-base-test-helpers + tezos-protocol-alpha.parameters) (flags (:standard) -open Tezos_base.TzPervasives @@ -46,7 +47,8 @@ -open Tezos_benchmark_type_inference_alpha -open Tezos_sc_rollup_alpha -open Tezos_crypto_dal - -open Tezos_base_test_helpers)) + -open Tezos_base_test_helpers + -open Tezos_protocol_alpha_parameters)) (rule (alias runtest) diff --git a/src/proto_alpha/lib_protocol/test/pbt/test_refutation_game.ml b/src/proto_alpha/lib_protocol/test/pbt/test_refutation_game.ml index 65ec64ad933ca62d2e75536168e97a10c516bc1a..697a606fd7f73425f79bbfd6f3ccf6706919232c 100644 --- a/src/proto_alpha/lib_protocol/test/pbt/test_refutation_game.ml +++ b/src/proto_alpha/lib_protocol/test/pbt/test_refutation_game.ml @@ -1354,6 +1354,22 @@ let build_proof ~player_client start_tick (game : Game.t) = let inbox = history_proof end + + (* FIXME/DAL-REFUTATION: https://gitlab.com/tezos/tezos/-/issues/3992 + Extend refutation game to handle Dal refutation case. *) + module Dal_with_history = struct + let confirmed_slots_history = Dal.Slots_history.genesis + + let history_cache = Dal.Slots_history.History_cache.empty ~capacity:0L + + let page_info = None + + let dal_parameters = + Default_parameters.constants_test.dal.cryptobox_parameters + + let dal_endorsement_lag = + Default_parameters.constants_test.dal.endorsement_lag + end end in let*! proof = Sc_rollup.Proof.produce ~metadata (module P) game.inbox_level in return (WithExceptions.Result.get_ok ~loc:__LOC__ proof) diff --git a/src/proto_alpha/lib_protocol/test/pbt/test_sc_rollup_encoding.ml b/src/proto_alpha/lib_protocol/test/pbt/test_sc_rollup_encoding.ml index a06186cc595792ea39d5ef6bbf4f6ffb3aed2bbf..87da1c9dc820be180a09e0796ca94cda36b1a44f 100644 --- a/src/proto_alpha/lib_protocol/test/pbt/test_sc_rollup_encoding.ml +++ b/src/proto_alpha/lib_protocol/test/pbt/test_sc_rollup_encoding.ml @@ -115,6 +115,40 @@ let gen_inbox level = | Error e -> Stdlib.failwith (Format.asprintf "%a" Error_monad.pp_print_trace e)) +let gen_dal_slots_history () = + let open Gen in + let open Dal_slot_repr in + (* Generate a list of (level * confirmed slot ID). *) + let* list = small_list (pair small_nat small_nat) in + let list = + List.rev_map + (fun (level, slot_index) -> + let published_level = + Raw_level_repr.( + (* use succ to avoid having a published_level = 0, as it's the + genesis cell's level in the skip list. *) + succ @@ try of_int32_exn (Int32.of_int level) with _ -> root) + in + let index = Index.(of_int slot_index |> Option.value ~default:zero) in + Header.{id = {published_level; index}; commitment = Commitment.zero}) + list + in + let list = + (* Sort the list in the right ordering before adding slots to slots_history. *) + List.sort_uniq + (fun {Header.id = a; _} {id = b; _} -> + let c = Raw_level_repr.compare a.published_level b.published_level in + if c <> 0 then c else Index.compare a.index b.index) + list + in + History.(add_confirmed_slot_headers_no_cache genesis list) |> function + | Ok v -> return v + | Error e -> + return + @@ Stdlib.failwith + (Format.asprintf "%a" Error_monad.pp_print_trace + @@ Environment.wrap_tztrace e) + let gen_inbox_history_proof inbox_level = let open Gen in let* inbox = gen_inbox inbox_level in @@ -160,11 +194,20 @@ let gen_game = let* inbox_level = gen_inbox_level in let* start_level = gen_start_level in let* inbox_snapshot = gen_inbox_history_proof inbox_level in + let* dal_snapshot = gen_dal_slots_history () in let* pvm_name = gen_pvm_name in let* game_state = gen_game_state in return Sc_rollup_game_repr. - {turn; inbox_snapshot; start_level; inbox_level; pvm_name; game_state} + { + turn; + dal_snapshot; + inbox_snapshot; + start_level; + inbox_level; + pvm_name; + game_state; + } let gen_conflict = let open Gen in diff --git a/src/proto_alpha/lib_protocol/test/unit/dune b/src/proto_alpha/lib_protocol/test/unit/dune index 25103a12fff8c513deaaa8f6b77393ad0b68514b..3a31da904645ba15d8537750f30ca04f322d869a 100644 --- a/src/proto_alpha/lib_protocol/test/unit/dune +++ b/src/proto_alpha/lib_protocol/test/unit/dune @@ -27,6 +27,7 @@ -open Tezos_base_test_helpers -open Tezos_micheline -open Tezos_client_alpha + -open Tezos_protocol_alpha_parameters -open Tezos_protocol_alpha -open Tezos_alpha_test_helpers -open Test_scoru_wasm_test_helpers diff --git a/src/proto_alpha/lib_protocol/test/unit/test_sc_rollup_game.ml b/src/proto_alpha/lib_protocol/test/unit/test_sc_rollup_game.ml index 65dedc896cee5c8192f99183b53831218977cef6..055bfdc68d50fb372adf21adbf2eb5921d2d0ea8 100644 --- a/src/proto_alpha/lib_protocol/test/unit/test_sc_rollup_game.ml +++ b/src/proto_alpha/lib_protocol/test/unit/test_sc_rollup_game.ml @@ -274,7 +274,8 @@ let test_invalid_serialized_inbox_proof () = let level = Raw_level.(succ root) in let*! inbox = Sc_rollup.Inbox.empty ctxt level in let snapshot = Sc_rollup.Inbox.take_snapshot inbox in - + let dal_snapshot = Dal.Slots_history.genesis in + let dal_parameters = Default_parameters.constants_mainnet.dal in let ctxt = Tezos_context_memory.make_empty_context () in let*! state = Arith_pvm.initial_state ctxt in (* We evaluate the boot sector, so the [input_requested] is a @@ -313,6 +314,9 @@ let test_invalid_serialized_inbox_proof () = ~metadata snapshot Raw_level.root + dal_snapshot + dal_parameters.cryptobox_parameters + ~dal_endorsement_lag:dal_parameters.endorsement_lag ~pvm_name:"arith" proof in diff --git a/tezt/tests/dal.ml b/tezt/tests/dal.ml index 14aad1e172a916f03a6018142b78ac430df7e4f8..7fb53a818053b650c2cc4634802b25192f22af8e 100644 --- a/tezt/tests/dal.ml +++ b/tezt/tests/dal.ml @@ -703,7 +703,7 @@ let test_dal_node_startup = let* () = Dal_node.terminate dal_node in return () -let rollup_node_stores_dal_slots _protocol dal_node sc_rollup_node +let rollup_node_stores_dal_slots ?expand_test _protocol dal_node sc_rollup_node sc_rollup_address node client = (* Check that the rollup node stores the slots published in a block, along with slot headers: 0. Run dal node @@ -722,15 +722,15 @@ let rollup_node_stores_dal_slots _protocol dal_node sc_rollup_node let* () = Dal_node.run dal_node in (* 1. Send three slots to dal node and obtain corresponding headers. *) - let slot_contents_0 = "DEADC0DE" in + let slot_contents_0 = " 10 " in let* commitment_0 = RPC.call dal_node (Rollup.Dal.RPC.split_slot slot_contents_0) in - let slot_contents_1 = "CAFEDEAD" in + let slot_contents_1 = " 200 " in let* commitment_1 = RPC.call dal_node (Rollup.Dal.RPC.split_slot slot_contents_1) in - let slot_contents_2 = "C0FFEE" in + let slot_contents_2 = " 400 " in let* commitment_2 = RPC.call dal_node (Rollup.Dal.RPC.split_slot slot_contents_2) in @@ -861,7 +861,88 @@ let rollup_node_stores_dal_slots _protocol dal_node sc_rollup_node Check.(message = slot_contents_1) Check.string ~error_msg:"unexpected message in slot (%L = %R)" ; - return () + match expand_test with + | None -> return () + | Some f -> f client sc_rollup_address sc_rollup_node + +let send_messages ?(src = Constant.bootstrap2.alias) client msgs = + let msg = Ezjsonm.(to_string ~minify:true @@ list Ezjsonm.string msgs) in + let* () = Client.Sc_rollup.send_message ~hooks ~src ~msg client in + Client.bake_for_and_wait client + +let rollup_node_interprets_dal_pages client sc_rollup sc_rollup_node = + let* genesis_info = + RPC.Client.call ~hooks client + @@ RPC.get_chain_block_context_sc_rollup_genesis_info sc_rollup + in + let init_level = JSON.(genesis_info |-> "level" |> as_int) in + let sc_rollup_client = Sc_rollup_client.create sc_rollup_node in + let* level = + Sc_rollup_node.wait_for_level ~timeout:120. sc_rollup_node init_level + in + + (* The Dal content is as follows: + - the page 0 of slot 0 contains 10, + - the page 0 of slot 1 contains 200, + - the page 0 of slot 2 contains 400. + The rollup subscribed to slots 0 and 1, but only slot 1 is confirmed. + Below, we expect to have value = 302. *) + let expected_value = 302 in + (* The code should be adapted if the current level changes. *) + assert (level = 6) ; + let* () = + send_messages + client + [ + " 99 3 "; + (* Total sum is now 99 + 3 = 102 *) + " dal:5:1:0 "; + (* Page 0 of Slot 1 contains 200, total sum is 302. *) + " dal:5:1:1 "; + " dal:5:0:0 "; + (* Slot 0 is not confirmed, total sum doesn't change. *) + " dal:5:0:2 "; + (* Page 2 of Slot 0 empty, total sum unchanged. *) + (* Page 1 of Slot 1 is empty, total sum unchanged. *) + " dal:4:1:0 "; + (* It's too late to import a page published at level 5. *) + " dal:6:1:0 "; + (* It's too early to import a page published at level 7. *) + " dal:5:10000:0 "; + " dal:5:0:100000 "; + " dal:5:-10000:0 "; + " dal:5:0:-100000 "; + " dal:5:expecting_integer:0 "; + " dal:5:0:expecting_integer "; + (* The 6 pages requests above are ignored by the PVM because + slot/page ID is out of bounds or illformed. *) + " dal:1002147483647:1:1 " + (* Level is about Int32.max_int, directive should be ignored. *); + " + + value"; + ] + in + + (* Slot 1 is not confirmed, hence the total sum doesn't change. *) + let* () = repeat 2 (fun () -> Client.bake_for_and_wait client) in + let* _lvl = + Sc_rollup_node.wait_for_level ~timeout:120. sc_rollup_node (level + 1) + in + let* encoded_value = + Sc_rollup_client.state_value ~hooks sc_rollup_client ~key:"vars/value" + in + match Data_encoding.(Binary.of_bytes int31) @@ encoded_value with + | Error error -> + failwith + (Format.asprintf + "The arithmetic PVM has an unexpected state: %a" + Data_encoding.Binary.pp_read_error + error) + | Ok value -> + Check.( + (value = expected_value) + int + ~error_msg:"Invalid value in rollup state (%L <> %R)") ; + return () let register ~protocols = test_dal_scenario "feature_flag_is_disabled" test_feature_flag protocols ; @@ -879,4 +960,9 @@ let register ~protocols = ~dal_enable:true "rollup_node_downloads_slots" rollup_node_stores_dal_slots + protocols ; + test_dal_rollup_scenario + ~dal_enable:true + "rollup_node_applies_dal_pages" + (rollup_node_stores_dal_slots ~expand_test:rollup_node_interprets_dal_pages) protocols diff --git a/tezt/tests/expected/dal.ml/Alpha- Testing rollup and Data availability layer node (rollup_node_applies_dal_.out b/tezt/tests/expected/dal.ml/Alpha- Testing rollup and Data availability layer node (rollup_node_applies_dal_.out new file mode 100644 index 0000000000000000000000000000000000000000..36ef8d429a779d2c77c24b4d06af61ab0f5e690c --- /dev/null +++ b/tezt/tests/expected/dal.ml/Alpha- Testing rollup and Data availability layer node (rollup_node_applies_dal_.out @@ -0,0 +1,380 @@ + +./octez-client --wait none originate sc rollup from '[PUBLIC_KEY_HASH]' of kind arith of type unit booting with --burn-cap 9999999 +Node is bootstrapped. +Estimated gas: 2909.925 units (will add 100 for safety) +Estimated storage: 6524 bytes added (will add 20 for safety) +Operation successfully injected in the node. +Operation hash is '[OPERATION_HASH]' +NOT waiting for the operation to be included. +Use command + octez-client wait for [OPERATION_HASH] to be included --confirmations 1 --branch [BLOCK_HASH] +and/or an external block explorer to make sure that it has been included. +This sequence of operations was run: + Manager signed operations: + From: [PUBLIC_KEY_HASH] + Fee to the baker: ꜩ0.000649 + Expected counter: 1 + Gas limit: 3010 + Storage limit: 6544 bytes + Balance updates: + [PUBLIC_KEY_HASH] ... -ꜩ0.000649 + payload fees(the block proposer) ....... +ꜩ0.000649 + Smart contract rollup origination: + Kind: arith + Parameter type: unit + Boot sector Blake2B hash: '0e5751c026e543b2e8ab2eb06099daa1d1e5df47778f7787faab45cdf12fe3a8' + This smart contract rollup origination was successfully applied + Consumed gas: 2909.925 + Storage size: 6524 bytes + Address: [SC_ROLLUP_HASH] + Genesis commitment hash: [SC_ROLLUP_COMMITMENT_HASH] + Balance updates: + [PUBLIC_KEY_HASH] ... -ꜩ1.631 + storage fees ........................... +ꜩ1.631 + + +./octez-client rpc get '/chains/main/blocks/head/context/sc_rollup/[SC_ROLLUP_HASH]/genesis_info' +{ "level": 2, + "commitment_hash": "[SC_ROLLUP_COMMITMENT_HASH]" } + +./octez-sc-rollup-client-alpha rpc get /global/block/head/dal/slot_headers +[ { "level": 4, "index": 0, + "commitment": + "sh23Xtg7DY2qvSKgM1TiQDLH4cGZ2tHQwiQ5usHYdBUMzkirZUEVkSKoBDvjQePseeKFnQDGc9" }, + { "level": 4, "index": 1, + "commitment": + "[DAL_SLOT_HEADER]" }, + { "level": 4, "index": 2, + "commitment": + "sh237VRQLZqf8Uno4hjiiJh8RJxuwhPF4xWnPq2VKuC2ZbwVp3w9nw36iGfLHzpQrbopWx8GFq" } ] + +./octez-sc-rollup-client-alpha rpc get /global/block/head/dal/slot_pages +[ { "index": 0, + "contents": + [ null, null, null, null, null, null, null, null, null, null, null, + null, null, null, null, null, null, null, null, null, null, null, + null, null, null, null, null, null, null, null, null, null, null, + null, null, null, null, null, null, null, null, null, null, null, + null, null, null, null, null, null, null, null, null, null, null, + null, null, null, null, null, null, null, null, null, null, null, + null, null, null, null, null, null, null, null, null, null, null, + null, null, null, null, null, null, null, null, null, null, null, + null, null, null, null, null, null, null, null, null, null, null, + null, null, null, null, null, null, null, null, null, null, null, + null, null, null, null, null, null, null, null, null, null, null, + null, null, null, null, null, null, null, null, null, null, null, + null, null, null, null, null, null, null, null, null, null, null, + null, null, null, null, null, null, null, null, null, null, null, + null, null, null, null, null, null, null, null, null, null, null, + null, null, null, null, null, null, null, null, null, null, null, + null, null, null, null, null, null, null, null, null, null, null, + null, null, null, null, null, null, null, null, null, null, null, + null, null, null, null, null, null, null, null, null, null, null, + null, null, null, null, null, null, null, null, null, null, null, + null, null, null, null, null, null, null, null, null, null, null, + null, null, null, null, null, null, null, null, null, null, null, + null, null, null, null, null, null, null, null, null, null, null, + null, null, null ] }, + { "index": 1, + "contents": + [ "2032303020000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", + "0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", + "0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", + "0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", + "0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", + "0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", + "0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", + "0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", + "0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", + "0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", + "0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", + "0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", + "0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", + "0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", + "0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", + "0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", + "0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", + "0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", + "0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", + "0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", + "0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", + "0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", + "0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", + "0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", + "0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", + "0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", + "0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", + "0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", + "0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", + "0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", + "0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", + "0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", + "0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", + "0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", + "0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", + "0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", + "0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", + "0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", + "0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", + "0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", + "0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", + "0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", + "0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", + "0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", + "0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", + "0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", + "0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", + "0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", + "0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", + "0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", + "0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", + "0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", + "0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", + "0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", + "0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", + "0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", + "0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", + "0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", + "0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", + "0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", + "0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", + "0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", + "0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", + "0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", + "0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", + "0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", + "0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", + "0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", + "0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", + "0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", + "0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", + "0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", + "0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", + "0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", + "0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", + "0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", + "0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", + "0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", + "0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", + "0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", + "0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", + "0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", + "0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", + "0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", + "0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", + "0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", + "0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", + "0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", + "0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", + "0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", + "0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", + "0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", + "0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", + "0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", + "0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", + "0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", + "0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", + "0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", + "0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", + "0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", + "0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", + "0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", + "0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", + "0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", + "0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", + "0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", + "0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", + "0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", + "0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", + "0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", + "0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", + "0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", + "0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", + "0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", + "0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", + "0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", + "0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", + "0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", + "0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", + "0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", + "0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", + "0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", + "0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", + "0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", + "0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", + "0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", + "0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", + "0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", + "0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", + "0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", + "0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", + "0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", + "0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", + "0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", + "0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", + "0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", + "0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", + "0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", + "0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", + "0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", + "0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", + "0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", + "0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", + "0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", + "0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", + "0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", + "0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", + "0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", + "0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", + "0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", + "0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", + "0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", + "0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", + "0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", + "0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", + "0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", + "0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", + "0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", + "0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", + "0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", + "0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", + "0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", + "0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", + "0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", + "0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", + "0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", + "0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", + "0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", + "0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", + "0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", + "0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", + "0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", + "0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", + "0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", + "0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", + "0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", + "0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", + "0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", + "0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", + "0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", + "0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", + "0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", + "0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", + "0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", + "0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", + "0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", + "0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", + "0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", + "0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", + "0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", + "0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", + "0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", + "0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", + "0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", + "0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", + "0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", + "0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", + "0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", + "0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", + "0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", + "0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", + "0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", + "0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", + "0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", + "0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", + "0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", + "0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", + "0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", + "0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", + "0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", + "0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", + "0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", + "0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", + "0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", + "0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", + "0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", + "0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", + "0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", + "0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", + "0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", + "0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", + "0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", + "0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", + "0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", + "0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", + "0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", + "0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", + "0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", + "0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", + "0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", + "0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", + "0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", + "0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", + "0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", + "0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", + "0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", + "0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", + "0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", + "0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", + "0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", + "0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", + "0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", + "0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", + "0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", + "0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", + "0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", + "0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", + "0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", + "0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", + "0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", + "0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", + "0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", + "0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", + "0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", + "0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", + "0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000" ] } ] + +./octez-client rpc get '/chains/main/blocks/head/context/sc_rollup/[SC_ROLLUP_HASH]/genesis_info' +{ "level": 2, + "commitment_hash": "[SC_ROLLUP_COMMITMENT_HASH]" } + +./octez-client --wait none send sc rollup message '[" 99 3 "," dal:5:1:0 "," dal:5:1:1 "," dal:5:0:0 "," dal:5:0:2 "," dal:4:1:0 "," dal:6:1:0 "," dal:5:10000:0 "," dal:5:0:100000 "," dal:5:-10000:0 "," dal:5:0:-100000 "," dal:5:expecting_integer:0 "," dal:5:0:expecting_integer "," dal:1002147483647:1:1 "," + + value"]' from bootstrap2 +Node is bootstrapped. +Estimated gas: 1010.725 units (will add 100 for safety) +Estimated storage: no bytes added +Operation successfully injected in the node. +Operation hash is '[OPERATION_HASH]' +NOT waiting for the operation to be included. +Use command + octez-client wait for [OPERATION_HASH] to be included --confirmations 1 --branch [BLOCK_HASH] +and/or an external block explorer to make sure that it has been included. +This sequence of operations was run: + Manager signed operations: + From: [PUBLIC_KEY_HASH] + Fee to the baker: ꜩ0.000625 + Expected counter: 2 + Gas limit: 1111 + Storage limit: 0 bytes + Balance updates: + [PUBLIC_KEY_HASH] ... -ꜩ0.000625 + payload fees(the block proposer) ....... +ꜩ0.000625 + Smart contract rollup messages submission + This smart contract rollup messages submission was successfully applied + Consumed gas: 1010.725 + Resulting inbox state: { level = 7 + current messages hash = [SC_ROLLUP_INBOX_HASH] + nb_messages_in_commitment_period = 28 + message_counter = 16 + old_levels_messages = hash : [SC_ROLLUP_INBOX_HASH] + + content = [SC_ROLLUP_INBOX_HASH] + index = 6 + back_pointers = [SC_ROLLUP_INBOX_HASH] + [SC_ROLLUP_INBOX_HASH] + [SC_ROLLUP_INBOX_HASH] + + } + + +./octez-sc-rollup-client-alpha get state value for vars/value --block head +"\000\000\001." diff --git a/tezt/tests/expected/dal.ml/Alpha- Testing rollup and Data availability layer node (rollup_node_downloads_sl.out b/tezt/tests/expected/dal.ml/Alpha- Testing rollup and Data availability layer node (rollup_node_downloads_sl.out index 25e5f5a84e6bfb9eb600a91c4a44f67e85a5f340..3c0d89a45427c32108660cafbf58c3b2aca916ce 100644 --- a/tezt/tests/expected/dal.ml/Alpha- Testing rollup and Data availability layer node (rollup_node_downloads_sl.out +++ b/tezt/tests/expected/dal.ml/Alpha- Testing rollup and Data availability layer node (rollup_node_downloads_sl.out @@ -40,13 +40,13 @@ This sequence of operations was run: ./octez-sc-rollup-client-alpha rpc get /global/block/head/dal/slot_headers [ { "level": 4, "index": 0, "commitment": - "[DAL_SLOT_HEADER]" }, + "sh23Xtg7DY2qvSKgM1TiQDLH4cGZ2tHQwiQ5usHYdBUMzkirZUEVkSKoBDvjQePseeKFnQDGc9" }, { "level": 4, "index": 1, "commitment": - "sh26NhBTFadoP2pmdEVtoNjm37vENA4SyDnmyqoAP7KmCKHcWGmJwETzbAMG8JVVJX1DX27kG8" }, + "[DAL_SLOT_HEADER]" }, { "level": 4, "index": 2, "commitment": - "sh22RunyP4K5p6tTzyn3UeSkiL4CjqRiimbkiLTc3pTZf2HaVpExyRsydBHhUsC5pKD9jReYSt" } ] + "sh237VRQLZqf8Uno4hjiiJh8RJxuwhPF4xWnPq2VKuC2ZbwVp3w9nw36iGfLHzpQrbopWx8GFq" } ] ./octez-sc-rollup-client-alpha rpc get /global/block/head/dal/slot_pages [ { "index": 0, @@ -77,7 +77,7 @@ This sequence of operations was run: null, null, null ] }, { "index": 1, "contents": - [ "4341464544454144000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", + [ "2032303020000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", "0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", "0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", "0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", diff --git a/tezt/tests/expected/sc_rollup.ml/Alpha- commitments- publish- and try to cement not on top of LCC or disputed.out b/tezt/tests/expected/sc_rollup.ml/Alpha- commitments- publish- and try to cement not on top of LCC or disputed.out index f7aade668ab44d499b366b0574f4b81dbf04248d..4ae72b9e3dff602a79dc939df2e767b130e02486 100644 --- a/tezt/tests/expected/sc_rollup.ml/Alpha- commitments- publish- and try to cement not on top of LCC or disputed.out +++ b/tezt/tests/expected/sc_rollup.ml/Alpha- commitments- publish- and try to cement not on top of LCC or disputed.out @@ -467,7 +467,7 @@ Error: ./octez-client --wait none timeout dispute on sc rollup '[SC_ROLLUP_HASH]' with '[PUBLIC_KEY_HASH]' from bootstrap1 Node is bootstrapped. -Estimated gas: 8211.196 units (will add 100 for safety) +Estimated gas: 8211.318 units (will add 100 for safety) Estimated storage: no bytes added Operation successfully injected in the node. Operation hash is '[OPERATION_HASH]' @@ -490,7 +490,7 @@ This sequence of operations was run: First staker (Alice): [PUBLIC_KEY_HASH] Second staker (Bob): [PUBLIC_KEY_HASH] This smart contract rollup refutation timeout was successfully applied - Consumed gas: 8211.196 + Consumed gas: 8211.318 Refutation game status: Game ended: [PUBLIC_KEY_HASH] lost because: timeout Balance updates: Frozen_bonds([PUBLIC_KEY_HASH],[SC_ROLLUP_HASH]) ... -ꜩ10000 diff --git a/tezt/tests/expected/sc_rollup.ml/Alpha- refutation game timeout.out b/tezt/tests/expected/sc_rollup.ml/Alpha- refutation game timeout.out index ea3c8d4ea4382b15a0249ab94beee04c5de88f91..114c8dcd6d92a2d0c60adf957a1e4a1cdf647c51 100644 --- a/tezt/tests/expected/sc_rollup.ml/Alpha- refutation game timeout.out +++ b/tezt/tests/expected/sc_rollup.ml/Alpha- refutation game timeout.out @@ -295,7 +295,7 @@ This sequence of operations was run: ./octez-client --wait none timeout dispute on sc rollup '[SC_ROLLUP_HASH]' with '[PUBLIC_KEY_HASH]' from bootstrap1 Node is bootstrapped. -Estimated gas: 8211.196 units (will add 100 for safety) +Estimated gas: 8211.318 units (will add 100 for safety) Estimated storage: no bytes added Operation successfully injected in the node. Operation hash is '[OPERATION_HASH]' @@ -318,7 +318,7 @@ This sequence of operations was run: First staker (Alice): [PUBLIC_KEY_HASH] Second staker (Bob): [PUBLIC_KEY_HASH] This smart contract rollup refutation timeout was successfully applied - Consumed gas: 8211.196 + Consumed gas: 8211.318 Refutation game status: Game ended: [PUBLIC_KEY_HASH] lost because: timeout Balance updates: Frozen_bonds([PUBLIC_KEY_HASH],[SC_ROLLUP_HASH]) ... -ꜩ10000 diff --git a/tezt/tests/expected/sc_rollup.ml/Alpha- refutation- check the punishment and reward.out b/tezt/tests/expected/sc_rollup.ml/Alpha- refutation- check the punishment and reward.out index 403955e16f26888b36c78de61151a7afddd04a80..5ad053297922fa11a38016b5cd35c81d87d13856 100644 --- a/tezt/tests/expected/sc_rollup.ml/Alpha- refutation- check the punishment and reward.out +++ b/tezt/tests/expected/sc_rollup.ml/Alpha- refutation- check the punishment and reward.out @@ -107,7 +107,7 @@ This sequence of operations was run: ./octez-client --wait none timeout dispute on sc rollup '[SC_ROLLUP_HASH]' with '[PUBLIC_KEY_HASH]' from bootstrap1 Node is bootstrapped. -Estimated gas: 6460.826 units (will add 100 for safety) +Estimated gas: 6460.948 units (will add 100 for safety) Estimated storage: no bytes added Operation successfully injected in the node. Operation hash is '[OPERATION_HASH]' @@ -130,7 +130,7 @@ This sequence of operations was run: First staker (Alice): [PUBLIC_KEY_HASH] Second staker (Bob): [PUBLIC_KEY_HASH] This smart contract rollup refutation timeout was successfully applied - Consumed gas: 6460.826 + Consumed gas: 6460.948 Refutation game status: Game ended: [PUBLIC_KEY_HASH] lost because: timeout Balance updates: Frozen_bonds([PUBLIC_KEY_HASH],[SC_ROLLUP_HASH]) ... -ꜩ10000