From 19726066fa32c0590811f2fd49a0076b6b606b38 Mon Sep 17 00:00:00 2001 From: Alain Mebsout Date: Fri, 31 Mar 2023 10:41:03 +0200 Subject: [PATCH 1/8] Tests/SCORU: give priority to refute operations to one or the other node This allows to make sure that the same player always starts the game and makes the test more deterministic (which is important for the regression traces of dissections). --- tezt/tests/sc_rollup.ml | 128 ++++++++++++++++++++++++++++++++-------- 1 file changed, 104 insertions(+), 24 deletions(-) diff --git a/tezt/tests/sc_rollup.ml b/tezt/tests/sc_rollup.ml index c3462c5608c3..4ed59fd47760 100644 --- a/tezt/tests/sc_rollup.ml +++ b/tezt/tests/sc_rollup.ml @@ -720,6 +720,23 @@ let get_inbox_from_sc_rollup_node sc_rollup_node = let* inbox = sc_rollup_node_rpc sc_rollup_node "global/block/head/inbox" in parse_inbox inbox +(** Configure the rollup node to pay more fees for its refute operations. *) +let prioritize_refute_operations sc_rollup_node = + Log.info + "Prioritize refutation operations for rollup node %s" + (Sc_rollup_node.name sc_rollup_node) ; + Sc_rollup_node.Config_file.update sc_rollup_node @@ fun config -> + let open JSON in + update + "fee-parameters" + (update "refute" + @@ put + ( "minimal-nanotez-per-gas-unit", + JSON.annotate + ~origin:"higher-priority" + (`A [`String "200"; `String "1"]) )) + config + (* Synchronizing the inbox in the rollup node ------------------------------------------ @@ -2675,7 +2692,8 @@ let test_refutation_scenario ?commitment_period ?challenge_window ~variant ~mode final_level, empty_levels, stop_loser_at, - reset_honest_on ) = + reset_honest_on, + (priority : [`Priority_honest | `Priority_loser | `No_priority]) ) = let regression = (* TODO: https://gitlab.com/tezos/tezos/-/issues/5313 Disabled dissection regressions for parallel games, as it introduces @@ -2760,6 +2778,10 @@ let test_refutation_scenario ?commitment_period ?challenge_window ~variant ~mode in gather_dissections () in + (* Write configuration to be able to change it *) + let* _ = Sc_rollup_node.config_init sc_rollup_node sc_rollup_address in + if priority = `Priority_honest then + prioritize_refute_operations sc_rollup_node ; let* () = Sc_rollup_node.run ~event_level:`Debug sc_rollup_node sc_rollup_address [] in @@ -2787,6 +2809,14 @@ let test_refutation_scenario ?commitment_period ?challenge_window ~variant ~mode let* gather_promises = run_honest_node sc_rollup_node and* () = Lwt_list.iter_p (fun (loser_mode, loser_sc_rollup_node) -> + let* _ = + Sc_rollup_node.config_init + ~loser_mode + loser_sc_rollup_node + sc_rollup_address + in + if priority = `Priority_loser then + prioritize_refute_operations loser_sc_rollup_node ; Sc_rollup_node.run loser_sc_rollup_node ~loser_mode sc_rollup_address []) @@ List.combine loser_modes loser_sc_rollup_nodes in @@ -2940,62 +2970,112 @@ let test_refutation protocols ~kind = message index of the failure, and the third integer is the index of the failing tick during the processing of this message. *) - ("inbox_proof_at_genesis", (["3 0 0"], inputs_for 10, 80, [], [], [])); - ("pvm_proof_at_genesis", (["3 0 1"], inputs_for 10, 80, [], [], [])); - ("inbox_proof", (["5 0 0"], inputs_for 10, 80, [], [], [])); + ( "inbox_proof_at_genesis", + (["3 0 0"], inputs_for 10, 80, [], [], [], `Priority_honest) ); + ( "pvm_proof_at_genesis", + (["3 0 1"], inputs_for 10, 80, [], [], [], `Priority_honest) ); + ( "inbox_proof", + (["5 0 0"], inputs_for 10, 80, [], [], [], `Priority_honest) ); ( "inbox_proof_with_new_content", - (["5 0 0"], inputs_for 30, 80, [], [], []) ); + (["5 0 0"], inputs_for 30, 80, [], [], [], `Priority_honest) ); (* In "inbox_proof_with_new_content" we add messages after the commitment period so the current inbox is not equal to the inbox snapshot-ted at the game creation. *) ( "inbox_proof_one_empty_level", - (["6 0 0"], inputs_for 10, 80, [2], [], []) ); + (["6 0 0"], inputs_for 10, 80, [2], [], [], `Priority_honest) ); ( "inbox_proof_many_empty_levels", - (["9 0 0"], inputs_for 10, 80, [2; 3; 4], [], []) ); - ("pvm_proof_0", (["5 2 1"], inputs_for 10, 80, [], [], [])); - ("pvm_proof_1", (["7 2 0"], inputs_for 10, 80, [], [], [])); - ("pvm_proof_2", (["7 2 5"], inputs_for 7, 80, [], [], [])); - ("pvm_proof_3", (["9 2 5"], inputs_for 7, 80, [4; 5], [], [])); - ("timeout", (["5 2 1"], inputs_for 10, 80, [], [35], [])); + (["9 0 0"], inputs_for 10, 80, [2; 3; 4], [], [], `Priority_honest) + ); + ( "pvm_proof_0", + (["5 2 1"], inputs_for 10, 80, [], [], [], `Priority_honest) ); + ( "pvm_proof_1", + (["7 2 0"], inputs_for 10, 80, [], [], [], `Priority_honest) ); + ( "pvm_proof_2", + (["7 2 5"], inputs_for 7, 80, [], [], [], `Priority_honest) ); + ( "pvm_proof_3", + (["9 2 5"], inputs_for 7, 80, [4; 5], [], [], `Priority_honest) ); + ( "timeout", + (["5 2 1"], inputs_for 10, 80, [], [35], [], `Priority_honest) ); ( "reset_honest_during_game", ( ["5 2 1"], inputs_for 10, 80, [], [], - [("sc_rollup_node_conflict_detected.v0", 2)] ) ); + [("sc_rollup_node_conflict_detected.v0", 2)], + `Priority_honest ) ); ( "parallel_games_0", - (["3 0 0"; "3 0 1"], inputs_for 10, 80, [], [], []) ); + (["3 0 0"; "3 0 1"], inputs_for 10, 80, [], [], [], `Priority_honest) + ); ( "parallel_games_1", - (["3 0 0"; "3 0 1"; "3 0 0"], inputs_for 10, 200, [], [], []) ); + ( ["3 0 0"; "3 0 1"; "3 0 0"], + inputs_for 10, + 200, + [], + [], + [], + `Priority_honest ) ); ] | "wasm_2_0_0" -> [ (* First message of an inbox (level 3) *) - ("inbox_proof_0", (["3 0 0"], inputs_for 10, 80, [], [], [])); + ( "inbox_proof_0", + (["3 0 0"], inputs_for 10, 80, [], [], [], `Priority_loser) ); (* Fourth message of an inbox (level 3) *) - ("inbox_proof_1", (["3 4 0"], inputs_for 10, 80, [], [], [])); + ( "inbox_proof_1", + (["3 4 0"], inputs_for 10, 80, [], [], [], `Priority_loser) ); (* Echo kernel takes around 2,100 ticks to execute *) (* Second tick of decoding *) ( "pvm_proof_0", - (["5 7 11_000_000_001"], inputs_for 10, 80, [], [], []) ); + ( ["5 7 11_000_000_001"], + inputs_for 10, + 80, + [], + [], + [], + `Priority_loser ) ); ( "pvm_proof_1", - (["7 7 11_000_001_000"], inputs_for 10, 80, [], [], []) ); + ( ["7 7 11_000_001_000"], + inputs_for 10, + 80, + [], + [], + [], + `Priority_loser ) ); (* End of evaluation *) ( "pvm_proof_2", - (["7 7 22_000_002_000"], inputs_for 10, 80, [], [], []) ); + ( ["7 7 22_000_002_000"], + inputs_for 10, + 80, + [], + [], + [], + `Priority_loser ) ); (* During padding *) ( "pvm_proof_3", - (["7 7 22_010_000_000"], inputs_for 10, 80, [], [], []) ); + ( ["7 7 22_010_000_000"], + inputs_for 10, + 80, + [], + [], + [], + `Priority_loser ) ); ( "parallel_games_0", - (["4 0 0"; "5 7 11_000_000_001"], inputs_for 10, 80, [], [], []) ); + ( ["4 0 0"; "5 7 11_000_000_001"], + inputs_for 10, + 80, + [], + [], + [], + `Priority_loser ) ); ( "parallel_games_1", ( ["4 0 0"; "7 7 22_000_002_000"; "7 7 22_000_002_000"], inputs_for 10, 80, [], [], - [] ) ); + [], + `Priority_loser ) ); ] | _ -> assert false in @@ -3019,7 +3099,7 @@ let test_accuser protocols = ~challenge_window:10 ~commitment_period:10 ~variant:"pvm_proof_2" - (["7 7 22_000_002_000"], inputs_for 10, 80, [], [], []) + (["7 7 22_000_002_000"], inputs_for 10, 80, [], [], [], `Priority_honest) protocols (** Helper to check that the operation whose hash is given is successfully -- GitLab From 4135a82e49c83aba63f88afa4473babe1eb7e5d5 Mon Sep 17 00:00:00 2001 From: Antonio Locascio Date: Tue, 7 Mar 2023 08:47:51 +0100 Subject: [PATCH 2/8] SCORU/Node: helper types for player and coordinator workers --- .../refutation_coordinator_types.ml | 68 +++++++++++++++++ .../refutation_coordinator_types.mli | 40 ++++++++++ .../refutation_player_types.ml | 73 +++++++++++++++++++ .../refutation_player_types.mli | 45 ++++++++++++ 4 files changed, 226 insertions(+) create mode 100644 src/proto_alpha/lib_sc_rollup_node/refutation_coordinator_types.ml create mode 100644 src/proto_alpha/lib_sc_rollup_node/refutation_coordinator_types.mli create mode 100644 src/proto_alpha/lib_sc_rollup_node/refutation_player_types.ml create mode 100644 src/proto_alpha/lib_sc_rollup_node/refutation_player_types.mli diff --git a/src/proto_alpha/lib_sc_rollup_node/refutation_coordinator_types.ml b/src/proto_alpha/lib_sc_rollup_node/refutation_coordinator_types.ml new file mode 100644 index 000000000000..9718e7b9ae19 --- /dev/null +++ b/src/proto_alpha/lib_sc_rollup_node/refutation_coordinator_types.ml @@ -0,0 +1,68 @@ +(*****************************************************************************) +(* *) +(* Open Source License *) +(* Copyright (c) 2023 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. *) +(* *) +(*****************************************************************************) + +module Request = struct + type ('a, 'b) t = Process : Layer1.head -> (unit, error trace) t + + type view = View : _ t -> view + + let view req = View req + + let encoding = + let open Data_encoding in + union + [ + case + (Tag 0) + ~title:"Process" + (obj2 + (req "request" (constant "process")) + (req "block" Layer1.head_encoding)) + (function View (Process b) -> Some ((), b)) + (fun ((), b) -> View (Process b)); + ] + + let pp ppf (View r) = + match r with + | Process {Layer1.hash; level} -> + Format.fprintf + ppf + "Processing new L1 head %a at level %ld" + Block_hash.pp + hash + level +end + +module Name = struct + type t = unit + + let encoding = Data_encoding.unit + + let base = ["sc_rollup_refutation_coordinator"] + + let pp _ _ = () + + let equal () () = true +end diff --git a/src/proto_alpha/lib_sc_rollup_node/refutation_coordinator_types.mli b/src/proto_alpha/lib_sc_rollup_node/refutation_coordinator_types.mli new file mode 100644 index 000000000000..803b39130f2a --- /dev/null +++ b/src/proto_alpha/lib_sc_rollup_node/refutation_coordinator_types.mli @@ -0,0 +1,40 @@ +(*****************************************************************************) +(* *) +(* Open Source License *) +(* Copyright (c) 2023 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. *) +(* *) +(*****************************************************************************) + +module Request : sig + (** Type of requests accepted by the refutation coordinator. *) + type ('a, 'b) t = + | Process : Layer1.head -> (unit, error trace) t + (** Request to process new refutation games. *) + + type view = View : _ t -> view + + include + Worker_intf.REQUEST + with type ('a, 'request_error) t := ('a, 'request_error) t + and type view := view +end + +module Name : Worker_intf.NAME with type t = unit diff --git a/src/proto_alpha/lib_sc_rollup_node/refutation_player_types.ml b/src/proto_alpha/lib_sc_rollup_node/refutation_player_types.ml new file mode 100644 index 000000000000..5cb43af30509 --- /dev/null +++ b/src/proto_alpha/lib_sc_rollup_node/refutation_player_types.ml @@ -0,0 +1,73 @@ +(*****************************************************************************) +(* *) +(* Open Source License *) +(* Copyright (c) 2023 Nomadic Labs, *) +(* *) +(* Permission is hereby granted, free of charge, to any person obtaining a *) +(* copy of this software and associated documentation files (the "Software"),*) +(* to deal in the Software without restriction, including without limitation *) +(* the rights to use, copy, modify, merge, publish, distribute, sublicense, *) +(* and/or sell copies of the Software, and to permit persons to whom the *) +(* Software is furnished to do so, subject to the following conditions: *) +(* *) +(* The above copyright notice and this permission notice shall be included *) +(* in all copies or substantial portions of the Software. *) +(* *) +(* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR*) +(* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, *) +(* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL *) +(* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER*) +(* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING *) +(* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER *) +(* DEALINGS IN THE SOFTWARE. *) +(* *) +(*****************************************************************************) +open Protocol +open Alpha_context + +module Request = struct + type ('a, 'b) t = + | Play : Sc_rollup.Game.t -> (unit, error trace) t + | Play_opening : + Sc_rollup.Refutation_storage.conflict + -> (unit, error trace) t + + type view = View : _ t -> view + + let view req = View req + + let encoding = + let open Data_encoding in + union + [ + case + (Tag 0) + ~title:"Play" + (obj2 + (req "request" (constant "play")) + (req "game" Sc_rollup.Game.encoding)) + (function View (Play g) -> Some ((), g) | _ -> None) + (fun ((), g) -> View (Play g)); + case + (Tag 1) + ~title:"Play opening" + (obj2 + (req "request" (constant "play_opening")) + (req "conflict" Sc_rollup.Refutation_storage.conflict_encoding)) + (function View (Play_opening c) -> Some ((), c) | _ -> None) + (fun ((), c) -> View (Play_opening c)); + ] + + let pp ppf (View r) = + match r with + | Play game -> Format.fprintf ppf "Playing game %a" Sc_rollup.Game.pp game + | Play_opening conflict -> + Format.fprintf + ppf + "Playing opening move for conflict against staker %a at our \ + commitment %a" + Sc_rollup.Staker.pp + conflict.other + Sc_rollup.Commitment.pp + conflict.our_commitment +end diff --git a/src/proto_alpha/lib_sc_rollup_node/refutation_player_types.mli b/src/proto_alpha/lib_sc_rollup_node/refutation_player_types.mli new file mode 100644 index 000000000000..d29fd8289f45 --- /dev/null +++ b/src/proto_alpha/lib_sc_rollup_node/refutation_player_types.mli @@ -0,0 +1,45 @@ +(*****************************************************************************) +(* *) +(* Open Source License *) +(* Copyright (c) 2023 Nomadic Labs, *) +(* *) +(* Permission is hereby granted, free of charge, to any person obtaining a *) +(* copy of this software and associated documentation files (the "Software"),*) +(* to deal in the Software without restriction, including without limitation *) +(* the rights to use, copy, modify, merge, publish, distribute, sublicense, *) +(* and/or sell copies of the Software, and to permit persons to whom the *) +(* Software is furnished to do so, subject to the following conditions: *) +(* *) +(* The above copyright notice and this permission notice shall be included *) +(* in all copies or substantial portions of the Software. *) +(* *) +(* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR*) +(* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, *) +(* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL *) +(* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER*) +(* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING *) +(* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER *) +(* DEALINGS IN THE SOFTWARE. *) +(* *) +(*****************************************************************************) + +open Protocol +open Alpha_context + +module Request : sig + (** Type of requests accepted by the refutation player. *) + type ('a, 'b) t = + | Play : Sc_rollup.Game.t -> (unit, error trace) t + (** Play a step of an ongoing refutation game. *) + | Play_opening : + Sc_rollup.Refutation_storage.conflict + -> (unit, error trace) t + (** Play the opening move of a refutation game. *) + + type view = View : _ t -> view + + include + Worker_intf.REQUEST + with type ('a, 'request_error) t := ('a, 'request_error) t + and type view := view +end -- GitLab From 80c885bb95e4899c1e19ec397bde2f4af4049643 Mon Sep 17 00:00:00 2001 From: Antonio Locascio Date: Tue, 7 Mar 2023 08:48:14 +0100 Subject: [PATCH 3/8] SCORU/Node: add errors for missing refutation workers --- .../sc_rollup_node_errors.ml | 26 ++++++++++++++++++- 1 file changed, 25 insertions(+), 1 deletion(-) diff --git a/src/proto_alpha/lib_sc_rollup_node/sc_rollup_node_errors.ml b/src/proto_alpha/lib_sc_rollup_node/sc_rollup_node_errors.ml index 48d36a8391eb..c0b3197a1bbe 100644 --- a/src/proto_alpha/lib_sc_rollup_node/sc_rollup_node_errors.ml +++ b/src/proto_alpha/lib_sc_rollup_node/sc_rollup_node_errors.ml @@ -55,6 +55,8 @@ type error += | Cannot_checkout_context of Block_hash.t * Sc_rollup_context_hash.t option | No_batcher | No_publisher + | Refutation_player_failed_to_start + | No_refutation_coordinator type error += Lost_game of Protocol.Alpha_context.Sc_rollup.Game.game_result @@ -321,4 +323,26 @@ let () = `Permanent Data_encoding.unit (function No_publisher -> Some () | _ -> None) - (fun () -> No_publisher) + (fun () -> No_publisher) ; + + register_error_kind + ~id:"sc_rollup.node.no_refutation_coordinator" + ~title:"No refutation coordinator for this node" + ~description:"This node does not have a refutation game coordinator" + ~pp:(fun ppf () -> + Format.fprintf ppf "This node does not have a refutation game coordinator") + `Permanent + Data_encoding.unit + (function No_refutation_coordinator -> Some () | _ -> None) + (fun () -> No_refutation_coordinator) ; + + register_error_kind + ~id:"sc_rollup.node.no_refutation_player" + ~title:"A refutation player failed to start" + ~description:"A refutation player failed to start" + ~pp:(fun ppf () -> + Format.fprintf ppf "A refutation player failed to start.") + `Permanent + Data_encoding.unit + (function Refutation_player_failed_to_start -> Some () | _ -> None) + (fun () -> Refutation_player_failed_to_start) -- GitLab From ed4241413d7255c23364301285311508f9ba6acc Mon Sep 17 00:00:00 2001 From: Antonio Locascio Date: Tue, 7 Mar 2023 08:48:32 +0100 Subject: [PATCH 4/8] SCORU/Node: add events for refutation player and coordinator --- .../lib_sc_rollup_node/commitment_event.ml | 16 ++- .../lib_sc_rollup_node/commitment_event.mli | 6 + src/proto_alpha/lib_sc_rollup_node/daemon.ml | 5 + .../refutation_game_event.ml | 111 +++++++++++++++++- 4 files changed, 135 insertions(+), 3 deletions(-) diff --git a/src/proto_alpha/lib_sc_rollup_node/commitment_event.ml b/src/proto_alpha/lib_sc_rollup_node/commitment_event.ml index e5d62ef4337c..92c014f0ab7c 100644 --- a/src/proto_alpha/lib_sc_rollup_node/commitment_event.ml +++ b/src/proto_alpha/lib_sc_rollup_node/commitment_event.ml @@ -71,7 +71,18 @@ module Simple = struct ~msg: "Last cemented commitment was updated to hash {hash} at inbox level \ {level}" - ~level:Notice + ~level:Debug + ("hash", Sc_rollup.Commitment.Hash.encoding) + ("level", Raw_level.encoding) + + let last_published_commitment_updated = + declare_2 + ~section + ~name:"sc_rollup_node_lpc_updated" + ~msg: + "Last published commitment was updated to hash {hash} at inbox level \ + {level}" + ~level:Debug ("hash", Sc_rollup.Commitment.Hash.encoding) ("level", Raw_level.encoding) @@ -182,6 +193,9 @@ let commitment_stored = emit_commitment_event Simple.commitment_stored let last_cemented_commitment_updated head level = Simple.(emit last_cemented_commitment_updated (head, level)) +let last_published_commitment_updated head level = + Simple.(emit last_published_commitment_updated (head, level)) + let compute_commitment level = Simple.(emit compute_commitment level) let publish_commitment head level = diff --git a/src/proto_alpha/lib_sc_rollup_node/commitment_event.mli b/src/proto_alpha/lib_sc_rollup_node/commitment_event.mli index 6f583d61cc72..89b337266710 100644 --- a/src/proto_alpha/lib_sc_rollup_node/commitment_event.mli +++ b/src/proto_alpha/lib_sc_rollup_node/commitment_event.mli @@ -53,6 +53,12 @@ val commitment_will_not_be_published : val last_cemented_commitment_updated : Sc_rollup.Commitment.Hash.t -> Raw_level.t -> unit Lwt.t +(** [last_published_commitment_updated hash level] emits the event that the last + published commitment was updated to the given [hash] at the given inbox + [level]. *) +val last_published_commitment_updated : + Sc_rollup.Commitment.Hash.t -> Raw_level.t -> unit Lwt.t + (** [commitment_parent_is_not_lcc predecessor_hash last_cemented_commitment_hash] emits the event that a commitment at the given inbox [level] is being published, whose parent is the last cemented commitment, but the diff --git a/src/proto_alpha/lib_sc_rollup_node/daemon.ml b/src/proto_alpha/lib_sc_rollup_node/daemon.ml index b824df25ac95..6bf9289528b8 100644 --- a/src/proto_alpha/lib_sc_rollup_node/daemon.ml +++ b/src/proto_alpha/lib_sc_rollup_node/daemon.ml @@ -111,6 +111,11 @@ module Make (PVM : Pvm.S) = struct Some (Raw_level.of_int32_exn head.Layer1.level); } in + let*! () = + Commitment_event.last_published_commitment_updated + commitment_hash + (Raw_level.of_int32_exn head.Layer1.level) + in return_unit | ( Sc_rollup_publish {commitment = their_commitment; rollup}, Sc_rollup_publish_result diff --git a/src/proto_alpha/lib_sc_rollup_node/refutation_game_event.ml b/src/proto_alpha/lib_sc_rollup_node/refutation_game_event.ml index 45530c687e35..ec11b4cdc3fc 100644 --- a/src/proto_alpha/lib_sc_rollup_node/refutation_game_event.ml +++ b/src/proto_alpha/lib_sc_rollup_node/refutation_game_event.ml @@ -28,11 +28,11 @@ open Protocol.Alpha_context (* TODO: https://gitlab.com/tezos/tezos/-/issues/2880 Add corresponding .mli file. *) +let section = [Protocol.name; "sc_rollup_node"; "refutation_game"] + module Simple = struct include Internal_event.Simple - let section = [Protocol.name; "sc_rollup_node"; "refutation_game"] - let timeout = declare_1 ~section @@ -115,6 +115,86 @@ module Simple = struct ("start_tick", Sc_rollup.Tick.encoding) ("end_tick", Sc_rollup.Tick.encoding) ("dissection", Data_encoding.list dissection_chunk_encoding) + + module Worker (ARG : sig + val section : string list + end) + (Request : Worker_intf.REQUEST) = + struct + include ARG + + let request_failed = + declare_3 + ~section + ~name:"request_failed" + ~msg:"request {view} failed ({worker_status}): {errors}" + ~level:Debug + ("view", Request.encoding) + ~pp1:Request.pp + ("worker_status", Worker_types.request_status_encoding) + ~pp2:Worker_types.pp_status + ("errors", Error_monad.trace_encoding) + ~pp3:Error_monad.pp_print_trace + + let request_completed = + declare_2 + ~section + ~name:"request_completed" + ~msg:"{view} {worker_status}" + ~level:Debug + ("view", Request.encoding) + ("worker_status", Worker_types.request_status_encoding) + ~pp1:Request.pp + ~pp2:Worker_types.pp_status + end + + module Player = struct + include + Worker + (struct + let section = section @ ["player"] + end) + (Refutation_player_types.Request) + + let started = + declare_2 + ~section + ~name:"player_started" + ~msg: + "refutation player started to play against {opponent}, defenfing \ + commitment {commitment}" + ~level:Notice + ("opponent", Signature.Public_key_hash.encoding) + ~pp1:Signature.Public_key_hash.pp + ("commitment", Sc_rollup.Commitment.encoding) + ~pp2:Sc_rollup.Commitment.pp + + let stopped = + declare_1 + ~section + ~name:"player_stopped" + ~msg:"refutation player for opponent {opponent} has been stopped" + ~level:Notice + ("opponent", Signature.Public_key_hash.encoding) + ~pp1:Signature.Public_key_hash.pp + end + + module Coordinator = struct + include + Worker + (struct + let section = section @ ["coordinator"] + end) + (Refutation_coordinator_types.Request) + + let starting = + declare_0 + ~section + ~name:"coordinator_starting" + ~msg:"Starting refutation coordinator for the smart rollup node" + ~level:Notice + () + end end let timeout address = Simple.(emit timeout address) @@ -151,3 +231,30 @@ let timeout_detected other = Simple.(emit timeout_detected other) let computed_dissection ~opponent ~start_tick ~end_tick dissection = Simple.(emit computed_dissection (opponent, start_tick, end_tick, dissection)) + +module Player = struct + let section = Simple.Player.section + + let request_failed view worker_status errors = + Simple.(emit Player.request_failed (view, worker_status, errors)) + + let request_completed view worker_status = + Simple.(emit Player.request_completed (view, worker_status)) + + let started opponent commitment = + Simple.(emit Player.started (opponent, commitment)) + + let stopped opponent = Simple.(emit Player.stopped opponent) +end + +module Coordinator = struct + let section = Simple.Coordinator.section + + let request_failed view worker_status errors = + Simple.(emit Coordinator.request_failed (view, worker_status, errors)) + + let request_completed view worker_status = + Simple.(emit Coordinator.request_completed (view, worker_status)) + + let starting = Simple.(emit Coordinator.starting) +end -- GitLab From 825805a690cc5fe1d20f7d59a51e647dd47e5469 Mon Sep 17 00:00:00 2001 From: Antonio Locascio Date: Tue, 7 Mar 2023 08:54:15 +0100 Subject: [PATCH 5/8] SCORU/Node: move the playing of refutation games to workers The module [Refutation_player] defines a worker group that will be handled by the refutation coordinator. A new refutation player will be spawned for each new conflict that the node has to defend. A [Refutation_player] can be initialized on a fresh conflict, and therefore tasked with playing the opening move, or for an ongoing game. This commit also adds a component to the rollup node for coordinating refutation game players (as introduced in the previous commit). --- .../lib_sc_rollup_node/components.ml | 2 +- .../lib_sc_rollup_node/configuration.ml | 2 + .../lib_sc_rollup_node/configuration.mli | 4 + src/proto_alpha/lib_sc_rollup_node/daemon.ml | 5 +- .../refutation_coordinator.ml | 248 ++++++++++++++++++ .../refutation_coordinator.mli | 53 ++++ .../refutation_coordinator_types.ml | 12 - .../refutation_coordinator_types.mli | 2 - .../lib_sc_rollup_node/refutation_game.ml | 67 ++--- .../lib_sc_rollup_node/refutation_game.mli | 22 +- .../lib_sc_rollup_node/refutation_player.ml | 204 ++++++++++++++ .../lib_sc_rollup_node/refutation_player.mli | 68 +++++ 12 files changed, 619 insertions(+), 70 deletions(-) create mode 100644 src/proto_alpha/lib_sc_rollup_node/refutation_coordinator.ml create mode 100644 src/proto_alpha/lib_sc_rollup_node/refutation_coordinator.mli create mode 100644 src/proto_alpha/lib_sc_rollup_node/refutation_player.ml create mode 100644 src/proto_alpha/lib_sc_rollup_node/refutation_player.mli diff --git a/src/proto_alpha/lib_sc_rollup_node/components.ml b/src/proto_alpha/lib_sc_rollup_node/components.ml index 70f7e12c8ed8..1d5b8c0984fa 100644 --- a/src/proto_alpha/lib_sc_rollup_node/components.ml +++ b/src/proto_alpha/lib_sc_rollup_node/components.ml @@ -29,7 +29,7 @@ module Make (PVM : Pvm.S) = struct module Interpreter = Interpreter.Make (PVM) module Commitment = Commitment.Make (PVM) module Simulation = Simulation.Make (Interpreter) - module Refutation_game = Refutation_game.Make (Interpreter) + module Refutation_coordinator = Refutation_coordinator.Make (Interpreter) module Batcher = Batcher.Make (Simulation) module RPC_server = RPC_server.Make (Simulation) (Batcher) end diff --git a/src/proto_alpha/lib_sc_rollup_node/configuration.ml b/src/proto_alpha/lib_sc_rollup_node/configuration.ml index 5ccab66b2e2c..9b319701b694 100644 --- a/src/proto_alpha/lib_sc_rollup_node/configuration.ml +++ b/src/proto_alpha/lib_sc_rollup_node/configuration.ml @@ -619,6 +619,8 @@ let check_mode config = | Operator -> narrow_purposes [Publish; Cement; Add_messages; Refute] | Custom -> return config +let refutation_player_buffer_levels = 5 + let loser_warning_message config = if config.loser_mode <> Loser_mode.no_failures then Format.printf diff --git a/src/proto_alpha/lib_sc_rollup_node/configuration.mli b/src/proto_alpha/lib_sc_rollup_node/configuration.mli index bcd7946d3973..68afde1092a8 100644 --- a/src/proto_alpha/lib_sc_rollup_node/configuration.mli +++ b/src/proto_alpha/lib_sc_rollup_node/configuration.mli @@ -167,6 +167,10 @@ val config_filename : data_dir:string -> string removes the extra ones. *) val check_mode : t -> t tzresult +(** Number of levels the refutation player waits until trying to play + for a game state it already played before. *) +val refutation_player_buffer_levels : int + (** [save configuration] overwrites [configuration] file from [data_dir]. *) val save : data_dir:string -> t -> unit tzresult Lwt.t diff --git a/src/proto_alpha/lib_sc_rollup_node/daemon.ml b/src/proto_alpha/lib_sc_rollup_node/daemon.ml index 6bf9289528b8..7c688c934cb5 100644 --- a/src/proto_alpha/lib_sc_rollup_node/daemon.ml +++ b/src/proto_alpha/lib_sc_rollup_node/daemon.ml @@ -451,7 +451,7 @@ module Make (PVM : Pvm.S) = struct let* () = Components.Commitment.Publisher.publish_commitments () in let* () = Components.Commitment.Publisher.cement_commitments () in let*! () = Daemon_event.new_heads_processed reorg.new_chain in - let* () = Components.Refutation_game.process head node_ctxt in + let* () = Components.Refutation_coordinator.process head in let* () = Components.Batcher.batch () in let* () = Components.Batcher.new_head head in let*! () = Injector.inject ~header () in @@ -472,6 +472,8 @@ module Make (PVM : Pvm.S) = struct let* () = Components.Batcher.shutdown () in let* () = message "Shutting down Commitment Publisher@." in let* () = Components.Commitment.Publisher.shutdown () in + let* () = message "Shutting down Refutation Coordinator@." in + let* () = Components.Refutation_coordinator.shutdown () in let* (_ : unit tzresult) = Node_context.close node_ctxt in let* () = Event.shutdown_node exit_status in Tezos_base_unix.Internal_event_unix.close () @@ -525,6 +527,7 @@ module Make (PVM : Pvm.S) = struct (operator, strategy, purposes)) in let* () = Components.Commitment.Publisher.init node_ctxt in + let* () = Components.Refutation_coordinator.init node_ctxt in let* () = Injector.init node_ctxt.cctxt diff --git a/src/proto_alpha/lib_sc_rollup_node/refutation_coordinator.ml b/src/proto_alpha/lib_sc_rollup_node/refutation_coordinator.ml new file mode 100644 index 000000000000..183553ddda91 --- /dev/null +++ b/src/proto_alpha/lib_sc_rollup_node/refutation_coordinator.ml @@ -0,0 +1,248 @@ +(*****************************************************************************) +(* *) +(* Open Source License *) +(* Copyright (c) 2023 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 +open Refutation_coordinator_types + +module type S = sig + module PVM : Pvm.S + + val init : Node_context.rw -> unit tzresult Lwt.t + + val process : Layer1.head -> unit tzresult Lwt.t + + val shutdown : unit -> unit Lwt.t +end + +(* Count instances of the coordinator functor to allow for multiple + worker events without conflicts. *) +let instances_count = ref 0 + +module Make (Interpreter : Interpreter.S) = struct + include Refutation_game.Make (Interpreter) + module Player = Refutation_player.Make (Interpreter) + module Pkh_map = Signature.Public_key_hash.Map + module Pkh_table = Signature.Public_key_hash.Table + + let () = incr instances_count + + type state = { + node_ctxt : Node_context.rw; + pending_opponents : unit Pkh_table.t; + } + + let get_conflicts cctxt head_block = + Plugin.RPC.Sc_rollup.conflicts cctxt (cctxt#chain, head_block) + + let get_ongoing_games cctxt head_block = + Plugin.RPC.Sc_rollup.ongoing_refutation_games cctxt (cctxt#chain, head_block) + + let untracked_conflicts opponent_players conflicts = + List.filter + (fun conflict -> + not + @@ Pkh_map.mem + conflict.Sc_rollup.Refutation_storage.other + opponent_players) + conflicts + + (* Transform the list of ongoing games [(Game.t * pkh * pkh) list] + into a mapping from opponents' pkhs to their corresponding game + state. + *) + let make_game_map self ongoing_games = + List.fold_left + (fun acc (game, alice, bob) -> + let opponent_pkh = + if Signature.Public_key_hash.equal self alice then bob else alice + in + Pkh_map.add opponent_pkh game acc) + Pkh_map.empty + ongoing_games + + let on_process Layer1.{hash; level} state = + let node_ctxt = state.node_ctxt in + let head_block = `Hash (hash, 0) in + let open Lwt_result_syntax in + let refute_signer = Node_context.get_operator node_ctxt Refute in + match refute_signer with + | None -> + (* Not injecting refutations, don't play refutation games *) + return_unit + | Some self -> + let Node_context.{rollup_address; cctxt; _} = node_ctxt in + (* Current conflicts in L1 *) + let* conflicts = get_conflicts cctxt head_block rollup_address self in + (* Map of opponents the node is playing against to the corresponding + player worker *) + let opponent_players = + Pkh_map.of_seq @@ List.to_seq @@ Player.current_games () + in + (* Conflicts for which we need to start new refutation players. + Some of these might be ongoing. *) + let new_conflicts = untracked_conflicts opponent_players conflicts in + (* L1 ongoing games *) + let* ongoing_games = + get_ongoing_games cctxt head_block rollup_address self + in + (* Map between opponents and their corresponding games *) + let ongoing_game_map = make_game_map self ongoing_games in + (* Launch new players for new conflicts, and play one step *) + let* () = + List.iter_ep + (fun conflict -> + let other = conflict.Sc_rollup.Refutation_storage.other in + Pkh_table.replace state.pending_opponents other () ; + let game = Pkh_map.find_opt other ongoing_game_map in + Player.init_and_play node_ctxt ~self ~conflict ~game ~level) + new_conflicts + in + let*! () = + (* Play one step of the refutation game in every remaining player *) + Pkh_map.iter_p + (fun opponent worker -> + match Pkh_map.find opponent ongoing_game_map with + | Some game -> + Pkh_table.remove state.pending_opponents opponent ; + Player.play worker game ~level + | None -> + (* Kill finished players: those who don't aren't + playing against pending opponents that don't have + ongoing games in the L1 *) + if not @@ Pkh_table.mem state.pending_opponents opponent then + Player.shutdown worker + else Lwt.return_unit) + opponent_players + in + return_unit + + module Types = struct + type nonrec state = state + + type parameters = {node_ctxt : Node_context.rw} + end + + module Name = struct + (* We only have a single coordinator in the node *) + type t = unit + + let encoding = Data_encoding.unit + + let base = + (* But we can have multiple instances in the unit tests. This is just to + avoid conflicts in the events declarations. *) + Refutation_game_event.Coordinator.section + @ [ + ("worker" + ^ if !instances_count = 1 then "" else string_of_int !instances_count + ); + ] + + let pp _ _ = () + + let equal () () = true + end + + module Worker = Worker.MakeSingle (Name) (Request) (Types) + + type worker = Worker.infinite Worker.queue Worker.t + + module Handlers = struct + type self = worker + + let on_request : + type r request_error. + worker -> + (r, request_error) Request.t -> + (r, request_error) result Lwt.t = + fun w request -> + let state = Worker.state w in + match request with Request.Process b -> on_process b state + + type launch_error = error trace + + let on_launch _w () Types.{node_ctxt} = + return {node_ctxt; pending_opponents = Pkh_table.create 5} + + let on_error (type a b) _w st (r : (a, b) Request.t) (errs : b) : + unit tzresult Lwt.t = + let open Lwt_result_syntax in + let request_view = Request.view r in + let emit_and_return_errors errs = + let*! () = + Refutation_game_event.Coordinator.request_failed request_view st errs + in + return_unit + in + match r with Request.Process _ -> emit_and_return_errors errs + + let on_completion _w r _ st = + Refutation_game_event.Coordinator.request_completed (Request.view r) st + + let on_no_request _ = Lwt.return_unit + + let on_close _w = Lwt.return_unit + end + + let table = Worker.create_table Queue + + let worker_promise, worker_waker = Lwt.task () + + let init node_ctxt = + let open Lwt_result_syntax in + let*! () = Refutation_game_event.Coordinator.starting () in + let+ worker = Worker.launch table () {node_ctxt} (module Handlers) in + Lwt.wakeup worker_waker worker + + (* This is a refutation coordinator for a single scoru *) + let worker = + lazy + (match Lwt.state worker_promise with + | Lwt.Return worker -> ok worker + | Lwt.Fail _ | Lwt.Sleep -> + error Sc_rollup_node_errors.No_refutation_coordinator) + + let process b = + let open Lwt_result_syntax in + let*? w = Lazy.force worker in + let*! (_pushed : bool) = Worker.Queue.push_request w (Request.Process b) in + return_unit + + let shutdown () = + let open Lwt_syntax in + let w = Lazy.force worker in + match w with + | Error _ -> + (* There is no refutation coordinator, nothing to do *) + Lwt.return_unit + | Ok w -> + (* Shut down all current refutation players *) + let games = Player.current_games () in + let* () = + List.iter_s (fun (_opponent, player) -> Player.shutdown player) games + in + Worker.shutdown w +end diff --git a/src/proto_alpha/lib_sc_rollup_node/refutation_coordinator.mli b/src/proto_alpha/lib_sc_rollup_node/refutation_coordinator.mli new file mode 100644 index 000000000000..ca17d1eb19ab --- /dev/null +++ b/src/proto_alpha/lib_sc_rollup_node/refutation_coordinator.mli @@ -0,0 +1,53 @@ +(*****************************************************************************) +(* *) +(* Open Source License *) +(* Copyright (c) 2023 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. *) +(* *) +(*****************************************************************************) + +(** Component for managing refutation games. + This module is implemented as a single worker in the rollup node, + which takes care of processing new L1 heads, and coordinating + the refutation game players. (See {!Refutation_player}). +*) + +module type S = sig + module PVM : Pvm.S + + (** Initiatilize the refuation coordinator. *) + val init : Node_context.rw -> unit tzresult Lwt.t + + (** Process a new l1 head. This means that the coordinator will: + {ol + {li Gather all existing conflicts} + {li Launch new refutation players for each conflict that doesn't + have a player in this node} + {li Kill all players whose conflict has disappeared from L1} + {li Make all players play a step in the refutation} + } + *) + val process : Layer1.head -> unit tzresult Lwt.t + + (** Shutdown the refutation coordinator. *) + val shutdown : unit -> unit Lwt.t +end + +module Make (Interpreter : Interpreter.S) : S diff --git a/src/proto_alpha/lib_sc_rollup_node/refutation_coordinator_types.ml b/src/proto_alpha/lib_sc_rollup_node/refutation_coordinator_types.ml index 9718e7b9ae19..314698ed82ff 100644 --- a/src/proto_alpha/lib_sc_rollup_node/refutation_coordinator_types.ml +++ b/src/proto_alpha/lib_sc_rollup_node/refutation_coordinator_types.ml @@ -54,15 +54,3 @@ module Request = struct hash level end - -module Name = struct - type t = unit - - let encoding = Data_encoding.unit - - let base = ["sc_rollup_refutation_coordinator"] - - let pp _ _ = () - - let equal () () = true -end diff --git a/src/proto_alpha/lib_sc_rollup_node/refutation_coordinator_types.mli b/src/proto_alpha/lib_sc_rollup_node/refutation_coordinator_types.mli index 803b39130f2a..f26d46885c77 100644 --- a/src/proto_alpha/lib_sc_rollup_node/refutation_coordinator_types.mli +++ b/src/proto_alpha/lib_sc_rollup_node/refutation_coordinator_types.mli @@ -36,5 +36,3 @@ module Request : sig with type ('a, 'request_error) t := ('a, 'request_error) t and type view := view end - -module Name : Worker_intf.NAME with type t = unit diff --git a/src/proto_alpha/lib_sc_rollup_node/refutation_game.ml b/src/proto_alpha/lib_sc_rollup_node/refutation_game.ml index 9e145022763e..42f30af2fbd4 100644 --- a/src/proto_alpha/lib_sc_rollup_node/refutation_game.ml +++ b/src/proto_alpha/lib_sc_rollup_node/refutation_game.ml @@ -49,7 +49,18 @@ open Alpha_context module type S = sig module PVM : Pvm.S - val process : Layer1.head -> Node_context.rw -> unit tzresult Lwt.t + val play_opening_move : + [< `Read | `Write > `Read] Node_context.t -> + public_key_hash -> + Sc_rollup.Refutation_storage.conflict -> + (unit, tztrace) result Lwt.t + + val play : + Node_context.rw -> + self:public_key_hash -> + Sc_rollup.Game.t -> + public_key_hash -> + (unit, tztrace) result Lwt.t end module Make (Interpreter : Interpreter.S) : @@ -496,14 +507,15 @@ module Make (Interpreter : Interpreter.S) : if is_it_me then return_none else return (Some loser) | _ -> return_none - let play head_block node_ctxt self game staker1 staker2 = + let play node_ctxt ~self game opponent = let open Lwt_result_syntax in - let index = Sc_rollup.Game.Index.make staker1 staker2 in + let index = Sc_rollup.Game.Index.make self opponent in + let head_block = `Head 0 in match turn ~self game index with | Our_turn {opponent} -> play_next_move node_ctxt game self opponent | Their_turn -> ( let* timeout_reached = - timeout_reached ~self head_block node_ctxt staker1 staker2 + timeout_reached ~self head_block node_ctxt self opponent in match timeout_reached with | Some opponent -> @@ -511,14 +523,6 @@ module Make (Interpreter : Interpreter.S) : play_timeout node_ctxt self index | None -> return_unit) - let ongoing_games head_block node_ctxt self = - let Node_context.{rollup_address; cctxt; _} = node_ctxt in - Plugin.RPC.Sc_rollup.ongoing_refutation_games - cctxt - (cctxt#chain, head_block) - rollup_address - self - let play_opening_move node_ctxt self conflict = let open Lwt_syntax in let open Sc_rollup.Refutation_storage in @@ -531,43 +535,4 @@ module Make (Interpreter : Interpreter.S) : in let refutation = Start {player_commitment_hash; opponent_commitment_hash} in inject_next_move node_ctxt self ~refutation ~opponent:conflict.other - - let start_game_if_conflict head_block node_ctxt self = - let open Lwt_result_syntax in - let Node_context.{rollup_address; cctxt; _} = node_ctxt in - let* conflicts = - Plugin.RPC.Sc_rollup.conflicts - cctxt - (cctxt#chain, head_block) - rollup_address - self - in - let*! res = List.iter_es (play_opening_move node_ctxt self) conflicts in - match res with - | Ok r -> return r - | Error - [ - Environment.Ecoproto_error - Sc_rollup_errors.Sc_rollup_game_already_started; - ] -> - (* The game may already be starting in the meantime. So we - ignore this error. *) - return_unit - | Error errs -> Lwt.return (Error errs) - - let process Layer1.{hash; _} node_ctxt = - let head_block = `Hash (hash, 0) in - let open Lwt_result_syntax in - let refute_signer = Node_context.get_operator node_ctxt Refute in - match refute_signer with - | None -> - (* Not injecting refutations, don't play refutation games *) - return_unit - | Some self -> - let* () = start_game_if_conflict head_block node_ctxt self in - let* res = ongoing_games head_block node_ctxt self in - List.iter_es - (fun (game, staker1, staker2) -> - play head_block node_ctxt self game staker1 staker2) - res end diff --git a/src/proto_alpha/lib_sc_rollup_node/refutation_game.mli b/src/proto_alpha/lib_sc_rollup_node/refutation_game.mli index 12f7125221b8..89399c86ae0a 100644 --- a/src/proto_alpha/lib_sc_rollup_node/refutation_game.mli +++ b/src/proto_alpha/lib_sc_rollup_node/refutation_game.mli @@ -23,14 +23,30 @@ (* *) (*****************************************************************************) +open Protocol +open Alpha_context + (** This module implements the refutation game logic of the rollup node. *) module type S = sig module PVM : Pvm.S - (** [process head node_ctxt] reacts to any operations of [head] related to - refutation games. *) - val process : Layer1.head -> Node_context.rw -> unit tzresult Lwt.t + (** [play_opening_move node_ctxt self conflict] injects the opening + refutation game move for [conflict]. *) + val play_opening_move : + [< `Read | `Write > `Read] Node_context.t -> + public_key_hash -> + Sc_rollup.Refutation_storage.conflict -> + (unit, tztrace) result Lwt.t + + (** [play head_block node_ctxt ~self game opponent] injects the next + move in the refutation [game] played by [self] and [opponent]. *) + val play : + Node_context.rw -> + self:public_key_hash -> + Sc_rollup.Game.t -> + public_key_hash -> + (unit, tztrace) result Lwt.t end module Make (Interpreter : Interpreter.S) : S with module PVM = Interpreter.PVM diff --git a/src/proto_alpha/lib_sc_rollup_node/refutation_player.ml b/src/proto_alpha/lib_sc_rollup_node/refutation_player.ml new file mode 100644 index 000000000000..e5c51eecfb46 --- /dev/null +++ b/src/proto_alpha/lib_sc_rollup_node/refutation_player.ml @@ -0,0 +1,204 @@ +(*****************************************************************************) +(* *) +(* Open Source License *) +(* Copyright (c) 2023 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 +open Refutation_player_types + +module Types = struct + type state = { + node_ctxt : Node_context.rw; + self : public_key_hash; + opponent : public_key_hash; + mutable last_move_cache : (Sc_rollup.Game.game_state * int32) option; + } + + type parameters = { + node_ctxt : Node_context.rw; + self : public_key_hash; + conflict : Sc_rollup.Refutation_storage.conflict; + } +end + +module Name = struct + let base = Refutation_game_event.Player.section @ ["worker"] + + include Signature.Public_key_hash +end + +module Worker = Worker.MakeSingle (Name) (Request) (Types) + +type worker = Worker.infinite Worker.queue Worker.t + +let table = Worker.create_table Queue + +module type S = sig + val init_and_play : + Node_context.rw -> + self:public_key_hash -> + conflict:Sc_rollup.Refutation_storage.conflict -> + game:Sc_rollup.Game.t option -> + level:int32 -> + unit tzresult Lwt.t + + val play : worker -> Sc_rollup.Game.t -> level:int32 -> unit Lwt.t + + val shutdown : worker -> unit Lwt.t + + val current_games : unit -> (public_key_hash * worker) list +end + +module Make (Interpreter : Interpreter.S) : S = struct + open Refutation_game.Make (Interpreter) + + let on_play game Types.{node_ctxt; self; opponent; _} = + play node_ctxt ~self game opponent + + let on_play_opening conflict (Types.{node_ctxt; self; _} : Types.state) = + play_opening_move node_ctxt self conflict + + module Handlers = struct + type self = worker + + let on_request : + type r request_error. + worker -> + (r, request_error) Request.t -> + (r, request_error) result Lwt.t = + fun w request -> + let state = Worker.state w in + match request with + | Request.Play game -> on_play game state + | Request.Play_opening conflict -> on_play_opening conflict state + + type launch_error = error trace + + let on_launch _w _name Types.{node_ctxt; self; conflict} = + return + Types. + {node_ctxt; self; opponent = conflict.other; last_move_cache = None} + + let on_error (type a b) _w st (r : (a, b) Request.t) (errs : b) : + unit tzresult Lwt.t = + let open Lwt_result_syntax in + let request_view = Request.view r in + let emit_and_return_errors errs = + let*! () = + Refutation_game_event.Player.request_failed request_view st errs + in + return_unit + in + match r with + | Request.Play _ -> emit_and_return_errors errs + | Request.Play_opening _ -> emit_and_return_errors errs + + let on_completion _w r _ st = + Refutation_game_event.Player.request_completed (Request.view r) st + + let on_no_request _ = Lwt.return_unit + + let on_close w = + let open Lwt_syntax in + let state = Worker.state w in + let* () = Refutation_game_event.Player.stopped state.opponent in + return_unit + end + + let init node_ctxt ~self ~conflict = + let open Lwt_result_syntax in + let*! () = + Refutation_game_event.Player.started + conflict.Sc_rollup.Refutation_storage.other + conflict.Sc_rollup.Refutation_storage.our_commitment + in + let worker_promise, worker_waker = Lwt.task () in + let* worker = + trace Sc_rollup_node_errors.Refutation_player_failed_to_start + @@ Worker.launch + table + conflict.other + {node_ctxt; self; conflict} + (module Handlers) + in + let () = Lwt.wakeup worker_waker worker in + let worker = + match Lwt.state worker_promise with + | Lwt.Return worker -> ok worker + | Lwt.Fail _ | Lwt.Sleep -> + error Sc_rollup_node_errors.Refutation_player_failed_to_start + in + Lwt.return worker + + (* Play if: + - There's a new game state to play against or + - The current level is past the buffer for re-playing in the + same game state. + *) + let should_move ~level game last_move_cache = + match last_move_cache with + | None -> true + | Some (last_move_game_state, last_move_level) -> + (not + (Sc_rollup.Game.game_state_equal + game.Sc_rollup.Game.game_state + last_move_game_state)) + || Int32.( + sub level last_move_level + > of_int Configuration.refutation_player_buffer_levels) + + let play w game ~(level : int32) = + let open Lwt_syntax in + let state = Worker.state w in + if should_move ~level game state.last_move_cache then ( + let* pushed = Worker.Queue.push_request w (Request.Play game) in + if pushed then + state.last_move_cache <- Some (game.Sc_rollup.Game.game_state, level) ; + return_unit) + else return_unit + + let play_opening w conflict = + let open Lwt_syntax in + let* (_pushed : bool) = + Worker.Queue.push_request w (Request.Play_opening conflict) + in + return_unit + + let init_and_play node_ctxt ~self ~conflict ~game ~level = + let open Lwt_result_syntax in + let* worker = init node_ctxt ~self ~conflict in + let*! () = + match game with + | None -> play_opening worker conflict + | Some game -> play worker game ~level + in + return_unit + + let current_games () = + List.map + (fun (_name, worker) -> ((Worker.state worker).opponent, worker)) + (Worker.list table) + + let shutdown = Worker.shutdown +end diff --git a/src/proto_alpha/lib_sc_rollup_node/refutation_player.mli b/src/proto_alpha/lib_sc_rollup_node/refutation_player.mli new file mode 100644 index 000000000000..1c6bbed96676 --- /dev/null +++ b/src/proto_alpha/lib_sc_rollup_node/refutation_player.mli @@ -0,0 +1,68 @@ +(*****************************************************************************) +(* *) +(* Open Source License *) +(* Copyright (c) 2023 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 + +(** Worker module for a signle refutation game player. + The node's refutation coordinator will spawn a new refutation player + for each refutation game. +*) +module Worker : Worker.T + +(** Type for a refutation game player. *) +type worker = Worker.infinite Worker.queue Worker.t + +module type S = sig + (** [init_and_play node_ctxt ~self ~conflict ~game ~level] + initializes a new refutation game player for signer [self]. + After initizialization, the worker will play the next move + depending on the [game] state. + If no [game] is passed, the worker will play the opening + move for [conflict]. + *) + val init_and_play : + Node_context.rw -> + self:public_key_hash -> + conflict:Sc_rollup.Refutation_storage.conflict -> + game:Sc_rollup.Game.t option -> + level:int32 -> + unit tzresult Lwt.t + + (** [play worker game ~level] makes the [worker] play the next move depending + on the [game] state for their conflict. + *) + val play : worker -> Sc_rollup.Game.t -> level:int32 -> unit Lwt.t + + (** Shutdown a refutaiton game player. *) + val shutdown : worker -> unit Lwt.t + + (** [current_games ()] lists the opponents' this node is playing + refutation games against, alongside the worker that takes care + of each game. *) + val current_games : unit -> (public_key_hash * worker) list +end + +module Make (Interpreter : Interpreter.S) : S -- GitLab From 00b557edf9887c89951395bc8838304516c12fbc Mon Sep 17 00:00:00 2001 From: Antonio Locascio Date: Thu, 30 Mar 2023 09:38:32 +0200 Subject: [PATCH 6/8] Tezt/SCORU: make tests more robust to concurrent node --- tezt/lib_tezos/sc_rollup_node.ml | 8 +- tezt/lib_tezos/sc_rollup_node.mli | 7 +- ... tx kernel should run e2e (kernel_e2e).out | 2 +- tezt/tests/sc_rollup.ml | 147 ++++++++++-------- tezt/tests/tx_sc_rollup.ml | 4 +- 5 files changed, 98 insertions(+), 70 deletions(-) diff --git a/tezt/lib_tezos/sc_rollup_node.ml b/tezt/lib_tezos/sc_rollup_node.ml index 357533e5c64a..d2f6f7b095b6 100644 --- a/tezt/lib_tezos/sc_rollup_node.ml +++ b/tezt/lib_tezos/sc_rollup_node.ml @@ -242,6 +242,10 @@ let wait_for_level ?timeout sc_node level = ~where:("level >= " ^ string_of_int level) promise +let wait_sync sc_node ~timeout = + let node_level = Node.get_level sc_node.persistent_state.node in + wait_for_level ~timeout sc_node node_level + let handle_event sc_node {name; value; timestamp = _} = match name with | "smart_rollup_node_is_ready.v0" -> set_ready sc_node @@ -336,7 +340,7 @@ let run ?event_level ?event_sections_levels ?loser_mode node rollup_address let* () = wait_for_ready node in return () -let change_node_and_restart sc_rollup_node rollup_address node = +let change_node_and_restart ?event_level sc_rollup_node rollup_address node = let* () = terminate sc_rollup_node in sc_rollup_node.persistent_state.node <- node ; - run sc_rollup_node rollup_address [] + run ?event_level sc_rollup_node rollup_address [] diff --git a/tezt/lib_tezos/sc_rollup_node.mli b/tezt/lib_tezos/sc_rollup_node.mli index 9defa9fdd3c4..e64a87c0c771 100644 --- a/tezt/lib_tezos/sc_rollup_node.mli +++ b/tezt/lib_tezos/sc_rollup_node.mli @@ -172,6 +172,10 @@ val wait_for_ready : t -> unit Lwt.t passed. *) val wait_for_level : ?timeout:float -> t -> int -> int Lwt.t +(** Wait until the layer 1 of the sc node is synchronized with its + underlying l1 node. *) +val wait_sync : t -> timeout:float -> int Lwt.t + (** [wait_for ?where sc_node event_name filter] waits for the SCORU node [sc_node] to emit an event named [name] (usually this is the name the event is declared with, concatenated with [".v0"]). [wait_for] continues to wait @@ -183,4 +187,5 @@ val wait_for : ?where:string -> t -> string -> (JSON.t -> 'a option) -> 'a Lwt.t (** Stops the rollup node and restart it, connected to another Tezos Layer 1 node. *) -val change_node_and_restart : t -> string -> Node.t -> unit Lwt.t +val change_node_and_restart : + ?event_level:Daemon.Level.default_level -> t -> string -> Node.t -> unit Lwt.t diff --git a/tezt/tests/expected/tx_sc_rollup.ml/Alpha- wasm_2_0_0 - tx kernel should run e2e (kernel_e2e).out b/tezt/tests/expected/tx_sc_rollup.ml/Alpha- wasm_2_0_0 - tx kernel should run e2e (kernel_e2e).out index 56aaeaac96e4..c63b7d22b6d5 100644 --- a/tezt/tests/expected/tx_sc_rollup.ml/Alpha- wasm_2_0_0 - tx kernel should run e2e (kernel_e2e).out +++ b/tezt/tests/expected/tx_sc_rollup.ml/Alpha- wasm_2_0_0 - tx kernel should run e2e (kernel_e2e).out @@ -142,7 +142,7 @@ This sequence of operations was run: Manager signed operations: From: [PUBLIC_KEY_HASH] Fee to the baker: ꜩ0.00229 - Expected counter: 14 + Expected counter: 15 Gas limit: 9512 Storage limit: 250 bytes Balance updates: diff --git a/tezt/tests/sc_rollup.ml b/tezt/tests/sc_rollup.ml index 4ed59fd47760..3bb8fd22d6a4 100644 --- a/tezt/tests/sc_rollup.ml +++ b/tezt/tests/sc_rollup.ml @@ -895,10 +895,49 @@ let bake_levels ?hook n client = let* () = match hook with None -> unit | Some hook -> hook i in Client.bake_for_and_wait client +(** Bake [at_least] levels. + Then continues baking until the rollup node updates the lpc, + waiting for the rollup node to catch up to the client's level. + Returns the level at which the lpc was updated. *) +let bake_until_lpc_updated ?hook ?(at_least = 0) ~timeout client sc_rollup_node + = + let event_level = ref None in + let _ = + let* lvl = + Sc_rollup_node.wait_for sc_rollup_node "sc_rollup_node_lpc_updated.v0" + @@ fun json -> JSON.(json |-> "level" |> as_int_opt) + in + event_level := Some lvl ; + unit + in + let rec bake_loop i = + let* () = match hook with None -> unit | Some hook -> hook i in + let* () = Client.bake_for_and_wait client in + match !event_level with + | Some level -> return level + | None -> bake_loop (i + 1) + in + let* () = bake_levels ?hook at_least client in + let* updated_level = + Lwt.catch + (fun () -> Lwt.pick [Lwt_unix.timeout timeout; bake_loop 0]) + (function + | Lwt_unix.Timeout -> + Test.fail + "Timeout of %f seconds reached when waiting for LPC to be updated" + timeout + | e -> raise e) + in + (* Let the sc rollup node catch up *) + let* _ = Sc_rollup_node.wait_sync sc_rollup_node ~timeout:3. in + return updated_level + (* Rollup node batcher *) let sc_rollup_node_batcher sc_rollup_node sc_rollup_client sc_rollup node client = - let* () = Sc_rollup_node.run sc_rollup_node sc_rollup [] in + let* () = + Sc_rollup_node.run ~event_level:`Debug sc_rollup_node sc_rollup [] + in Log.info "Sending one message to the batcher" ; let msg1 = "3 3 + out" in let*! hashes = Sc_rollup_client.inject sc_rollup_client [msg1] in @@ -1000,15 +1039,11 @@ let sc_rollup_node_batcher sc_rollup_node sc_rollup_client sc_rollup node client in let levels = levels_to_commitment + init_level - Node.get_level node - + block_finality_time + 1 + + block_finality_time in Log.info "Baking %d blocks for commitment of first message" levels ; - let* () = bake_levels levels client in let* _ = - Sc_rollup_node.wait_for_level - ~timeout:3. - sc_rollup_node - (Node.get_level node) + bake_until_lpc_updated ~at_least:levels ~timeout:5. client sc_rollup_node in let*! _msg1, status_msg1 = Sc_rollup_client.get_batcher_msg sc_rollup_client msg1_hash @@ -1325,6 +1360,11 @@ let test_commitment_scenario ?commitment_period ?challenge_window description = "rollup node - correct handling of commitments"; } +let bake_levels ?hook n client = + fold n () @@ fun i () -> + let* () = match hook with None -> unit | Some hook -> hook i in + Client.bake_for_and_wait client + let commitment_stored _protocol sc_rollup_node sc_rollup_client sc_rollup _node client = (* The rollup is originated at level `init_level`, and it requires @@ -1346,10 +1386,9 @@ let commitment_stored _protocol sc_rollup_node sc_rollup_client sc_rollup _node let* levels_to_commitment = get_sc_rollup_commitment_period_in_blocks client in - let store_commitment_level = - init_level + levels_to_commitment + block_finality_time + let* () = + Sc_rollup_node.run ~event_level:`Debug sc_rollup_node sc_rollup [] in - let* () = Sc_rollup_node.run sc_rollup_node sc_rollup [] in let* level = Sc_rollup_node.wait_for_level ~timeout:3. sc_rollup_node init_level in @@ -1373,12 +1412,6 @@ let commitment_stored _protocol sc_rollup_node sc_rollup_client sc_rollup _node [init_level + sc_rollup_commitment_period_in_blocks] is processed by the rollup node as finalized. *) let* () = bake_levels block_finality_time client in - let* _ = - Sc_rollup_node.wait_for_level - ~timeout:3. - sc_rollup_node - store_commitment_level - in let* { commitment = {inbox_level = stored_inbox_level; _} as stored_commitment; hash = _; @@ -1389,8 +1422,7 @@ let commitment_stored _protocol sc_rollup_node sc_rollup_client sc_rollup _node Check.int ~error_msg: "Commitment has been stored at a level different than expected (%L = %R)" ; - (* Bake one level for commitment to be included *) - let* () = Client.bake_for_and_wait client in + let* _level = bake_until_lpc_updated ~timeout:5. client sc_rollup_node in let*! published_commitment = Sc_rollup_client.last_published_commitment ~hooks sc_rollup_client in @@ -1534,7 +1566,7 @@ let commitment_not_published_if_non_final _protocol sc_rollup_node unit let commitments_messages_reset kind _protocol sc_rollup_node sc_rollup_client - sc_rollup node client = + sc_rollup _node client = (* For `sc_rollup_commitment_period_in_blocks` levels after the sc rollup origination, i messages are sent to the rollup, for a total of `sc_rollup_commitment_period_in_blocks * @@ -1556,7 +1588,9 @@ let commitments_messages_reset kind _protocol sc_rollup_node sc_rollup_client let* levels_to_commitment = get_sc_rollup_commitment_period_in_blocks client in - let* () = Sc_rollup_node.run sc_rollup_node sc_rollup [] in + let* () = + Sc_rollup_node.run ~event_level:`Debug sc_rollup_node sc_rollup [] + in let* level = Sc_rollup_node.wait_for_level ~timeout:3. sc_rollup_node init_level in @@ -1578,12 +1612,6 @@ let commitments_messages_reset kind _protocol sc_rollup_node sc_rollup_client rollup node. *) let* () = bake_levels (levels_to_commitment + block_finality_time) client in - let* _ = - Sc_rollup_node.wait_for_level - ~timeout:3. - sc_rollup_node - (init_level + (2 * levels_to_commitment) + block_finality_time) - in let* { commitment = { @@ -1616,8 +1644,7 @@ let commitments_messages_reset kind _protocol sc_rollup_node sc_rollup_client ~error_msg: "Number of ticks processed by commitment is different from the number \ of ticks expected (%L = %R)") ; - let* () = Client.bake_for_and_wait client in - let* _ = Sc_rollup_node.wait_for_level sc_rollup_node (Node.get_level node) in + let* _level = bake_until_lpc_updated ~timeout:5. client sc_rollup_node in let*! published_commitment = Sc_rollup_client.last_published_commitment ~hooks sc_rollup_client in @@ -1746,7 +1773,9 @@ let commitments_reorgs ~switch_l1_node ~kind _protocol sc_rollup_node and* () = Client.Admin.trust_address client' ~peer:node in let* () = Client.Admin.connect_address client ~peer:node' in - let* () = Sc_rollup_node.run sc_rollup_node sc_rollup [] in + let* () = + Sc_rollup_node.run sc_rollup_node ~event_level:`Debug sc_rollup [] + in (* We bake `sc_rollup_commitment_period_in_blocks - 1` levels, which should cause both nodes to observe level `sc_rollup_commitment_period_in_blocks + init_level - 1 . *) @@ -1795,18 +1824,22 @@ let commitments_reorgs ~switch_l1_node ~kind _protocol sc_rollup_node in let* () = divergence () in - let* client, node = + let* client = if switch_l1_node then ( (* Switch the L1 node of a rollup node so that reverted blocks are not *) (* available in the new L1 node. *) Log.info "Changing L1 node for rollup node" ; let* () = - Sc_rollup_node.change_node_and_restart sc_rollup_node sc_rollup node' + Sc_rollup_node.change_node_and_restart + ~event_level:`Debug + sc_rollup_node + sc_rollup + node' in - return (client', node')) + return client') else let* () = trigger_reorg () in - return (client, node) + return client in (* After triggering a reorganisation the node should see that there is a more attractive head at level `init_level + @@ -1862,8 +1895,7 @@ let commitments_reorgs ~switch_l1_node ~kind _protocol sc_rollup_node ~error_msg: "Number of ticks processed by commitment is different from the number \ of ticks expected (%L = %R)") ; - let* () = Client.bake_for_and_wait client in - let* _ = Sc_rollup_node.wait_for_level sc_rollup_node (Node.get_level node) in + let* _ = bake_until_lpc_updated ~timeout:5.0 client sc_rollup_node in let*! published_commitment = Sc_rollup_client.last_published_commitment ~hooks sc_rollup_client in @@ -1942,7 +1974,9 @@ let commitment_before_lcc_not_published protocol sc_rollup_node sc_rollup_client in let init_level = JSON.(genesis_info |-> "level" |> as_int) in - let* () = Sc_rollup_node.run sc_rollup_node sc_rollup [] in + let* () = + Sc_rollup_node.run ~event_level:`Debug sc_rollup_node sc_rollup [] + in let* level = Sc_rollup_node.wait_for_level ~timeout:3. sc_rollup_node init_level in @@ -1956,16 +1990,7 @@ let commitment_before_lcc_not_published protocol sc_rollup_node sc_rollup_client sc_rollup_node (init_level + commitment_period) in - (* Bake `block_finality_time` additional level to ensure that block number - `init_level + sc_rollup_commitment_period_in_blocks` is processed by - the rollup node as finalized and one additional for commitment inclusion. *) - let* () = bake_levels (block_finality_time + 1) client in - let* _ = - Sc_rollup_node.wait_for_level - ~timeout:3. - sc_rollup_node - (Node.get_level node) - in + let* _level = bake_until_lpc_updated ~timeout:5. client sc_rollup_node in let* {commitment = _; hash = rollup_node1_stored_hash} = get_last_stored_commitment ~__LOC__ ~hooks sc_rollup_client in @@ -2122,7 +2147,9 @@ let first_published_level_is_global protocol sc_rollup_node sc_rollup_client in let init_level = JSON.(genesis_info |-> "level" |> as_int) in let* commitment_period = get_sc_rollup_commitment_period_in_blocks client in - let* () = Sc_rollup_node.run sc_rollup_node sc_rollup [] in + let* () = + Sc_rollup_node.run ~event_level:`Debug sc_rollup_node sc_rollup [] + in let* level = Sc_rollup_node.wait_for_level ~timeout:3. sc_rollup_node init_level in @@ -2136,15 +2163,8 @@ let first_published_level_is_global protocol sc_rollup_node sc_rollup_client sc_rollup_node (init_level + commitment_period) in - (* Bake `block_finality_time` additional level to ensure that block number - `init_level + sc_rollup_commitment_period_in_blocks` is processed by - the rollup node as finalized. *) - let* () = bake_levels (block_finality_time + 1) client in - let* _commitment_finalized_level = - Sc_rollup_node.wait_for_level - ~timeout:3. - sc_rollup_node - (Node.get_level node) + let* commitment_publish_level = + bake_until_lpc_updated ~timeout:5. client sc_rollup_node in let* rollup_node1_published_commitment = get_last_published_commitment ~__LOC__ ~hooks sc_rollup_client @@ -2155,7 +2175,6 @@ let first_published_level_is_global protocol sc_rollup_node sc_rollup_client Check.int ~error_msg: "Commitment has been published for a level %L different than expected %R" ; - let commitment_publish_level = Node.get_level node in Check.( commitment_info_first_published_at_level rollup_node1_published_commitment = Some commitment_publish_level) @@ -2176,7 +2195,9 @@ let first_published_level_is_global protocol sc_rollup_node sc_rollup_client ~default_operator:bootstrap2_key in let sc_rollup_client' = Sc_rollup_client.create ~protocol sc_rollup_node' in - let* () = Sc_rollup_node.run sc_rollup_node' sc_rollup [] in + let* () = + Sc_rollup_node.run ~event_level:`Debug sc_rollup_node' sc_rollup [] + in let* _ = Sc_rollup_node.wait_for_level @@ -2194,11 +2215,7 @@ let first_published_level_is_global protocol sc_rollup_node sc_rollup_client = None) (Check.option Check.int) ~error_msg:"Rollup node 2 cannot publish commitment without any new block." ; - let* () = Client.bake_for_and_wait client in - let commitment_publish_level2 = Node.get_level node in - let* _ = - Sc_rollup_node.wait_for_level sc_rollup_node' commitment_publish_level2 - in + let* _level = bake_until_lpc_updated ~timeout:5. client sc_rollup_node' in let* rollup_node2_published_commitment = get_last_published_commitment ~__LOC__ ~hooks sc_rollup_client' in @@ -3840,9 +3857,9 @@ let test_outbox_message_generic ?supports ?regression ?expected_error client in let blocks_to_wait = - 2 + (2 * commitment_period) + challenge_window - earliness + 3 + (2 * commitment_period) + challenge_window - earliness in - repeat blocks_to_wait @@ fun () -> Client.bake_for client + repeat blocks_to_wait @@ fun () -> Client.bake_for_and_wait client in let trigger_outbox_message_execution ?expected_l1_error address = let outbox_level = 5 in diff --git a/tezt/tests/tx_sc_rollup.ml b/tezt/tests/tx_sc_rollup.ml index eb00f4ecbfd8..8c1cb7067b8d 100644 --- a/tezt/tests/tx_sc_rollup.ml +++ b/tezt/tests/tx_sc_rollup.ml @@ -456,7 +456,9 @@ let test_tx_kernel_e2e protocol = let* () = assert_ticks_advanced sc_rollup_client prev_ticks in (* EXECUTE withdrawal *) - let blocks_to_wait = 1 + (2 * commitment_period) + challenge_window in + (* We bake a few more blocks in case the injection of the cementation + operation is late *) + let blocks_to_wait = 3 + (2 * commitment_period) + challenge_window in let* () = repeat blocks_to_wait @@ fun () -> Client.bake_for_and_wait client in -- GitLab From c51749567ed4b091cb980d93a1125f49c82c8a1c Mon Sep 17 00:00:00 2001 From: Alain Mebsout Date: Fri, 31 Mar 2023 12:15:31 +0200 Subject: [PATCH 7/8] Tezt: regenerate regression traces for refutation tests --- ...mes winning strategies (inbox_proof_0).out | 323 ++++++----------- ...mes winning strategies (inbox_proof_1).out | 325 ++++++----------- ...games winning strategies (pvm_proof_0).out | 326 ++++++------------ ...games winning strategies (pvm_proof_1).out | 326 ++++++------------ ...games winning strategies (pvm_proof_2).out | 326 ++++++------------ ...games winning strategies (pvm_proof_3).out | 326 ++++++------------ ...mes winning strategies (inbox_proof_0).out | 323 ++++++----------- ...mes winning strategies (inbox_proof_1).out | 325 ++++++----------- ...games winning strategies (pvm_proof_0).out | 326 ++++++------------ ...games winning strategies (pvm_proof_1).out | 326 ++++++------------ ...games winning strategies (pvm_proof_2).out | 326 ++++++------------ ...games winning strategies (pvm_proof_3).out | 326 ++++++------------ 12 files changed, 1262 insertions(+), 2642 deletions(-) diff --git a/tezt/tests/expected/sc_rollup.ml/Alpha- wasm_2_0_0 - refutation games winning strategies (inbox_proof_0).out b/tezt/tests/expected/sc_rollup.ml/Alpha- wasm_2_0_0 - refutation games winning strategies (inbox_proof_0).out index 5994a7d55da0..5cf83e4cfa9a 100644 --- a/tezt/tests/expected/sc_rollup.ml/Alpha- wasm_2_0_0 - refutation games winning strategies (inbox_proof_0).out +++ b/tezt/tests/expected/sc_rollup.ml/Alpha- wasm_2_0_0 - refutation games winning strategies (inbox_proof_0).out @@ -3,106 +3,16 @@ { "opponent": "tz1gjaF81ZRRvdzjobyfVNsAeSC6PScjfQwN", "start_tick": "0", - "end_tick": "990000000000", + "end_tick": "22000000000", "dissection": [ { "tick": "0" }, { - "tick": "22000000000" - }, - { - "tick": "44000000000" - }, - { - "tick": "66000000000" - }, - { - "tick": "88000000000" - }, - { - "tick": "110000000000" - }, - { - "tick": "132000000000" - }, - { - "tick": "165000000000" - }, - { - "tick": "198000000000" - }, - { - "tick": "231000000000" - }, - { - "tick": "264000000000" - }, - { - "tick": "297000000000" - }, - { - "tick": "330000000000" - }, - { - "tick": "363000000000" - }, - { - "tick": "396000000000" - }, - { - "tick": "429000000000" - }, - { - "tick": "462000000000" - }, - { - "tick": "495000000000" - }, - { - "tick": "528000000000" - }, - { - "tick": "561000000000" - }, - { - "tick": "594000000000" - }, - { - "tick": "627000000000" - }, - { - "tick": "660000000000" - }, - { - "tick": "693000000000" - }, - { - "tick": "726000000000" - }, - { - "tick": "759000000000" - }, - { - "tick": "792000000000" - }, - { - "tick": "825000000000" - }, - { - "tick": "858000000000" - }, - { - "tick": "891000000000" - }, - { - "tick": "924000000000" - }, - { - "tick": "957000000000" + "tick": "11000000000" }, { - "tick": "990000000000" + "tick": "22000000000" } ] } @@ -111,106 +21,106 @@ { "opponent": "tz1gjaF81ZRRvdzjobyfVNsAeSC6PScjfQwN", "start_tick": "0", - "end_tick": "11000000000", + "end_tick": "343750000", "dissection": [ { "tick": "0" }, { - "tick": "343750000" + "tick": "10742187" }, { - "tick": "687500000" + "tick": "21484374" }, { - "tick": "1031250000" + "tick": "32226561" }, { - "tick": "1375000000" + "tick": "42968748" }, { - "tick": "1718750000" + "tick": "53710935" }, { - "tick": "2062500000" + "tick": "64453122" }, { - "tick": "2406250000" + "tick": "75195309" }, { - "tick": "2750000000" + "tick": "85937496" }, { - "tick": "3093750000" + "tick": "96679683" }, { - "tick": "3437500000" + "tick": "107421870" }, { - "tick": "3781250000" + "tick": "118164057" }, { - "tick": "4125000000" + "tick": "128906244" }, { - "tick": "4468750000" + "tick": "139648431" }, { - "tick": "4812500000" + "tick": "150390618" }, { - "tick": "5156250000" + "tick": "161132805" }, { - "tick": "5500000000" + "tick": "171874992" }, { - "tick": "5843750000" + "tick": "182617179" }, { - "tick": "6187500000" + "tick": "193359366" }, { - "tick": "6531250000" + "tick": "204101553" }, { - "tick": "6875000000" + "tick": "214843740" }, { - "tick": "7218750000" + "tick": "225585927" }, { - "tick": "7562500000" + "tick": "236328114" }, { - "tick": "7906250000" + "tick": "247070301" }, { - "tick": "8250000000" + "tick": "257812488" }, { - "tick": "8593750000" + "tick": "268554675" }, { - "tick": "8937500000" + "tick": "279296862" }, { - "tick": "9281250000" + "tick": "290039049" }, { - "tick": "9625000000" + "tick": "300781236" }, { - "tick": "9968750000" + "tick": "311523423" }, { - "tick": "10312500000" + "tick": "322265610" }, { - "tick": "10656250000" + "tick": "333007797" }, { - "tick": "11000000000" + "tick": "343750000" } ] } @@ -219,106 +129,106 @@ { "opponent": "tz1gjaF81ZRRvdzjobyfVNsAeSC6PScjfQwN", "start_tick": "0", - "end_tick": "10742187", + "end_tick": "335693", "dissection": [ { "tick": "0" }, { - "tick": "335693" + "tick": "10490" }, { - "tick": "671386" + "tick": "20980" }, { - "tick": "1007079" + "tick": "31470" }, { - "tick": "1342772" + "tick": "41960" }, { - "tick": "1678465" + "tick": "52450" }, { - "tick": "2014158" + "tick": "62940" }, { - "tick": "2349851" + "tick": "73430" }, { - "tick": "2685544" + "tick": "83920" }, { - "tick": "3021237" + "tick": "94410" }, { - "tick": "3356930" + "tick": "104900" }, { - "tick": "3692623" + "tick": "115390" }, { - "tick": "4028316" + "tick": "125880" }, { - "tick": "4364009" + "tick": "136370" }, { - "tick": "4699702" + "tick": "146860" }, { - "tick": "5035395" + "tick": "157350" }, { - "tick": "5371088" + "tick": "167840" }, { - "tick": "5706781" + "tick": "178330" }, { - "tick": "6042474" + "tick": "188820" }, { - "tick": "6378167" + "tick": "199310" }, { - "tick": "6713860" + "tick": "209800" }, { - "tick": "7049553" + "tick": "220290" }, { - "tick": "7385246" + "tick": "230780" }, { - "tick": "7720939" + "tick": "241270" }, { - "tick": "8056632" + "tick": "251760" }, { - "tick": "8392325" + "tick": "262250" }, { - "tick": "8728018" + "tick": "272740" }, { - "tick": "9063711" + "tick": "283230" }, { - "tick": "9399404" + "tick": "293720" }, { - "tick": "9735097" + "tick": "304210" }, { - "tick": "10070790" + "tick": "314700" }, { - "tick": "10406483" + "tick": "325190" }, { - "tick": "10742187" + "tick": "335693" } ] } @@ -327,106 +237,106 @@ { "opponent": "tz1gjaF81ZRRvdzjobyfVNsAeSC6PScjfQwN", "start_tick": "0", - "end_tick": "10490", + "end_tick": "327", "dissection": [ { "tick": "0" }, { - "tick": "327" + "tick": "10" }, { - "tick": "654" + "tick": "20" }, { - "tick": "981" + "tick": "30" }, { - "tick": "1308" + "tick": "40" }, { - "tick": "1635" + "tick": "50" }, { - "tick": "1962" + "tick": "60" }, { - "tick": "2289" + "tick": "70" }, { - "tick": "2616" + "tick": "80" }, { - "tick": "2943" + "tick": "90" }, { - "tick": "3270" + "tick": "100" }, { - "tick": "3597" + "tick": "110" }, { - "tick": "3924" + "tick": "120" }, { - "tick": "4251" + "tick": "130" }, { - "tick": "4578" + "tick": "140" }, { - "tick": "4905" + "tick": "150" }, { - "tick": "5232" + "tick": "160" }, { - "tick": "5559" + "tick": "170" }, { - "tick": "5886" + "tick": "180" }, { - "tick": "6213" + "tick": "190" }, { - "tick": "6540" + "tick": "200" }, { - "tick": "6867" + "tick": "210" }, { - "tick": "7194" + "tick": "220" }, { - "tick": "7521" + "tick": "230" }, { - "tick": "7848" + "tick": "240" }, { - "tick": "8175" + "tick": "250" }, { - "tick": "8502" + "tick": "260" }, { - "tick": "8829" + "tick": "270" }, { - "tick": "9156" + "tick": "280" }, { - "tick": "9483" + "tick": "290" }, { - "tick": "9810" + "tick": "300" }, { - "tick": "10137" + "tick": "310" }, { - "tick": "10490" + "tick": "327" } ] } @@ -435,40 +345,13 @@ { "opponent": "tz1gjaF81ZRRvdzjobyfVNsAeSC6PScjfQwN", "start_tick": "0", - "end_tick": "10", + "end_tick": "1", "dissection": [ { "tick": "0" }, { "tick": "1" - }, - { - "tick": "2" - }, - { - "tick": "3" - }, - { - "tick": "4" - }, - { - "tick": "5" - }, - { - "tick": "6" - }, - { - "tick": "7" - }, - { - "tick": "8" - }, - { - "tick": "9" - }, - { - "tick": "10" } ] } diff --git a/tezt/tests/expected/sc_rollup.ml/Alpha- wasm_2_0_0 - refutation games winning strategies (inbox_proof_1).out b/tezt/tests/expected/sc_rollup.ml/Alpha- wasm_2_0_0 - refutation games winning strategies (inbox_proof_1).out index 5994a7d55da0..c62802d88db7 100644 --- a/tezt/tests/expected/sc_rollup.ml/Alpha- wasm_2_0_0 - refutation games winning strategies (inbox_proof_1).out +++ b/tezt/tests/expected/sc_rollup.ml/Alpha- wasm_2_0_0 - refutation games winning strategies (inbox_proof_1).out @@ -3,106 +3,16 @@ { "opponent": "tz1gjaF81ZRRvdzjobyfVNsAeSC6PScjfQwN", "start_tick": "0", - "end_tick": "990000000000", + "end_tick": "22000000000", "dissection": [ { "tick": "0" }, { - "tick": "22000000000" - }, - { - "tick": "44000000000" - }, - { - "tick": "66000000000" - }, - { - "tick": "88000000000" - }, - { - "tick": "110000000000" - }, - { - "tick": "132000000000" - }, - { - "tick": "165000000000" - }, - { - "tick": "198000000000" - }, - { - "tick": "231000000000" - }, - { - "tick": "264000000000" - }, - { - "tick": "297000000000" - }, - { - "tick": "330000000000" - }, - { - "tick": "363000000000" - }, - { - "tick": "396000000000" - }, - { - "tick": "429000000000" - }, - { - "tick": "462000000000" - }, - { - "tick": "495000000000" - }, - { - "tick": "528000000000" - }, - { - "tick": "561000000000" - }, - { - "tick": "594000000000" - }, - { - "tick": "627000000000" - }, - { - "tick": "660000000000" - }, - { - "tick": "693000000000" - }, - { - "tick": "726000000000" - }, - { - "tick": "759000000000" - }, - { - "tick": "792000000000" - }, - { - "tick": "825000000000" - }, - { - "tick": "858000000000" - }, - { - "tick": "891000000000" - }, - { - "tick": "924000000000" - }, - { - "tick": "957000000000" + "tick": "11000000000" }, { - "tick": "990000000000" + "tick": "22000000000" } ] } @@ -111,106 +21,106 @@ { "opponent": "tz1gjaF81ZRRvdzjobyfVNsAeSC6PScjfQwN", "start_tick": "0", - "end_tick": "11000000000", + "end_tick": "343750000", "dissection": [ { "tick": "0" }, { - "tick": "343750000" + "tick": "10742187" }, { - "tick": "687500000" + "tick": "21484374" }, { - "tick": "1031250000" + "tick": "32226561" }, { - "tick": "1375000000" + "tick": "42968748" }, { - "tick": "1718750000" + "tick": "53710935" }, { - "tick": "2062500000" + "tick": "64453122" }, { - "tick": "2406250000" + "tick": "75195309" }, { - "tick": "2750000000" + "tick": "85937496" }, { - "tick": "3093750000" + "tick": "96679683" }, { - "tick": "3437500000" + "tick": "107421870" }, { - "tick": "3781250000" + "tick": "118164057" }, { - "tick": "4125000000" + "tick": "128906244" }, { - "tick": "4468750000" + "tick": "139648431" }, { - "tick": "4812500000" + "tick": "150390618" }, { - "tick": "5156250000" + "tick": "161132805" }, { - "tick": "5500000000" + "tick": "171874992" }, { - "tick": "5843750000" + "tick": "182617179" }, { - "tick": "6187500000" + "tick": "193359366" }, { - "tick": "6531250000" + "tick": "204101553" }, { - "tick": "6875000000" + "tick": "214843740" }, { - "tick": "7218750000" + "tick": "225585927" }, { - "tick": "7562500000" + "tick": "236328114" }, { - "tick": "7906250000" + "tick": "247070301" }, { - "tick": "8250000000" + "tick": "257812488" }, { - "tick": "8593750000" + "tick": "268554675" }, { - "tick": "8937500000" + "tick": "279296862" }, { - "tick": "9281250000" + "tick": "290039049" }, { - "tick": "9625000000" + "tick": "300781236" }, { - "tick": "9968750000" + "tick": "311523423" }, { - "tick": "10312500000" + "tick": "322265610" }, { - "tick": "10656250000" + "tick": "333007797" }, { - "tick": "11000000000" + "tick": "343750000" } ] } @@ -219,106 +129,106 @@ { "opponent": "tz1gjaF81ZRRvdzjobyfVNsAeSC6PScjfQwN", "start_tick": "0", - "end_tick": "10742187", + "end_tick": "335693", "dissection": [ { "tick": "0" }, { - "tick": "335693" + "tick": "10490" }, { - "tick": "671386" + "tick": "20980" }, { - "tick": "1007079" + "tick": "31470" }, { - "tick": "1342772" + "tick": "41960" }, { - "tick": "1678465" + "tick": "52450" }, { - "tick": "2014158" + "tick": "62940" }, { - "tick": "2349851" + "tick": "73430" }, { - "tick": "2685544" + "tick": "83920" }, { - "tick": "3021237" + "tick": "94410" }, { - "tick": "3356930" + "tick": "104900" }, { - "tick": "3692623" + "tick": "115390" }, { - "tick": "4028316" + "tick": "125880" }, { - "tick": "4364009" + "tick": "136370" }, { - "tick": "4699702" + "tick": "146860" }, { - "tick": "5035395" + "tick": "157350" }, { - "tick": "5371088" + "tick": "167840" }, { - "tick": "5706781" + "tick": "178330" }, { - "tick": "6042474" + "tick": "188820" }, { - "tick": "6378167" + "tick": "199310" }, { - "tick": "6713860" + "tick": "209800" }, { - "tick": "7049553" + "tick": "220290" }, { - "tick": "7385246" + "tick": "230780" }, { - "tick": "7720939" + "tick": "241270" }, { - "tick": "8056632" + "tick": "251760" }, { - "tick": "8392325" + "tick": "262250" }, { - "tick": "8728018" + "tick": "272740" }, { - "tick": "9063711" + "tick": "283230" }, { - "tick": "9399404" + "tick": "293720" }, { - "tick": "9735097" + "tick": "304210" }, { - "tick": "10070790" + "tick": "314700" }, { - "tick": "10406483" + "tick": "325190" }, { - "tick": "10742187" + "tick": "335693" } ] } @@ -327,106 +237,106 @@ { "opponent": "tz1gjaF81ZRRvdzjobyfVNsAeSC6PScjfQwN", "start_tick": "0", - "end_tick": "10490", + "end_tick": "327", "dissection": [ { "tick": "0" }, { - "tick": "327" + "tick": "10" }, { - "tick": "654" + "tick": "20" }, { - "tick": "981" + "tick": "30" }, { - "tick": "1308" + "tick": "40" }, { - "tick": "1635" + "tick": "50" }, { - "tick": "1962" + "tick": "60" }, { - "tick": "2289" + "tick": "70" }, { - "tick": "2616" + "tick": "80" }, { - "tick": "2943" + "tick": "90" }, { - "tick": "3270" + "tick": "100" }, { - "tick": "3597" + "tick": "110" }, { - "tick": "3924" + "tick": "120" }, { - "tick": "4251" + "tick": "130" }, { - "tick": "4578" + "tick": "140" }, { - "tick": "4905" + "tick": "150" }, { - "tick": "5232" + "tick": "160" }, { - "tick": "5559" + "tick": "170" }, { - "tick": "5886" + "tick": "180" }, { - "tick": "6213" + "tick": "190" }, { - "tick": "6540" + "tick": "200" }, { - "tick": "6867" + "tick": "210" }, { - "tick": "7194" + "tick": "220" }, { - "tick": "7521" + "tick": "230" }, { - "tick": "7848" + "tick": "240" }, { - "tick": "8175" + "tick": "250" }, { - "tick": "8502" + "tick": "260" }, { - "tick": "8829" + "tick": "270" }, { - "tick": "9156" + "tick": "280" }, { - "tick": "9483" + "tick": "290" }, { - "tick": "9810" + "tick": "300" }, { - "tick": "10137" + "tick": "310" }, { - "tick": "10490" + "tick": "327" } ] } @@ -434,41 +344,14 @@ { "opponent": "tz1gjaF81ZRRvdzjobyfVNsAeSC6PScjfQwN", - "start_tick": "0", - "end_tick": "10", + "start_tick": "4", + "end_tick": "5", "dissection": [ - { - "tick": "0" - }, - { - "tick": "1" - }, - { - "tick": "2" - }, - { - "tick": "3" - }, { "tick": "4" }, { "tick": "5" - }, - { - "tick": "6" - }, - { - "tick": "7" - }, - { - "tick": "8" - }, - { - "tick": "9" - }, - { - "tick": "10" } ] } diff --git a/tezt/tests/expected/sc_rollup.ml/Alpha- wasm_2_0_0 - refutation games winning strategies (pvm_proof_0).out b/tezt/tests/expected/sc_rollup.ml/Alpha- wasm_2_0_0 - refutation games winning strategies (pvm_proof_0).out index a55a3d1ac3d2..97cf7e39daab 100644 --- a/tezt/tests/expected/sc_rollup.ml/Alpha- wasm_2_0_0 - refutation games winning strategies (pvm_proof_0).out +++ b/tezt/tests/expected/sc_rollup.ml/Alpha- wasm_2_0_0 - refutation games winning strategies (pvm_proof_0).out @@ -2,107 +2,20 @@ { "opponent": "tz1gjaF81ZRRvdzjobyfVNsAeSC6PScjfQwN", - "start_tick": "0", - "end_tick": "990000000000", + "start_tick": "198000000000", + "end_tick": "231000000000", "dissection": [ - { - "tick": "0" - }, - { - "tick": "22000000000" - }, - { - "tick": "44000000000" - }, - { - "tick": "66000000000" - }, - { - "tick": "88000000000" - }, - { - "tick": "110000000000" - }, - { - "tick": "132000000000" - }, - { - "tick": "165000000000" - }, { "tick": "198000000000" }, { - "tick": "231000000000" - }, - { - "tick": "264000000000" - }, - { - "tick": "297000000000" - }, - { - "tick": "330000000000" - }, - { - "tick": "363000000000" - }, - { - "tick": "396000000000" - }, - { - "tick": "429000000000" - }, - { - "tick": "462000000000" - }, - { - "tick": "495000000000" - }, - { - "tick": "528000000000" - }, - { - "tick": "561000000000" - }, - { - "tick": "594000000000" - }, - { - "tick": "627000000000" - }, - { - "tick": "660000000000" - }, - { - "tick": "693000000000" - }, - { - "tick": "726000000000" - }, - { - "tick": "759000000000" - }, - { - "tick": "792000000000" - }, - { - "tick": "825000000000" - }, - { - "tick": "858000000000" - }, - { - "tick": "891000000000" - }, - { - "tick": "924000000000" + "tick": "209000000000" }, { - "tick": "957000000000" + "tick": "220000000000" }, { - "tick": "990000000000" + "tick": "231000000000" } ] } @@ -111,106 +24,106 @@ { "opponent": "tz1gjaF81ZRRvdzjobyfVNsAeSC6PScjfQwN", "start_tick": "198000000000", - "end_tick": "209000000000", + "end_tick": "198343750000", "dissection": [ { "tick": "198000000000" }, { - "tick": "198343750000" + "tick": "198010742187" }, { - "tick": "198687500000" + "tick": "198021484374" }, { - "tick": "199031250000" + "tick": "198032226561" }, { - "tick": "199375000000" + "tick": "198042968748" }, { - "tick": "199718750000" + "tick": "198053710935" }, { - "tick": "200062500000" + "tick": "198064453122" }, { - "tick": "200406250000" + "tick": "198075195309" }, { - "tick": "200750000000" + "tick": "198085937496" }, { - "tick": "201093750000" + "tick": "198096679683" }, { - "tick": "201437500000" + "tick": "198107421870" }, { - "tick": "201781250000" + "tick": "198118164057" }, { - "tick": "202125000000" + "tick": "198128906244" }, { - "tick": "202468750000" + "tick": "198139648431" }, { - "tick": "202812500000" + "tick": "198150390618" }, { - "tick": "203156250000" + "tick": "198161132805" }, { - "tick": "203500000000" + "tick": "198171874992" }, { - "tick": "203843750000" + "tick": "198182617179" }, { - "tick": "204187500000" + "tick": "198193359366" }, { - "tick": "204531250000" + "tick": "198204101553" }, { - "tick": "204875000000" + "tick": "198214843740" }, { - "tick": "205218750000" + "tick": "198225585927" }, { - "tick": "205562500000" + "tick": "198236328114" }, { - "tick": "205906250000" + "tick": "198247070301" }, { - "tick": "206250000000" + "tick": "198257812488" }, { - "tick": "206593750000" + "tick": "198268554675" }, { - "tick": "206937500000" + "tick": "198279296862" }, { - "tick": "207281250000" + "tick": "198290039049" }, { - "tick": "207625000000" + "tick": "198300781236" }, { - "tick": "207968750000" + "tick": "198311523423" }, { - "tick": "208312500000" + "tick": "198322265610" }, { - "tick": "208656250000" + "tick": "198333007797" }, { - "tick": "209000000000" + "tick": "198343750000" } ] } @@ -219,106 +132,106 @@ { "opponent": "tz1gjaF81ZRRvdzjobyfVNsAeSC6PScjfQwN", "start_tick": "198000000000", - "end_tick": "198010742187", + "end_tick": "198000335693", "dissection": [ { "tick": "198000000000" }, { - "tick": "198000335693" + "tick": "198000010490" }, { - "tick": "198000671386" + "tick": "198000020980" }, { - "tick": "198001007079" + "tick": "198000031470" }, { - "tick": "198001342772" + "tick": "198000041960" }, { - "tick": "198001678465" + "tick": "198000052450" }, { - "tick": "198002014158" + "tick": "198000062940" }, { - "tick": "198002349851" + "tick": "198000073430" }, { - "tick": "198002685544" + "tick": "198000083920" }, { - "tick": "198003021237" + "tick": "198000094410" }, { - "tick": "198003356930" + "tick": "198000104900" }, { - "tick": "198003692623" + "tick": "198000115390" }, { - "tick": "198004028316" + "tick": "198000125880" }, { - "tick": "198004364009" + "tick": "198000136370" }, { - "tick": "198004699702" + "tick": "198000146860" }, { - "tick": "198005035395" + "tick": "198000157350" }, { - "tick": "198005371088" + "tick": "198000167840" }, { - "tick": "198005706781" + "tick": "198000178330" }, { - "tick": "198006042474" + "tick": "198000188820" }, { - "tick": "198006378167" + "tick": "198000199310" }, { - "tick": "198006713860" + "tick": "198000209800" }, { - "tick": "198007049553" + "tick": "198000220290" }, { - "tick": "198007385246" + "tick": "198000230780" }, { - "tick": "198007720939" + "tick": "198000241270" }, { - "tick": "198008056632" + "tick": "198000251760" }, { - "tick": "198008392325" + "tick": "198000262250" }, { - "tick": "198008728018" + "tick": "198000272740" }, { - "tick": "198009063711" + "tick": "198000283230" }, { - "tick": "198009399404" + "tick": "198000293720" }, { - "tick": "198009735097" + "tick": "198000304210" }, { - "tick": "198010070790" + "tick": "198000314700" }, { - "tick": "198010406483" + "tick": "198000325190" }, { - "tick": "198010742187" + "tick": "198000335693" } ] } @@ -327,106 +240,106 @@ { "opponent": "tz1gjaF81ZRRvdzjobyfVNsAeSC6PScjfQwN", "start_tick": "198000000000", - "end_tick": "198000010490", + "end_tick": "198000000327", "dissection": [ { "tick": "198000000000" }, { - "tick": "198000000327" + "tick": "198000000010" }, { - "tick": "198000000654" + "tick": "198000000020" }, { - "tick": "198000000981" + "tick": "198000000030" }, { - "tick": "198000001308" + "tick": "198000000040" }, { - "tick": "198000001635" + "tick": "198000000050" }, { - "tick": "198000001962" + "tick": "198000000060" }, { - "tick": "198000002289" + "tick": "198000000070" }, { - "tick": "198000002616" + "tick": "198000000080" }, { - "tick": "198000002943" + "tick": "198000000090" }, { - "tick": "198000003270" + "tick": "198000000100" }, { - "tick": "198000003597" + "tick": "198000000110" }, { - "tick": "198000003924" + "tick": "198000000120" }, { - "tick": "198000004251" + "tick": "198000000130" }, { - "tick": "198000004578" + "tick": "198000000140" }, { - "tick": "198000004905" + "tick": "198000000150" }, { - "tick": "198000005232" + "tick": "198000000160" }, { - "tick": "198000005559" + "tick": "198000000170" }, { - "tick": "198000005886" + "tick": "198000000180" }, { - "tick": "198000006213" + "tick": "198000000190" }, { - "tick": "198000006540" + "tick": "198000000200" }, { - "tick": "198000006867" + "tick": "198000000210" }, { - "tick": "198000007194" + "tick": "198000000220" }, { - "tick": "198000007521" + "tick": "198000000230" }, { - "tick": "198000007848" + "tick": "198000000240" }, { - "tick": "198000008175" + "tick": "198000000250" }, { - "tick": "198000008502" + "tick": "198000000260" }, { - "tick": "198000008829" + "tick": "198000000270" }, { - "tick": "198000009156" + "tick": "198000000280" }, { - "tick": "198000009483" + "tick": "198000000290" }, { - "tick": "198000009810" + "tick": "198000000300" }, { - "tick": "198000010137" + "tick": "198000000310" }, { - "tick": "198000010490" + "tick": "198000000327" } ] } @@ -434,41 +347,14 @@ { "opponent": "tz1gjaF81ZRRvdzjobyfVNsAeSC6PScjfQwN", - "start_tick": "198000000000", - "end_tick": "198000000010", + "start_tick": "198000000008", + "end_tick": "198000000009", "dissection": [ - { - "tick": "198000000000" - }, - { - "tick": "198000000001" - }, - { - "tick": "198000000002" - }, - { - "tick": "198000000003" - }, - { - "tick": "198000000004" - }, - { - "tick": "198000000005" - }, - { - "tick": "198000000006" - }, - { - "tick": "198000000007" - }, { "tick": "198000000008" }, { "tick": "198000000009" - }, - { - "tick": "198000000010" } ] } diff --git a/tezt/tests/expected/sc_rollup.ml/Alpha- wasm_2_0_0 - refutation games winning strategies (pvm_proof_1).out b/tezt/tests/expected/sc_rollup.ml/Alpha- wasm_2_0_0 - refutation games winning strategies (pvm_proof_1).out index 697c6fab249d..29b87b472190 100644 --- a/tezt/tests/expected/sc_rollup.ml/Alpha- wasm_2_0_0 - refutation games winning strategies (pvm_proof_1).out +++ b/tezt/tests/expected/sc_rollup.ml/Alpha- wasm_2_0_0 - refutation games winning strategies (pvm_proof_1).out @@ -2,107 +2,20 @@ { "opponent": "tz1gjaF81ZRRvdzjobyfVNsAeSC6PScjfQwN", - "start_tick": "0", - "end_tick": "990000000000", + "start_tick": "396000000000", + "end_tick": "429000000000", "dissection": [ - { - "tick": "0" - }, - { - "tick": "22000000000" - }, - { - "tick": "44000000000" - }, - { - "tick": "66000000000" - }, - { - "tick": "88000000000" - }, - { - "tick": "110000000000" - }, - { - "tick": "132000000000" - }, - { - "tick": "165000000000" - }, - { - "tick": "198000000000" - }, - { - "tick": "231000000000" - }, - { - "tick": "264000000000" - }, - { - "tick": "297000000000" - }, - { - "tick": "330000000000" - }, - { - "tick": "363000000000" - }, { "tick": "396000000000" }, { - "tick": "429000000000" - }, - { - "tick": "462000000000" - }, - { - "tick": "495000000000" - }, - { - "tick": "528000000000" - }, - { - "tick": "561000000000" - }, - { - "tick": "594000000000" - }, - { - "tick": "627000000000" - }, - { - "tick": "660000000000" - }, - { - "tick": "693000000000" - }, - { - "tick": "726000000000" - }, - { - "tick": "759000000000" - }, - { - "tick": "792000000000" - }, - { - "tick": "825000000000" - }, - { - "tick": "858000000000" - }, - { - "tick": "891000000000" - }, - { - "tick": "924000000000" + "tick": "407000000000" }, { - "tick": "957000000000" + "tick": "418000000000" }, { - "tick": "990000000000" + "tick": "429000000000" } ] } @@ -111,106 +24,106 @@ { "opponent": "tz1gjaF81ZRRvdzjobyfVNsAeSC6PScjfQwN", "start_tick": "396000000000", - "end_tick": "407000000000", + "end_tick": "396343750000", "dissection": [ { "tick": "396000000000" }, { - "tick": "396343750000" + "tick": "396010742187" }, { - "tick": "396687500000" + "tick": "396021484374" }, { - "tick": "397031250000" + "tick": "396032226561" }, { - "tick": "397375000000" + "tick": "396042968748" }, { - "tick": "397718750000" + "tick": "396053710935" }, { - "tick": "398062500000" + "tick": "396064453122" }, { - "tick": "398406250000" + "tick": "396075195309" }, { - "tick": "398750000000" + "tick": "396085937496" }, { - "tick": "399093750000" + "tick": "396096679683" }, { - "tick": "399437500000" + "tick": "396107421870" }, { - "tick": "399781250000" + "tick": "396118164057" }, { - "tick": "400125000000" + "tick": "396128906244" }, { - "tick": "400468750000" + "tick": "396139648431" }, { - "tick": "400812500000" + "tick": "396150390618" }, { - "tick": "401156250000" + "tick": "396161132805" }, { - "tick": "401500000000" + "tick": "396171874992" }, { - "tick": "401843750000" + "tick": "396182617179" }, { - "tick": "402187500000" + "tick": "396193359366" }, { - "tick": "402531250000" + "tick": "396204101553" }, { - "tick": "402875000000" + "tick": "396214843740" }, { - "tick": "403218750000" + "tick": "396225585927" }, { - "tick": "403562500000" + "tick": "396236328114" }, { - "tick": "403906250000" + "tick": "396247070301" }, { - "tick": "404250000000" + "tick": "396257812488" }, { - "tick": "404593750000" + "tick": "396268554675" }, { - "tick": "404937500000" + "tick": "396279296862" }, { - "tick": "405281250000" + "tick": "396290039049" }, { - "tick": "405625000000" + "tick": "396300781236" }, { - "tick": "405968750000" + "tick": "396311523423" }, { - "tick": "406312500000" + "tick": "396322265610" }, { - "tick": "406656250000" + "tick": "396333007797" }, { - "tick": "407000000000" + "tick": "396343750000" } ] } @@ -219,106 +132,106 @@ { "opponent": "tz1gjaF81ZRRvdzjobyfVNsAeSC6PScjfQwN", "start_tick": "396000000000", - "end_tick": "396010742187", + "end_tick": "396000335693", "dissection": [ { "tick": "396000000000" }, { - "tick": "396000335693" + "tick": "396000010490" }, { - "tick": "396000671386" + "tick": "396000020980" }, { - "tick": "396001007079" + "tick": "396000031470" }, { - "tick": "396001342772" + "tick": "396000041960" }, { - "tick": "396001678465" + "tick": "396000052450" }, { - "tick": "396002014158" + "tick": "396000062940" }, { - "tick": "396002349851" + "tick": "396000073430" }, { - "tick": "396002685544" + "tick": "396000083920" }, { - "tick": "396003021237" + "tick": "396000094410" }, { - "tick": "396003356930" + "tick": "396000104900" }, { - "tick": "396003692623" + "tick": "396000115390" }, { - "tick": "396004028316" + "tick": "396000125880" }, { - "tick": "396004364009" + "tick": "396000136370" }, { - "tick": "396004699702" + "tick": "396000146860" }, { - "tick": "396005035395" + "tick": "396000157350" }, { - "tick": "396005371088" + "tick": "396000167840" }, { - "tick": "396005706781" + "tick": "396000178330" }, { - "tick": "396006042474" + "tick": "396000188820" }, { - "tick": "396006378167" + "tick": "396000199310" }, { - "tick": "396006713860" + "tick": "396000209800" }, { - "tick": "396007049553" + "tick": "396000220290" }, { - "tick": "396007385246" + "tick": "396000230780" }, { - "tick": "396007720939" + "tick": "396000241270" }, { - "tick": "396008056632" + "tick": "396000251760" }, { - "tick": "396008392325" + "tick": "396000262250" }, { - "tick": "396008728018" + "tick": "396000272740" }, { - "tick": "396009063711" + "tick": "396000283230" }, { - "tick": "396009399404" + "tick": "396000293720" }, { - "tick": "396009735097" + "tick": "396000304210" }, { - "tick": "396010070790" + "tick": "396000314700" }, { - "tick": "396010406483" + "tick": "396000325190" }, { - "tick": "396010742187" + "tick": "396000335693" } ] } @@ -327,106 +240,106 @@ { "opponent": "tz1gjaF81ZRRvdzjobyfVNsAeSC6PScjfQwN", "start_tick": "396000000000", - "end_tick": "396000010490", + "end_tick": "396000000327", "dissection": [ { "tick": "396000000000" }, { - "tick": "396000000327" + "tick": "396000000010" }, { - "tick": "396000000654" + "tick": "396000000020" }, { - "tick": "396000000981" + "tick": "396000000030" }, { - "tick": "396000001308" + "tick": "396000000040" }, { - "tick": "396000001635" + "tick": "396000000050" }, { - "tick": "396000001962" + "tick": "396000000060" }, { - "tick": "396000002289" + "tick": "396000000070" }, { - "tick": "396000002616" + "tick": "396000000080" }, { - "tick": "396000002943" + "tick": "396000000090" }, { - "tick": "396000003270" + "tick": "396000000100" }, { - "tick": "396000003597" + "tick": "396000000110" }, { - "tick": "396000003924" + "tick": "396000000120" }, { - "tick": "396000004251" + "tick": "396000000130" }, { - "tick": "396000004578" + "tick": "396000000140" }, { - "tick": "396000004905" + "tick": "396000000150" }, { - "tick": "396000005232" + "tick": "396000000160" }, { - "tick": "396000005559" + "tick": "396000000170" }, { - "tick": "396000005886" + "tick": "396000000180" }, { - "tick": "396000006213" + "tick": "396000000190" }, { - "tick": "396000006540" + "tick": "396000000200" }, { - "tick": "396000006867" + "tick": "396000000210" }, { - "tick": "396000007194" + "tick": "396000000220" }, { - "tick": "396000007521" + "tick": "396000000230" }, { - "tick": "396000007848" + "tick": "396000000240" }, { - "tick": "396000008175" + "tick": "396000000250" }, { - "tick": "396000008502" + "tick": "396000000260" }, { - "tick": "396000008829" + "tick": "396000000270" }, { - "tick": "396000009156" + "tick": "396000000280" }, { - "tick": "396000009483" + "tick": "396000000290" }, { - "tick": "396000009810" + "tick": "396000000300" }, { - "tick": "396000010137" + "tick": "396000000310" }, { - "tick": "396000010490" + "tick": "396000000327" } ] } @@ -434,41 +347,14 @@ { "opponent": "tz1gjaF81ZRRvdzjobyfVNsAeSC6PScjfQwN", - "start_tick": "396000000000", - "end_tick": "396000000010", + "start_tick": "396000000008", + "end_tick": "396000000009", "dissection": [ - { - "tick": "396000000000" - }, - { - "tick": "396000000001" - }, - { - "tick": "396000000002" - }, - { - "tick": "396000000003" - }, - { - "tick": "396000000004" - }, - { - "tick": "396000000005" - }, - { - "tick": "396000000006" - }, - { - "tick": "396000000007" - }, { "tick": "396000000008" }, { "tick": "396000000009" - }, - { - "tick": "396000000010" } ] } diff --git a/tezt/tests/expected/sc_rollup.ml/Alpha- wasm_2_0_0 - refutation games winning strategies (pvm_proof_2).out b/tezt/tests/expected/sc_rollup.ml/Alpha- wasm_2_0_0 - refutation games winning strategies (pvm_proof_2).out index 697c6fab249d..29b87b472190 100644 --- a/tezt/tests/expected/sc_rollup.ml/Alpha- wasm_2_0_0 - refutation games winning strategies (pvm_proof_2).out +++ b/tezt/tests/expected/sc_rollup.ml/Alpha- wasm_2_0_0 - refutation games winning strategies (pvm_proof_2).out @@ -2,107 +2,20 @@ { "opponent": "tz1gjaF81ZRRvdzjobyfVNsAeSC6PScjfQwN", - "start_tick": "0", - "end_tick": "990000000000", + "start_tick": "396000000000", + "end_tick": "429000000000", "dissection": [ - { - "tick": "0" - }, - { - "tick": "22000000000" - }, - { - "tick": "44000000000" - }, - { - "tick": "66000000000" - }, - { - "tick": "88000000000" - }, - { - "tick": "110000000000" - }, - { - "tick": "132000000000" - }, - { - "tick": "165000000000" - }, - { - "tick": "198000000000" - }, - { - "tick": "231000000000" - }, - { - "tick": "264000000000" - }, - { - "tick": "297000000000" - }, - { - "tick": "330000000000" - }, - { - "tick": "363000000000" - }, { "tick": "396000000000" }, { - "tick": "429000000000" - }, - { - "tick": "462000000000" - }, - { - "tick": "495000000000" - }, - { - "tick": "528000000000" - }, - { - "tick": "561000000000" - }, - { - "tick": "594000000000" - }, - { - "tick": "627000000000" - }, - { - "tick": "660000000000" - }, - { - "tick": "693000000000" - }, - { - "tick": "726000000000" - }, - { - "tick": "759000000000" - }, - { - "tick": "792000000000" - }, - { - "tick": "825000000000" - }, - { - "tick": "858000000000" - }, - { - "tick": "891000000000" - }, - { - "tick": "924000000000" + "tick": "407000000000" }, { - "tick": "957000000000" + "tick": "418000000000" }, { - "tick": "990000000000" + "tick": "429000000000" } ] } @@ -111,106 +24,106 @@ { "opponent": "tz1gjaF81ZRRvdzjobyfVNsAeSC6PScjfQwN", "start_tick": "396000000000", - "end_tick": "407000000000", + "end_tick": "396343750000", "dissection": [ { "tick": "396000000000" }, { - "tick": "396343750000" + "tick": "396010742187" }, { - "tick": "396687500000" + "tick": "396021484374" }, { - "tick": "397031250000" + "tick": "396032226561" }, { - "tick": "397375000000" + "tick": "396042968748" }, { - "tick": "397718750000" + "tick": "396053710935" }, { - "tick": "398062500000" + "tick": "396064453122" }, { - "tick": "398406250000" + "tick": "396075195309" }, { - "tick": "398750000000" + "tick": "396085937496" }, { - "tick": "399093750000" + "tick": "396096679683" }, { - "tick": "399437500000" + "tick": "396107421870" }, { - "tick": "399781250000" + "tick": "396118164057" }, { - "tick": "400125000000" + "tick": "396128906244" }, { - "tick": "400468750000" + "tick": "396139648431" }, { - "tick": "400812500000" + "tick": "396150390618" }, { - "tick": "401156250000" + "tick": "396161132805" }, { - "tick": "401500000000" + "tick": "396171874992" }, { - "tick": "401843750000" + "tick": "396182617179" }, { - "tick": "402187500000" + "tick": "396193359366" }, { - "tick": "402531250000" + "tick": "396204101553" }, { - "tick": "402875000000" + "tick": "396214843740" }, { - "tick": "403218750000" + "tick": "396225585927" }, { - "tick": "403562500000" + "tick": "396236328114" }, { - "tick": "403906250000" + "tick": "396247070301" }, { - "tick": "404250000000" + "tick": "396257812488" }, { - "tick": "404593750000" + "tick": "396268554675" }, { - "tick": "404937500000" + "tick": "396279296862" }, { - "tick": "405281250000" + "tick": "396290039049" }, { - "tick": "405625000000" + "tick": "396300781236" }, { - "tick": "405968750000" + "tick": "396311523423" }, { - "tick": "406312500000" + "tick": "396322265610" }, { - "tick": "406656250000" + "tick": "396333007797" }, { - "tick": "407000000000" + "tick": "396343750000" } ] } @@ -219,106 +132,106 @@ { "opponent": "tz1gjaF81ZRRvdzjobyfVNsAeSC6PScjfQwN", "start_tick": "396000000000", - "end_tick": "396010742187", + "end_tick": "396000335693", "dissection": [ { "tick": "396000000000" }, { - "tick": "396000335693" + "tick": "396000010490" }, { - "tick": "396000671386" + "tick": "396000020980" }, { - "tick": "396001007079" + "tick": "396000031470" }, { - "tick": "396001342772" + "tick": "396000041960" }, { - "tick": "396001678465" + "tick": "396000052450" }, { - "tick": "396002014158" + "tick": "396000062940" }, { - "tick": "396002349851" + "tick": "396000073430" }, { - "tick": "396002685544" + "tick": "396000083920" }, { - "tick": "396003021237" + "tick": "396000094410" }, { - "tick": "396003356930" + "tick": "396000104900" }, { - "tick": "396003692623" + "tick": "396000115390" }, { - "tick": "396004028316" + "tick": "396000125880" }, { - "tick": "396004364009" + "tick": "396000136370" }, { - "tick": "396004699702" + "tick": "396000146860" }, { - "tick": "396005035395" + "tick": "396000157350" }, { - "tick": "396005371088" + "tick": "396000167840" }, { - "tick": "396005706781" + "tick": "396000178330" }, { - "tick": "396006042474" + "tick": "396000188820" }, { - "tick": "396006378167" + "tick": "396000199310" }, { - "tick": "396006713860" + "tick": "396000209800" }, { - "tick": "396007049553" + "tick": "396000220290" }, { - "tick": "396007385246" + "tick": "396000230780" }, { - "tick": "396007720939" + "tick": "396000241270" }, { - "tick": "396008056632" + "tick": "396000251760" }, { - "tick": "396008392325" + "tick": "396000262250" }, { - "tick": "396008728018" + "tick": "396000272740" }, { - "tick": "396009063711" + "tick": "396000283230" }, { - "tick": "396009399404" + "tick": "396000293720" }, { - "tick": "396009735097" + "tick": "396000304210" }, { - "tick": "396010070790" + "tick": "396000314700" }, { - "tick": "396010406483" + "tick": "396000325190" }, { - "tick": "396010742187" + "tick": "396000335693" } ] } @@ -327,106 +240,106 @@ { "opponent": "tz1gjaF81ZRRvdzjobyfVNsAeSC6PScjfQwN", "start_tick": "396000000000", - "end_tick": "396000010490", + "end_tick": "396000000327", "dissection": [ { "tick": "396000000000" }, { - "tick": "396000000327" + "tick": "396000000010" }, { - "tick": "396000000654" + "tick": "396000000020" }, { - "tick": "396000000981" + "tick": "396000000030" }, { - "tick": "396000001308" + "tick": "396000000040" }, { - "tick": "396000001635" + "tick": "396000000050" }, { - "tick": "396000001962" + "tick": "396000000060" }, { - "tick": "396000002289" + "tick": "396000000070" }, { - "tick": "396000002616" + "tick": "396000000080" }, { - "tick": "396000002943" + "tick": "396000000090" }, { - "tick": "396000003270" + "tick": "396000000100" }, { - "tick": "396000003597" + "tick": "396000000110" }, { - "tick": "396000003924" + "tick": "396000000120" }, { - "tick": "396000004251" + "tick": "396000000130" }, { - "tick": "396000004578" + "tick": "396000000140" }, { - "tick": "396000004905" + "tick": "396000000150" }, { - "tick": "396000005232" + "tick": "396000000160" }, { - "tick": "396000005559" + "tick": "396000000170" }, { - "tick": "396000005886" + "tick": "396000000180" }, { - "tick": "396000006213" + "tick": "396000000190" }, { - "tick": "396000006540" + "tick": "396000000200" }, { - "tick": "396000006867" + "tick": "396000000210" }, { - "tick": "396000007194" + "tick": "396000000220" }, { - "tick": "396000007521" + "tick": "396000000230" }, { - "tick": "396000007848" + "tick": "396000000240" }, { - "tick": "396000008175" + "tick": "396000000250" }, { - "tick": "396000008502" + "tick": "396000000260" }, { - "tick": "396000008829" + "tick": "396000000270" }, { - "tick": "396000009156" + "tick": "396000000280" }, { - "tick": "396000009483" + "tick": "396000000290" }, { - "tick": "396000009810" + "tick": "396000000300" }, { - "tick": "396000010137" + "tick": "396000000310" }, { - "tick": "396000010490" + "tick": "396000000327" } ] } @@ -434,41 +347,14 @@ { "opponent": "tz1gjaF81ZRRvdzjobyfVNsAeSC6PScjfQwN", - "start_tick": "396000000000", - "end_tick": "396000000010", + "start_tick": "396000000008", + "end_tick": "396000000009", "dissection": [ - { - "tick": "396000000000" - }, - { - "tick": "396000000001" - }, - { - "tick": "396000000002" - }, - { - "tick": "396000000003" - }, - { - "tick": "396000000004" - }, - { - "tick": "396000000005" - }, - { - "tick": "396000000006" - }, - { - "tick": "396000000007" - }, { "tick": "396000000008" }, { "tick": "396000000009" - }, - { - "tick": "396000000010" } ] } diff --git a/tezt/tests/expected/sc_rollup.ml/Alpha- wasm_2_0_0 - refutation games winning strategies (pvm_proof_3).out b/tezt/tests/expected/sc_rollup.ml/Alpha- wasm_2_0_0 - refutation games winning strategies (pvm_proof_3).out index 697c6fab249d..29b87b472190 100644 --- a/tezt/tests/expected/sc_rollup.ml/Alpha- wasm_2_0_0 - refutation games winning strategies (pvm_proof_3).out +++ b/tezt/tests/expected/sc_rollup.ml/Alpha- wasm_2_0_0 - refutation games winning strategies (pvm_proof_3).out @@ -2,107 +2,20 @@ { "opponent": "tz1gjaF81ZRRvdzjobyfVNsAeSC6PScjfQwN", - "start_tick": "0", - "end_tick": "990000000000", + "start_tick": "396000000000", + "end_tick": "429000000000", "dissection": [ - { - "tick": "0" - }, - { - "tick": "22000000000" - }, - { - "tick": "44000000000" - }, - { - "tick": "66000000000" - }, - { - "tick": "88000000000" - }, - { - "tick": "110000000000" - }, - { - "tick": "132000000000" - }, - { - "tick": "165000000000" - }, - { - "tick": "198000000000" - }, - { - "tick": "231000000000" - }, - { - "tick": "264000000000" - }, - { - "tick": "297000000000" - }, - { - "tick": "330000000000" - }, - { - "tick": "363000000000" - }, { "tick": "396000000000" }, { - "tick": "429000000000" - }, - { - "tick": "462000000000" - }, - { - "tick": "495000000000" - }, - { - "tick": "528000000000" - }, - { - "tick": "561000000000" - }, - { - "tick": "594000000000" - }, - { - "tick": "627000000000" - }, - { - "tick": "660000000000" - }, - { - "tick": "693000000000" - }, - { - "tick": "726000000000" - }, - { - "tick": "759000000000" - }, - { - "tick": "792000000000" - }, - { - "tick": "825000000000" - }, - { - "tick": "858000000000" - }, - { - "tick": "891000000000" - }, - { - "tick": "924000000000" + "tick": "407000000000" }, { - "tick": "957000000000" + "tick": "418000000000" }, { - "tick": "990000000000" + "tick": "429000000000" } ] } @@ -111,106 +24,106 @@ { "opponent": "tz1gjaF81ZRRvdzjobyfVNsAeSC6PScjfQwN", "start_tick": "396000000000", - "end_tick": "407000000000", + "end_tick": "396343750000", "dissection": [ { "tick": "396000000000" }, { - "tick": "396343750000" + "tick": "396010742187" }, { - "tick": "396687500000" + "tick": "396021484374" }, { - "tick": "397031250000" + "tick": "396032226561" }, { - "tick": "397375000000" + "tick": "396042968748" }, { - "tick": "397718750000" + "tick": "396053710935" }, { - "tick": "398062500000" + "tick": "396064453122" }, { - "tick": "398406250000" + "tick": "396075195309" }, { - "tick": "398750000000" + "tick": "396085937496" }, { - "tick": "399093750000" + "tick": "396096679683" }, { - "tick": "399437500000" + "tick": "396107421870" }, { - "tick": "399781250000" + "tick": "396118164057" }, { - "tick": "400125000000" + "tick": "396128906244" }, { - "tick": "400468750000" + "tick": "396139648431" }, { - "tick": "400812500000" + "tick": "396150390618" }, { - "tick": "401156250000" + "tick": "396161132805" }, { - "tick": "401500000000" + "tick": "396171874992" }, { - "tick": "401843750000" + "tick": "396182617179" }, { - "tick": "402187500000" + "tick": "396193359366" }, { - "tick": "402531250000" + "tick": "396204101553" }, { - "tick": "402875000000" + "tick": "396214843740" }, { - "tick": "403218750000" + "tick": "396225585927" }, { - "tick": "403562500000" + "tick": "396236328114" }, { - "tick": "403906250000" + "tick": "396247070301" }, { - "tick": "404250000000" + "tick": "396257812488" }, { - "tick": "404593750000" + "tick": "396268554675" }, { - "tick": "404937500000" + "tick": "396279296862" }, { - "tick": "405281250000" + "tick": "396290039049" }, { - "tick": "405625000000" + "tick": "396300781236" }, { - "tick": "405968750000" + "tick": "396311523423" }, { - "tick": "406312500000" + "tick": "396322265610" }, { - "tick": "406656250000" + "tick": "396333007797" }, { - "tick": "407000000000" + "tick": "396343750000" } ] } @@ -219,106 +132,106 @@ { "opponent": "tz1gjaF81ZRRvdzjobyfVNsAeSC6PScjfQwN", "start_tick": "396000000000", - "end_tick": "396010742187", + "end_tick": "396000335693", "dissection": [ { "tick": "396000000000" }, { - "tick": "396000335693" + "tick": "396000010490" }, { - "tick": "396000671386" + "tick": "396000020980" }, { - "tick": "396001007079" + "tick": "396000031470" }, { - "tick": "396001342772" + "tick": "396000041960" }, { - "tick": "396001678465" + "tick": "396000052450" }, { - "tick": "396002014158" + "tick": "396000062940" }, { - "tick": "396002349851" + "tick": "396000073430" }, { - "tick": "396002685544" + "tick": "396000083920" }, { - "tick": "396003021237" + "tick": "396000094410" }, { - "tick": "396003356930" + "tick": "396000104900" }, { - "tick": "396003692623" + "tick": "396000115390" }, { - "tick": "396004028316" + "tick": "396000125880" }, { - "tick": "396004364009" + "tick": "396000136370" }, { - "tick": "396004699702" + "tick": "396000146860" }, { - "tick": "396005035395" + "tick": "396000157350" }, { - "tick": "396005371088" + "tick": "396000167840" }, { - "tick": "396005706781" + "tick": "396000178330" }, { - "tick": "396006042474" + "tick": "396000188820" }, { - "tick": "396006378167" + "tick": "396000199310" }, { - "tick": "396006713860" + "tick": "396000209800" }, { - "tick": "396007049553" + "tick": "396000220290" }, { - "tick": "396007385246" + "tick": "396000230780" }, { - "tick": "396007720939" + "tick": "396000241270" }, { - "tick": "396008056632" + "tick": "396000251760" }, { - "tick": "396008392325" + "tick": "396000262250" }, { - "tick": "396008728018" + "tick": "396000272740" }, { - "tick": "396009063711" + "tick": "396000283230" }, { - "tick": "396009399404" + "tick": "396000293720" }, { - "tick": "396009735097" + "tick": "396000304210" }, { - "tick": "396010070790" + "tick": "396000314700" }, { - "tick": "396010406483" + "tick": "396000325190" }, { - "tick": "396010742187" + "tick": "396000335693" } ] } @@ -327,106 +240,106 @@ { "opponent": "tz1gjaF81ZRRvdzjobyfVNsAeSC6PScjfQwN", "start_tick": "396000000000", - "end_tick": "396000010490", + "end_tick": "396000000327", "dissection": [ { "tick": "396000000000" }, { - "tick": "396000000327" + "tick": "396000000010" }, { - "tick": "396000000654" + "tick": "396000000020" }, { - "tick": "396000000981" + "tick": "396000000030" }, { - "tick": "396000001308" + "tick": "396000000040" }, { - "tick": "396000001635" + "tick": "396000000050" }, { - "tick": "396000001962" + "tick": "396000000060" }, { - "tick": "396000002289" + "tick": "396000000070" }, { - "tick": "396000002616" + "tick": "396000000080" }, { - "tick": "396000002943" + "tick": "396000000090" }, { - "tick": "396000003270" + "tick": "396000000100" }, { - "tick": "396000003597" + "tick": "396000000110" }, { - "tick": "396000003924" + "tick": "396000000120" }, { - "tick": "396000004251" + "tick": "396000000130" }, { - "tick": "396000004578" + "tick": "396000000140" }, { - "tick": "396000004905" + "tick": "396000000150" }, { - "tick": "396000005232" + "tick": "396000000160" }, { - "tick": "396000005559" + "tick": "396000000170" }, { - "tick": "396000005886" + "tick": "396000000180" }, { - "tick": "396000006213" + "tick": "396000000190" }, { - "tick": "396000006540" + "tick": "396000000200" }, { - "tick": "396000006867" + "tick": "396000000210" }, { - "tick": "396000007194" + "tick": "396000000220" }, { - "tick": "396000007521" + "tick": "396000000230" }, { - "tick": "396000007848" + "tick": "396000000240" }, { - "tick": "396000008175" + "tick": "396000000250" }, { - "tick": "396000008502" + "tick": "396000000260" }, { - "tick": "396000008829" + "tick": "396000000270" }, { - "tick": "396000009156" + "tick": "396000000280" }, { - "tick": "396000009483" + "tick": "396000000290" }, { - "tick": "396000009810" + "tick": "396000000300" }, { - "tick": "396000010137" + "tick": "396000000310" }, { - "tick": "396000010490" + "tick": "396000000327" } ] } @@ -434,41 +347,14 @@ { "opponent": "tz1gjaF81ZRRvdzjobyfVNsAeSC6PScjfQwN", - "start_tick": "396000000000", - "end_tick": "396000000010", + "start_tick": "396000000008", + "end_tick": "396000000009", "dissection": [ - { - "tick": "396000000000" - }, - { - "tick": "396000000001" - }, - { - "tick": "396000000002" - }, - { - "tick": "396000000003" - }, - { - "tick": "396000000004" - }, - { - "tick": "396000000005" - }, - { - "tick": "396000000006" - }, - { - "tick": "396000000007" - }, { "tick": "396000000008" }, { "tick": "396000000009" - }, - { - "tick": "396000000010" } ] } diff --git a/tezt/tests/expected/sc_rollup.ml/Mumbai- wasm_2_0_0 - refutation games winning strategies (inbox_proof_0).out b/tezt/tests/expected/sc_rollup.ml/Mumbai- wasm_2_0_0 - refutation games winning strategies (inbox_proof_0).out index 5994a7d55da0..5cf83e4cfa9a 100644 --- a/tezt/tests/expected/sc_rollup.ml/Mumbai- wasm_2_0_0 - refutation games winning strategies (inbox_proof_0).out +++ b/tezt/tests/expected/sc_rollup.ml/Mumbai- wasm_2_0_0 - refutation games winning strategies (inbox_proof_0).out @@ -3,106 +3,16 @@ { "opponent": "tz1gjaF81ZRRvdzjobyfVNsAeSC6PScjfQwN", "start_tick": "0", - "end_tick": "990000000000", + "end_tick": "22000000000", "dissection": [ { "tick": "0" }, { - "tick": "22000000000" - }, - { - "tick": "44000000000" - }, - { - "tick": "66000000000" - }, - { - "tick": "88000000000" - }, - { - "tick": "110000000000" - }, - { - "tick": "132000000000" - }, - { - "tick": "165000000000" - }, - { - "tick": "198000000000" - }, - { - "tick": "231000000000" - }, - { - "tick": "264000000000" - }, - { - "tick": "297000000000" - }, - { - "tick": "330000000000" - }, - { - "tick": "363000000000" - }, - { - "tick": "396000000000" - }, - { - "tick": "429000000000" - }, - { - "tick": "462000000000" - }, - { - "tick": "495000000000" - }, - { - "tick": "528000000000" - }, - { - "tick": "561000000000" - }, - { - "tick": "594000000000" - }, - { - "tick": "627000000000" - }, - { - "tick": "660000000000" - }, - { - "tick": "693000000000" - }, - { - "tick": "726000000000" - }, - { - "tick": "759000000000" - }, - { - "tick": "792000000000" - }, - { - "tick": "825000000000" - }, - { - "tick": "858000000000" - }, - { - "tick": "891000000000" - }, - { - "tick": "924000000000" - }, - { - "tick": "957000000000" + "tick": "11000000000" }, { - "tick": "990000000000" + "tick": "22000000000" } ] } @@ -111,106 +21,106 @@ { "opponent": "tz1gjaF81ZRRvdzjobyfVNsAeSC6PScjfQwN", "start_tick": "0", - "end_tick": "11000000000", + "end_tick": "343750000", "dissection": [ { "tick": "0" }, { - "tick": "343750000" + "tick": "10742187" }, { - "tick": "687500000" + "tick": "21484374" }, { - "tick": "1031250000" + "tick": "32226561" }, { - "tick": "1375000000" + "tick": "42968748" }, { - "tick": "1718750000" + "tick": "53710935" }, { - "tick": "2062500000" + "tick": "64453122" }, { - "tick": "2406250000" + "tick": "75195309" }, { - "tick": "2750000000" + "tick": "85937496" }, { - "tick": "3093750000" + "tick": "96679683" }, { - "tick": "3437500000" + "tick": "107421870" }, { - "tick": "3781250000" + "tick": "118164057" }, { - "tick": "4125000000" + "tick": "128906244" }, { - "tick": "4468750000" + "tick": "139648431" }, { - "tick": "4812500000" + "tick": "150390618" }, { - "tick": "5156250000" + "tick": "161132805" }, { - "tick": "5500000000" + "tick": "171874992" }, { - "tick": "5843750000" + "tick": "182617179" }, { - "tick": "6187500000" + "tick": "193359366" }, { - "tick": "6531250000" + "tick": "204101553" }, { - "tick": "6875000000" + "tick": "214843740" }, { - "tick": "7218750000" + "tick": "225585927" }, { - "tick": "7562500000" + "tick": "236328114" }, { - "tick": "7906250000" + "tick": "247070301" }, { - "tick": "8250000000" + "tick": "257812488" }, { - "tick": "8593750000" + "tick": "268554675" }, { - "tick": "8937500000" + "tick": "279296862" }, { - "tick": "9281250000" + "tick": "290039049" }, { - "tick": "9625000000" + "tick": "300781236" }, { - "tick": "9968750000" + "tick": "311523423" }, { - "tick": "10312500000" + "tick": "322265610" }, { - "tick": "10656250000" + "tick": "333007797" }, { - "tick": "11000000000" + "tick": "343750000" } ] } @@ -219,106 +129,106 @@ { "opponent": "tz1gjaF81ZRRvdzjobyfVNsAeSC6PScjfQwN", "start_tick": "0", - "end_tick": "10742187", + "end_tick": "335693", "dissection": [ { "tick": "0" }, { - "tick": "335693" + "tick": "10490" }, { - "tick": "671386" + "tick": "20980" }, { - "tick": "1007079" + "tick": "31470" }, { - "tick": "1342772" + "tick": "41960" }, { - "tick": "1678465" + "tick": "52450" }, { - "tick": "2014158" + "tick": "62940" }, { - "tick": "2349851" + "tick": "73430" }, { - "tick": "2685544" + "tick": "83920" }, { - "tick": "3021237" + "tick": "94410" }, { - "tick": "3356930" + "tick": "104900" }, { - "tick": "3692623" + "tick": "115390" }, { - "tick": "4028316" + "tick": "125880" }, { - "tick": "4364009" + "tick": "136370" }, { - "tick": "4699702" + "tick": "146860" }, { - "tick": "5035395" + "tick": "157350" }, { - "tick": "5371088" + "tick": "167840" }, { - "tick": "5706781" + "tick": "178330" }, { - "tick": "6042474" + "tick": "188820" }, { - "tick": "6378167" + "tick": "199310" }, { - "tick": "6713860" + "tick": "209800" }, { - "tick": "7049553" + "tick": "220290" }, { - "tick": "7385246" + "tick": "230780" }, { - "tick": "7720939" + "tick": "241270" }, { - "tick": "8056632" + "tick": "251760" }, { - "tick": "8392325" + "tick": "262250" }, { - "tick": "8728018" + "tick": "272740" }, { - "tick": "9063711" + "tick": "283230" }, { - "tick": "9399404" + "tick": "293720" }, { - "tick": "9735097" + "tick": "304210" }, { - "tick": "10070790" + "tick": "314700" }, { - "tick": "10406483" + "tick": "325190" }, { - "tick": "10742187" + "tick": "335693" } ] } @@ -327,106 +237,106 @@ { "opponent": "tz1gjaF81ZRRvdzjobyfVNsAeSC6PScjfQwN", "start_tick": "0", - "end_tick": "10490", + "end_tick": "327", "dissection": [ { "tick": "0" }, { - "tick": "327" + "tick": "10" }, { - "tick": "654" + "tick": "20" }, { - "tick": "981" + "tick": "30" }, { - "tick": "1308" + "tick": "40" }, { - "tick": "1635" + "tick": "50" }, { - "tick": "1962" + "tick": "60" }, { - "tick": "2289" + "tick": "70" }, { - "tick": "2616" + "tick": "80" }, { - "tick": "2943" + "tick": "90" }, { - "tick": "3270" + "tick": "100" }, { - "tick": "3597" + "tick": "110" }, { - "tick": "3924" + "tick": "120" }, { - "tick": "4251" + "tick": "130" }, { - "tick": "4578" + "tick": "140" }, { - "tick": "4905" + "tick": "150" }, { - "tick": "5232" + "tick": "160" }, { - "tick": "5559" + "tick": "170" }, { - "tick": "5886" + "tick": "180" }, { - "tick": "6213" + "tick": "190" }, { - "tick": "6540" + "tick": "200" }, { - "tick": "6867" + "tick": "210" }, { - "tick": "7194" + "tick": "220" }, { - "tick": "7521" + "tick": "230" }, { - "tick": "7848" + "tick": "240" }, { - "tick": "8175" + "tick": "250" }, { - "tick": "8502" + "tick": "260" }, { - "tick": "8829" + "tick": "270" }, { - "tick": "9156" + "tick": "280" }, { - "tick": "9483" + "tick": "290" }, { - "tick": "9810" + "tick": "300" }, { - "tick": "10137" + "tick": "310" }, { - "tick": "10490" + "tick": "327" } ] } @@ -435,40 +345,13 @@ { "opponent": "tz1gjaF81ZRRvdzjobyfVNsAeSC6PScjfQwN", "start_tick": "0", - "end_tick": "10", + "end_tick": "1", "dissection": [ { "tick": "0" }, { "tick": "1" - }, - { - "tick": "2" - }, - { - "tick": "3" - }, - { - "tick": "4" - }, - { - "tick": "5" - }, - { - "tick": "6" - }, - { - "tick": "7" - }, - { - "tick": "8" - }, - { - "tick": "9" - }, - { - "tick": "10" } ] } diff --git a/tezt/tests/expected/sc_rollup.ml/Mumbai- wasm_2_0_0 - refutation games winning strategies (inbox_proof_1).out b/tezt/tests/expected/sc_rollup.ml/Mumbai- wasm_2_0_0 - refutation games winning strategies (inbox_proof_1).out index 5994a7d55da0..c62802d88db7 100644 --- a/tezt/tests/expected/sc_rollup.ml/Mumbai- wasm_2_0_0 - refutation games winning strategies (inbox_proof_1).out +++ b/tezt/tests/expected/sc_rollup.ml/Mumbai- wasm_2_0_0 - refutation games winning strategies (inbox_proof_1).out @@ -3,106 +3,16 @@ { "opponent": "tz1gjaF81ZRRvdzjobyfVNsAeSC6PScjfQwN", "start_tick": "0", - "end_tick": "990000000000", + "end_tick": "22000000000", "dissection": [ { "tick": "0" }, { - "tick": "22000000000" - }, - { - "tick": "44000000000" - }, - { - "tick": "66000000000" - }, - { - "tick": "88000000000" - }, - { - "tick": "110000000000" - }, - { - "tick": "132000000000" - }, - { - "tick": "165000000000" - }, - { - "tick": "198000000000" - }, - { - "tick": "231000000000" - }, - { - "tick": "264000000000" - }, - { - "tick": "297000000000" - }, - { - "tick": "330000000000" - }, - { - "tick": "363000000000" - }, - { - "tick": "396000000000" - }, - { - "tick": "429000000000" - }, - { - "tick": "462000000000" - }, - { - "tick": "495000000000" - }, - { - "tick": "528000000000" - }, - { - "tick": "561000000000" - }, - { - "tick": "594000000000" - }, - { - "tick": "627000000000" - }, - { - "tick": "660000000000" - }, - { - "tick": "693000000000" - }, - { - "tick": "726000000000" - }, - { - "tick": "759000000000" - }, - { - "tick": "792000000000" - }, - { - "tick": "825000000000" - }, - { - "tick": "858000000000" - }, - { - "tick": "891000000000" - }, - { - "tick": "924000000000" - }, - { - "tick": "957000000000" + "tick": "11000000000" }, { - "tick": "990000000000" + "tick": "22000000000" } ] } @@ -111,106 +21,106 @@ { "opponent": "tz1gjaF81ZRRvdzjobyfVNsAeSC6PScjfQwN", "start_tick": "0", - "end_tick": "11000000000", + "end_tick": "343750000", "dissection": [ { "tick": "0" }, { - "tick": "343750000" + "tick": "10742187" }, { - "tick": "687500000" + "tick": "21484374" }, { - "tick": "1031250000" + "tick": "32226561" }, { - "tick": "1375000000" + "tick": "42968748" }, { - "tick": "1718750000" + "tick": "53710935" }, { - "tick": "2062500000" + "tick": "64453122" }, { - "tick": "2406250000" + "tick": "75195309" }, { - "tick": "2750000000" + "tick": "85937496" }, { - "tick": "3093750000" + "tick": "96679683" }, { - "tick": "3437500000" + "tick": "107421870" }, { - "tick": "3781250000" + "tick": "118164057" }, { - "tick": "4125000000" + "tick": "128906244" }, { - "tick": "4468750000" + "tick": "139648431" }, { - "tick": "4812500000" + "tick": "150390618" }, { - "tick": "5156250000" + "tick": "161132805" }, { - "tick": "5500000000" + "tick": "171874992" }, { - "tick": "5843750000" + "tick": "182617179" }, { - "tick": "6187500000" + "tick": "193359366" }, { - "tick": "6531250000" + "tick": "204101553" }, { - "tick": "6875000000" + "tick": "214843740" }, { - "tick": "7218750000" + "tick": "225585927" }, { - "tick": "7562500000" + "tick": "236328114" }, { - "tick": "7906250000" + "tick": "247070301" }, { - "tick": "8250000000" + "tick": "257812488" }, { - "tick": "8593750000" + "tick": "268554675" }, { - "tick": "8937500000" + "tick": "279296862" }, { - "tick": "9281250000" + "tick": "290039049" }, { - "tick": "9625000000" + "tick": "300781236" }, { - "tick": "9968750000" + "tick": "311523423" }, { - "tick": "10312500000" + "tick": "322265610" }, { - "tick": "10656250000" + "tick": "333007797" }, { - "tick": "11000000000" + "tick": "343750000" } ] } @@ -219,106 +129,106 @@ { "opponent": "tz1gjaF81ZRRvdzjobyfVNsAeSC6PScjfQwN", "start_tick": "0", - "end_tick": "10742187", + "end_tick": "335693", "dissection": [ { "tick": "0" }, { - "tick": "335693" + "tick": "10490" }, { - "tick": "671386" + "tick": "20980" }, { - "tick": "1007079" + "tick": "31470" }, { - "tick": "1342772" + "tick": "41960" }, { - "tick": "1678465" + "tick": "52450" }, { - "tick": "2014158" + "tick": "62940" }, { - "tick": "2349851" + "tick": "73430" }, { - "tick": "2685544" + "tick": "83920" }, { - "tick": "3021237" + "tick": "94410" }, { - "tick": "3356930" + "tick": "104900" }, { - "tick": "3692623" + "tick": "115390" }, { - "tick": "4028316" + "tick": "125880" }, { - "tick": "4364009" + "tick": "136370" }, { - "tick": "4699702" + "tick": "146860" }, { - "tick": "5035395" + "tick": "157350" }, { - "tick": "5371088" + "tick": "167840" }, { - "tick": "5706781" + "tick": "178330" }, { - "tick": "6042474" + "tick": "188820" }, { - "tick": "6378167" + "tick": "199310" }, { - "tick": "6713860" + "tick": "209800" }, { - "tick": "7049553" + "tick": "220290" }, { - "tick": "7385246" + "tick": "230780" }, { - "tick": "7720939" + "tick": "241270" }, { - "tick": "8056632" + "tick": "251760" }, { - "tick": "8392325" + "tick": "262250" }, { - "tick": "8728018" + "tick": "272740" }, { - "tick": "9063711" + "tick": "283230" }, { - "tick": "9399404" + "tick": "293720" }, { - "tick": "9735097" + "tick": "304210" }, { - "tick": "10070790" + "tick": "314700" }, { - "tick": "10406483" + "tick": "325190" }, { - "tick": "10742187" + "tick": "335693" } ] } @@ -327,106 +237,106 @@ { "opponent": "tz1gjaF81ZRRvdzjobyfVNsAeSC6PScjfQwN", "start_tick": "0", - "end_tick": "10490", + "end_tick": "327", "dissection": [ { "tick": "0" }, { - "tick": "327" + "tick": "10" }, { - "tick": "654" + "tick": "20" }, { - "tick": "981" + "tick": "30" }, { - "tick": "1308" + "tick": "40" }, { - "tick": "1635" + "tick": "50" }, { - "tick": "1962" + "tick": "60" }, { - "tick": "2289" + "tick": "70" }, { - "tick": "2616" + "tick": "80" }, { - "tick": "2943" + "tick": "90" }, { - "tick": "3270" + "tick": "100" }, { - "tick": "3597" + "tick": "110" }, { - "tick": "3924" + "tick": "120" }, { - "tick": "4251" + "tick": "130" }, { - "tick": "4578" + "tick": "140" }, { - "tick": "4905" + "tick": "150" }, { - "tick": "5232" + "tick": "160" }, { - "tick": "5559" + "tick": "170" }, { - "tick": "5886" + "tick": "180" }, { - "tick": "6213" + "tick": "190" }, { - "tick": "6540" + "tick": "200" }, { - "tick": "6867" + "tick": "210" }, { - "tick": "7194" + "tick": "220" }, { - "tick": "7521" + "tick": "230" }, { - "tick": "7848" + "tick": "240" }, { - "tick": "8175" + "tick": "250" }, { - "tick": "8502" + "tick": "260" }, { - "tick": "8829" + "tick": "270" }, { - "tick": "9156" + "tick": "280" }, { - "tick": "9483" + "tick": "290" }, { - "tick": "9810" + "tick": "300" }, { - "tick": "10137" + "tick": "310" }, { - "tick": "10490" + "tick": "327" } ] } @@ -434,41 +344,14 @@ { "opponent": "tz1gjaF81ZRRvdzjobyfVNsAeSC6PScjfQwN", - "start_tick": "0", - "end_tick": "10", + "start_tick": "4", + "end_tick": "5", "dissection": [ - { - "tick": "0" - }, - { - "tick": "1" - }, - { - "tick": "2" - }, - { - "tick": "3" - }, { "tick": "4" }, { "tick": "5" - }, - { - "tick": "6" - }, - { - "tick": "7" - }, - { - "tick": "8" - }, - { - "tick": "9" - }, - { - "tick": "10" } ] } diff --git a/tezt/tests/expected/sc_rollup.ml/Mumbai- wasm_2_0_0 - refutation games winning strategies (pvm_proof_0).out b/tezt/tests/expected/sc_rollup.ml/Mumbai- wasm_2_0_0 - refutation games winning strategies (pvm_proof_0).out index a55a3d1ac3d2..97cf7e39daab 100644 --- a/tezt/tests/expected/sc_rollup.ml/Mumbai- wasm_2_0_0 - refutation games winning strategies (pvm_proof_0).out +++ b/tezt/tests/expected/sc_rollup.ml/Mumbai- wasm_2_0_0 - refutation games winning strategies (pvm_proof_0).out @@ -2,107 +2,20 @@ { "opponent": "tz1gjaF81ZRRvdzjobyfVNsAeSC6PScjfQwN", - "start_tick": "0", - "end_tick": "990000000000", + "start_tick": "198000000000", + "end_tick": "231000000000", "dissection": [ - { - "tick": "0" - }, - { - "tick": "22000000000" - }, - { - "tick": "44000000000" - }, - { - "tick": "66000000000" - }, - { - "tick": "88000000000" - }, - { - "tick": "110000000000" - }, - { - "tick": "132000000000" - }, - { - "tick": "165000000000" - }, { "tick": "198000000000" }, { - "tick": "231000000000" - }, - { - "tick": "264000000000" - }, - { - "tick": "297000000000" - }, - { - "tick": "330000000000" - }, - { - "tick": "363000000000" - }, - { - "tick": "396000000000" - }, - { - "tick": "429000000000" - }, - { - "tick": "462000000000" - }, - { - "tick": "495000000000" - }, - { - "tick": "528000000000" - }, - { - "tick": "561000000000" - }, - { - "tick": "594000000000" - }, - { - "tick": "627000000000" - }, - { - "tick": "660000000000" - }, - { - "tick": "693000000000" - }, - { - "tick": "726000000000" - }, - { - "tick": "759000000000" - }, - { - "tick": "792000000000" - }, - { - "tick": "825000000000" - }, - { - "tick": "858000000000" - }, - { - "tick": "891000000000" - }, - { - "tick": "924000000000" + "tick": "209000000000" }, { - "tick": "957000000000" + "tick": "220000000000" }, { - "tick": "990000000000" + "tick": "231000000000" } ] } @@ -111,106 +24,106 @@ { "opponent": "tz1gjaF81ZRRvdzjobyfVNsAeSC6PScjfQwN", "start_tick": "198000000000", - "end_tick": "209000000000", + "end_tick": "198343750000", "dissection": [ { "tick": "198000000000" }, { - "tick": "198343750000" + "tick": "198010742187" }, { - "tick": "198687500000" + "tick": "198021484374" }, { - "tick": "199031250000" + "tick": "198032226561" }, { - "tick": "199375000000" + "tick": "198042968748" }, { - "tick": "199718750000" + "tick": "198053710935" }, { - "tick": "200062500000" + "tick": "198064453122" }, { - "tick": "200406250000" + "tick": "198075195309" }, { - "tick": "200750000000" + "tick": "198085937496" }, { - "tick": "201093750000" + "tick": "198096679683" }, { - "tick": "201437500000" + "tick": "198107421870" }, { - "tick": "201781250000" + "tick": "198118164057" }, { - "tick": "202125000000" + "tick": "198128906244" }, { - "tick": "202468750000" + "tick": "198139648431" }, { - "tick": "202812500000" + "tick": "198150390618" }, { - "tick": "203156250000" + "tick": "198161132805" }, { - "tick": "203500000000" + "tick": "198171874992" }, { - "tick": "203843750000" + "tick": "198182617179" }, { - "tick": "204187500000" + "tick": "198193359366" }, { - "tick": "204531250000" + "tick": "198204101553" }, { - "tick": "204875000000" + "tick": "198214843740" }, { - "tick": "205218750000" + "tick": "198225585927" }, { - "tick": "205562500000" + "tick": "198236328114" }, { - "tick": "205906250000" + "tick": "198247070301" }, { - "tick": "206250000000" + "tick": "198257812488" }, { - "tick": "206593750000" + "tick": "198268554675" }, { - "tick": "206937500000" + "tick": "198279296862" }, { - "tick": "207281250000" + "tick": "198290039049" }, { - "tick": "207625000000" + "tick": "198300781236" }, { - "tick": "207968750000" + "tick": "198311523423" }, { - "tick": "208312500000" + "tick": "198322265610" }, { - "tick": "208656250000" + "tick": "198333007797" }, { - "tick": "209000000000" + "tick": "198343750000" } ] } @@ -219,106 +132,106 @@ { "opponent": "tz1gjaF81ZRRvdzjobyfVNsAeSC6PScjfQwN", "start_tick": "198000000000", - "end_tick": "198010742187", + "end_tick": "198000335693", "dissection": [ { "tick": "198000000000" }, { - "tick": "198000335693" + "tick": "198000010490" }, { - "tick": "198000671386" + "tick": "198000020980" }, { - "tick": "198001007079" + "tick": "198000031470" }, { - "tick": "198001342772" + "tick": "198000041960" }, { - "tick": "198001678465" + "tick": "198000052450" }, { - "tick": "198002014158" + "tick": "198000062940" }, { - "tick": "198002349851" + "tick": "198000073430" }, { - "tick": "198002685544" + "tick": "198000083920" }, { - "tick": "198003021237" + "tick": "198000094410" }, { - "tick": "198003356930" + "tick": "198000104900" }, { - "tick": "198003692623" + "tick": "198000115390" }, { - "tick": "198004028316" + "tick": "198000125880" }, { - "tick": "198004364009" + "tick": "198000136370" }, { - "tick": "198004699702" + "tick": "198000146860" }, { - "tick": "198005035395" + "tick": "198000157350" }, { - "tick": "198005371088" + "tick": "198000167840" }, { - "tick": "198005706781" + "tick": "198000178330" }, { - "tick": "198006042474" + "tick": "198000188820" }, { - "tick": "198006378167" + "tick": "198000199310" }, { - "tick": "198006713860" + "tick": "198000209800" }, { - "tick": "198007049553" + "tick": "198000220290" }, { - "tick": "198007385246" + "tick": "198000230780" }, { - "tick": "198007720939" + "tick": "198000241270" }, { - "tick": "198008056632" + "tick": "198000251760" }, { - "tick": "198008392325" + "tick": "198000262250" }, { - "tick": "198008728018" + "tick": "198000272740" }, { - "tick": "198009063711" + "tick": "198000283230" }, { - "tick": "198009399404" + "tick": "198000293720" }, { - "tick": "198009735097" + "tick": "198000304210" }, { - "tick": "198010070790" + "tick": "198000314700" }, { - "tick": "198010406483" + "tick": "198000325190" }, { - "tick": "198010742187" + "tick": "198000335693" } ] } @@ -327,106 +240,106 @@ { "opponent": "tz1gjaF81ZRRvdzjobyfVNsAeSC6PScjfQwN", "start_tick": "198000000000", - "end_tick": "198000010490", + "end_tick": "198000000327", "dissection": [ { "tick": "198000000000" }, { - "tick": "198000000327" + "tick": "198000000010" }, { - "tick": "198000000654" + "tick": "198000000020" }, { - "tick": "198000000981" + "tick": "198000000030" }, { - "tick": "198000001308" + "tick": "198000000040" }, { - "tick": "198000001635" + "tick": "198000000050" }, { - "tick": "198000001962" + "tick": "198000000060" }, { - "tick": "198000002289" + "tick": "198000000070" }, { - "tick": "198000002616" + "tick": "198000000080" }, { - "tick": "198000002943" + "tick": "198000000090" }, { - "tick": "198000003270" + "tick": "198000000100" }, { - "tick": "198000003597" + "tick": "198000000110" }, { - "tick": "198000003924" + "tick": "198000000120" }, { - "tick": "198000004251" + "tick": "198000000130" }, { - "tick": "198000004578" + "tick": "198000000140" }, { - "tick": "198000004905" + "tick": "198000000150" }, { - "tick": "198000005232" + "tick": "198000000160" }, { - "tick": "198000005559" + "tick": "198000000170" }, { - "tick": "198000005886" + "tick": "198000000180" }, { - "tick": "198000006213" + "tick": "198000000190" }, { - "tick": "198000006540" + "tick": "198000000200" }, { - "tick": "198000006867" + "tick": "198000000210" }, { - "tick": "198000007194" + "tick": "198000000220" }, { - "tick": "198000007521" + "tick": "198000000230" }, { - "tick": "198000007848" + "tick": "198000000240" }, { - "tick": "198000008175" + "tick": "198000000250" }, { - "tick": "198000008502" + "tick": "198000000260" }, { - "tick": "198000008829" + "tick": "198000000270" }, { - "tick": "198000009156" + "tick": "198000000280" }, { - "tick": "198000009483" + "tick": "198000000290" }, { - "tick": "198000009810" + "tick": "198000000300" }, { - "tick": "198000010137" + "tick": "198000000310" }, { - "tick": "198000010490" + "tick": "198000000327" } ] } @@ -434,41 +347,14 @@ { "opponent": "tz1gjaF81ZRRvdzjobyfVNsAeSC6PScjfQwN", - "start_tick": "198000000000", - "end_tick": "198000000010", + "start_tick": "198000000008", + "end_tick": "198000000009", "dissection": [ - { - "tick": "198000000000" - }, - { - "tick": "198000000001" - }, - { - "tick": "198000000002" - }, - { - "tick": "198000000003" - }, - { - "tick": "198000000004" - }, - { - "tick": "198000000005" - }, - { - "tick": "198000000006" - }, - { - "tick": "198000000007" - }, { "tick": "198000000008" }, { "tick": "198000000009" - }, - { - "tick": "198000000010" } ] } diff --git a/tezt/tests/expected/sc_rollup.ml/Mumbai- wasm_2_0_0 - refutation games winning strategies (pvm_proof_1).out b/tezt/tests/expected/sc_rollup.ml/Mumbai- wasm_2_0_0 - refutation games winning strategies (pvm_proof_1).out index 697c6fab249d..29b87b472190 100644 --- a/tezt/tests/expected/sc_rollup.ml/Mumbai- wasm_2_0_0 - refutation games winning strategies (pvm_proof_1).out +++ b/tezt/tests/expected/sc_rollup.ml/Mumbai- wasm_2_0_0 - refutation games winning strategies (pvm_proof_1).out @@ -2,107 +2,20 @@ { "opponent": "tz1gjaF81ZRRvdzjobyfVNsAeSC6PScjfQwN", - "start_tick": "0", - "end_tick": "990000000000", + "start_tick": "396000000000", + "end_tick": "429000000000", "dissection": [ - { - "tick": "0" - }, - { - "tick": "22000000000" - }, - { - "tick": "44000000000" - }, - { - "tick": "66000000000" - }, - { - "tick": "88000000000" - }, - { - "tick": "110000000000" - }, - { - "tick": "132000000000" - }, - { - "tick": "165000000000" - }, - { - "tick": "198000000000" - }, - { - "tick": "231000000000" - }, - { - "tick": "264000000000" - }, - { - "tick": "297000000000" - }, - { - "tick": "330000000000" - }, - { - "tick": "363000000000" - }, { "tick": "396000000000" }, { - "tick": "429000000000" - }, - { - "tick": "462000000000" - }, - { - "tick": "495000000000" - }, - { - "tick": "528000000000" - }, - { - "tick": "561000000000" - }, - { - "tick": "594000000000" - }, - { - "tick": "627000000000" - }, - { - "tick": "660000000000" - }, - { - "tick": "693000000000" - }, - { - "tick": "726000000000" - }, - { - "tick": "759000000000" - }, - { - "tick": "792000000000" - }, - { - "tick": "825000000000" - }, - { - "tick": "858000000000" - }, - { - "tick": "891000000000" - }, - { - "tick": "924000000000" + "tick": "407000000000" }, { - "tick": "957000000000" + "tick": "418000000000" }, { - "tick": "990000000000" + "tick": "429000000000" } ] } @@ -111,106 +24,106 @@ { "opponent": "tz1gjaF81ZRRvdzjobyfVNsAeSC6PScjfQwN", "start_tick": "396000000000", - "end_tick": "407000000000", + "end_tick": "396343750000", "dissection": [ { "tick": "396000000000" }, { - "tick": "396343750000" + "tick": "396010742187" }, { - "tick": "396687500000" + "tick": "396021484374" }, { - "tick": "397031250000" + "tick": "396032226561" }, { - "tick": "397375000000" + "tick": "396042968748" }, { - "tick": "397718750000" + "tick": "396053710935" }, { - "tick": "398062500000" + "tick": "396064453122" }, { - "tick": "398406250000" + "tick": "396075195309" }, { - "tick": "398750000000" + "tick": "396085937496" }, { - "tick": "399093750000" + "tick": "396096679683" }, { - "tick": "399437500000" + "tick": "396107421870" }, { - "tick": "399781250000" + "tick": "396118164057" }, { - "tick": "400125000000" + "tick": "396128906244" }, { - "tick": "400468750000" + "tick": "396139648431" }, { - "tick": "400812500000" + "tick": "396150390618" }, { - "tick": "401156250000" + "tick": "396161132805" }, { - "tick": "401500000000" + "tick": "396171874992" }, { - "tick": "401843750000" + "tick": "396182617179" }, { - "tick": "402187500000" + "tick": "396193359366" }, { - "tick": "402531250000" + "tick": "396204101553" }, { - "tick": "402875000000" + "tick": "396214843740" }, { - "tick": "403218750000" + "tick": "396225585927" }, { - "tick": "403562500000" + "tick": "396236328114" }, { - "tick": "403906250000" + "tick": "396247070301" }, { - "tick": "404250000000" + "tick": "396257812488" }, { - "tick": "404593750000" + "tick": "396268554675" }, { - "tick": "404937500000" + "tick": "396279296862" }, { - "tick": "405281250000" + "tick": "396290039049" }, { - "tick": "405625000000" + "tick": "396300781236" }, { - "tick": "405968750000" + "tick": "396311523423" }, { - "tick": "406312500000" + "tick": "396322265610" }, { - "tick": "406656250000" + "tick": "396333007797" }, { - "tick": "407000000000" + "tick": "396343750000" } ] } @@ -219,106 +132,106 @@ { "opponent": "tz1gjaF81ZRRvdzjobyfVNsAeSC6PScjfQwN", "start_tick": "396000000000", - "end_tick": "396010742187", + "end_tick": "396000335693", "dissection": [ { "tick": "396000000000" }, { - "tick": "396000335693" + "tick": "396000010490" }, { - "tick": "396000671386" + "tick": "396000020980" }, { - "tick": "396001007079" + "tick": "396000031470" }, { - "tick": "396001342772" + "tick": "396000041960" }, { - "tick": "396001678465" + "tick": "396000052450" }, { - "tick": "396002014158" + "tick": "396000062940" }, { - "tick": "396002349851" + "tick": "396000073430" }, { - "tick": "396002685544" + "tick": "396000083920" }, { - "tick": "396003021237" + "tick": "396000094410" }, { - "tick": "396003356930" + "tick": "396000104900" }, { - "tick": "396003692623" + "tick": "396000115390" }, { - "tick": "396004028316" + "tick": "396000125880" }, { - "tick": "396004364009" + "tick": "396000136370" }, { - "tick": "396004699702" + "tick": "396000146860" }, { - "tick": "396005035395" + "tick": "396000157350" }, { - "tick": "396005371088" + "tick": "396000167840" }, { - "tick": "396005706781" + "tick": "396000178330" }, { - "tick": "396006042474" + "tick": "396000188820" }, { - "tick": "396006378167" + "tick": "396000199310" }, { - "tick": "396006713860" + "tick": "396000209800" }, { - "tick": "396007049553" + "tick": "396000220290" }, { - "tick": "396007385246" + "tick": "396000230780" }, { - "tick": "396007720939" + "tick": "396000241270" }, { - "tick": "396008056632" + "tick": "396000251760" }, { - "tick": "396008392325" + "tick": "396000262250" }, { - "tick": "396008728018" + "tick": "396000272740" }, { - "tick": "396009063711" + "tick": "396000283230" }, { - "tick": "396009399404" + "tick": "396000293720" }, { - "tick": "396009735097" + "tick": "396000304210" }, { - "tick": "396010070790" + "tick": "396000314700" }, { - "tick": "396010406483" + "tick": "396000325190" }, { - "tick": "396010742187" + "tick": "396000335693" } ] } @@ -327,106 +240,106 @@ { "opponent": "tz1gjaF81ZRRvdzjobyfVNsAeSC6PScjfQwN", "start_tick": "396000000000", - "end_tick": "396000010490", + "end_tick": "396000000327", "dissection": [ { "tick": "396000000000" }, { - "tick": "396000000327" + "tick": "396000000010" }, { - "tick": "396000000654" + "tick": "396000000020" }, { - "tick": "396000000981" + "tick": "396000000030" }, { - "tick": "396000001308" + "tick": "396000000040" }, { - "tick": "396000001635" + "tick": "396000000050" }, { - "tick": "396000001962" + "tick": "396000000060" }, { - "tick": "396000002289" + "tick": "396000000070" }, { - "tick": "396000002616" + "tick": "396000000080" }, { - "tick": "396000002943" + "tick": "396000000090" }, { - "tick": "396000003270" + "tick": "396000000100" }, { - "tick": "396000003597" + "tick": "396000000110" }, { - "tick": "396000003924" + "tick": "396000000120" }, { - "tick": "396000004251" + "tick": "396000000130" }, { - "tick": "396000004578" + "tick": "396000000140" }, { - "tick": "396000004905" + "tick": "396000000150" }, { - "tick": "396000005232" + "tick": "396000000160" }, { - "tick": "396000005559" + "tick": "396000000170" }, { - "tick": "396000005886" + "tick": "396000000180" }, { - "tick": "396000006213" + "tick": "396000000190" }, { - "tick": "396000006540" + "tick": "396000000200" }, { - "tick": "396000006867" + "tick": "396000000210" }, { - "tick": "396000007194" + "tick": "396000000220" }, { - "tick": "396000007521" + "tick": "396000000230" }, { - "tick": "396000007848" + "tick": "396000000240" }, { - "tick": "396000008175" + "tick": "396000000250" }, { - "tick": "396000008502" + "tick": "396000000260" }, { - "tick": "396000008829" + "tick": "396000000270" }, { - "tick": "396000009156" + "tick": "396000000280" }, { - "tick": "396000009483" + "tick": "396000000290" }, { - "tick": "396000009810" + "tick": "396000000300" }, { - "tick": "396000010137" + "tick": "396000000310" }, { - "tick": "396000010490" + "tick": "396000000327" } ] } @@ -434,41 +347,14 @@ { "opponent": "tz1gjaF81ZRRvdzjobyfVNsAeSC6PScjfQwN", - "start_tick": "396000000000", - "end_tick": "396000000010", + "start_tick": "396000000008", + "end_tick": "396000000009", "dissection": [ - { - "tick": "396000000000" - }, - { - "tick": "396000000001" - }, - { - "tick": "396000000002" - }, - { - "tick": "396000000003" - }, - { - "tick": "396000000004" - }, - { - "tick": "396000000005" - }, - { - "tick": "396000000006" - }, - { - "tick": "396000000007" - }, { "tick": "396000000008" }, { "tick": "396000000009" - }, - { - "tick": "396000000010" } ] } diff --git a/tezt/tests/expected/sc_rollup.ml/Mumbai- wasm_2_0_0 - refutation games winning strategies (pvm_proof_2).out b/tezt/tests/expected/sc_rollup.ml/Mumbai- wasm_2_0_0 - refutation games winning strategies (pvm_proof_2).out index 697c6fab249d..29b87b472190 100644 --- a/tezt/tests/expected/sc_rollup.ml/Mumbai- wasm_2_0_0 - refutation games winning strategies (pvm_proof_2).out +++ b/tezt/tests/expected/sc_rollup.ml/Mumbai- wasm_2_0_0 - refutation games winning strategies (pvm_proof_2).out @@ -2,107 +2,20 @@ { "opponent": "tz1gjaF81ZRRvdzjobyfVNsAeSC6PScjfQwN", - "start_tick": "0", - "end_tick": "990000000000", + "start_tick": "396000000000", + "end_tick": "429000000000", "dissection": [ - { - "tick": "0" - }, - { - "tick": "22000000000" - }, - { - "tick": "44000000000" - }, - { - "tick": "66000000000" - }, - { - "tick": "88000000000" - }, - { - "tick": "110000000000" - }, - { - "tick": "132000000000" - }, - { - "tick": "165000000000" - }, - { - "tick": "198000000000" - }, - { - "tick": "231000000000" - }, - { - "tick": "264000000000" - }, - { - "tick": "297000000000" - }, - { - "tick": "330000000000" - }, - { - "tick": "363000000000" - }, { "tick": "396000000000" }, { - "tick": "429000000000" - }, - { - "tick": "462000000000" - }, - { - "tick": "495000000000" - }, - { - "tick": "528000000000" - }, - { - "tick": "561000000000" - }, - { - "tick": "594000000000" - }, - { - "tick": "627000000000" - }, - { - "tick": "660000000000" - }, - { - "tick": "693000000000" - }, - { - "tick": "726000000000" - }, - { - "tick": "759000000000" - }, - { - "tick": "792000000000" - }, - { - "tick": "825000000000" - }, - { - "tick": "858000000000" - }, - { - "tick": "891000000000" - }, - { - "tick": "924000000000" + "tick": "407000000000" }, { - "tick": "957000000000" + "tick": "418000000000" }, { - "tick": "990000000000" + "tick": "429000000000" } ] } @@ -111,106 +24,106 @@ { "opponent": "tz1gjaF81ZRRvdzjobyfVNsAeSC6PScjfQwN", "start_tick": "396000000000", - "end_tick": "407000000000", + "end_tick": "396343750000", "dissection": [ { "tick": "396000000000" }, { - "tick": "396343750000" + "tick": "396010742187" }, { - "tick": "396687500000" + "tick": "396021484374" }, { - "tick": "397031250000" + "tick": "396032226561" }, { - "tick": "397375000000" + "tick": "396042968748" }, { - "tick": "397718750000" + "tick": "396053710935" }, { - "tick": "398062500000" + "tick": "396064453122" }, { - "tick": "398406250000" + "tick": "396075195309" }, { - "tick": "398750000000" + "tick": "396085937496" }, { - "tick": "399093750000" + "tick": "396096679683" }, { - "tick": "399437500000" + "tick": "396107421870" }, { - "tick": "399781250000" + "tick": "396118164057" }, { - "tick": "400125000000" + "tick": "396128906244" }, { - "tick": "400468750000" + "tick": "396139648431" }, { - "tick": "400812500000" + "tick": "396150390618" }, { - "tick": "401156250000" + "tick": "396161132805" }, { - "tick": "401500000000" + "tick": "396171874992" }, { - "tick": "401843750000" + "tick": "396182617179" }, { - "tick": "402187500000" + "tick": "396193359366" }, { - "tick": "402531250000" + "tick": "396204101553" }, { - "tick": "402875000000" + "tick": "396214843740" }, { - "tick": "403218750000" + "tick": "396225585927" }, { - "tick": "403562500000" + "tick": "396236328114" }, { - "tick": "403906250000" + "tick": "396247070301" }, { - "tick": "404250000000" + "tick": "396257812488" }, { - "tick": "404593750000" + "tick": "396268554675" }, { - "tick": "404937500000" + "tick": "396279296862" }, { - "tick": "405281250000" + "tick": "396290039049" }, { - "tick": "405625000000" + "tick": "396300781236" }, { - "tick": "405968750000" + "tick": "396311523423" }, { - "tick": "406312500000" + "tick": "396322265610" }, { - "tick": "406656250000" + "tick": "396333007797" }, { - "tick": "407000000000" + "tick": "396343750000" } ] } @@ -219,106 +132,106 @@ { "opponent": "tz1gjaF81ZRRvdzjobyfVNsAeSC6PScjfQwN", "start_tick": "396000000000", - "end_tick": "396010742187", + "end_tick": "396000335693", "dissection": [ { "tick": "396000000000" }, { - "tick": "396000335693" + "tick": "396000010490" }, { - "tick": "396000671386" + "tick": "396000020980" }, { - "tick": "396001007079" + "tick": "396000031470" }, { - "tick": "396001342772" + "tick": "396000041960" }, { - "tick": "396001678465" + "tick": "396000052450" }, { - "tick": "396002014158" + "tick": "396000062940" }, { - "tick": "396002349851" + "tick": "396000073430" }, { - "tick": "396002685544" + "tick": "396000083920" }, { - "tick": "396003021237" + "tick": "396000094410" }, { - "tick": "396003356930" + "tick": "396000104900" }, { - "tick": "396003692623" + "tick": "396000115390" }, { - "tick": "396004028316" + "tick": "396000125880" }, { - "tick": "396004364009" + "tick": "396000136370" }, { - "tick": "396004699702" + "tick": "396000146860" }, { - "tick": "396005035395" + "tick": "396000157350" }, { - "tick": "396005371088" + "tick": "396000167840" }, { - "tick": "396005706781" + "tick": "396000178330" }, { - "tick": "396006042474" + "tick": "396000188820" }, { - "tick": "396006378167" + "tick": "396000199310" }, { - "tick": "396006713860" + "tick": "396000209800" }, { - "tick": "396007049553" + "tick": "396000220290" }, { - "tick": "396007385246" + "tick": "396000230780" }, { - "tick": "396007720939" + "tick": "396000241270" }, { - "tick": "396008056632" + "tick": "396000251760" }, { - "tick": "396008392325" + "tick": "396000262250" }, { - "tick": "396008728018" + "tick": "396000272740" }, { - "tick": "396009063711" + "tick": "396000283230" }, { - "tick": "396009399404" + "tick": "396000293720" }, { - "tick": "396009735097" + "tick": "396000304210" }, { - "tick": "396010070790" + "tick": "396000314700" }, { - "tick": "396010406483" + "tick": "396000325190" }, { - "tick": "396010742187" + "tick": "396000335693" } ] } @@ -327,106 +240,106 @@ { "opponent": "tz1gjaF81ZRRvdzjobyfVNsAeSC6PScjfQwN", "start_tick": "396000000000", - "end_tick": "396000010490", + "end_tick": "396000000327", "dissection": [ { "tick": "396000000000" }, { - "tick": "396000000327" + "tick": "396000000010" }, { - "tick": "396000000654" + "tick": "396000000020" }, { - "tick": "396000000981" + "tick": "396000000030" }, { - "tick": "396000001308" + "tick": "396000000040" }, { - "tick": "396000001635" + "tick": "396000000050" }, { - "tick": "396000001962" + "tick": "396000000060" }, { - "tick": "396000002289" + "tick": "396000000070" }, { - "tick": "396000002616" + "tick": "396000000080" }, { - "tick": "396000002943" + "tick": "396000000090" }, { - "tick": "396000003270" + "tick": "396000000100" }, { - "tick": "396000003597" + "tick": "396000000110" }, { - "tick": "396000003924" + "tick": "396000000120" }, { - "tick": "396000004251" + "tick": "396000000130" }, { - "tick": "396000004578" + "tick": "396000000140" }, { - "tick": "396000004905" + "tick": "396000000150" }, { - "tick": "396000005232" + "tick": "396000000160" }, { - "tick": "396000005559" + "tick": "396000000170" }, { - "tick": "396000005886" + "tick": "396000000180" }, { - "tick": "396000006213" + "tick": "396000000190" }, { - "tick": "396000006540" + "tick": "396000000200" }, { - "tick": "396000006867" + "tick": "396000000210" }, { - "tick": "396000007194" + "tick": "396000000220" }, { - "tick": "396000007521" + "tick": "396000000230" }, { - "tick": "396000007848" + "tick": "396000000240" }, { - "tick": "396000008175" + "tick": "396000000250" }, { - "tick": "396000008502" + "tick": "396000000260" }, { - "tick": "396000008829" + "tick": "396000000270" }, { - "tick": "396000009156" + "tick": "396000000280" }, { - "tick": "396000009483" + "tick": "396000000290" }, { - "tick": "396000009810" + "tick": "396000000300" }, { - "tick": "396000010137" + "tick": "396000000310" }, { - "tick": "396000010490" + "tick": "396000000327" } ] } @@ -434,41 +347,14 @@ { "opponent": "tz1gjaF81ZRRvdzjobyfVNsAeSC6PScjfQwN", - "start_tick": "396000000000", - "end_tick": "396000000010", + "start_tick": "396000000008", + "end_tick": "396000000009", "dissection": [ - { - "tick": "396000000000" - }, - { - "tick": "396000000001" - }, - { - "tick": "396000000002" - }, - { - "tick": "396000000003" - }, - { - "tick": "396000000004" - }, - { - "tick": "396000000005" - }, - { - "tick": "396000000006" - }, - { - "tick": "396000000007" - }, { "tick": "396000000008" }, { "tick": "396000000009" - }, - { - "tick": "396000000010" } ] } diff --git a/tezt/tests/expected/sc_rollup.ml/Mumbai- wasm_2_0_0 - refutation games winning strategies (pvm_proof_3).out b/tezt/tests/expected/sc_rollup.ml/Mumbai- wasm_2_0_0 - refutation games winning strategies (pvm_proof_3).out index 697c6fab249d..29b87b472190 100644 --- a/tezt/tests/expected/sc_rollup.ml/Mumbai- wasm_2_0_0 - refutation games winning strategies (pvm_proof_3).out +++ b/tezt/tests/expected/sc_rollup.ml/Mumbai- wasm_2_0_0 - refutation games winning strategies (pvm_proof_3).out @@ -2,107 +2,20 @@ { "opponent": "tz1gjaF81ZRRvdzjobyfVNsAeSC6PScjfQwN", - "start_tick": "0", - "end_tick": "990000000000", + "start_tick": "396000000000", + "end_tick": "429000000000", "dissection": [ - { - "tick": "0" - }, - { - "tick": "22000000000" - }, - { - "tick": "44000000000" - }, - { - "tick": "66000000000" - }, - { - "tick": "88000000000" - }, - { - "tick": "110000000000" - }, - { - "tick": "132000000000" - }, - { - "tick": "165000000000" - }, - { - "tick": "198000000000" - }, - { - "tick": "231000000000" - }, - { - "tick": "264000000000" - }, - { - "tick": "297000000000" - }, - { - "tick": "330000000000" - }, - { - "tick": "363000000000" - }, { "tick": "396000000000" }, { - "tick": "429000000000" - }, - { - "tick": "462000000000" - }, - { - "tick": "495000000000" - }, - { - "tick": "528000000000" - }, - { - "tick": "561000000000" - }, - { - "tick": "594000000000" - }, - { - "tick": "627000000000" - }, - { - "tick": "660000000000" - }, - { - "tick": "693000000000" - }, - { - "tick": "726000000000" - }, - { - "tick": "759000000000" - }, - { - "tick": "792000000000" - }, - { - "tick": "825000000000" - }, - { - "tick": "858000000000" - }, - { - "tick": "891000000000" - }, - { - "tick": "924000000000" + "tick": "407000000000" }, { - "tick": "957000000000" + "tick": "418000000000" }, { - "tick": "990000000000" + "tick": "429000000000" } ] } @@ -111,106 +24,106 @@ { "opponent": "tz1gjaF81ZRRvdzjobyfVNsAeSC6PScjfQwN", "start_tick": "396000000000", - "end_tick": "407000000000", + "end_tick": "396343750000", "dissection": [ { "tick": "396000000000" }, { - "tick": "396343750000" + "tick": "396010742187" }, { - "tick": "396687500000" + "tick": "396021484374" }, { - "tick": "397031250000" + "tick": "396032226561" }, { - "tick": "397375000000" + "tick": "396042968748" }, { - "tick": "397718750000" + "tick": "396053710935" }, { - "tick": "398062500000" + "tick": "396064453122" }, { - "tick": "398406250000" + "tick": "396075195309" }, { - "tick": "398750000000" + "tick": "396085937496" }, { - "tick": "399093750000" + "tick": "396096679683" }, { - "tick": "399437500000" + "tick": "396107421870" }, { - "tick": "399781250000" + "tick": "396118164057" }, { - "tick": "400125000000" + "tick": "396128906244" }, { - "tick": "400468750000" + "tick": "396139648431" }, { - "tick": "400812500000" + "tick": "396150390618" }, { - "tick": "401156250000" + "tick": "396161132805" }, { - "tick": "401500000000" + "tick": "396171874992" }, { - "tick": "401843750000" + "tick": "396182617179" }, { - "tick": "402187500000" + "tick": "396193359366" }, { - "tick": "402531250000" + "tick": "396204101553" }, { - "tick": "402875000000" + "tick": "396214843740" }, { - "tick": "403218750000" + "tick": "396225585927" }, { - "tick": "403562500000" + "tick": "396236328114" }, { - "tick": "403906250000" + "tick": "396247070301" }, { - "tick": "404250000000" + "tick": "396257812488" }, { - "tick": "404593750000" + "tick": "396268554675" }, { - "tick": "404937500000" + "tick": "396279296862" }, { - "tick": "405281250000" + "tick": "396290039049" }, { - "tick": "405625000000" + "tick": "396300781236" }, { - "tick": "405968750000" + "tick": "396311523423" }, { - "tick": "406312500000" + "tick": "396322265610" }, { - "tick": "406656250000" + "tick": "396333007797" }, { - "tick": "407000000000" + "tick": "396343750000" } ] } @@ -219,106 +132,106 @@ { "opponent": "tz1gjaF81ZRRvdzjobyfVNsAeSC6PScjfQwN", "start_tick": "396000000000", - "end_tick": "396010742187", + "end_tick": "396000335693", "dissection": [ { "tick": "396000000000" }, { - "tick": "396000335693" + "tick": "396000010490" }, { - "tick": "396000671386" + "tick": "396000020980" }, { - "tick": "396001007079" + "tick": "396000031470" }, { - "tick": "396001342772" + "tick": "396000041960" }, { - "tick": "396001678465" + "tick": "396000052450" }, { - "tick": "396002014158" + "tick": "396000062940" }, { - "tick": "396002349851" + "tick": "396000073430" }, { - "tick": "396002685544" + "tick": "396000083920" }, { - "tick": "396003021237" + "tick": "396000094410" }, { - "tick": "396003356930" + "tick": "396000104900" }, { - "tick": "396003692623" + "tick": "396000115390" }, { - "tick": "396004028316" + "tick": "396000125880" }, { - "tick": "396004364009" + "tick": "396000136370" }, { - "tick": "396004699702" + "tick": "396000146860" }, { - "tick": "396005035395" + "tick": "396000157350" }, { - "tick": "396005371088" + "tick": "396000167840" }, { - "tick": "396005706781" + "tick": "396000178330" }, { - "tick": "396006042474" + "tick": "396000188820" }, { - "tick": "396006378167" + "tick": "396000199310" }, { - "tick": "396006713860" + "tick": "396000209800" }, { - "tick": "396007049553" + "tick": "396000220290" }, { - "tick": "396007385246" + "tick": "396000230780" }, { - "tick": "396007720939" + "tick": "396000241270" }, { - "tick": "396008056632" + "tick": "396000251760" }, { - "tick": "396008392325" + "tick": "396000262250" }, { - "tick": "396008728018" + "tick": "396000272740" }, { - "tick": "396009063711" + "tick": "396000283230" }, { - "tick": "396009399404" + "tick": "396000293720" }, { - "tick": "396009735097" + "tick": "396000304210" }, { - "tick": "396010070790" + "tick": "396000314700" }, { - "tick": "396010406483" + "tick": "396000325190" }, { - "tick": "396010742187" + "tick": "396000335693" } ] } @@ -327,106 +240,106 @@ { "opponent": "tz1gjaF81ZRRvdzjobyfVNsAeSC6PScjfQwN", "start_tick": "396000000000", - "end_tick": "396000010490", + "end_tick": "396000000327", "dissection": [ { "tick": "396000000000" }, { - "tick": "396000000327" + "tick": "396000000010" }, { - "tick": "396000000654" + "tick": "396000000020" }, { - "tick": "396000000981" + "tick": "396000000030" }, { - "tick": "396000001308" + "tick": "396000000040" }, { - "tick": "396000001635" + "tick": "396000000050" }, { - "tick": "396000001962" + "tick": "396000000060" }, { - "tick": "396000002289" + "tick": "396000000070" }, { - "tick": "396000002616" + "tick": "396000000080" }, { - "tick": "396000002943" + "tick": "396000000090" }, { - "tick": "396000003270" + "tick": "396000000100" }, { - "tick": "396000003597" + "tick": "396000000110" }, { - "tick": "396000003924" + "tick": "396000000120" }, { - "tick": "396000004251" + "tick": "396000000130" }, { - "tick": "396000004578" + "tick": "396000000140" }, { - "tick": "396000004905" + "tick": "396000000150" }, { - "tick": "396000005232" + "tick": "396000000160" }, { - "tick": "396000005559" + "tick": "396000000170" }, { - "tick": "396000005886" + "tick": "396000000180" }, { - "tick": "396000006213" + "tick": "396000000190" }, { - "tick": "396000006540" + "tick": "396000000200" }, { - "tick": "396000006867" + "tick": "396000000210" }, { - "tick": "396000007194" + "tick": "396000000220" }, { - "tick": "396000007521" + "tick": "396000000230" }, { - "tick": "396000007848" + "tick": "396000000240" }, { - "tick": "396000008175" + "tick": "396000000250" }, { - "tick": "396000008502" + "tick": "396000000260" }, { - "tick": "396000008829" + "tick": "396000000270" }, { - "tick": "396000009156" + "tick": "396000000280" }, { - "tick": "396000009483" + "tick": "396000000290" }, { - "tick": "396000009810" + "tick": "396000000300" }, { - "tick": "396000010137" + "tick": "396000000310" }, { - "tick": "396000010490" + "tick": "396000000327" } ] } @@ -434,41 +347,14 @@ { "opponent": "tz1gjaF81ZRRvdzjobyfVNsAeSC6PScjfQwN", - "start_tick": "396000000000", - "end_tick": "396000000010", + "start_tick": "396000000008", + "end_tick": "396000000009", "dissection": [ - { - "tick": "396000000000" - }, - { - "tick": "396000000001" - }, - { - "tick": "396000000002" - }, - { - "tick": "396000000003" - }, - { - "tick": "396000000004" - }, - { - "tick": "396000000005" - }, - { - "tick": "396000000006" - }, - { - "tick": "396000000007" - }, { "tick": "396000000008" }, { "tick": "396000000009" - }, - { - "tick": "396000000010" } ] } -- GitLab From a6c588b834d751b9a001cbb5051c002e104ecbd8 Mon Sep 17 00:00:00 2001 From: Antonio Locascio Date: Tue, 7 Mar 2023 08:47:51 +0100 Subject: [PATCH 8/8] SCORU/Node: backport #7792 to Mumbai Includes commits: SCORU/Node: helper types for player and coordinator workers SCORU/Node: add errors for missing refutation workers SCORU/Node: add events for refutation player and coordinator SCORU/Node: move the playing of refutation games to workers --- .../lib_sc_rollup_node/commitment_event.ml | 16 +- .../lib_sc_rollup_node/commitment_event.mli | 6 + .../lib_sc_rollup_node/components.ml | 2 +- .../lib_sc_rollup_node/daemon.ml | 10 +- .../refutation_coordinator.ml | 248 ++++++++++++++++++ .../refutation_coordinator.mli | 53 ++++ .../refutation_coordinator_types.ml | 56 ++++ .../refutation_coordinator_types.mli | 38 +++ .../lib_sc_rollup_node/refutation_game.ml | 67 ++--- .../lib_sc_rollup_node/refutation_game.mli | 22 +- .../refutation_game_event.ml | 111 +++++++- .../lib_sc_rollup_node/refutation_player.ml | 206 +++++++++++++++ .../lib_sc_rollup_node/refutation_player.mli | 68 +++++ .../refutation_player_types.ml | 73 ++++++ .../refutation_player_types.mli | 45 ++++ .../sc_rollup_node_errors.ml | 26 +- 16 files changed, 987 insertions(+), 60 deletions(-) create mode 100644 src/proto_016_PtMumbai/lib_sc_rollup_node/refutation_coordinator.ml create mode 100644 src/proto_016_PtMumbai/lib_sc_rollup_node/refutation_coordinator.mli create mode 100644 src/proto_016_PtMumbai/lib_sc_rollup_node/refutation_coordinator_types.ml create mode 100644 src/proto_016_PtMumbai/lib_sc_rollup_node/refutation_coordinator_types.mli create mode 100644 src/proto_016_PtMumbai/lib_sc_rollup_node/refutation_player.ml create mode 100644 src/proto_016_PtMumbai/lib_sc_rollup_node/refutation_player.mli create mode 100644 src/proto_016_PtMumbai/lib_sc_rollup_node/refutation_player_types.ml create mode 100644 src/proto_016_PtMumbai/lib_sc_rollup_node/refutation_player_types.mli diff --git a/src/proto_016_PtMumbai/lib_sc_rollup_node/commitment_event.ml b/src/proto_016_PtMumbai/lib_sc_rollup_node/commitment_event.ml index e5d62ef4337c..92c014f0ab7c 100644 --- a/src/proto_016_PtMumbai/lib_sc_rollup_node/commitment_event.ml +++ b/src/proto_016_PtMumbai/lib_sc_rollup_node/commitment_event.ml @@ -71,7 +71,18 @@ module Simple = struct ~msg: "Last cemented commitment was updated to hash {hash} at inbox level \ {level}" - ~level:Notice + ~level:Debug + ("hash", Sc_rollup.Commitment.Hash.encoding) + ("level", Raw_level.encoding) + + let last_published_commitment_updated = + declare_2 + ~section + ~name:"sc_rollup_node_lpc_updated" + ~msg: + "Last published commitment was updated to hash {hash} at inbox level \ + {level}" + ~level:Debug ("hash", Sc_rollup.Commitment.Hash.encoding) ("level", Raw_level.encoding) @@ -182,6 +193,9 @@ let commitment_stored = emit_commitment_event Simple.commitment_stored let last_cemented_commitment_updated head level = Simple.(emit last_cemented_commitment_updated (head, level)) +let last_published_commitment_updated head level = + Simple.(emit last_published_commitment_updated (head, level)) + let compute_commitment level = Simple.(emit compute_commitment level) let publish_commitment head level = diff --git a/src/proto_016_PtMumbai/lib_sc_rollup_node/commitment_event.mli b/src/proto_016_PtMumbai/lib_sc_rollup_node/commitment_event.mli index 6f583d61cc72..89b337266710 100644 --- a/src/proto_016_PtMumbai/lib_sc_rollup_node/commitment_event.mli +++ b/src/proto_016_PtMumbai/lib_sc_rollup_node/commitment_event.mli @@ -53,6 +53,12 @@ val commitment_will_not_be_published : val last_cemented_commitment_updated : Sc_rollup.Commitment.Hash.t -> Raw_level.t -> unit Lwt.t +(** [last_published_commitment_updated hash level] emits the event that the last + published commitment was updated to the given [hash] at the given inbox + [level]. *) +val last_published_commitment_updated : + Sc_rollup.Commitment.Hash.t -> Raw_level.t -> unit Lwt.t + (** [commitment_parent_is_not_lcc predecessor_hash last_cemented_commitment_hash] emits the event that a commitment at the given inbox [level] is being published, whose parent is the last cemented commitment, but the diff --git a/src/proto_016_PtMumbai/lib_sc_rollup_node/components.ml b/src/proto_016_PtMumbai/lib_sc_rollup_node/components.ml index 70f7e12c8ed8..1d5b8c0984fa 100644 --- a/src/proto_016_PtMumbai/lib_sc_rollup_node/components.ml +++ b/src/proto_016_PtMumbai/lib_sc_rollup_node/components.ml @@ -29,7 +29,7 @@ module Make (PVM : Pvm.S) = struct module Interpreter = Interpreter.Make (PVM) module Commitment = Commitment.Make (PVM) module Simulation = Simulation.Make (Interpreter) - module Refutation_game = Refutation_game.Make (Interpreter) + module Refutation_coordinator = Refutation_coordinator.Make (Interpreter) module Batcher = Batcher.Make (Simulation) module RPC_server = RPC_server.Make (Simulation) (Batcher) end diff --git a/src/proto_016_PtMumbai/lib_sc_rollup_node/daemon.ml b/src/proto_016_PtMumbai/lib_sc_rollup_node/daemon.ml index e52d3e6bed11..c42785dd6169 100644 --- a/src/proto_016_PtMumbai/lib_sc_rollup_node/daemon.ml +++ b/src/proto_016_PtMumbai/lib_sc_rollup_node/daemon.ml @@ -111,6 +111,11 @@ module Make (PVM : Pvm.S) = struct Some (Raw_level.of_int32_exn head.Layer1.level); } in + let*! () = + Commitment_event.last_published_commitment_updated + commitment_hash + (Raw_level.of_int32_exn head.Layer1.level) + in return_unit | ( Sc_rollup_publish {commitment = their_commitment; rollup}, Sc_rollup_publish_result @@ -449,7 +454,7 @@ module Make (PVM : Pvm.S) = struct let* () = Components.Commitment.Publisher.publish_commitments () in let* () = Components.Commitment.Publisher.cement_commitments () in let*! () = Daemon_event.new_heads_processed reorg.new_chain in - let* () = Components.Refutation_game.process head node_ctxt in + let* () = Components.Refutation_coordinator.process head in let* () = Components.Batcher.batch () in let* () = Components.Batcher.new_head head in let*! () = Injector.inject ~header () in @@ -470,6 +475,8 @@ module Make (PVM : Pvm.S) = struct let* () = Components.Batcher.shutdown () in let* () = message "Shutting down Commitment Publisher@." in let* () = Components.Commitment.Publisher.shutdown () in + let* () = message "Shutting down Refutation Coordinator@." in + let* () = Components.Refutation_coordinator.shutdown () in let* (_ : unit tzresult) = Node_context.close node_ctxt in let* () = Event.shutdown_node exit_status in Tezos_base_unix.Internal_event_unix.close () @@ -528,6 +535,7 @@ module Make (PVM : Pvm.S) = struct (operator, strategy, purposes)) in let* () = Components.Commitment.Publisher.init node_ctxt in + let* () = Components.Refutation_coordinator.init node_ctxt in let* () = Injector.init node_ctxt.cctxt diff --git a/src/proto_016_PtMumbai/lib_sc_rollup_node/refutation_coordinator.ml b/src/proto_016_PtMumbai/lib_sc_rollup_node/refutation_coordinator.ml new file mode 100644 index 000000000000..183553ddda91 --- /dev/null +++ b/src/proto_016_PtMumbai/lib_sc_rollup_node/refutation_coordinator.ml @@ -0,0 +1,248 @@ +(*****************************************************************************) +(* *) +(* Open Source License *) +(* Copyright (c) 2023 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 +open Refutation_coordinator_types + +module type S = sig + module PVM : Pvm.S + + val init : Node_context.rw -> unit tzresult Lwt.t + + val process : Layer1.head -> unit tzresult Lwt.t + + val shutdown : unit -> unit Lwt.t +end + +(* Count instances of the coordinator functor to allow for multiple + worker events without conflicts. *) +let instances_count = ref 0 + +module Make (Interpreter : Interpreter.S) = struct + include Refutation_game.Make (Interpreter) + module Player = Refutation_player.Make (Interpreter) + module Pkh_map = Signature.Public_key_hash.Map + module Pkh_table = Signature.Public_key_hash.Table + + let () = incr instances_count + + type state = { + node_ctxt : Node_context.rw; + pending_opponents : unit Pkh_table.t; + } + + let get_conflicts cctxt head_block = + Plugin.RPC.Sc_rollup.conflicts cctxt (cctxt#chain, head_block) + + let get_ongoing_games cctxt head_block = + Plugin.RPC.Sc_rollup.ongoing_refutation_games cctxt (cctxt#chain, head_block) + + let untracked_conflicts opponent_players conflicts = + List.filter + (fun conflict -> + not + @@ Pkh_map.mem + conflict.Sc_rollup.Refutation_storage.other + opponent_players) + conflicts + + (* Transform the list of ongoing games [(Game.t * pkh * pkh) list] + into a mapping from opponents' pkhs to their corresponding game + state. + *) + let make_game_map self ongoing_games = + List.fold_left + (fun acc (game, alice, bob) -> + let opponent_pkh = + if Signature.Public_key_hash.equal self alice then bob else alice + in + Pkh_map.add opponent_pkh game acc) + Pkh_map.empty + ongoing_games + + let on_process Layer1.{hash; level} state = + let node_ctxt = state.node_ctxt in + let head_block = `Hash (hash, 0) in + let open Lwt_result_syntax in + let refute_signer = Node_context.get_operator node_ctxt Refute in + match refute_signer with + | None -> + (* Not injecting refutations, don't play refutation games *) + return_unit + | Some self -> + let Node_context.{rollup_address; cctxt; _} = node_ctxt in + (* Current conflicts in L1 *) + let* conflicts = get_conflicts cctxt head_block rollup_address self in + (* Map of opponents the node is playing against to the corresponding + player worker *) + let opponent_players = + Pkh_map.of_seq @@ List.to_seq @@ Player.current_games () + in + (* Conflicts for which we need to start new refutation players. + Some of these might be ongoing. *) + let new_conflicts = untracked_conflicts opponent_players conflicts in + (* L1 ongoing games *) + let* ongoing_games = + get_ongoing_games cctxt head_block rollup_address self + in + (* Map between opponents and their corresponding games *) + let ongoing_game_map = make_game_map self ongoing_games in + (* Launch new players for new conflicts, and play one step *) + let* () = + List.iter_ep + (fun conflict -> + let other = conflict.Sc_rollup.Refutation_storage.other in + Pkh_table.replace state.pending_opponents other () ; + let game = Pkh_map.find_opt other ongoing_game_map in + Player.init_and_play node_ctxt ~self ~conflict ~game ~level) + new_conflicts + in + let*! () = + (* Play one step of the refutation game in every remaining player *) + Pkh_map.iter_p + (fun opponent worker -> + match Pkh_map.find opponent ongoing_game_map with + | Some game -> + Pkh_table.remove state.pending_opponents opponent ; + Player.play worker game ~level + | None -> + (* Kill finished players: those who don't aren't + playing against pending opponents that don't have + ongoing games in the L1 *) + if not @@ Pkh_table.mem state.pending_opponents opponent then + Player.shutdown worker + else Lwt.return_unit) + opponent_players + in + return_unit + + module Types = struct + type nonrec state = state + + type parameters = {node_ctxt : Node_context.rw} + end + + module Name = struct + (* We only have a single coordinator in the node *) + type t = unit + + let encoding = Data_encoding.unit + + let base = + (* But we can have multiple instances in the unit tests. This is just to + avoid conflicts in the events declarations. *) + Refutation_game_event.Coordinator.section + @ [ + ("worker" + ^ if !instances_count = 1 then "" else string_of_int !instances_count + ); + ] + + let pp _ _ = () + + let equal () () = true + end + + module Worker = Worker.MakeSingle (Name) (Request) (Types) + + type worker = Worker.infinite Worker.queue Worker.t + + module Handlers = struct + type self = worker + + let on_request : + type r request_error. + worker -> + (r, request_error) Request.t -> + (r, request_error) result Lwt.t = + fun w request -> + let state = Worker.state w in + match request with Request.Process b -> on_process b state + + type launch_error = error trace + + let on_launch _w () Types.{node_ctxt} = + return {node_ctxt; pending_opponents = Pkh_table.create 5} + + let on_error (type a b) _w st (r : (a, b) Request.t) (errs : b) : + unit tzresult Lwt.t = + let open Lwt_result_syntax in + let request_view = Request.view r in + let emit_and_return_errors errs = + let*! () = + Refutation_game_event.Coordinator.request_failed request_view st errs + in + return_unit + in + match r with Request.Process _ -> emit_and_return_errors errs + + let on_completion _w r _ st = + Refutation_game_event.Coordinator.request_completed (Request.view r) st + + let on_no_request _ = Lwt.return_unit + + let on_close _w = Lwt.return_unit + end + + let table = Worker.create_table Queue + + let worker_promise, worker_waker = Lwt.task () + + let init node_ctxt = + let open Lwt_result_syntax in + let*! () = Refutation_game_event.Coordinator.starting () in + let+ worker = Worker.launch table () {node_ctxt} (module Handlers) in + Lwt.wakeup worker_waker worker + + (* This is a refutation coordinator for a single scoru *) + let worker = + lazy + (match Lwt.state worker_promise with + | Lwt.Return worker -> ok worker + | Lwt.Fail _ | Lwt.Sleep -> + error Sc_rollup_node_errors.No_refutation_coordinator) + + let process b = + let open Lwt_result_syntax in + let*? w = Lazy.force worker in + let*! (_pushed : bool) = Worker.Queue.push_request w (Request.Process b) in + return_unit + + let shutdown () = + let open Lwt_syntax in + let w = Lazy.force worker in + match w with + | Error _ -> + (* There is no refutation coordinator, nothing to do *) + Lwt.return_unit + | Ok w -> + (* Shut down all current refutation players *) + let games = Player.current_games () in + let* () = + List.iter_s (fun (_opponent, player) -> Player.shutdown player) games + in + Worker.shutdown w +end diff --git a/src/proto_016_PtMumbai/lib_sc_rollup_node/refutation_coordinator.mli b/src/proto_016_PtMumbai/lib_sc_rollup_node/refutation_coordinator.mli new file mode 100644 index 000000000000..ca17d1eb19ab --- /dev/null +++ b/src/proto_016_PtMumbai/lib_sc_rollup_node/refutation_coordinator.mli @@ -0,0 +1,53 @@ +(*****************************************************************************) +(* *) +(* Open Source License *) +(* Copyright (c) 2023 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. *) +(* *) +(*****************************************************************************) + +(** Component for managing refutation games. + This module is implemented as a single worker in the rollup node, + which takes care of processing new L1 heads, and coordinating + the refutation game players. (See {!Refutation_player}). +*) + +module type S = sig + module PVM : Pvm.S + + (** Initiatilize the refuation coordinator. *) + val init : Node_context.rw -> unit tzresult Lwt.t + + (** Process a new l1 head. This means that the coordinator will: + {ol + {li Gather all existing conflicts} + {li Launch new refutation players for each conflict that doesn't + have a player in this node} + {li Kill all players whose conflict has disappeared from L1} + {li Make all players play a step in the refutation} + } + *) + val process : Layer1.head -> unit tzresult Lwt.t + + (** Shutdown the refutation coordinator. *) + val shutdown : unit -> unit Lwt.t +end + +module Make (Interpreter : Interpreter.S) : S diff --git a/src/proto_016_PtMumbai/lib_sc_rollup_node/refutation_coordinator_types.ml b/src/proto_016_PtMumbai/lib_sc_rollup_node/refutation_coordinator_types.ml new file mode 100644 index 000000000000..314698ed82ff --- /dev/null +++ b/src/proto_016_PtMumbai/lib_sc_rollup_node/refutation_coordinator_types.ml @@ -0,0 +1,56 @@ +(*****************************************************************************) +(* *) +(* Open Source License *) +(* Copyright (c) 2023 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. *) +(* *) +(*****************************************************************************) + +module Request = struct + type ('a, 'b) t = Process : Layer1.head -> (unit, error trace) t + + type view = View : _ t -> view + + let view req = View req + + let encoding = + let open Data_encoding in + union + [ + case + (Tag 0) + ~title:"Process" + (obj2 + (req "request" (constant "process")) + (req "block" Layer1.head_encoding)) + (function View (Process b) -> Some ((), b)) + (fun ((), b) -> View (Process b)); + ] + + let pp ppf (View r) = + match r with + | Process {Layer1.hash; level} -> + Format.fprintf + ppf + "Processing new L1 head %a at level %ld" + Block_hash.pp + hash + level +end diff --git a/src/proto_016_PtMumbai/lib_sc_rollup_node/refutation_coordinator_types.mli b/src/proto_016_PtMumbai/lib_sc_rollup_node/refutation_coordinator_types.mli new file mode 100644 index 000000000000..f26d46885c77 --- /dev/null +++ b/src/proto_016_PtMumbai/lib_sc_rollup_node/refutation_coordinator_types.mli @@ -0,0 +1,38 @@ +(*****************************************************************************) +(* *) +(* Open Source License *) +(* Copyright (c) 2023 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. *) +(* *) +(*****************************************************************************) + +module Request : sig + (** Type of requests accepted by the refutation coordinator. *) + type ('a, 'b) t = + | Process : Layer1.head -> (unit, error trace) t + (** Request to process new refutation games. *) + + type view = View : _ t -> view + + include + Worker_intf.REQUEST + with type ('a, 'request_error) t := ('a, 'request_error) t + and type view := view +end diff --git a/src/proto_016_PtMumbai/lib_sc_rollup_node/refutation_game.ml b/src/proto_016_PtMumbai/lib_sc_rollup_node/refutation_game.ml index bac47d380032..2ad4f7ab399d 100644 --- a/src/proto_016_PtMumbai/lib_sc_rollup_node/refutation_game.ml +++ b/src/proto_016_PtMumbai/lib_sc_rollup_node/refutation_game.ml @@ -49,7 +49,18 @@ open Alpha_context module type S = sig module PVM : Pvm.S - val process : Layer1.head -> Node_context.rw -> unit tzresult Lwt.t + val play_opening_move : + [< `Read | `Write > `Read] Node_context.t -> + public_key_hash -> + Sc_rollup.Refutation_storage.conflict -> + (unit, tztrace) result Lwt.t + + val play : + Node_context.rw -> + self:public_key_hash -> + Sc_rollup.Game.t -> + public_key_hash -> + (unit, tztrace) result Lwt.t end module Make (Interpreter : Interpreter.S) : @@ -491,14 +502,15 @@ module Make (Interpreter : Interpreter.S) : if is_it_me then return_none else return (Some loser) | _ -> return_none - let play head_block node_ctxt self game staker1 staker2 = + let play node_ctxt ~self game opponent = let open Lwt_result_syntax in - let index = Sc_rollup.Game.Index.make staker1 staker2 in + let index = Sc_rollup.Game.Index.make self opponent in + let head_block = `Head 0 in match turn ~self game index with | Our_turn {opponent} -> play_next_move node_ctxt game self opponent | Their_turn -> ( let* timeout_reached = - timeout_reached ~self head_block node_ctxt staker1 staker2 + timeout_reached ~self head_block node_ctxt self opponent in match timeout_reached with | Some opponent -> @@ -506,14 +518,6 @@ module Make (Interpreter : Interpreter.S) : play_timeout node_ctxt self index | None -> return_unit) - let ongoing_games head_block node_ctxt self = - let Node_context.{rollup_address; cctxt; _} = node_ctxt in - Plugin.RPC.Sc_rollup.ongoing_refutation_games - cctxt - (cctxt#chain, head_block) - rollup_address - self - let play_opening_move node_ctxt self conflict = let open Lwt_syntax in let open Sc_rollup.Refutation_storage in @@ -526,43 +530,4 @@ module Make (Interpreter : Interpreter.S) : in let refutation = Start {player_commitment_hash; opponent_commitment_hash} in inject_next_move node_ctxt self ~refutation ~opponent:conflict.other - - let start_game_if_conflict head_block node_ctxt self = - let open Lwt_result_syntax in - let Node_context.{rollup_address; cctxt; _} = node_ctxt in - let* conflicts = - Plugin.RPC.Sc_rollup.conflicts - cctxt - (cctxt#chain, head_block) - rollup_address - self - in - let*! res = List.iter_es (play_opening_move node_ctxt self) conflicts in - match res with - | Ok r -> return r - | Error - [ - Environment.Ecoproto_error - Sc_rollup_errors.Sc_rollup_game_already_started; - ] -> - (* The game may already be starting in the meantime. So we - ignore this error. *) - return_unit - | Error errs -> Lwt.return (Error errs) - - let process Layer1.{hash; _} node_ctxt = - let head_block = `Hash (hash, 0) in - let open Lwt_result_syntax in - let refute_signer = Node_context.get_operator node_ctxt Refute in - match refute_signer with - | None -> - (* Not injecting refutations, don't play refutation games *) - return_unit - | Some self -> - let* () = start_game_if_conflict head_block node_ctxt self in - let* res = ongoing_games head_block node_ctxt self in - List.iter_es - (fun (game, staker1, staker2) -> - play head_block node_ctxt self game staker1 staker2) - res end diff --git a/src/proto_016_PtMumbai/lib_sc_rollup_node/refutation_game.mli b/src/proto_016_PtMumbai/lib_sc_rollup_node/refutation_game.mli index 12f7125221b8..89399c86ae0a 100644 --- a/src/proto_016_PtMumbai/lib_sc_rollup_node/refutation_game.mli +++ b/src/proto_016_PtMumbai/lib_sc_rollup_node/refutation_game.mli @@ -23,14 +23,30 @@ (* *) (*****************************************************************************) +open Protocol +open Alpha_context + (** This module implements the refutation game logic of the rollup node. *) module type S = sig module PVM : Pvm.S - (** [process head node_ctxt] reacts to any operations of [head] related to - refutation games. *) - val process : Layer1.head -> Node_context.rw -> unit tzresult Lwt.t + (** [play_opening_move node_ctxt self conflict] injects the opening + refutation game move for [conflict]. *) + val play_opening_move : + [< `Read | `Write > `Read] Node_context.t -> + public_key_hash -> + Sc_rollup.Refutation_storage.conflict -> + (unit, tztrace) result Lwt.t + + (** [play head_block node_ctxt ~self game opponent] injects the next + move in the refutation [game] played by [self] and [opponent]. *) + val play : + Node_context.rw -> + self:public_key_hash -> + Sc_rollup.Game.t -> + public_key_hash -> + (unit, tztrace) result Lwt.t end module Make (Interpreter : Interpreter.S) : S with module PVM = Interpreter.PVM diff --git a/src/proto_016_PtMumbai/lib_sc_rollup_node/refutation_game_event.ml b/src/proto_016_PtMumbai/lib_sc_rollup_node/refutation_game_event.ml index f894e7e199dd..b03f3a081070 100644 --- a/src/proto_016_PtMumbai/lib_sc_rollup_node/refutation_game_event.ml +++ b/src/proto_016_PtMumbai/lib_sc_rollup_node/refutation_game_event.ml @@ -28,11 +28,11 @@ open Protocol.Alpha_context (* TODO: https://gitlab.com/tezos/tezos/-/issues/2880 Add corresponding .mli file. *) +let section = [Protocol.name; "sc_rollup_node"; "refutation_game"] + module Simple = struct include Internal_event.Simple - let section = [Protocol.name; "sc_rollup_node"; "refutation_game"] - let timeout = declare_1 ~section @@ -115,6 +115,86 @@ module Simple = struct ("start_tick", Sc_rollup.Tick.encoding) ("end_tick", Sc_rollup.Tick.encoding) ("dissection", Data_encoding.list dissection_chunk_encoding) + + module Worker (ARG : sig + val section : string list + end) + (Request : Worker_intf.REQUEST) = + struct + include ARG + + let request_failed = + declare_3 + ~section + ~name:"request_failed" + ~msg:"request {view} failed ({worker_status}): {errors}" + ~level:Debug + ("view", Request.encoding) + ~pp1:Request.pp + ("worker_status", Worker_types.request_status_encoding) + ~pp2:Worker_types.pp_status + ("errors", Error_monad.trace_encoding) + ~pp3:Error_monad.pp_print_trace + + let request_completed = + declare_2 + ~section + ~name:"request_completed" + ~msg:"{view} {worker_status}" + ~level:Debug + ("view", Request.encoding) + ("worker_status", Worker_types.request_status_encoding) + ~pp1:Request.pp + ~pp2:Worker_types.pp_status + end + + module Player = struct + include + Worker + (struct + let section = section @ ["player"] + end) + (Refutation_player_types.Request) + + let started = + declare_2 + ~section + ~name:"player_started" + ~msg: + "refutation player started to play against {opponent}, defenfing \ + commitment {commitment}" + ~level:Notice + ("opponent", Signature.Public_key_hash.encoding) + ~pp1:Signature.Public_key_hash.pp + ("commitment", Sc_rollup.Commitment.encoding) + ~pp2:Sc_rollup.Commitment.pp + + let stopped = + declare_1 + ~section + ~name:"player_stopped" + ~msg:"refutation player for opponent {opponent} has been stopped" + ~level:Notice + ("opponent", Signature.Public_key_hash.encoding) + ~pp1:Signature.Public_key_hash.pp + end + + module Coordinator = struct + include + Worker + (struct + let section = section @ ["coordinator"] + end) + (Refutation_coordinator_types.Request) + + let starting = + declare_0 + ~section + ~name:"coordinator_starting" + ~msg:"Starting refutation coordinator for the smart rollup node" + ~level:Notice + () + end end let timeout address = Simple.(emit timeout address) @@ -151,3 +231,30 @@ let timeout_detected other = Simple.(emit timeout_detected other) let computed_dissection ~opponent ~start_tick ~end_tick dissection = Simple.(emit computed_dissection (opponent, start_tick, end_tick, dissection)) + +module Player = struct + let section = Simple.Player.section + + let request_failed view worker_status errors = + Simple.(emit Player.request_failed (view, worker_status, errors)) + + let request_completed view worker_status = + Simple.(emit Player.request_completed (view, worker_status)) + + let started opponent commitment = + Simple.(emit Player.started (opponent, commitment)) + + let stopped opponent = Simple.(emit Player.stopped opponent) +end + +module Coordinator = struct + let section = Simple.Coordinator.section + + let request_failed view worker_status errors = + Simple.(emit Coordinator.request_failed (view, worker_status, errors)) + + let request_completed view worker_status = + Simple.(emit Coordinator.request_completed (view, worker_status)) + + let starting = Simple.(emit Coordinator.starting) +end diff --git a/src/proto_016_PtMumbai/lib_sc_rollup_node/refutation_player.ml b/src/proto_016_PtMumbai/lib_sc_rollup_node/refutation_player.ml new file mode 100644 index 000000000000..0d129f6f7bdc --- /dev/null +++ b/src/proto_016_PtMumbai/lib_sc_rollup_node/refutation_player.ml @@ -0,0 +1,206 @@ +(*****************************************************************************) +(* *) +(* Open Source License *) +(* Copyright (c) 2023 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 +open Refutation_player_types + +module Types = struct + type state = { + node_ctxt : Node_context.rw; + self : public_key_hash; + opponent : public_key_hash; + mutable last_move_cache : (Sc_rollup.Game.game_state * int32) option; + } + + type parameters = { + node_ctxt : Node_context.rw; + self : public_key_hash; + conflict : Sc_rollup.Refutation_storage.conflict; + } +end + +module Name = struct + let base = Refutation_game_event.Player.section @ ["worker"] + + include Signature.Public_key_hash +end + +module Worker = Worker.MakeSingle (Name) (Request) (Types) + +type worker = Worker.infinite Worker.queue Worker.t + +let table = Worker.create_table Queue + +module type S = sig + val init_and_play : + Node_context.rw -> + self:public_key_hash -> + conflict:Sc_rollup.Refutation_storage.conflict -> + game:Sc_rollup.Game.t option -> + level:int32 -> + unit tzresult Lwt.t + + val play : worker -> Sc_rollup.Game.t -> level:int32 -> unit Lwt.t + + val shutdown : worker -> unit Lwt.t + + val current_games : unit -> (public_key_hash * worker) list +end + +module Make (Interpreter : Interpreter.S) : S = struct + open Refutation_game.Make (Interpreter) + + let on_play game Types.{node_ctxt; self; opponent; _} = + play node_ctxt ~self game opponent + + let on_play_opening conflict (Types.{node_ctxt; self; _} : Types.state) = + play_opening_move node_ctxt self conflict + + module Handlers = struct + type self = worker + + let on_request : + type r request_error. + worker -> + (r, request_error) Request.t -> + (r, request_error) result Lwt.t = + fun w request -> + let state = Worker.state w in + match request with + | Request.Play game -> on_play game state + | Request.Play_opening conflict -> on_play_opening conflict state + + type launch_error = error trace + + let on_launch _w _name Types.{node_ctxt; self; conflict} = + return + Types. + {node_ctxt; self; opponent = conflict.other; last_move_cache = None} + + let on_error (type a b) _w st (r : (a, b) Request.t) (errs : b) : + unit tzresult Lwt.t = + let open Lwt_result_syntax in + let request_view = Request.view r in + let emit_and_return_errors errs = + let*! () = + Refutation_game_event.Player.request_failed request_view st errs + in + return_unit + in + match r with + | Request.Play _ -> emit_and_return_errors errs + | Request.Play_opening _ -> emit_and_return_errors errs + + let on_completion _w r _ st = + Refutation_game_event.Player.request_completed (Request.view r) st + + let on_no_request _ = Lwt.return_unit + + let on_close w = + let open Lwt_syntax in + let state = Worker.state w in + let* () = Refutation_game_event.Player.stopped state.opponent in + return_unit + end + + let init node_ctxt ~self ~conflict = + let open Lwt_result_syntax in + let*! () = + Refutation_game_event.Player.started + conflict.Sc_rollup.Refutation_storage.other + conflict.Sc_rollup.Refutation_storage.our_commitment + in + let worker_promise, worker_waker = Lwt.task () in + let* worker = + trace Sc_rollup_node_errors.Refutation_player_failed_to_start + @@ Worker.launch + table + conflict.other + {node_ctxt; self; conflict} + (module Handlers) + in + let () = Lwt.wakeup worker_waker worker in + let worker = + match Lwt.state worker_promise with + | Lwt.Return worker -> ok worker + | Lwt.Fail _ | Lwt.Sleep -> + error Sc_rollup_node_errors.Refutation_player_failed_to_start + in + Lwt.return worker + + (* Number of levels the player waits until trying to play + for a game state it already played for. *) + let buffer_levels = 5l + + (* Play if: + - There's a new game state to play against or + - The current level is past the buffer for re-playing in the + same game state. + *) + let should_move ~level game last_move_cache = + match last_move_cache with + | None -> true + | Some (last_move_game_state, last_move_level) -> + (not + (Sc_rollup.Game.game_state_equal + game.Sc_rollup.Game.game_state + last_move_game_state)) + || Int32.(sub level last_move_level > buffer_levels) + + let play w game ~(level : int32) = + let open Lwt_syntax in + let state = Worker.state w in + if should_move ~level game state.last_move_cache then ( + let* pushed = Worker.Queue.push_request w (Request.Play game) in + if pushed then + state.last_move_cache <- Some (game.Sc_rollup.Game.game_state, level) ; + return_unit) + else return_unit + + let play_opening w conflict = + let open Lwt_syntax in + let* (_pushed : bool) = + Worker.Queue.push_request w (Request.Play_opening conflict) + in + return_unit + + let init_and_play node_ctxt ~self ~conflict ~game ~level = + let open Lwt_result_syntax in + let* worker = init node_ctxt ~self ~conflict in + let*! () = + match game with + | None -> play_opening worker conflict + | Some game -> play worker game ~level + in + return_unit + + let current_games () = + List.map + (fun (_name, worker) -> ((Worker.state worker).opponent, worker)) + (Worker.list table) + + let shutdown = Worker.shutdown +end diff --git a/src/proto_016_PtMumbai/lib_sc_rollup_node/refutation_player.mli b/src/proto_016_PtMumbai/lib_sc_rollup_node/refutation_player.mli new file mode 100644 index 000000000000..1c6bbed96676 --- /dev/null +++ b/src/proto_016_PtMumbai/lib_sc_rollup_node/refutation_player.mli @@ -0,0 +1,68 @@ +(*****************************************************************************) +(* *) +(* Open Source License *) +(* Copyright (c) 2023 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 + +(** Worker module for a signle refutation game player. + The node's refutation coordinator will spawn a new refutation player + for each refutation game. +*) +module Worker : Worker.T + +(** Type for a refutation game player. *) +type worker = Worker.infinite Worker.queue Worker.t + +module type S = sig + (** [init_and_play node_ctxt ~self ~conflict ~game ~level] + initializes a new refutation game player for signer [self]. + After initizialization, the worker will play the next move + depending on the [game] state. + If no [game] is passed, the worker will play the opening + move for [conflict]. + *) + val init_and_play : + Node_context.rw -> + self:public_key_hash -> + conflict:Sc_rollup.Refutation_storage.conflict -> + game:Sc_rollup.Game.t option -> + level:int32 -> + unit tzresult Lwt.t + + (** [play worker game ~level] makes the [worker] play the next move depending + on the [game] state for their conflict. + *) + val play : worker -> Sc_rollup.Game.t -> level:int32 -> unit Lwt.t + + (** Shutdown a refutaiton game player. *) + val shutdown : worker -> unit Lwt.t + + (** [current_games ()] lists the opponents' this node is playing + refutation games against, alongside the worker that takes care + of each game. *) + val current_games : unit -> (public_key_hash * worker) list +end + +module Make (Interpreter : Interpreter.S) : S diff --git a/src/proto_016_PtMumbai/lib_sc_rollup_node/refutation_player_types.ml b/src/proto_016_PtMumbai/lib_sc_rollup_node/refutation_player_types.ml new file mode 100644 index 000000000000..5cb43af30509 --- /dev/null +++ b/src/proto_016_PtMumbai/lib_sc_rollup_node/refutation_player_types.ml @@ -0,0 +1,73 @@ +(*****************************************************************************) +(* *) +(* Open Source License *) +(* Copyright (c) 2023 Nomadic Labs, *) +(* *) +(* Permission is hereby granted, free of charge, to any person obtaining a *) +(* copy of this software and associated documentation files (the "Software"),*) +(* to deal in the Software without restriction, including without limitation *) +(* the rights to use, copy, modify, merge, publish, distribute, sublicense, *) +(* and/or sell copies of the Software, and to permit persons to whom the *) +(* Software is furnished to do so, subject to the following conditions: *) +(* *) +(* The above copyright notice and this permission notice shall be included *) +(* in all copies or substantial portions of the Software. *) +(* *) +(* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR*) +(* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, *) +(* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL *) +(* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER*) +(* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING *) +(* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER *) +(* DEALINGS IN THE SOFTWARE. *) +(* *) +(*****************************************************************************) +open Protocol +open Alpha_context + +module Request = struct + type ('a, 'b) t = + | Play : Sc_rollup.Game.t -> (unit, error trace) t + | Play_opening : + Sc_rollup.Refutation_storage.conflict + -> (unit, error trace) t + + type view = View : _ t -> view + + let view req = View req + + let encoding = + let open Data_encoding in + union + [ + case + (Tag 0) + ~title:"Play" + (obj2 + (req "request" (constant "play")) + (req "game" Sc_rollup.Game.encoding)) + (function View (Play g) -> Some ((), g) | _ -> None) + (fun ((), g) -> View (Play g)); + case + (Tag 1) + ~title:"Play opening" + (obj2 + (req "request" (constant "play_opening")) + (req "conflict" Sc_rollup.Refutation_storage.conflict_encoding)) + (function View (Play_opening c) -> Some ((), c) | _ -> None) + (fun ((), c) -> View (Play_opening c)); + ] + + let pp ppf (View r) = + match r with + | Play game -> Format.fprintf ppf "Playing game %a" Sc_rollup.Game.pp game + | Play_opening conflict -> + Format.fprintf + ppf + "Playing opening move for conflict against staker %a at our \ + commitment %a" + Sc_rollup.Staker.pp + conflict.other + Sc_rollup.Commitment.pp + conflict.our_commitment +end diff --git a/src/proto_016_PtMumbai/lib_sc_rollup_node/refutation_player_types.mli b/src/proto_016_PtMumbai/lib_sc_rollup_node/refutation_player_types.mli new file mode 100644 index 000000000000..d29fd8289f45 --- /dev/null +++ b/src/proto_016_PtMumbai/lib_sc_rollup_node/refutation_player_types.mli @@ -0,0 +1,45 @@ +(*****************************************************************************) +(* *) +(* Open Source License *) +(* Copyright (c) 2023 Nomadic Labs, *) +(* *) +(* Permission is hereby granted, free of charge, to any person obtaining a *) +(* copy of this software and associated documentation files (the "Software"),*) +(* to deal in the Software without restriction, including without limitation *) +(* the rights to use, copy, modify, merge, publish, distribute, sublicense, *) +(* and/or sell copies of the Software, and to permit persons to whom the *) +(* Software is furnished to do so, subject to the following conditions: *) +(* *) +(* The above copyright notice and this permission notice shall be included *) +(* in all copies or substantial portions of the Software. *) +(* *) +(* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR*) +(* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, *) +(* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL *) +(* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER*) +(* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING *) +(* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER *) +(* DEALINGS IN THE SOFTWARE. *) +(* *) +(*****************************************************************************) + +open Protocol +open Alpha_context + +module Request : sig + (** Type of requests accepted by the refutation player. *) + type ('a, 'b) t = + | Play : Sc_rollup.Game.t -> (unit, error trace) t + (** Play a step of an ongoing refutation game. *) + | Play_opening : + Sc_rollup.Refutation_storage.conflict + -> (unit, error trace) t + (** Play the opening move of a refutation game. *) + + type view = View : _ t -> view + + include + Worker_intf.REQUEST + with type ('a, 'request_error) t := ('a, 'request_error) t + and type view := view +end diff --git a/src/proto_016_PtMumbai/lib_sc_rollup_node/sc_rollup_node_errors.ml b/src/proto_016_PtMumbai/lib_sc_rollup_node/sc_rollup_node_errors.ml index 48d36a8391eb..c0b3197a1bbe 100644 --- a/src/proto_016_PtMumbai/lib_sc_rollup_node/sc_rollup_node_errors.ml +++ b/src/proto_016_PtMumbai/lib_sc_rollup_node/sc_rollup_node_errors.ml @@ -55,6 +55,8 @@ type error += | Cannot_checkout_context of Block_hash.t * Sc_rollup_context_hash.t option | No_batcher | No_publisher + | Refutation_player_failed_to_start + | No_refutation_coordinator type error += Lost_game of Protocol.Alpha_context.Sc_rollup.Game.game_result @@ -321,4 +323,26 @@ let () = `Permanent Data_encoding.unit (function No_publisher -> Some () | _ -> None) - (fun () -> No_publisher) + (fun () -> No_publisher) ; + + register_error_kind + ~id:"sc_rollup.node.no_refutation_coordinator" + ~title:"No refutation coordinator for this node" + ~description:"This node does not have a refutation game coordinator" + ~pp:(fun ppf () -> + Format.fprintf ppf "This node does not have a refutation game coordinator") + `Permanent + Data_encoding.unit + (function No_refutation_coordinator -> Some () | _ -> None) + (fun () -> No_refutation_coordinator) ; + + register_error_kind + ~id:"sc_rollup.node.no_refutation_player" + ~title:"A refutation player failed to start" + ~description:"A refutation player failed to start" + ~pp:(fun ppf () -> + Format.fprintf ppf "A refutation player failed to start.") + `Permanent + Data_encoding.unit + (function Refutation_player_failed_to_start -> Some () | _ -> None) + (fun () -> Refutation_player_failed_to_start) -- GitLab