From c977b0bb849c49cf7a2928eb8cc1dc4143846b38 Mon Sep 17 00:00:00 2001 From: Valentin Chaboche Date: Wed, 21 Sep 2022 10:54:16 +0200 Subject: [PATCH 1/9] Scoru,Proto: add rollup metadata --- src/proto_alpha/lib_protocol/TEZOS_PROTOCOL | 1 + src/proto_alpha/lib_protocol/alpha_context.ml | 1 + .../lib_protocol/alpha_context.mli | 11 ++++ src/proto_alpha/lib_protocol/dune | 4 ++ .../lib_protocol/sc_rollup_metadata_repr.ml | 54 +++++++++++++++++++ .../lib_protocol/sc_rollup_metadata_repr.mli | 42 +++++++++++++++ 6 files changed, 113 insertions(+) create mode 100644 src/proto_alpha/lib_protocol/sc_rollup_metadata_repr.ml create mode 100644 src/proto_alpha/lib_protocol/sc_rollup_metadata_repr.mli diff --git a/src/proto_alpha/lib_protocol/TEZOS_PROTOCOL b/src/proto_alpha/lib_protocol/TEZOS_PROTOCOL index 99183904737f..0ff25de257dd 100644 --- a/src/proto_alpha/lib_protocol/TEZOS_PROTOCOL +++ b/src/proto_alpha/lib_protocol/TEZOS_PROTOCOL @@ -46,6 +46,7 @@ "Entrypoint_repr", "Bounded_history_repr", "Sc_rollup_repr", + "Sc_rollup_metadata_repr", "Sc_rollup_tick_repr", "Sc_rollup_inbox_message_repr", "Sc_rollup_outbox_message_repr", diff --git a/src/proto_alpha/lib_protocol/alpha_context.ml b/src/proto_alpha/lib_protocol/alpha_context.ml index eed5bc39554b..c8daaa0291ab 100644 --- a/src/proto_alpha/lib_protocol/alpha_context.ml +++ b/src/proto_alpha/lib_protocol/alpha_context.ml @@ -56,6 +56,7 @@ module Sc_rollup_repr = Sc_rollup_repr module Sc_rollup = struct module Tick = Sc_rollup_tick_repr include Sc_rollup_repr + module Metadata = Sc_rollup_metadata_repr include Sc_rollup_PVM_sig module ArithPVM = Sc_rollup_arith module Wasm_2_0_0PVM = Sc_rollup_wasm.V2_0_0 diff --git a/src/proto_alpha/lib_protocol/alpha_context.mli b/src/proto_alpha/lib_protocol/alpha_context.mli index 57ae508c62fe..baf061a2bf25 100644 --- a/src/proto_alpha/lib_protocol/alpha_context.mli +++ b/src/proto_alpha/lib_protocol/alpha_context.mli @@ -2959,6 +2959,17 @@ module Sc_rollup : sig val hash_string : unreachable -> t end + (** See {!Sc_rollup_metadata_repr}. *) + module Metadata : sig + type t = {address : rollup; origination_level : Raw_level.t} + + val pp : Format.formatter -> t -> unit + + val equal : t -> t -> bool + + val encoding : t Data_encoding.t + end + (** See {!Sc_rollup_inbox_message_repr}. *) module Inbox_message : sig type internal_inbox_message = { diff --git a/src/proto_alpha/lib_protocol/dune b/src/proto_alpha/lib_protocol/dune index c81dd4ec06c0..426c8bc56355 100644 --- a/src/proto_alpha/lib_protocol/dune +++ b/src/proto_alpha/lib_protocol/dune @@ -75,6 +75,7 @@ Entrypoint_repr Bounded_history_repr Sc_rollup_repr + Sc_rollup_metadata_repr Sc_rollup_tick_repr Sc_rollup_inbox_message_repr Sc_rollup_outbox_message_repr @@ -339,6 +340,7 @@ entrypoint_repr.ml entrypoint_repr.mli bounded_history_repr.ml bounded_history_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 sc_rollup_inbox_message_repr.ml sc_rollup_inbox_message_repr.mli sc_rollup_outbox_message_repr.ml sc_rollup_outbox_message_repr.mli @@ -585,6 +587,7 @@ entrypoint_repr.ml entrypoint_repr.mli bounded_history_repr.ml bounded_history_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 sc_rollup_inbox_message_repr.ml sc_rollup_inbox_message_repr.mli sc_rollup_outbox_message_repr.ml sc_rollup_outbox_message_repr.mli @@ -836,6 +839,7 @@ entrypoint_repr.ml entrypoint_repr.mli bounded_history_repr.ml bounded_history_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 sc_rollup_inbox_message_repr.ml sc_rollup_inbox_message_repr.mli sc_rollup_outbox_message_repr.ml sc_rollup_outbox_message_repr.mli diff --git a/src/proto_alpha/lib_protocol/sc_rollup_metadata_repr.ml b/src/proto_alpha/lib_protocol/sc_rollup_metadata_repr.ml new file mode 100644 index 000000000000..5aea557a5959 --- /dev/null +++ b/src/proto_alpha/lib_protocol/sc_rollup_metadata_repr.ml @@ -0,0 +1,54 @@ +(*****************************************************************************) +(* *) +(* 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. *) +(* *) +(*****************************************************************************) + +(* TODO: https://gitlab.com/tezos/tezos/-/issues/3898 + We also need dynamic metadatas. *) + +type t = { + address : Sc_rollup_repr.Address.t; + origination_level : Raw_level_repr.t; +} + +let pp ppf {address; origination_level} = + Format.fprintf + ppf + "address: %a ; origination_level: %a" + Sc_rollup_repr.Address.pp + address + Raw_level_repr.pp + origination_level + +let equal {address; origination_level} metadata2 = + Sc_rollup_repr.Address.equal address metadata2.address + && Raw_level_repr.equal origination_level metadata2.origination_level + +let encoding = + let open Data_encoding in + conv + (fun {address; origination_level} -> (address, origination_level)) + (fun (address, origination_level) -> {address; origination_level}) + (obj2 + (req "address" Sc_rollup_repr.Address.encoding) + (req "origination_level" Raw_level_repr.encoding)) diff --git a/src/proto_alpha/lib_protocol/sc_rollup_metadata_repr.mli b/src/proto_alpha/lib_protocol/sc_rollup_metadata_repr.mli new file mode 100644 index 000000000000..c9b9ef648178 --- /dev/null +++ b/src/proto_alpha/lib_protocol/sc_rollup_metadata_repr.mli @@ -0,0 +1,42 @@ +(*****************************************************************************) +(* *) +(* 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. *) +(* *) +(*****************************************************************************) + +(** Static rollup-related metadata for the PVMs. *) + +(** A metadata contains: *) +type t = { + address : Sc_rollup_repr.Address.t; (** The rollup address. *) + origination_level : Raw_level_repr.t; + (** The origination level of the rollup. *) +} + +(** Pretty-printer for metadatas *) +val pp : Format.formatter -> t -> unit + +(** Metadatas equality *) +val equal : t -> t -> bool + +(** Encoding for metadatas *) +val encoding : t Data_encoding.t -- GitLab From e629dde3cf4ab93839c0756e7d13694015936877 Mon Sep 17 00:00:00 2001 From: Valentin Chaboche Date: Thu, 22 Sep 2022 10:58:15 +0200 Subject: [PATCH 2/9] Scoru,Proto: add metadata tick --- src/proto_alpha/lib_protocol/TEZOS_PROTOCOL | 2 +- .../lib_protocol/alpha_context.mli | 14 +++- src/proto_alpha/lib_protocol/dune | 8 +- .../lib_protocol/sc_rollup_PVM_sig.ml | 50 ++++++++++--- .../lib_protocol/sc_rollup_arith.ml | 73 ++++++++++++++----- .../lib_protocol/sc_rollup_arith.mli | 1 + .../lib_protocol/sc_rollup_game_repr.ml | 35 +++++++-- .../lib_protocol/sc_rollup_game_repr.mli | 6 +- .../lib_protocol/sc_rollup_proof_repr.ml | 37 +++++++--- .../lib_protocol/sc_rollup_proof_repr.mli | 15 +++- .../sc_rollup_refutation_storage.ml | 5 +- .../lib_protocol/sc_rollup_storage.ml | 19 ++++- .../lib_protocol/sc_rollup_storage.mli | 10 +++ .../lib_protocol/sc_rollup_wasm.ml | 8 ++ src/proto_alpha/lib_protocol/storage.mli | 1 + 15 files changed, 216 insertions(+), 68 deletions(-) diff --git a/src/proto_alpha/lib_protocol/TEZOS_PROTOCOL b/src/proto_alpha/lib_protocol/TEZOS_PROTOCOL index 0ff25de257dd..35182bbcdc57 100644 --- a/src/proto_alpha/lib_protocol/TEZOS_PROTOCOL +++ b/src/proto_alpha/lib_protocol/TEZOS_PROTOCOL @@ -171,8 +171,8 @@ "Sc_rollup_inbox_storage", "Sc_rollup_outbox_storage", "Sc_rollup_stake_storage", - "Sc_rollup_refutation_storage", "Sc_rollup_storage", + "Sc_rollup_refutation_storage", "Zk_rollup_errors", "Dal_slot_storage", diff --git a/src/proto_alpha/lib_protocol/alpha_context.mli b/src/proto_alpha/lib_protocol/alpha_context.mli index baf061a2bf25..cc66adbdfef8 100644 --- a/src/proto_alpha/lib_protocol/alpha_context.mli +++ b/src/proto_alpha/lib_protocol/alpha_context.mli @@ -2999,7 +2999,7 @@ module Sc_rollup : sig payload : Inbox_message.serialized; } - type reveal_data = Raw_data of string + type reveal_data = Raw_data of string | Metadata of Metadata.t type input = Inbox_message of inbox_message | Reveal of reveal_data @@ -3009,7 +3009,7 @@ module Sc_rollup : sig module Input_hash : S.HASH - type reveal = Reveal_raw_data of Input_hash.t + type reveal = Reveal_raw_data of Input_hash.t | Reveal_metadata type input_request = | No_input_required @@ -3355,6 +3355,7 @@ module Sc_rollup : sig | Halted | Waiting_for_input_message | Waiting_for_reveal + | Waiting_for_metadata | Parsing | Evaluating @@ -3505,7 +3506,7 @@ 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 + type reveal_proof = Raw_data_proof of string | Metadata_proof type input_proof = | Inbox_proof of { @@ -3540,6 +3541,7 @@ module Sc_rollup : sig type error += Sc_rollup_proof_check of string val valid : + metadata:Metadata.t -> Inbox.history_proof -> Raw_level.t -> pvm_name:string -> @@ -3547,7 +3549,10 @@ module Sc_rollup : sig (input option * input_request) tzresult Lwt.t val produce : - (module PVM_with_context_and_state) -> Raw_level.t -> t tzresult Lwt.t + metadata:Metadata.t -> + (module PVM_with_context_and_state) -> + Raw_level.t -> + t tzresult Lwt.t end module Game : sig @@ -3643,6 +3648,7 @@ module Sc_rollup : sig val play : stakers:Index.t -> + Metadata.t -> t -> refutation -> (game_result, t) Either.t tzresult Lwt.t diff --git a/src/proto_alpha/lib_protocol/dune b/src/proto_alpha/lib_protocol/dune index 426c8bc56355..b53da12c6614 100644 --- a/src/proto_alpha/lib_protocol/dune +++ b/src/proto_alpha/lib_protocol/dune @@ -189,8 +189,8 @@ Sc_rollup_inbox_storage Sc_rollup_outbox_storage Sc_rollup_stake_storage - Sc_rollup_refutation_storage Sc_rollup_storage + Sc_rollup_refutation_storage Zk_rollup_errors Dal_slot_storage Alpha_context @@ -456,8 +456,8 @@ sc_rollup_inbox_storage.ml sc_rollup_inbox_storage.mli sc_rollup_outbox_storage.ml sc_rollup_outbox_storage.mli sc_rollup_stake_storage.ml sc_rollup_stake_storage.mli - sc_rollup_refutation_storage.ml sc_rollup_refutation_storage.mli sc_rollup_storage.ml sc_rollup_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 @@ -703,8 +703,8 @@ sc_rollup_inbox_storage.ml sc_rollup_inbox_storage.mli sc_rollup_outbox_storage.ml sc_rollup_outbox_storage.mli sc_rollup_stake_storage.ml sc_rollup_stake_storage.mli - sc_rollup_refutation_storage.ml sc_rollup_refutation_storage.mli sc_rollup_storage.ml sc_rollup_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 @@ -955,8 +955,8 @@ sc_rollup_inbox_storage.ml sc_rollup_inbox_storage.mli sc_rollup_outbox_storage.ml sc_rollup_outbox_storage.mli sc_rollup_stake_storage.ml sc_rollup_stake_storage.mli - sc_rollup_refutation_storage.ml sc_rollup_refutation_storage.mli sc_rollup_storage.ml sc_rollup_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 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 f9c1c944bc13..f7de6e932631 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,7 @@ type inbox_message = { payload : Sc_rollup_inbox_message_repr.serialized; } -type reveal_data = Raw_data of string +type reveal_data = Raw_data of string | Metadata of Sc_rollup_metadata_repr.t type input = Inbox_message of inbox_message | Reveal of reveal_data @@ -92,10 +92,19 @@ let reveal_data_encoding = (req "raw_data" (check_size Constants_repr.sc_rollup_message_size_limit bytes))) - (function Raw_data m -> Some ((), Bytes.of_string m)) + (function Raw_data m -> Some ((), Bytes.of_string m) | _ -> None) (fun ((), m) -> Raw_data (Bytes.to_string m)) + and case_metadata = + case + ~title:"metadata" + (Tag 1) + (obj2 + (req "reveal_data_kind" (constant "metadata")) + (req "metadata" Sc_rollup_metadata_repr.encoding)) + (function Metadata md -> Some ((), md) | _ -> None) + (fun ((), md) -> Metadata md) in - union [case_raw_data] + union [case_raw_data; case_metadata] let input_encoding = let open Data_encoding in @@ -129,13 +138,18 @@ let inbox_message_equal a b = && String.equal (payload :> string) (b.payload :> string) let reveal_data_equal a b = - match (a, b) with Raw_data a, Raw_data b -> String.equal a b + match (a, b) with + | Raw_data a, Raw_data b -> String.equal a b + | Raw_data _, _ -> false + | Metadata a, Metadata b -> Sc_rollup_metadata_repr.equal a b + | Metadata _, _ -> false let input_equal a b = match (a, b) with | Inbox_message a, Inbox_message b -> inbox_message_equal a b + | Inbox_message _, _ -> false | Reveal a, Reveal b -> reveal_data_equal a b - | Inbox_message _, Reveal _ | Reveal _, Inbox_message _ -> false + | Reveal _, _ -> false module Input_hash = Blake2B.Make @@ -151,21 +165,28 @@ module Input_hash = let size = Some 20 end) -type reveal = Reveal_raw_data of Input_hash.t +type reveal = Reveal_raw_data of Input_hash.t | Reveal_metadata let reveal_encoding = let open Data_encoding in let case_raw_data = case - ~title:"RevealRawData" + ~title:"Reveal_raw_data" (Tag 0) (obj2 (req "reveal_kind" (constant "reveal_raw_data")) (req "input_hash" Input_hash.encoding)) - (function Reveal_raw_data s -> Some ((), s)) + (function Reveal_raw_data s -> Some ((), s) | _ -> None) (fun ((), s) -> Reveal_raw_data s) + and case_metadata = + case + ~title:"Reveal_metadata" + (Tag 1) + (obj1 (req "reveal_kind" (constant "reveal_metadata"))) + (function Reveal_metadata -> Some () | _ -> None) + (fun () -> Reveal_metadata) in - union [case_raw_data] + union [case_raw_data; case_metadata] (** The PVM's current input expectations: - [No_input_required] if the machine is busy and has no need for new input. @@ -176,8 +197,8 @@ let reveal_encoding = - [First_after (level, counter)] expects whatever comes next after that position in the inbox. - - [Needs_reveal reveal] if the machine reveals the existence of - some data and needs this data to continue its execution. + - [Needs_metadata] if the machine needs the metadata to continue + its execution. *) type input_request = | No_input_required @@ -224,7 +245,9 @@ let input_request_encoding = (fun ((), p) -> Needs_reveal p); ] -let pp_reveal fmt (Reveal_raw_data hash) = Input_hash.pp fmt hash +let pp_reveal fmt = function + | Reveal_raw_data hash -> Input_hash.pp fmt hash + | Reveal_metadata -> Format.pp_print_string fmt "Reveal metadata" (** [pp_input_request fmt i] pretty prints the given input [i] to the formatter [fmt]. *) @@ -246,6 +269,9 @@ let pp_input_request fmt request = let reveal_equal p1 p2 = match (p1, p2) with | Reveal_raw_data h1, Reveal_raw_data h2 -> Input_hash.equal h1 h2 + | Reveal_raw_data _, _ -> false + | Reveal_metadata, Reveal_metadata -> true + | Reveal_metadata, _ -> 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 78b967872b8a..2bf84893ec42 100644 --- a/src/proto_alpha/lib_protocol/sc_rollup_arith.ml +++ b/src/proto_alpha/lib_protocol/sc_rollup_arith.ml @@ -130,6 +130,7 @@ module type S = sig | Halted | Waiting_for_input_message | Waiting_for_reveal + | Waiting_for_metadata | Parsing | Evaluating @@ -190,6 +191,7 @@ module Make (Context : P) : | Halted | Waiting_for_input_message | Waiting_for_reveal + | Waiting_for_metadata | Parsing | Evaluating @@ -581,6 +583,7 @@ module Make (Context : P) : ("Halted", Halted); ("Waiting_for_input_message", Waiting_for_input_message); ("Waiting_for_reveal", Waiting_for_reveal); + ("Waiting_for_metadata", Waiting_for_metadata); ("Parsing", Parsing); ("Evaluating", Evaluating); ] @@ -591,6 +594,7 @@ module Make (Context : P) : | Halted -> "Halted" | Waiting_for_input_message -> "Waiting for input message" | Waiting_for_reveal -> "Waiting for reveal" + | Waiting_for_metadata -> "Waiting for metadata" | Parsing -> "Parsing" | Evaluating -> "Evaluating" @@ -612,6 +616,21 @@ module Make (Context : P) : | Some h -> PS.Input_hash.pp fmt h end) + module Metadata = Make_var (struct + type t = Sc_rollup_metadata_repr.t option + + let initial = None + + let encoding = Data_encoding.option Sc_rollup_metadata_repr.encoding + + let name = "metadata" + + let pp fmt v = + match v with + | None -> Format.fprintf fmt "" + | Some v -> Sc_rollup_metadata_repr.pp fmt v + end) + module Current_level = Make_var (struct type t = Raw_level_repr.t @@ -838,7 +857,7 @@ module Make (Context : P) : let open Monad.Syntax in let* () = Status.create in let* () = Next_message.create in - let* () = Status.set Waiting_for_input_message in + let* () = Status.set Waiting_for_metadata in return () let result_of ~default m state = @@ -868,7 +887,8 @@ module Make (Context : P) : match h with | None -> internal_error "Internal error: Reveal invariant broken" | Some h -> return (PS.Needs_reveal (Reveal_raw_data h))) - | _ -> return PS.No_input_required + | Waiting_for_metadata -> return PS.(Needs_reveal Reveal_metadata) + | Halted | Parsing | Evaluating -> return PS.No_input_required let is_input_state = result_of ~default:PS.No_input_required @@ is_input_state_monadic @@ -927,26 +947,31 @@ module Make (Context : P) : let* () = Status.set Waiting_for_input_message in return () - let reveal_monadic (PS.Raw_data data) = + let reveal_monadic reveal_data = (* The inbox cursor is unchanged as the message comes from the outer world. - We don't have to check that the data hash is the one we + We don't have to check that the data is the one we expected as we decided to trust the initial witness. - It is the responsibility of the rollup node to check it if it - does not want to publish a wrong commitment. - - Notice that a multi-page transmission is possible by embedding - a continuation encoded as an optional hash in [data]. + It is the responsibility of the rollup node to check the validity + of the [reveal_data] if it does not want to publish a wrong commitment. *) let open Monad.Syntax in - let* () = Next_message.set (Some data) in - let* () = start_parsing in - return () + match reveal_data with + | PS.Raw_data data -> + (* Notice that a multi-page transmission is possible by embedding + a continuation encoded as an optional hash in [data]. *) + let* () = Next_message.set (Some data) in + let* () = start_parsing in + return () + | PS.Metadata metadata -> + let* () = Metadata.set (Some metadata) in + let* () = Status.set Waiting_for_input_message in + return () let ticked m = let open Monad.Syntax in @@ -1190,7 +1215,8 @@ module Make (Context : P) : let* status = Status.get in match status with | Halted -> boot - | Waiting_for_input_message | Waiting_for_reveal -> ( + | Waiting_for_input_message | Waiting_for_reveal | Waiting_for_metadata + -> ( let* msg = Next_message.get in match msg with | None -> internal_error "An input state was not provided an input." @@ -1215,14 +1241,25 @@ module Make (Context : P) : (internal_error "Invalid set_input: expecting inbox message, got a reveal.") state) - | PS.Needs_reveal _hash -> ( + | 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 _ as input_given) -> set_input input_given state - | None | Some (PS.Inbox_message _) -> + | 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 reveal, got an inbox \ - message.") + "Invalid set_input: expecting a metadata reveal, got an \ + inbox message or a raw data reveal.") state) 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 0b9514ea625d..6b06c302cf9e 100644 --- a/src/proto_alpha/lib_protocol/sc_rollup_arith.mli +++ b/src/proto_alpha/lib_protocol/sc_rollup_arith.mli @@ -84,6 +84,7 @@ module type S = sig | Halted | Waiting_for_input_message | Waiting_for_reveal + | Waiting_for_metadata | Parsing | Evaluating 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 e0d8376cc39d..af9654f51f42 100644 --- a/src/proto_alpha/lib_protocol/sc_rollup_game_repr.ml +++ b/src/proto_alpha/lib_protocol/sc_rollup_game_repr.ml @@ -977,12 +977,18 @@ 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 ~proof ~game ~start_chunk ~stop_chunk = +let validity_final_move ~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*! valid = - Sc_rollup_proof_repr.valid inbox_snapshot inbox_level ~pvm_name proof + Sc_rollup_proof_repr.valid + ~metadata + inbox_snapshot + inbox_level + ~pvm_name + proof in let*? () = if first_move then @@ -1023,8 +1029,14 @@ let validity_final_move ~first_move ~proof ~game ~start_chunk ~stop_chunk = - The proof stop on the state different than the refuted one. - The proof is correctly verified. *) -let validity_first_final_move ~proof ~game ~start_chunk ~stop_chunk = - validity_final_move ~first_move:true ~proof ~game ~start_chunk ~stop_chunk +let validity_first_final_move ~metadata ~proof ~game ~start_chunk ~stop_chunk = + validity_final_move + ~first_move:true + ~metadata + ~proof + ~game + ~start_chunk + ~stop_chunk (** Returns the validity of the second final move. @@ -1033,10 +1045,11 @@ let validity_first_final_move ~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 ~agreed_start_chunk ~refuted_stop_chunk ~game - ~proof = +let validity_second_final_move ~metadata ~agreed_start_chunk ~refuted_stop_chunk + ~game ~proof = validity_final_move ~first_move:false + ~metadata ~proof ~game ~start_chunk:agreed_start_chunk @@ -1049,7 +1062,7 @@ let loser_of_results ~alice_result ~bob_result = | false, true -> Some Alice | true, false -> Some Bob -let play ~stakers game refutation = +let play ~stakers metadata game refutation = let open Lwt_tzresult_syntax in let mk_loser loser = let loser = Index.staker stakers loser in @@ -1086,7 +1099,12 @@ let play ~stakers game refutation = find_choice dissection refutation.choice in let*! player_result = - validity_first_final_move ~proof ~game ~start_chunk ~stop_chunk + validity_first_final_move + ~proof + ~metadata + ~game + ~start_chunk + ~stop_chunk in if player_result then return @@ mk_loser (opponent game.turn) else @@ -1108,6 +1126,7 @@ let play ~stakers game refutation = | Proof proof, Final_move {agreed_start_chunk; refuted_stop_chunk} -> let*! player_result = validity_second_final_move + ~metadata ~agreed_start_chunk ~refuted_stop_chunk ~game 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 beaed37722ac..66cd672b0e0a 100644 --- a/src/proto_alpha/lib_protocol/sc_rollup_game_repr.mli +++ b/src/proto_alpha/lib_protocol/sc_rollup_game_repr.mli @@ -409,7 +409,11 @@ val loser_of_results : alice_result:bool -> bob_result:bool -> player option [Ended ] status. *) val play : - stakers:Index.t -> t -> refutation -> (game_result, t) Either.t tzresult Lwt.t + stakers:Index.t -> + Sc_rollup_metadata_repr.t -> + t -> + refutation -> + (game_result, t) Either.t tzresult Lwt.t (** A type that represents the number of blocks left for players to play. Each player has her timeout value. `timeout` is expressed in the number of 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 292b26e9687e..525a7a498b50 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,7 @@ 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 +type reveal_proof = Raw_data_proof of string | Metadata_proof let reveal_proof_encoding = let open Data_encoding in @@ -62,10 +62,17 @@ let reveal_proof_encoding = (req "raw_data" (check_size Constants_repr.sc_rollup_message_size_limit bytes))) - (function Raw_data_proof s -> Some ((), Bytes.of_string s)) + (function Raw_data_proof s -> Some ((), Bytes.of_string s) | _ -> None) (fun ((), s) -> Raw_data_proof (Bytes.to_string s)) + and case_metadata_proof = + case + ~title:"metadata proof" + (Tag 1) + (obj1 (req "reveal_proof_kind" (constant "metadata_proof"))) + (function Metadata_proof -> Some () | _ -> None) + (fun () -> Metadata_proof) in - union [case_raw_data] + union [case_raw_data; case_metadata_proof] type input_proof = | Inbox_proof of { @@ -77,12 +84,13 @@ type input_proof = let input_proof_encoding = let open Data_encoding in + let proof_kind kind = req "input_proof_kind" (constant kind) in let case_inbox_proof = case ~title:"inbox proof" (Tag 0) (obj4 - (req "input_proof_kind" (constant "inbox_proof")) + (proof_kind "inbox_proof") (req "level" Raw_level_repr.encoding) (req "message_counter" Data_encoding.n) (req "serialized_proof" Sc_rollup_inbox_repr.serialized_proof_encoding)) @@ -98,11 +106,12 @@ let input_proof_encoding = ~title:"reveal proof" (Tag 1) (obj2 - (req "input_proof_kind" (constant "reveal_proof")) + (proof_kind "reveal_proof") (req "reveal_proof" reveal_proof_encoding)) (function Reveal_proof s -> Some ((), s) | _ -> None) (fun ((), s) -> Reveal_proof s) in + union [case_inbox_proof; case_reveal_proof] type t = {pvm_step : Sc_rollups.wrapped_proof; input_proof : input_proof option} @@ -153,7 +162,7 @@ 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 snapshot commit_level ~pvm_name proof = +let valid ~metadata snapshot commit_level ~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 @@ -167,6 +176,8 @@ let valid snapshot commit_level ~pvm_name proof = Option.map (fun i -> Sc_rollup_PVM_sig.Inbox_message i) inbox_message | Some (Reveal_proof (Raw_data_proof data)) -> return_some (Sc_rollup_PVM_sig.Reveal (Raw_data data)) + | Some (Reveal_proof Metadata_proof) -> + return_some (Sc_rollup_PVM_sig.Reveal (Metadata metadata)) in let input = Option.bind input (cut_at_level commit_level) in let* input_requested = P.verify_proof input P.proof in @@ -189,11 +200,9 @@ let valid snapshot commit_level ~pvm_name proof = check (Sc_rollup_PVM_sig.Input_hash.equal data_hash expected_hash) "Invalid reveal" - | None, (Initial | First_after _ | Needs_reveal _) - | Some _, No_input_required - | Some (Inbox_proof _), Needs_reveal _ - | Some (Reveal_proof _), (Initial | First_after _) -> - proof_error "Inbox proof and input request are dissociated." + | Some (Reveal_proof Metadata_proof), Needs_reveal Reveal_metadata -> + return_unit + | _ -> proof_error "Inbox proof and input request are dissociated." in return (input, input_requested) @@ -219,7 +228,7 @@ module type PVM_with_context_and_state = sig end end -let produce pvm_and_state commit_level = +let produce ~metadata pvm_and_state commit_level = let open Lwt_tzresult_syntax in let (module P : PVM_with_context_and_state) = pvm_and_state in let open P in @@ -272,6 +281,10 @@ let produce pvm_and_state commit_level = return ( Some (Reveal_proof (Raw_data_proof data)), Some (Sc_rollup_PVM_sig.Reveal (Raw_data data)) )) + | Needs_reveal Reveal_metadata -> + return + ( Some (Reveal_proof Metadata_proof), + Some Sc_rollup_PVM_sig.(Reveal (Metadata metadata)) ) in let input_given = Option.bind input_given (cut_at_level commit_level) in let* pvm_step_proof = P.produce_proof P.context input_given P.state in 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 6de550670d48..5cb09c8f578c 100644 --- a/src/proto_alpha/lib_protocol/sc_rollup_proof_repr.mli +++ b/src/proto_alpha/lib_protocol/sc_rollup_proof_repr.mli @@ -50,6 +50,7 @@ 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]. *) + | Metadata_proof (** A PVM proof [pvm_step] is combined with an [input_proof] to provide the proof necessary to validate a single step in the refutation @@ -115,6 +116,7 @@ val stop : t -> State_hash.t input_request for the state at the beginning of the proof. *) val valid : + metadata:Sc_rollup_metadata_repr.t -> Sc_rollup_inbox_repr.history_proof -> Raw_level_repr.t -> pvm_name:string -> @@ -144,7 +146,7 @@ module type PVM_with_context_and_state = sig end end -(** [produce pvm_and_state inbox_context inbox_history commit_level] +(** [produce ~metadata pvm_and_state inbox_context inbox_history commit_level] will construct a full refutation game proof out of the [state] given in [pvm_and_state]. It uses the [inbox] if necessary to provide input in the proof. If the input is above or at [commit_level] it @@ -160,6 +162,13 @@ end This uses the [name] in the [pvm_and_state] module to produce an encodable [wrapped_proof] if possible. See the [wrap_proof] function - in [Sc_rollups]. *) + in [Sc_rollups]. + + It also need the [metadata] if it produces a proof for the [Needs_metadata] + state. +*) val produce : - (module PVM_with_context_and_state) -> Raw_level_repr.t -> t tzresult Lwt.t + metadata:Sc_rollup_metadata_repr.t -> + (module PVM_with_context_and_state) -> + Raw_level_repr.t -> + t tzresult Lwt.t 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 e01ee38e22ee..aaec18587c86 100644 --- a/src/proto_alpha/lib_protocol/sc_rollup_refutation_storage.ml +++ b/src/proto_alpha/lib_protocol/sc_rollup_refutation_storage.ml @@ -288,7 +288,10 @@ let game_move ctxt rollup ~player ~opponent refutation = (Sc_rollup_game_repr.Index.staker stakers game.turn)) Sc_rollup_wrong_turn in - let* move_result = Sc_rollup_game_repr.play ~stakers game refutation in + let* ctxt, metadata = Sc_rollup_storage.get_metadata ctxt rollup in + let* move_result = + Sc_rollup_game_repr.play ~stakers metadata game refutation + in match move_result with | Either.Left game_result -> return (Some game_result, ctxt) | Either.Right new_game -> diff --git a/src/proto_alpha/lib_protocol/sc_rollup_storage.ml b/src/proto_alpha/lib_protocol/sc_rollup_storage.ml index bb45a9031b6d..53ea9c65de3c 100644 --- a/src/proto_alpha/lib_protocol/sc_rollup_storage.ml +++ b/src/proto_alpha/lib_protocol/sc_rollup_storage.ml @@ -53,16 +53,16 @@ let originate ctxt ~kind ~boot_sector ~parameters_ty ~genesis_commitment = Sc_rollup_commitment_storage.hash ctxt genesis_commitment in let*? ctxt, nonce = Raw_context.increment_origination_nonce ctxt in - let level = Raw_context.current_level ctxt in let*? ctxt, address = address_from_nonce ctxt nonce in let* ctxt, pvm_kind_size, _kind_existed = Store.PVM_kind.add ctxt address kind in + let origination_level = (Raw_context.current_level ctxt).level in let* ctxt, genesis_info_size, _info_existed = Store.Genesis_info.add ctxt address - {commitment_hash = genesis_commitment_hash; level = level.level} + {commitment_hash = genesis_commitment_hash; level = origination_level} in let* ctxt, boot_sector_size, _sector_existed = Store.Boot_sector.add ctxt address boot_sector @@ -71,7 +71,10 @@ let originate ctxt ~kind ~boot_sector ~parameters_ty ~genesis_commitment = Store.Parameters_type.add ctxt address parameters_ty in let*! inbox = - Sc_rollup_inbox_repr.empty (Raw_context.recover ctxt) address level.level + Sc_rollup_inbox_repr.empty + (Raw_context.recover ctxt) + address + origination_level in let* ctxt, inbox_size_diff = Store.Inbox.init ctxt address inbox in let* ctxt, lcc_size_diff = @@ -91,7 +94,7 @@ let originate ctxt ~kind ~boot_sector ~parameters_ty ~genesis_commitment = Store.Commitment_added.add (ctxt, address) genesis_commitment_hash - level.level + origination_level in (* This store [Store.Commitment_added] is going to be used to look this bootstrap commitment. This commitment is added here so the @@ -138,6 +141,14 @@ let genesis_info ctxt rollup = | None -> fail (Sc_rollup_does_not_exist rollup) | Some genesis_info -> return (ctxt, genesis_info) +let get_metadata ctxt rollup = + let open Lwt_tzresult_syntax in + let* ctxt, genesis_info = genesis_info ctxt rollup in + let metadata : Sc_rollup_metadata_repr.t = + {address = rollup; origination_level = genesis_info.level} + in + return (ctxt, metadata) + let get_boot_sector ctxt rollup = let open Lwt_tzresult_syntax in let* ctxt, boot_sector = Storage.Sc_rollup.Boot_sector.find ctxt rollup in diff --git a/src/proto_alpha/lib_protocol/sc_rollup_storage.mli b/src/proto_alpha/lib_protocol/sc_rollup_storage.mli index 682e0c1d9fda..36ea175365f6 100644 --- a/src/proto_alpha/lib_protocol/sc_rollup_storage.mli +++ b/src/proto_alpha/lib_protocol/sc_rollup_storage.mli @@ -61,6 +61,16 @@ val genesis_info : Sc_rollup_repr.t -> (Raw_context.t * Sc_rollup_commitment_repr.genesis_info) tzresult Lwt.t +(** [get_metadata ctxt rollup] retrieves the origination level of the [rollup] + using {!Sc_rollup_commitment_repr.genesis_info} and creates a + {!Sc_rollup_metadata_repr.t}. + Fails with [Sc_rollup_does_not_exist {rollup}] if the genesis info is + missing. *) +val get_metadata : + Raw_context.t -> + Sc_rollup_repr.t -> + (Raw_context.t * Sc_rollup_metadata_repr.t) tzresult Lwt.t + (** [get_boot_sector ctxt sc_rollup] retrieves the boot sector for [sc_rollup]. *) val get_boot_sector : Raw_context.t -> Sc_rollup_repr.t -> (Raw_context.t * string) tzresult Lwt.t diff --git a/src/proto_alpha/lib_protocol/sc_rollup_wasm.ml b/src/proto_alpha/lib_protocol/sc_rollup_wasm.ml index 2054eade58fa..5afc97ac6e4f 100644 --- a/src/proto_alpha/lib_protocol/sc_rollup_wasm.ml +++ b/src/proto_alpha/lib_protocol/sc_rollup_wasm.ml @@ -305,6 +305,14 @@ module V2_0_0 = struct let* s = get in let* s = lift (WASM_machine.reveal_step (Bytes.of_string data) s) in set s + | PS.Reveal (PS.Metadata _) -> + (* TODO: https://gitlab.com/tezos/tezos/-/issues/3890 + + The WASM PVM does not produce [Needs_metadata] input + requests. Thus, no [set_input_state] should transmit a + [Metadata]. + *) + assert false let set_input input = state_of @@ set_input_state input diff --git a/src/proto_alpha/lib_protocol/storage.mli b/src/proto_alpha/lib_protocol/storage.mli index c55c58d5dadc..96be4baef007 100644 --- a/src/proto_alpha/lib_protocol/storage.mli +++ b/src/proto_alpha/lib_protocol/storage.mli @@ -716,6 +716,7 @@ module Sc_rollup : sig Each smart contract rollup is associated to: - a PVM kind (provided at creation time, read-only) + - a metadata (generated at creation time, read-only) - a boot sector (provided at creation time, read-only) - a parameters type specifying the types of parameters the rollup accepts - the L1 block level at which the rollup was created -- GitLab From 5eb5207a011b31c72c6ca72066ea5ca0f53687f8 Mon Sep 17 00:00:00 2001 From: Valentin Chaboche Date: Thu, 22 Sep 2022 10:58:23 +0200 Subject: [PATCH 3/9] Scoru,Test: fix all unit tests --- .../test/pbt/test_refutation_game.ml | 81 ++++++++++++++++--- .../test/unit/test_sc_rollup_arith.ml | 9 +-- .../test/unit/test_sc_rollup_game.ml | 16 +++- 3 files changed, 85 insertions(+), 21 deletions(-) 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 0e5696eb0dee..d25d1fde5c4e 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 @@ -913,7 +913,6 @@ module Arith_test_pvm = struct creates the association list (tick, state_hash). *) let eval_until_input ~fuel ~our_states start_tick state = let open Lwt_syntax in - let eval_tick _tick state = eval state in let rec go ~our_states fuel (tick : int) state = let* input_request = is_input_state state in match fuel with @@ -921,7 +920,7 @@ module Arith_test_pvm = struct | None | Some _ -> ( match input_request with | No_input_required -> - let* state = eval_tick tick state in + let* state = eval state in let* state_hash = state_hash state in let our_states = (tick, state_hash) :: our_states in go ~our_states (consume_fuel fuel) (tick + 1) state @@ -929,6 +928,17 @@ module Arith_test_pvm = struct in go ~our_states fuel start_tick state + let eval_metadata ~fuel ~our_states tick state ~metadata = + let open Lwt_syntax in + continue_with_fuel ~our_states ~tick fuel state + @@ fun tick our_states fuel state -> + let input = Sc_rollup.(Reveal (Metadata metadata)) in + let* state = set_input input state in + let* state_hash = state_hash state in + let our_states = (tick, state_hash) :: our_states in + let tick = succ tick in + return (state, fuel, tick, our_states) + let feed_input ~fuel ~our_states ~tick state input = let open Lwt_syntax in let* state, fuel, tick, our_states = @@ -957,14 +967,22 @@ module Arith_test_pvm = struct (state, fuel, tick, []) inputs - let eval_levels_and_inputs ?fuel ctxt levels_and_inputs = + let eval_levels_and_inputs ~metadata ?fuel ctxt levels_and_inputs = let open Lwt_result_syntax in let*! state = initial_state ctxt in let*! state_hash = state_hash state in - let our_states = [(0, state_hash)] in + let tick = 0 in + let our_states = [(tick, state_hash)] in + let tick = succ tick in + (* 1. We evaluate the boot sector. *) + let*! state, fuel, tick, our_states = + eval_until_input ~fuel ~our_states tick state + in + (* 2. We evaluate the metadata. *) let*! state, fuel, tick, our_states = - eval_until_input ~fuel ~our_states 1 state + eval_metadata ~fuel ~our_states tick state ~metadata in + (* 3. We evaluate the inbox. *) let* state, _fuel, tick, our_states = List.fold_left_es (fun (state, fuel, tick, our_states) (level, inputs) -> @@ -1054,6 +1072,7 @@ type player_client = { * Inbox.History.t * Inbox.t; levels_and_inputs : (int * string list) list; + metadata : Metadata.t; } let pp_levels_and_inputs ppf levels_and_inputs = @@ -1070,7 +1089,7 @@ let pp_levels_and_inputs ppf levels_and_inputs = levels_and_inputs) let pp_player_client ppf - {player; states; final_tick; inbox = _; levels_and_inputs} = + {player; states; final_tick; inbox = _; levels_and_inputs; metadata} = Format.fprintf ppf "@[player:@,\ @@ -1079,7 +1098,8 @@ let pp_player_client ppf %a@]@,\ final tick: %a@,\ @[levels and inputs:@,\ - %a@]@," + %a@]@,\ + metadata: %a@," pp_player player (Format.pp_print_list (fun ppf (tick, hash) -> @@ -1096,6 +1116,8 @@ let pp_player_client ppf (* inbox *) pp_levels_and_inputs levels_and_inputs + Sc_rollup.Metadata.pp + metadata module Player_client = struct (** Transform inputs to payloads. *) @@ -1150,13 +1172,16 @@ module Player_client = struct (** Generate [our_states] for [levels_and_inputs] based on the strategy. It needs [level_min] and [level_max] in case it will need to generate new inputs. *) - let gen_our_states ctxt strategy ?level_min ?level_max levels_and_inputs = + let gen_our_states ~metadata ctxt strategy ?level_min ?level_max + levels_and_inputs = let open QCheck2.Gen in let eval_inputs levels_and_inputs = Lwt_main.run @@ let open Lwt_result_syntax in - let*! r = Arith_test_pvm.eval_levels_and_inputs ctxt levels_and_inputs in + let*! r = + Arith_test_pvm.eval_levels_and_inputs ~metadata ctxt levels_and_inputs + in Lwt.return @@ WithExceptions.Result.get_ok ~loc:__LOC__ r in match strategy with @@ -1220,14 +1245,37 @@ module Player_client = struct let _state, tick, our_states = eval_inputs new_levels_and_inputs in return (tick, our_states, new_levels_and_inputs) + let gen_raw_level = + let open QCheck2.Gen in + let* level = map Int32.abs int32 in + return (Raw_level.of_int32_exn level) + + let gen_rollup = + let open QCheck2.Gen in + let* bytes = bytes_fixed_gen Sc_rollup_repr.Address.size in + return (Sc_rollup_repr.Address.hash_bytes [bytes]) + + let gen_metadata = + let open QCheck2.Gen in + let* address = gen_rollup in + let* origination_level = gen_raw_level in + return Metadata.{address; origination_level} + (** [gen ~rollup ~level_min ~level_max player levels_and_inputs] generates a {!player_client} based on {!player.strategy}. *) let gen ~rollup ~origination_level ~level_min ~level_max player levels_and_inputs = let open QCheck2.Gen in let ctxt = empty_memory_ctxt "foo" in + let* metadata = + match player.strategy with + | Perfect | Lazy | Eager | Keen -> + return Sc_rollup.Metadata.{address = rollup; origination_level} + | Random -> gen_metadata + in let* tick, our_states, levels_and_inputs = gen_our_states + ~metadata ctxt player.strategy ~level_min @@ -1238,7 +1286,14 @@ module Player_client = struct construct_inbox ~origination_level ctxt rollup levels_and_inputs in return - {player; final_tick = tick; states = our_states; inbox; levels_and_inputs} + { + player; + final_tick = tick; + states = our_states; + inbox; + levels_and_inputs; + metadata; + } end (** [create_commitment ~predecessor ~inbox_level ~our_states] creates @@ -1289,8 +1344,10 @@ let build_proof ~player_client start_tick (game : Game.t) = (* We start a game on a commitment that starts at [Tick.initial], the fuel is necessarily [start_tick]. *) let fuel = tick_to_int_exn start_tick in + let metadata = player_client.metadata in let*! r = Arith_test_pvm.eval_levels_and_inputs + ~metadata ~fuel (Arith_test_pvm.init_context ()) player_client.levels_and_inputs @@ -1313,7 +1370,7 @@ let build_proof ~player_client start_tick (game : Game.t) = let inbox = history_proof end end in - let*! proof = Sc_rollup.Proof.produce (module P) game.inbox_level in + let*! proof = Sc_rollup.Proof.produce ~metadata (module P) game.inbox_level in return (WithExceptions.Result.get_ok ~loc:__LOC__ proof) (** [next_move ~number_of_sections ~player_client game] produces @@ -1563,7 +1620,7 @@ let test_game ?nonempty_inputs ~p1_strategy ~p2_strategy () = (if p1_start then "p1" else "p2") pp_levels_and_inputs levels_and_inputs) - ~count:300 + ~count:200 ~name ~gen:(gen_game ?nonempty_inputs ~p1_strategy ~p2_strategy ()) (fun ( block, diff --git a/src/proto_alpha/lib_protocol/test/unit/test_sc_rollup_arith.ml b/src/proto_alpha/lib_protocol/test/unit/test_sc_rollup_arith.ml index 22eb0bf2bd19..bad535c486ac 100644 --- a/src/proto_alpha/lib_protocol/test/unit/test_sc_rollup_arith.ml +++ b/src/proto_alpha/lib_protocol/test/unit/test_sc_rollup_arith.ml @@ -128,10 +128,9 @@ let test_boot () = let open Sc_rollup_PVM_sig in boot "" @@ fun _ctxt state -> is_input_state state >>= function - | Initial -> return () - | Needs_reveal _ | First_after _ -> - failwith - "After booting, the machine should be waiting for the initial input." + | Needs_reveal Reveal_metadata -> return () + | Initial | Needs_reveal _ | First_after _ -> + failwith "After booting, the machine should be waiting for the metadata." | No_input_required -> failwith "After booting, the machine must be waiting for input." @@ -211,7 +210,7 @@ let syntactically_valid_messages = let syntactically_invalid_messages = List.map (fun s -> (s, [])) - ["@"; " @"; " @ "; "---"; "12 +++ --"; "1a"; "a_"] + ["@"; " @"; " @ "; "---"; "12 +++ --"; "1a"; "a$"] let test_parsing_messages () = List.iter_es (test_parsing_message ~valid:true) syntactically_valid_messages 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 9561dcc8ab0d..4a3b055d627b 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 @@ -270,9 +270,9 @@ let test_invalid_serialized_inbox_proof () = let open Lwt_result_syntax in let open Alpha_context in let* ctxt = Test_sc_rollup_inbox.create_context () in - let*! inbox = - Sc_rollup.Inbox.empty ctxt Sc_rollup.Address.zero Raw_level.(succ root) - in + let rollup = Sc_rollup.Address.zero in + let level = Raw_level.(succ root) in + let*! inbox = Sc_rollup.Inbox.empty ctxt rollup level in let snapshot = Sc_rollup.Inbox.take_snapshot ~current_level:(Raw_level.of_int32_exn 42l) @@ -308,9 +308,17 @@ let test_invalid_serialized_inbox_proof () = Sc_rollup.Proof.{pvm_step = wrapped_proof; input_proof = Some inbox_proof} in + let metadata = + Sc_rollup.Metadata.{address = rollup; origination_level = level} + in let*! res = T.lift - @@ Sc_rollup.Proof.valid snapshot Raw_level.root ~pvm_name:"arith" proof + @@ Sc_rollup.Proof.valid + ~metadata + snapshot + Raw_level.root + ~pvm_name:"arith" + proof in Assert.proto_error ~loc:__LOC__ -- GitLab From bca1e0159c40c550b2ee8442c248393a869232cb Mon Sep 17 00:00:00 2001 From: Valentin Chaboche Date: Thu, 22 Sep 2022 17:41:19 +0200 Subject: [PATCH 4/9] Scoru,Test: test refutation of the [Needs_metadata] state --- .../integration/operations/test_sc_rollup.ml | 148 ++++++++++++++++++ 1 file changed, 148 insertions(+) diff --git a/src/proto_alpha/lib_protocol/test/integration/operations/test_sc_rollup.ml b/src/proto_alpha/lib_protocol/test/integration/operations/test_sc_rollup.ml index e30228562e6b..70ce655b20d1 100644 --- a/src/proto_alpha/lib_protocol/test/integration/operations/test_sc_rollup.ml +++ b/src/proto_alpha/lib_protocol/test/integration/operations/test_sc_rollup.ml @@ -1862,6 +1862,150 @@ let test_dissection_during_final_move () = let* _incr = Incremental.add_operation ~expect_apply_failure incr p2_op in return_unit +let init_arith_state ~boot_sector = + let open Lwt_syntax in + let context = Tezos_context_memory.make_empty_context () in + let* state = Arith_pvm.initial_state context in + let* state = Arith_pvm.install_boot_sector state boot_sector in + return (context, state) + +let make_arith_state ?(boot_sector = "") metadata = + let open Lwt_syntax in + let* _context, state = init_arith_state ~boot_sector in + let* state_hash1 = Arith_pvm.state_hash state in + + (* 1. We evaluate the boot sector. *) + let* input_required = Arith_pvm.is_input_state state in + assert (input_required = Sc_rollup.No_input_required) ; + let* state = Arith_pvm.eval state in + let* state_hash2 = Arith_pvm.state_hash state in + (* 2. The state now needs the metadata. *) + let* input_required = Arith_pvm.is_input_state state in + assert (input_required = Sc_rollup.Needs_reveal Reveal_metadata) ; + (* 3. We feed the state with the metadata. *) + let input = Sc_rollup.(Reveal (Metadata metadata)) in + let* state = Arith_pvm.set_input input state in + let* state_hash3 = Arith_pvm.state_hash state in + let* input_required = Arith_pvm.is_input_state state in + assert (input_required = Sc_rollup.Initial) ; + + return (state_hash1, state_hash2, state_hash3) + +let make_refutation_metadata ?(boot_sector = "") metadata = + let open Lwt_syntax in + let* context, state = init_arith_state ~boot_sector in + (* We will prove the tick after the evaluation of the boot sector. *) + let* state = Arith_pvm.eval state in + let input = Sc_rollup.(Reveal (Metadata metadata)) in + let* proof = Arith_pvm.produce_proof context (Some input) state in + let proof = WithExceptions.Result.get_ok ~loc:__LOC__ proof in + let wrapped_proof = + Sc_rollup.Arith_pvm_with_proof + (module struct + include Arith_pvm + + let proof = proof + end) + in + let choice = Sc_rollup.Tick.(next initial) in + let step : Sc_rollup.Game.step = + let pvm_step = wrapped_proof in + let input_proof = Some Sc_rollup.Proof.(Reveal_proof Metadata_proof) in + Proof {pvm_step; input_proof} + in + return Sc_rollup.Game.{choice; step} + +(** Test that during a refutation game when one malicious player lied on the + metadata, he can not win the game. *) +let test_refute_invalid_metadata () = + let open Lwt_result_syntax in + let* block, (account1, account2) = context_init Context.T2 in + let pkh1 = Account.pkh_of_contract_exn account1 in + let pkh2 = Account.pkh_of_contract_exn account2 in + let* block, rollup = sc_originate block account1 "unit" in + let* genesis_info = Context.Sc_rollup.genesis_info (B block) rollup in + let predecessor = genesis_info.commitment_hash in + + let post_commitment_from_metadata block account metadata = + let*! state1, state2, state3 = make_arith_state metadata in + let commitment : Sc_rollup.Commitment.t = + { + predecessor; + inbox_level = Raw_level.of_int32_exn 31l; + number_of_ticks = number_of_ticks_exn 2L; + compressed_state = state3; + } + in + let* block = add_publish ~rollup block account commitment in + return (block, state1, state2, state3) + in + + (* [account1] will play a valid commitment with the correct evaluation of + the [metadata]. *) + let valid_metadata = + Sc_rollup.Metadata. + {address = rollup; origination_level = Raw_level.(succ root)} + in + let* block, state1, state2, state3 = + post_commitment_from_metadata block account1 valid_metadata + in + + (* [account2] will play an invalid commitment with an invalid metadata. *) + let invalid_metadata = + {valid_metadata with origination_level = Raw_level.of_int32_exn 42l} + in + let* block, _, _, _ = + post_commitment_from_metadata block account2 invalid_metadata + in + + (* [account1] starts a refutation game. It will provide a dissection + that will directly allow a final move. It's a bit hack-ish, but we + know which tick we want to refute. + *) + let* start_game_op = + Op.sc_rollup_refute (B block) account1 rollup pkh2 None + in + let* block = add_op block start_game_op in + let dissection : Sc_rollup.Game.refutation = + let choice = Sc_rollup.Tick.initial in + let step : Sc_rollup.Game.step = + let zero = Sc_rollup.Tick.initial in + let one = Sc_rollup.Tick.next zero in + let two = Sc_rollup.Tick.next one in + Dissection + [ + {tick = zero; state_hash = Some state1}; + {tick = one; state_hash = Some state2}; + {tick = two; state_hash = Some state3}; + ] + in + {choice; step} + in + let* dissection_op = + Op.sc_rollup_refute (B block) account1 rollup pkh2 (Some dissection) + in + let* block = add_op block dissection_op in + + (* [account2] will play an invalid proof about the invalid metadata. *) + let*! proof = make_refutation_metadata invalid_metadata in + let* proof1_op = + Op.sc_rollup_refute (B block) account2 rollup pkh1 (Some proof) + in + let* block = add_op block proof1_op in + + (* We can implicitely check that [proof1_op] was invalid if + [account1] wins the game. *) + let*! proof = make_refutation_metadata valid_metadata in + let* incr = Incremental.begin_construction block in + let* proof2_op = + Op.sc_rollup_refute (I incr) account1 rollup pkh2 (Some proof) + in + let* incr = Incremental.add_operation incr proof2_op in + let expected_game_status : Sc_rollup.Game.status = + Ended (Loser {reason = Conflict_resolved; loser = pkh2}) + in + assert_refute_result ~game_status:expected_game_status incr + let tests = [ Tztest.tztest @@ -1963,4 +2107,8 @@ let tests = "Cannot play a dissection when the final move has started" `Quick test_dissection_during_final_move; + Tztest.tztest + "Invalid metadata initialization can be refuted" + `Quick + test_refute_invalid_metadata; ] -- GitLab From 00e238eb164dc008029a73d4bd5472dfa26b3979 Mon Sep 17 00:00:00 2001 From: Valentin Chaboche Date: Thu, 22 Sep 2022 17:42:11 +0200 Subject: [PATCH 5/9] Scoru,Proto: expose [pp_input_request] It's not used in the merge request but I expose this every time for tests, but when I'm finished, I remove the change. Pushing the commit once and for all. --- src/proto_alpha/lib_protocol/alpha_context.mli | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/proto_alpha/lib_protocol/alpha_context.mli b/src/proto_alpha/lib_protocol/alpha_context.mli index cc66adbdfef8..403dfb77e115 100644 --- a/src/proto_alpha/lib_protocol/alpha_context.mli +++ b/src/proto_alpha/lib_protocol/alpha_context.mli @@ -3021,6 +3021,8 @@ module Sc_rollup : sig val input_request_equal : input_request -> input_request -> bool + val pp_input_request : Format.formatter -> input_request -> unit + module Inbox : sig type t -- GitLab From 66d3eff31e9f25c8f934d53a49ad4486f2903513 Mon Sep 17 00:00:00 2001 From: Valentin Chaboche Date: Fri, 23 Sep 2022 16:45:49 +0200 Subject: [PATCH 6/9] Scoru,Test: test metadata input in the Arith PVM --- .../test/unit/test_sc_rollup_arith.ml | 22 +++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/src/proto_alpha/lib_protocol/test/unit/test_sc_rollup_arith.ml b/src/proto_alpha/lib_protocol/test/unit/test_sc_rollup_arith.ml index bad535c486ac..61ad98d29a11 100644 --- a/src/proto_alpha/lib_protocol/test/unit/test_sc_rollup_arith.ml +++ b/src/proto_alpha/lib_protocol/test/unit/test_sc_rollup_arith.ml @@ -134,6 +134,27 @@ let test_boot () = | No_input_required -> failwith "After booting, the machine must be waiting for input." +let test_metadata () = + let open Sc_rollup_PVM_sig in + let open Lwt_result_syntax in + boot "" @@ fun _ctxt state -> + let metadata = + Sc_rollup_metadata_repr. + { + address = Sc_rollup_repr.Address.zero; + origination_level = Raw_level_repr.root; + } + in + let input = Reveal (Metadata metadata) in + let*! state = set_input input state in + let*! input_request = is_input_state state in + match input_request with + | Initial -> return () + | Needs_reveal _ | First_after _ | No_input_required -> + failwith + "After evaluating the metadata, the machine must be in the [Initial] \ + state." + let test_input_message () = let open Sc_rollup_PVM_sig in boot "" @@ fun _ctxt state -> @@ -419,6 +440,7 @@ let tests = [ Tztest.tztest "PreBoot" `Quick test_preboot; Tztest.tztest "Boot" `Quick test_boot; + Tztest.tztest "Metadata" `Quick test_metadata; Tztest.tztest "Input message" `Quick test_input_message; Tztest.tztest "Parsing message" `Quick test_parsing_messages; Tztest.tztest "Evaluating message" `Quick test_evaluation_messages; -- GitLab From e2adbeef2a0f1a00011133e4d2a92f827c75dabc Mon Sep 17 00:00:00 2001 From: Valentin Chaboche Date: Mon, 26 Sep 2022 09:55:24 +0200 Subject: [PATCH 7/9] Scoru,Node: adapt node to new tick --- .../bin_sc_rollup_node/arith_pvm.ml | 1 + .../bin_sc_rollup_node/interpreter.ml | 41 ++++++++++++++++--- .../bin_sc_rollup_node/refutation_game.ml | 4 +- .../bin_sc_rollup_node/wasm_2_0_0_pvm.ml | 1 + 4 files changed, 40 insertions(+), 7 deletions(-) diff --git a/src/proto_alpha/bin_sc_rollup_node/arith_pvm.ml b/src/proto_alpha/bin_sc_rollup_node/arith_pvm.ml index 84325edd3fc0..190b4f3ba021 100644 --- a/src/proto_alpha/bin_sc_rollup_node/arith_pvm.ml +++ b/src/proto_alpha/bin_sc_rollup_node/arith_pvm.ml @@ -53,6 +53,7 @@ module Impl : Pvm.S = struct | Halted -> "Halted" | Waiting_for_input_message -> "Waiting for input message" | Waiting_for_reveal -> "Waiting for reveal" + | Waiting_for_metadata -> "Waiting for metadata" | Parsing -> "Parsing" | Evaluating -> "Evaluating" end diff --git a/src/proto_alpha/bin_sc_rollup_node/interpreter.ml b/src/proto_alpha/bin_sc_rollup_node/interpreter.ml index 4844dee6b44b..266aa94b8daf 100644 --- a/src/proto_alpha/bin_sc_rollup_node/interpreter.ml +++ b/src/proto_alpha/bin_sc_rollup_node/interpreter.ml @@ -30,6 +30,8 @@ module Inbox = Sc_rollup.Inbox module type S = sig module PVM : Pvm.S + val metadata : Node_context.t -> Sc_rollup.Metadata.t + (** [process_head node_ctxt head] interprets the messages associated with a [head] from a chain [event]. This requires the inbox to be updated beforehand. *) @@ -50,6 +52,13 @@ module Make (PVM : Pvm.S) : S with module PVM = PVM = struct module PVM = PVM module Interpreter_event = Interpreter_event.Make (PVM) + (** [metadata node_ctxt] creates a {Sc_rollup.Metadata.t} using the information + stored in [node_ctxt]. *) + let metadata (node_ctxt : Node_context.t) = + let address = node_ctxt.rollup_address in + let origination_level = node_ctxt.genesis_info.Sc_rollup.Commitment.level in + Sc_rollup.Metadata.{address; origination_level} + let consume_fuel = Option.map pred let continue_with_fuel fuel state f = @@ -58,14 +67,14 @@ module Make (PVM : Pvm.S) : S with module PVM = PVM = struct | Some 0 -> return (state, fuel) | _ -> f (consume_fuel fuel) state - (** [eval_until_input level message_index ~fuel start_tick + (** [eval_until_input ~metadata level message_index ~fuel start_tick failing_ticks state] advances a PVM [state] until it wants more inputs or there are no more [fuel] (if [Some fuel] is specified). The evaluation is running under the processing of 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 data_dir level message_index ~fuel start_tick + let eval_until_input ~metadata data_dir level message_index ~fuel start_tick failing_ticks state = let open Lwt_result_syntax in let eval_tick tick failing_ticks state = @@ -109,6 +118,11 @@ module Make (PVM : Pvm.S) : S with module PVM = PVM = struct PVM.set_input (Reveal (Raw_data data)) state in go (consume_fuel fuel) (tick + 1) failing_ticks next_state) + | Needs_reveal Reveal_metadata -> + let*! next_state = + PVM.set_input (Reveal (Metadata metadata)) state + in + go (consume_fuel fuel) (tick + 1) failing_ticks next_state | _ -> return (state, fuel, tick, failing_ticks)) in go fuel start_tick failing_ticks state @@ -118,16 +132,25 @@ module Make (PVM : Pvm.S) : S with module PVM = PVM = struct let payload = Sc_rollup.Inbox_message.unsafe_of_string "0xC4C4" in {input with Sc_rollup.payload} - (** [feed_input level message_index ~fuel ~failing_ticks state + (** [feed_input ~metadata level message_index ~fuel ~failing_ticks state input] feeds [input] (that has a given [message_index] in inbox of [level]) to the PVM in order to advance [state] to the next 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 data_dir level message_index ~fuel ~failing_ticks state input = + let feed_input ~metadata data_dir level message_index ~fuel ~failing_ticks + state input = let open Lwt_result_syntax in let* state, fuel, tick, failing_ticks = - eval_until_input data_dir level message_index ~fuel 0 failing_ticks state + eval_until_input + ~metadata + data_dir + level + message_index + ~fuel + 0 + failing_ticks + state in continue_with_fuel fuel state @@ fun fuel state -> let* input, failing_ticks = @@ -148,6 +171,7 @@ module Make (PVM : Pvm.S) : S with module PVM = PVM = struct let*! state = PVM.set_input (Inbox_message input) state in let* state, fuel, _tick, _failing_ticks = eval_until_input + ~metadata data_dir level message_index @@ -158,7 +182,7 @@ module Make (PVM : Pvm.S) : S with module PVM = PVM = struct in return (state, fuel) - let eval_block_inbox data_dir ?fuel failures store hash state = + let eval_block_inbox ~metadata data_dir ?fuel failures store hash state = let open Lwt_result_syntax in (* Obtain inbox and its messages for this block. *) let*! inbox = Store.Inboxes.find store hash in @@ -199,6 +223,7 @@ module Make (PVM : Pvm.S) : S with module PVM = PVM = struct in let* state, fuel = feed_input + ~metadata data_dir level message_counter @@ -251,8 +276,10 @@ module Make (PVM : Pvm.S) : S with module PVM = PVM = struct then genesis_state hash node_ctxt ctxt else state_of_hash node_ctxt ctxt predecessor_hash pred_level in + let metadata = metadata node_ctxt in let* state, num_messages, inbox_level, _fuel = eval_block_inbox + ~metadata data_dir node_ctxt.loser_mode node_ctxt.store @@ -320,8 +347,10 @@ module Make (PVM : Pvm.S) : S with module PVM = PVM = struct let* _ctxt, state = state_of_hash node_ctxt ctxt predecessor_hash pred_level in + let metadata = metadata node_ctxt in let* state, _counter, _level, _fuel = eval_block_inbox + ~metadata node_ctxt.data_dir node_ctxt.loser_mode ~fuel:tick_distance 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 7fb8d1ca534d..6fe062b64105 100644 --- a/src/proto_alpha/bin_sc_rollup_node/refutation_game.ml +++ b/src/proto_alpha/bin_sc_rollup_node/refutation_game.ml @@ -127,15 +127,17 @@ module Make (Interpreter : Interpreter.S) : let inbox = snapshot end end in + let metadata = Interpreter.metadata node_ctxt in let* proof = trace (Sc_rollup_node_errors.Cannot_produce_proof (snapshot_inbox, snapshot_history, game.inbox_level)) - @@ (Sc_rollup.Proof.produce (module P) game.inbox_level + @@ (Sc_rollup.Proof.produce ~metadata (module P) game.inbox_level >|= Environment.wrap_tzresult) in let*! res = Sc_rollup.Proof.valid + ~metadata snapshot game.inbox_level ~pvm_name:game.pvm_name 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 d11dc059e08a..16d6f0594a8a 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 @@ -74,6 +74,7 @@ module Impl : Pvm.S = struct "Waiting for preimage reveal %a" Sc_rollup.Input_hash.pp hash + | Waiting_for_reveal Sc_rollup.Reveal_metadata -> "Waiting for metadata" | Computing -> "Computing" end -- GitLab From e2695a6ceb47ef5feb47af2039624ada5098f884 Mon Sep 17 00:00:00 2001 From: Valentin Chaboche Date: Fri, 30 Sep 2022 17:04:58 +0200 Subject: [PATCH 8/9] Scoru,Tezt: update regression traces --- ...ances PVM state with internal messages.out | 38 +++++++++---------- ... node advances PVM state with messages.out | 38 +++++++++---------- ...ing of commitments (batcher_does_not_p.out | 2 +- ...ing of commitments (commitment_is_stor.out | 4 +- ...ing of commitments (maintenance_publis.out | 4 +- ...ing of commitments (node_use_proto_par.out | 4 +- ...ing of commitments (observer_does_not_.out | 2 +- ...ing of commitments (operator_publishes.out | 4 +- ...ing of commitments (robust_to_failures.out | 4 +- 9 files changed, 50 insertions(+), 50 deletions(-) diff --git a/tezt/tests/expected/sc_rollup.ml/Alpha- arith - node advances PVM state with internal messages.out b/tezt/tests/expected/sc_rollup.ml/Alpha- arith - node advances PVM state with internal messages.out index d8e1eba53aa9..eed6161cb172 100644 --- a/tezt/tests/expected/sc_rollup.ml/Alpha- arith - node advances PVM state with internal messages.out +++ b/tezt/tests/expected/sc_rollup.ml/Alpha- arith - node advances PVM state with internal messages.out @@ -50,13 +50,13 @@ This sequence of operations was run: "[SC_ROLLUP_PVM_STATE_HASH]" ./octez-sc-rollup-client-alpha rpc get /global/total_ticks -"19" +"20" ./octez-sc-rollup-client-alpha rpc get /global/state_hash "[SC_ROLLUP_PVM_STATE_HASH]" ./octez-sc-rollup-client-alpha rpc get /global/total_ticks -"19" +"20" ./octez-sc-rollup-client-alpha get state value for vars/value "\000\000\000\n" @@ -65,13 +65,13 @@ This sequence of operations was run: "[SC_ROLLUP_PVM_STATE_HASH]" ./octez-sc-rollup-client-alpha rpc get /global/total_ticks -"37" +"38" ./octez-sc-rollup-client-alpha rpc get /global/state_hash "[SC_ROLLUP_PVM_STATE_HASH]" ./octez-sc-rollup-client-alpha rpc get /global/total_ticks -"37" +"38" ./octez-sc-rollup-client-alpha get state value for vars/value "\000\000\000\r" @@ -80,13 +80,13 @@ This sequence of operations was run: "[SC_ROLLUP_PVM_STATE_HASH]" ./octez-sc-rollup-client-alpha rpc get /global/total_ticks -"56" +"57" ./octez-sc-rollup-client-alpha rpc get /global/state_hash "[SC_ROLLUP_PVM_STATE_HASH]" ./octez-sc-rollup-client-alpha rpc get /global/total_ticks -"56" +"57" ./octez-sc-rollup-client-alpha get state value for vars/value "\000\000\000\016" @@ -95,13 +95,13 @@ This sequence of operations was run: "[SC_ROLLUP_PVM_STATE_HASH]" ./octez-sc-rollup-client-alpha rpc get /global/total_ticks -"75" +"76" ./octez-sc-rollup-client-alpha rpc get /global/state_hash "[SC_ROLLUP_PVM_STATE_HASH]" ./octez-sc-rollup-client-alpha rpc get /global/total_ticks -"75" +"76" ./octez-sc-rollup-client-alpha get state value for vars/value "\000\000\000\019" @@ -110,13 +110,13 @@ This sequence of operations was run: "[SC_ROLLUP_PVM_STATE_HASH]" ./octez-sc-rollup-client-alpha rpc get /global/total_ticks -"94" +"95" ./octez-sc-rollup-client-alpha rpc get /global/state_hash "[SC_ROLLUP_PVM_STATE_HASH]" ./octez-sc-rollup-client-alpha rpc get /global/total_ticks -"94" +"95" ./octez-sc-rollup-client-alpha get state value for vars/value "\000\000\000\022" @@ -125,13 +125,13 @@ This sequence of operations was run: "[SC_ROLLUP_PVM_STATE_HASH]" ./octez-sc-rollup-client-alpha rpc get /global/total_ticks -"113" +"114" ./octez-sc-rollup-client-alpha rpc get /global/state_hash "[SC_ROLLUP_PVM_STATE_HASH]" ./octez-sc-rollup-client-alpha rpc get /global/total_ticks -"113" +"114" ./octez-sc-rollup-client-alpha get state value for vars/value "\000\000\000\025" @@ -140,13 +140,13 @@ This sequence of operations was run: "[SC_ROLLUP_PVM_STATE_HASH]" ./octez-sc-rollup-client-alpha rpc get /global/total_ticks -"132" +"133" ./octez-sc-rollup-client-alpha rpc get /global/state_hash "[SC_ROLLUP_PVM_STATE_HASH]" ./octez-sc-rollup-client-alpha rpc get /global/total_ticks -"132" +"133" ./octez-sc-rollup-client-alpha get state value for vars/value "\000\000\000\028" @@ -155,13 +155,13 @@ This sequence of operations was run: "[SC_ROLLUP_PVM_STATE_HASH]" ./octez-sc-rollup-client-alpha rpc get /global/total_ticks -"151" +"152" ./octez-sc-rollup-client-alpha rpc get /global/state_hash "[SC_ROLLUP_PVM_STATE_HASH]" ./octez-sc-rollup-client-alpha rpc get /global/total_ticks -"151" +"152" ./octez-sc-rollup-client-alpha get state value for vars/value "\000\000\000\031" @@ -170,13 +170,13 @@ This sequence of operations was run: "[SC_ROLLUP_PVM_STATE_HASH]" ./octez-sc-rollup-client-alpha rpc get /global/total_ticks -"170" +"171" ./octez-sc-rollup-client-alpha rpc get /global/state_hash "[SC_ROLLUP_PVM_STATE_HASH]" ./octez-sc-rollup-client-alpha rpc get /global/total_ticks -"170" +"171" ./octez-sc-rollup-client-alpha get state value for vars/value "\000\000\000\"" @@ -185,4 +185,4 @@ This sequence of operations was run: "[SC_ROLLUP_PVM_STATE_HASH]" ./octez-sc-rollup-client-alpha rpc get /global/total_ticks -"190" +"191" diff --git a/tezt/tests/expected/sc_rollup.ml/Alpha- arith - node advances PVM state with messages.out b/tezt/tests/expected/sc_rollup.ml/Alpha- arith - node advances PVM state with messages.out index 77b06e7d278a..ce23d28b8e2d 100644 --- a/tezt/tests/expected/sc_rollup.ml/Alpha- arith - node advances PVM state with messages.out +++ b/tezt/tests/expected/sc_rollup.ml/Alpha- arith - node advances PVM state with messages.out @@ -89,13 +89,13 @@ This sequence of operations was run: "[SC_ROLLUP_PVM_STATE_HASH]" ./octez-sc-rollup-client-alpha rpc get /global/total_ticks -"19" +"20" ./octez-sc-rollup-client-alpha rpc get /global/state_hash "[SC_ROLLUP_PVM_STATE_HASH]" ./octez-sc-rollup-client-alpha rpc get /global/total_ticks -"19" +"20" ./octez-client --wait none send sc rollup message '["2 8 + value"]' from bootstrap2 to '[SC_ROLLUP_HASH]' Node is bootstrapped. @@ -144,13 +144,13 @@ This sequence of operations was run: "[SC_ROLLUP_PVM_STATE_HASH]" ./octez-sc-rollup-client-alpha rpc get /global/total_ticks -"37" +"38" ./octez-sc-rollup-client-alpha rpc get /global/state_hash "[SC_ROLLUP_PVM_STATE_HASH]" ./octez-sc-rollup-client-alpha rpc get /global/total_ticks -"37" +"38" ./octez-client --wait none send sc rollup message '["3 10 + value"]' from bootstrap2 to '[SC_ROLLUP_HASH]' Node is bootstrapped. @@ -199,13 +199,13 @@ This sequence of operations was run: "[SC_ROLLUP_PVM_STATE_HASH]" ./octez-sc-rollup-client-alpha rpc get /global/total_ticks -"56" +"57" ./octez-sc-rollup-client-alpha rpc get /global/state_hash "[SC_ROLLUP_PVM_STATE_HASH]" ./octez-sc-rollup-client-alpha rpc get /global/total_ticks -"56" +"57" ./octez-client --wait none send sc rollup message '["4 12 + value"]' from bootstrap2 to '[SC_ROLLUP_HASH]' Node is bootstrapped. @@ -255,13 +255,13 @@ This sequence of operations was run: "[SC_ROLLUP_PVM_STATE_HASH]" ./octez-sc-rollup-client-alpha rpc get /global/total_ticks -"75" +"76" ./octez-sc-rollup-client-alpha rpc get /global/state_hash "[SC_ROLLUP_PVM_STATE_HASH]" ./octez-sc-rollup-client-alpha rpc get /global/total_ticks -"75" +"76" ./octez-client --wait none send sc rollup message '["5 14 + value"]' from bootstrap2 to '[SC_ROLLUP_HASH]' Node is bootstrapped. @@ -311,13 +311,13 @@ This sequence of operations was run: "[SC_ROLLUP_PVM_STATE_HASH]" ./octez-sc-rollup-client-alpha rpc get /global/total_ticks -"94" +"95" ./octez-sc-rollup-client-alpha rpc get /global/state_hash "[SC_ROLLUP_PVM_STATE_HASH]" ./octez-sc-rollup-client-alpha rpc get /global/total_ticks -"94" +"95" ./octez-client --wait none send sc rollup message '["6 16 + value"]' from bootstrap2 to '[SC_ROLLUP_HASH]' Node is bootstrapped. @@ -367,13 +367,13 @@ This sequence of operations was run: "[SC_ROLLUP_PVM_STATE_HASH]" ./octez-sc-rollup-client-alpha rpc get /global/total_ticks -"113" +"114" ./octez-sc-rollup-client-alpha rpc get /global/state_hash "[SC_ROLLUP_PVM_STATE_HASH]" ./octez-sc-rollup-client-alpha rpc get /global/total_ticks -"113" +"114" ./octez-client --wait none send sc rollup message '["7 18 + value"]' from bootstrap2 to '[SC_ROLLUP_HASH]' Node is bootstrapped. @@ -423,13 +423,13 @@ This sequence of operations was run: "[SC_ROLLUP_PVM_STATE_HASH]" ./octez-sc-rollup-client-alpha rpc get /global/total_ticks -"132" +"133" ./octez-sc-rollup-client-alpha rpc get /global/state_hash "[SC_ROLLUP_PVM_STATE_HASH]" ./octez-sc-rollup-client-alpha rpc get /global/total_ticks -"132" +"133" ./octez-client --wait none send sc rollup message '["8 20 + value"]' from bootstrap2 to '[SC_ROLLUP_HASH]' Node is bootstrapped. @@ -480,13 +480,13 @@ This sequence of operations was run: "[SC_ROLLUP_PVM_STATE_HASH]" ./octez-sc-rollup-client-alpha rpc get /global/total_ticks -"151" +"152" ./octez-sc-rollup-client-alpha rpc get /global/state_hash "[SC_ROLLUP_PVM_STATE_HASH]" ./octez-sc-rollup-client-alpha rpc get /global/total_ticks -"151" +"152" ./octez-client --wait none send sc rollup message '["9 22 + value"]' from bootstrap2 to '[SC_ROLLUP_HASH]' Node is bootstrapped. @@ -537,13 +537,13 @@ This sequence of operations was run: "[SC_ROLLUP_PVM_STATE_HASH]" ./octez-sc-rollup-client-alpha rpc get /global/total_ticks -"170" +"171" ./octez-sc-rollup-client-alpha rpc get /global/state_hash "[SC_ROLLUP_PVM_STATE_HASH]" ./octez-sc-rollup-client-alpha rpc get /global/total_ticks -"170" +"171" ./octez-client --wait none send sc rollup message '["10 24 + value"]' from bootstrap2 to '[SC_ROLLUP_HASH]' Node is bootstrapped. @@ -594,4 +594,4 @@ This sequence of operations was run: "[SC_ROLLUP_PVM_STATE_HASH]" ./octez-sc-rollup-client-alpha rpc get /global/total_ticks -"190" +"191" diff --git a/tezt/tests/expected/sc_rollup.ml/Alpha- arith - rollup node - correct handling of commitments (batcher_does_not_p.out b/tezt/tests/expected/sc_rollup.ml/Alpha- arith - rollup node - correct handling of commitments (batcher_does_not_p.out index 9e9769161a0d..4b2c409f4ca0 100644 --- a/tezt/tests/expected/sc_rollup.ml/Alpha- arith - rollup node - correct handling of commitments (batcher_does_not_p.out +++ b/tezt/tests/expected/sc_rollup.ml/Alpha- arith - rollup node - correct handling of commitments (batcher_does_not_p.out @@ -2622,7 +2622,7 @@ This sequence of operations was run: "[SC_ROLLUP_PVM_STATE_HASH]", "inbox_level": 32, "predecessor": "[SC_ROLLUP_COMMITMENT_HASH]", - "number_of_ticks": "5116" }, + "number_of_ticks": "5117" }, "hash": "[SC_ROLLUP_COMMITMENT_HASH]", "published_at_level": 35 } diff --git a/tezt/tests/expected/sc_rollup.ml/Alpha- arith - rollup node - correct handling of commitments (commitment_is_stor.out b/tezt/tests/expected/sc_rollup.ml/Alpha- arith - rollup node - correct handling of commitments (commitment_is_stor.out index fc606e3d6b2a..f6da6ec1b6d1 100644 --- a/tezt/tests/expected/sc_rollup.ml/Alpha- arith - rollup node - correct handling of commitments (commitment_is_stor.out +++ b/tezt/tests/expected/sc_rollup.ml/Alpha- arith - rollup node - correct handling of commitments (commitment_is_stor.out @@ -1307,7 +1307,7 @@ This sequence of operations was run: "[SC_ROLLUP_PVM_STATE_HASH]", "inbox_level": 32, "predecessor": "[SC_ROLLUP_COMMITMENT_HASH]", - "number_of_ticks": "5116" }, + "number_of_ticks": "5117" }, "hash": "[SC_ROLLUP_COMMITMENT_HASH]" } ./octez-sc-rollup-client-alpha rpc get /local/last_published_commitment @@ -1316,6 +1316,6 @@ This sequence of operations was run: "[SC_ROLLUP_PVM_STATE_HASH]", "inbox_level": 32, "predecessor": "[SC_ROLLUP_COMMITMENT_HASH]", - "number_of_ticks": "5116" }, + "number_of_ticks": "5117" }, "hash": "[SC_ROLLUP_COMMITMENT_HASH]", "published_at_level": 35 } diff --git a/tezt/tests/expected/sc_rollup.ml/Alpha- arith - rollup node - correct handling of commitments (maintenance_publis.out b/tezt/tests/expected/sc_rollup.ml/Alpha- arith - rollup node - correct handling of commitments (maintenance_publis.out index 436cb292fb56..8af1f5029647 100644 --- a/tezt/tests/expected/sc_rollup.ml/Alpha- arith - rollup node - correct handling of commitments (maintenance_publis.out +++ b/tezt/tests/expected/sc_rollup.ml/Alpha- arith - rollup node - correct handling of commitments (maintenance_publis.out @@ -2622,7 +2622,7 @@ This sequence of operations was run: "[SC_ROLLUP_PVM_STATE_HASH]", "inbox_level": 32, "predecessor": "[SC_ROLLUP_COMMITMENT_HASH]", - "number_of_ticks": "5116" }, + "number_of_ticks": "5117" }, "hash": "[SC_ROLLUP_COMMITMENT_HASH]", "published_at_level": 35 } @@ -2632,6 +2632,6 @@ This sequence of operations was run: "[SC_ROLLUP_PVM_STATE_HASH]", "inbox_level": 32, "predecessor": "[SC_ROLLUP_COMMITMENT_HASH]", - "number_of_ticks": "5116" }, + "number_of_ticks": "5117" }, "hash": "[SC_ROLLUP_COMMITMENT_HASH]", "published_at_level": 35 } diff --git a/tezt/tests/expected/sc_rollup.ml/Alpha- arith - rollup node - correct handling of commitments (node_use_proto_par.out b/tezt/tests/expected/sc_rollup.ml/Alpha- arith - rollup node - correct handling of commitments (node_use_proto_par.out index 783c2968981b..e7b7bea3767f 100644 --- a/tezt/tests/expected/sc_rollup.ml/Alpha- arith - rollup node - correct handling of commitments (node_use_proto_par.out +++ b/tezt/tests/expected/sc_rollup.ml/Alpha- arith - rollup node - correct handling of commitments (node_use_proto_par.out @@ -662,7 +662,7 @@ This sequence of operations was run: "[SC_ROLLUP_PVM_STATE_HASH]", "inbox_level": 17, "predecessor": "[SC_ROLLUP_COMMITMENT_HASH]", - "number_of_ticks": "1321" }, + "number_of_ticks": "1322" }, "hash": "[SC_ROLLUP_COMMITMENT_HASH]" } ./octez-sc-rollup-client-alpha rpc get /local/last_published_commitment @@ -671,6 +671,6 @@ This sequence of operations was run: "[SC_ROLLUP_PVM_STATE_HASH]", "inbox_level": 17, "predecessor": "[SC_ROLLUP_COMMITMENT_HASH]", - "number_of_ticks": "1321" }, + "number_of_ticks": "1322" }, "hash": "[SC_ROLLUP_COMMITMENT_HASH]", "published_at_level": 20 } diff --git a/tezt/tests/expected/sc_rollup.ml/Alpha- arith - rollup node - correct handling of commitments (observer_does_not_.out b/tezt/tests/expected/sc_rollup.ml/Alpha- arith - rollup node - correct handling of commitments (observer_does_not_.out index 9e9769161a0d..4b2c409f4ca0 100644 --- a/tezt/tests/expected/sc_rollup.ml/Alpha- arith - rollup node - correct handling of commitments (observer_does_not_.out +++ b/tezt/tests/expected/sc_rollup.ml/Alpha- arith - rollup node - correct handling of commitments (observer_does_not_.out @@ -2622,7 +2622,7 @@ This sequence of operations was run: "[SC_ROLLUP_PVM_STATE_HASH]", "inbox_level": 32, "predecessor": "[SC_ROLLUP_COMMITMENT_HASH]", - "number_of_ticks": "5116" }, + "number_of_ticks": "5117" }, "hash": "[SC_ROLLUP_COMMITMENT_HASH]", "published_at_level": 35 } diff --git a/tezt/tests/expected/sc_rollup.ml/Alpha- arith - rollup node - correct handling of commitments (operator_publishes.out b/tezt/tests/expected/sc_rollup.ml/Alpha- arith - rollup node - correct handling of commitments (operator_publishes.out index 436cb292fb56..8af1f5029647 100644 --- a/tezt/tests/expected/sc_rollup.ml/Alpha- arith - rollup node - correct handling of commitments (operator_publishes.out +++ b/tezt/tests/expected/sc_rollup.ml/Alpha- arith - rollup node - correct handling of commitments (operator_publishes.out @@ -2622,7 +2622,7 @@ This sequence of operations was run: "[SC_ROLLUP_PVM_STATE_HASH]", "inbox_level": 32, "predecessor": "[SC_ROLLUP_COMMITMENT_HASH]", - "number_of_ticks": "5116" }, + "number_of_ticks": "5117" }, "hash": "[SC_ROLLUP_COMMITMENT_HASH]", "published_at_level": 35 } @@ -2632,6 +2632,6 @@ This sequence of operations was run: "[SC_ROLLUP_PVM_STATE_HASH]", "inbox_level": 32, "predecessor": "[SC_ROLLUP_COMMITMENT_HASH]", - "number_of_ticks": "5116" }, + "number_of_ticks": "5117" }, "hash": "[SC_ROLLUP_COMMITMENT_HASH]", "published_at_level": 35 } diff --git a/tezt/tests/expected/sc_rollup.ml/Alpha- arith - rollup node - correct handling of commitments (robust_to_failures.out b/tezt/tests/expected/sc_rollup.ml/Alpha- arith - rollup node - correct handling of commitments (robust_to_failures.out index 824f8b19cfbc..b72f0e067e9d 100644 --- a/tezt/tests/expected/sc_rollup.ml/Alpha- arith - rollup node - correct handling of commitments (robust_to_failures.out +++ b/tezt/tests/expected/sc_rollup.ml/Alpha- arith - rollup node - correct handling of commitments (robust_to_failures.out @@ -1307,7 +1307,7 @@ This sequence of operations was run: "[SC_ROLLUP_PVM_STATE_HASH]", "inbox_level": 32, "predecessor": "[SC_ROLLUP_COMMITMENT_HASH]", - "number_of_ticks": "5116" }, + "number_of_ticks": "5117" }, "hash": "[SC_ROLLUP_COMMITMENT_HASH]" } ./octez-sc-rollup-client-alpha rpc get /global/last_stored_commitment @@ -1316,5 +1316,5 @@ This sequence of operations was run: "[SC_ROLLUP_PVM_STATE_HASH]", "inbox_level": 32, "predecessor": "[SC_ROLLUP_COMMITMENT_HASH]", - "number_of_ticks": "5116" }, + "number_of_ticks": "5117" }, "hash": "[SC_ROLLUP_COMMITMENT_HASH]" } -- GitLab From 9baf6cc17c1b5c859d5c30c6302134c4bffaec99 Mon Sep 17 00:00:00 2001 From: Valentin Chaboche Date: Thu, 6 Oct 2022 15:55:35 +0200 Subject: [PATCH 9/9] Tezt: order replacements by regexp lengths --- tezt/lib_tezos/tezos_regression.ml | 23 +++++++++++++---------- 1 file changed, 13 insertions(+), 10 deletions(-) diff --git a/tezt/lib_tezos/tezos_regression.ml b/tezt/lib_tezos/tezos_regression.ml index b4f1ca8ec2fc..934361083d97 100644 --- a/tezt/lib_tezos/tezos_regression.ml +++ b/tezt/lib_tezos/tezos_regression.ml @@ -23,31 +23,34 @@ (* *) (*****************************************************************************) -(* Replace variables that may change between different runs by constants. *) +(* Replace variables that may change between different runs by constants. + + Order them by length. +*) let replace_variables string = let replacements = [ - ("tz[123]\\w{33}\\b", "[PUBLIC_KEY_HASH]"); + ("sh1\\w{71}\\b", "[DAL_SLOT_HEADER]"); + (* TODO: https://gitlab.com/tezos/tezos/-/issues/3752 + Remove this regexp as soon as the WASM PVM stabilizes. *) + ("scs\\w{51}\\b", "[SC_ROLLUP_PVM_STATE_HASH]"); ("\\bB\\w{50}\\b", "[BLOCK_HASH]"); ("Co\\w{50}\\b", "[CONTEXT_HASH]"); - ("txr1\\w{33}\\b", "[TX_ROLLUP_HASH]"); - ("tz4\\w{33}\\b", "[TX_ROLLUP_PUBLIC_KEY_HASH]"); ("txi\\w{50}\\b", "[TX_ROLLUP_INBOX_HASH]"); ("txmr\\w{50}\\b", "[TX_ROLLUP_MESSAGE_RESULT_HASH]"); ("txm\\w{50}\\b", "[TX_ROLLUP_MESSAGE_HASH]"); ("txmr\\w{50}\\b", "[TX_ROLLUP_MESSAGE_RESULT_HASH]"); ("txM\\w{50}\\b", "[TX_ROLLUP_MESSAGE_RESULT_LIST_HASH]"); ("txc\\w{50}\\b", "[TX_ROLLUP_COMMITMENT_HASH]"); - ("scr1\\w{33}\\b", "[SC_ROLLUP_HASH]"); - (* TODO: https://gitlab.com/tezos/tezos/-/issues/3752 - Remove this regexp as soon as the WASM PVM stabilizes. *) - ("scs\\w{51}\\b", "[SC_ROLLUP_PVM_STATE_HASH]"); ("scc1\\w{50}\\b", "[SC_ROLLUP_COMMITMENT_HASH]"); ("scib1\\w{50}\\b", "[SC_ROLLUP_INBOX_HASH]"); - ("sh1\\w{71}\\b", "[DAL_SLOT_HEADER]"); ("edpk\\w{50}\\b", "[PUBLIC_KEY]"); - ("KT1\\w{33}\\b", "[CONTRACT_HASH]"); ("\\bo\\w{50}\\b", "[OPERATION_HASH]"); + ("tz[123]\\w{33}\\b", "[PUBLIC_KEY_HASH]"); + ("txr1\\w{33}\\b", "[TX_ROLLUP_HASH]"); + ("tz4\\w{33}\\b", "[TX_ROLLUP_PUBLIC_KEY_HASH]"); + ("scr1\\w{33}\\b", "[SC_ROLLUP_HASH]"); + ("KT1\\w{33}\\b", "[CONTRACT_HASH]"); ("\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}Z", "[TIMESTAMP]"); (* Ports are non-deterministic when using -j. *) ("/localhost:\\d{4,5}/", "/localhost:[PORT]/"); -- GitLab