diff --git a/tezt/tests/cloud/agent_kind.ml b/tezt/tests/cloud/agent_kind.ml new file mode 100644 index 0000000000000000000000000000000000000000..b3cfa44811da176c1c21c1a3bb748a9dce3ba166 --- /dev/null +++ b/tezt/tests/cloud/agent_kind.ml @@ -0,0 +1,38 @@ +(*****************************************************************************) +(* *) +(* SPDX-License-Identifier: MIT *) +(* Copyright (c) 2025 Nomadic Labs, *) +(* Copyright (c) 2025 Trilitech *) +(* *) +(*****************************************************************************) + +type t = + | Bootstrap + | Baker of int + | Producer of int + | Observer of [`Index of int | `Pkh of string] + | Reverse_proxy + | Etherlink_operator + | Etherlink_dal_operator + | Etherlink_dal_observer of {slot_index : int} + | Etherlink_producer of int + | Echo_rollup_operator + | Echo_rollup_dal_observer of {slot_index : int} + +let name_of = function + | Bootstrap -> "bootstrap" + | Baker i -> Format.asprintf "attester-%d" i + | Producer i -> Format.asprintf "dal-producer-%d" i + | Observer (`Index i) -> Format.asprintf "dal-observer-%d" i + | Observer (`Pkh pkh) -> + (* Shorting the pkh enables to get better logs. *) + Format.asprintf "dal-observer-%s" (String.sub pkh 0 8) + | Reverse_proxy -> "dal-reverse-proxy" + | Etherlink_operator -> "etherlink-operator" + | Etherlink_dal_operator -> "etherlink-dal-operator" + | Etherlink_dal_observer {slot_index} -> + Format.asprintf "etherlink-dal-operator-%d" slot_index + | Etherlink_producer i -> Format.asprintf "etherlink-producer-%d" i + | Echo_rollup_operator -> "echo-rollup-operator" + | Echo_rollup_dal_observer {slot_index} -> + Format.sprintf "echo-rollup-dal-node-%d" slot_index diff --git a/tezt/tests/cloud/agent_kind.mli b/tezt/tests/cloud/agent_kind.mli new file mode 100644 index 0000000000000000000000000000000000000000..6c97b36aaf061ae283759201404a5bb6b1712af4 --- /dev/null +++ b/tezt/tests/cloud/agent_kind.mli @@ -0,0 +1,38 @@ +(*****************************************************************************) +(* *) +(* SPDX-License-Identifier: MIT *) +(* Copyright (c) 2025 Nomadic Labs, *) +(* Copyright (c) 2025 Trilitech *) +(* *) +(*****************************************************************************) + +(** Here are defined various roles that agents (like L1 nodes, DAL nodes, + Bakers etc.) can assume in the tezt-cloud test scenarios. + + These roles are used to systematically name and distinguish + agents and their responsibilities across different configurations. +*) + +type t = + | Bootstrap + (** The main bootstrap node and client, typically the entry point of the network. *) + | Baker of int + (** A node responsible for block production, identified by index. *) + | Producer of int (** A DAL slot producer node, identified by index. *) + | Observer of [`Index of int | `Pkh of string] + (** A DAL observer node, either indexed or associated with a public key hash. *) + | Reverse_proxy + (** A reverse proxy between rollup nodes and multiple DAL nodes. *) + | Etherlink_operator (** The main Etherlink rollup operator node. *) + | Etherlink_dal_operator + (** A DAL node running alongside the Etherlink operator. *) + | Etherlink_dal_observer of {slot_index : int} + (** An Etherlink DAL observer responsible for a specific slot index. *) + | Etherlink_producer of int (** A DAL slot producer used by Etherlink. *) + | Echo_rollup_operator (** The main rollup operator for the Echo rollup. *) + | Echo_rollup_dal_observer of {slot_index : int} + (** A DAL observer node for the Echo rollup, indexed by slot. *) + +(** [name_of agent] returns the standard name associated with a given [agent]. + Used for consistent naming of VMs, logs and artifacts. *) +val name_of : t -> string diff --git a/tezt/tests/cloud/dal.ml b/tezt/tests/cloud/dal.ml index bb0188d7a4d86e39b4866ba59cccb883a99cdf74..005da18b5fbc76db417daf24321c0ce985d9c076 100644 --- a/tezt/tests/cloud/dal.ml +++ b/tezt/tests/cloud/dal.ml @@ -23,39 +23,10 @@ module Cryptobox = Dal_common.Cryptobox module Helpers = Dal_common.Helpers module Cli = Scenarios_cli +open Agent_kind open Scenarios_helpers open Tezos - -type agent_kind = - | Bootstrap - | Baker of int - | Producer of int - | Observer of [`Index of int | `Pkh of string] - | Reverse_proxy - | Etherlink_operator - | Etherlink_dal_operator - | Etherlink_dal_observer of {slot_index : int} - | Etherlink_producer of int - | Echo_rollup_operator - | Echo_rollup_dal_observer of {slot_index : int} - -let name_of = function - | Bootstrap -> "bootstrap" - | Baker i -> Format.asprintf "attester-%d" i - | Producer i -> Format.asprintf "dal-producer-%d" i - | Observer (`Index i) -> Format.asprintf "dal-observer-%d" i - | Observer (`Pkh pkh) -> - (* Shorting the pkh enables to get better logs. *) - Format.asprintf "dal-observer-%s" (String.sub pkh 0 8) - | Reverse_proxy -> "dal-reverse-proxy" - | Etherlink_operator -> "etherlink-operator" - | Etherlink_dal_operator -> "etherlink-dal-operator" - | Etherlink_dal_observer {slot_index} -> - Format.asprintf "etherlink-dal-operator-%d" slot_index - | Etherlink_producer i -> Format.asprintf "etherlink-producer-%d" i - | Echo_rollup_operator -> "echo-rollup-operator" - | Echo_rollup_dal_observer {slot_index} -> - Format.sprintf "echo-rollup-dal-node-%d" slot_index +open Yes_crypto (* Some DAL nodes (those in operator mode) refuse to start unless they are connected to an Octez node keeping enough history to play refutation @@ -134,201 +105,6 @@ module Disconnect = struct Lwt.return {t with disconnected_bakers = bakers_to_keep_disconnected} end -module Node = struct - open Snapshot_helpers - - let may_copy_node_identity_file agent node = function - | None -> Lwt.return_unit - | Some source -> - toplog "Copying the node identity file" ; - let* _ = - Agent.copy agent ~source ~destination:(Node.identity_file node) - in - Lwt.return_unit - - include Node - - let yes_wallet agent = - let name = Tezt_cloud.Agent.name agent ^ "-yes-wallet" in - Yes_wallet.Agent.create ~name agent - - let yes_crypto_env = - String_map.singleton - Tezos_crypto.Helpers.yes_crypto_environment_variable - "y" - - let init ?(arguments = []) ?data_dir ?identity_file ?dal_config ?env - ~rpc_external ~name network ~with_yes_crypto ~snapshot ?ppx_profiling - cloud agent = - toplog "Initializing an L1 node for %s" name ; - match network with - | #Network.public -> ( - let network = Network.to_public network in - (* for public networks deployments, we listen on all interfaces on both - ipv4 and ipv6 *) - let net_addr = "[::]" in - match data_dir with - | Some data_dir -> - let* node = - Node.Agent.create - ~rpc_external - ~net_addr - ~arguments - ~data_dir - ~name - cloud - agent - in - let* () = may_copy_node_identity_file agent node identity_file in - let* () = - Node.Agent.run - ?ppx_profiling - ?env - node - [Network (Network.to_octez_network_options network)] - in - let* () = Node.wait_for_ready node in - Lwt.return node - | None -> - toplog - "No data dir given, we will attempt to bootstrap the node from a \ - rolling snapshot." ; - toplog "Creating the agent %s." name ; - let* node = - Node.Agent.create - ~rpc_external - ~net_addr - ~arguments: - [ - Network (Network.to_octez_network_options network); - Expected_pow 26; - Cors_origin "*"; - ] - ?data_dir - ~name - cloud - agent - in - let* () = may_copy_node_identity_file agent node identity_file in - toplog "Initializing node configuration for %s" name ; - let* () = Node.config_init node [] in - let* snapshot_file_path = - ensure_snapshot ~agent ~name ~network snapshot - in - let* () = - import_snapshot - ~delete_snapshot_file:(snapshot = No_snapshot) - ~no_check:true - ~name - node - snapshot_file_path - in - toplog "Launching the node %s." name ; - let* () = - Node.Agent.run - ?ppx_profiling - ?env - node - (* We've just imported a rolling snapshot keeping few history. - To switch to the configured history mode, which may have - longer history, we need the --force-history-mode-switch - option. *) - (Force_history_mode_switch :: Synchronisation_threshold 1 - :: arguments) - in - toplog "Waiting for the node %s to be ready." name ; - let* () = wait_for_ready node in - toplog "Node %s is ready." name ; - let* () = Node.wait_for_synchronisation ~statuses:["synced"] node in - toplog "Node %s is bootstrapped" name ; - Lwt.return node) - | _ (* private network *) -> ( - (* For sandbox deployments, we only listen on local interface, hence - no connection could be made to us from outside networks *) - let net_addr = "127.0.0.1" in - let yes_crypto_arg = - if with_yes_crypto then [Allow_yes_crypto] else [] - in - match data_dir with - | None -> - let* node = - Node.Agent.create ~net_addr ~rpc_external ~name cloud agent - in - let* () = Node.config_init node [Cors_origin "*"] in - let* snapshot_path = ensure_snapshot_opt ~agent ~name snapshot in - let* snapshot_network = - match snapshot_path with - | Some path -> - let* network = get_snapshot_info_network node path in - Lwt.return_some network - | None -> Lwt.return_none - in - (* Set network *) - let* () = - Node.Config_file.update - node - (match snapshot_network with - | Some "mainnet" -> Node.Config_file.set_mainnet_network () - | Some "ghostnet" -> Node.Config_file.set_ghostnet_network () - | Some "rionet" -> Node.Config_file.set_rionet_network () - | Some "seoulnet" -> Node.Config_file.set_seoulnet_network () - | _ -> Node.Config_file.set_sandbox_network) - in - let* () = - match dal_config with - | None -> Lwt.return_unit - | Some config -> - Node.Config_file.update - node - (Node.Config_file.set_network_with_dal_config config) - in - let* () = may_copy_node_identity_file agent node identity_file in - let* () = - match snapshot_path with - | Some snapshot_path -> - import_snapshot ~no_check:true ~name node snapshot_path - | None -> Lwt.return_unit - in - let* () = - Node.Agent.run - ?ppx_profiling - ?env - node - ([ - No_bootstrap_peers; - Synchronisation_threshold 0; - Cors_origin "*"; - (* We've just imported a rolling snapshot keeping few - history. To switch to the configured history mode, which - may have longer history, we need the - --force-history-mode-switch option. *) - Force_history_mode_switch; - ] - @ yes_crypto_arg @ arguments) - in - let* () = wait_for_ready node in - Lwt.return node - | Some data_dir -> - let arguments = - [No_bootstrap_peers; Synchronisation_threshold 0; Cors_origin "*"] - @ yes_crypto_arg @ arguments - in - let* node = - Node.Agent.create - ~rpc_external - ~net_addr - ~arguments - ~data_dir - ~name - cloud - agent - in - let* () = may_copy_node_identity_file agent node identity_file in - let* () = Node.Agent.run ?env ?ppx_profiling node arguments in - let* () = Node.wait_for_ready node in - Lwt.return node) -end - module Dal_reverse_proxy = struct (** This module allows to configure NginX as a reverse proxy in front of a collection of DAL nodes. This allows to balance the @@ -2540,12 +2316,10 @@ let init_public_network cloud (configuration : configuration) let () = toplog "Some agent given (%s)" (Agent.name agent) in let () = toplog "Initializing the bootstrap node agent" in let with_yes_crypto = - match configuration.simulate_network with - | Scatter _ | Map _ -> true - | Disabled -> false + should_enable_yes_crypto configuration.simulate_network in let* node = - Node.init + Node_helpers.init ?identity_file:configuration.bootstrap_node_identity_file ~rpc_external:configuration.external_rpc ~name:"bootstrap-node" @@ -2694,10 +2468,6 @@ let round_robin_split m lst = (List.rev lst) ; Array.to_list buckets |> List.rev -let may_set_yes_crypto = function - | Cli.Scatter _ | Map _ -> (Some Node.yes_crypto_env, true) - | Disabled -> (None, false) - let init_sandbox_and_activate_protocol cloud (configuration : configuration) ?(etherlink_configuration : etherlink_configuration option) agent = let dal_bootstrap_node_net_port = Agent.next_available_port agent in @@ -2713,10 +2483,10 @@ let init_sandbox_and_activate_protocol cloud (configuration : configuration) configuration.data_dir |> Option.map (fun data_dir -> data_dir // name) in let env, with_yes_crypto = - may_set_yes_crypto configuration.simulate_network + may_set_yes_crypto_env configuration.simulate_network in let* bootstrap_node = - Node.init + Node_helpers.init ?env ?data_dir ?identity_file:configuration.bootstrap_node_identity_file @@ -2757,7 +2527,7 @@ let init_sandbox_and_activate_protocol cloud (configuration : configuration) ~endpoint:(Client.Node bootstrap_node) agent in - let* yes_wallet = Node.yes_wallet agent in + let* yes_wallet = Node_helpers.yes_wallet agent in let* snapshot_network = match configuration.snapshot with | Docker_embedded path | Local_file path -> @@ -2864,7 +2634,7 @@ let init_sandbox_and_activate_protocol cloud (configuration : configuration) |> return | Map _ | Scatter _ -> (* Substitute consensus pkh with delegate pkh *) - let* yw = Node.yes_wallet agent in + let* yw = Node_helpers.yes_wallet agent in let* ckm = Yes_wallet.load_consensus_key_mapping yw ~client in List.map (fun l -> @@ -3072,10 +2842,10 @@ let init_baker ?stake cloud (configuration : configuration) ~bootstrap teztale configuration.data_dir |> Option.map (fun data_dir -> data_dir // name) in let env, with_yes_crypto = - may_set_yes_crypto configuration.simulate_network + may_set_yes_crypto_env configuration.simulate_network in let* node = - Node.init + Node_helpers.init ?env ?data_dir ~arguments:Node.[Peer bootstrap.node_p2p_endpoint] @@ -3150,7 +2920,7 @@ let init_baker ?stake cloud (configuration : configuration) ~bootstrap teztale let* () = match configuration.simulate_network with | Scatter _ | Map _ -> - let* yes_wallet = Node.yes_wallet agent in + let* yes_wallet = Node_helpers.yes_wallet agent in let* () = Lwt_list.iter_s (fun account -> @@ -3204,10 +2974,10 @@ let init_producer cloud configuration ~bootstrap teztale account i slot_index in let () = toplog "Init producer %s: init L1 node" name in let env, with_yes_crypto = - may_set_yes_crypto configuration.simulate_network + may_set_yes_crypto_env configuration.simulate_network in let* node = - Node.init + Node_helpers.init ?env ?data_dir ~name @@ -3317,10 +3087,10 @@ let init_observer cloud configuration ~bootstrap teztale ~topic i agent = configuration.data_dir |> Option.map (fun data_dir -> data_dir // name) in let env, with_yes_crypto = - may_set_yes_crypto configuration.simulate_network + may_set_yes_crypto_env configuration.simulate_network in let* node = - Node.init + Node_helpers.init ?env ?data_dir ~name @@ -3407,9 +3177,9 @@ let init_dal_reverse_proxy_observers |> Lwt_list.map_p (fun slot_index -> let name = name_of slot_index in let* agent = next_agent ~name in - let env, with_yes_crypto = may_set_yes_crypto simulate_network in + let env, with_yes_crypto = may_set_yes_crypto_env simulate_network in let* node = - Node.init + Node_helpers.init ?env ~name ~arguments: @@ -3477,9 +3247,9 @@ let init_etherlink_dal_node toplog "Etherlink sequencer will run its own DAL node" ; let name = name_of Etherlink_dal_operator in let* agent = next_agent ~name in - let env, with_yes_crypto = may_set_yes_crypto simulate_network in + let env, with_yes_crypto = may_set_yes_crypto_env simulate_network in let* node = - Node.init + Node_helpers.init ?env ~name ~arguments: @@ -3521,9 +3291,9 @@ let init_etherlink_dal_node toplog "Etherlink sequencer will use a reverse proxy" ; let name = name_of Etherlink_dal_operator in let* agent = next_agent ~name in - let env, with_yes_crypto = may_set_yes_crypto simulate_network in + let env, with_yes_crypto = may_set_yes_crypto_env simulate_network in let* node = - Node.init + Node_helpers.init ?env ~name ~arguments: @@ -3577,10 +3347,10 @@ let init_etherlink_operator_setup cloud configuration etherlink_configuration configuration.data_dir |> Option.map (fun data_dir -> data_dir // name) in let env, with_yes_crypto = - may_set_yes_crypto configuration.simulate_network + may_set_yes_crypto_env configuration.simulate_network in let* node = - Node.init + Node_helpers.init ?env ?data_dir ~name @@ -3969,10 +3739,10 @@ let init_echo_rollup cloud configuration ~bootstrap operator dal_slots configuration.data_dir |> Option.map (fun data_dir -> data_dir // name) in let env, with_yes_crypto = - may_set_yes_crypto configuration.simulate_network + may_set_yes_crypto_env configuration.simulate_network in let* node = - Node.init + Node_helpers.init ?env ?data_dir ~name diff --git a/tezt/tests/cloud/node_helpers.ml b/tezt/tests/cloud/node_helpers.ml new file mode 100644 index 0000000000000000000000000000000000000000..c4f277fb7483bfb340e48d7bb531ca75bda82e24 --- /dev/null +++ b/tezt/tests/cloud/node_helpers.ml @@ -0,0 +1,197 @@ +(*****************************************************************************) +(* *) +(* SPDX-License-Identifier: MIT *) +(* Copyright (c) 2025 Nomadic Labs, *) +(* Copyright (c) 2025 Trilitech *) +(* *) +(*****************************************************************************) + +open Scenarios_helpers +open Snapshot_helpers +open Tezos + +let may_copy_node_identity_file agent node = function + | None -> Lwt.return_unit + | Some source -> + toplog "Copying the node identity file" ; + let* _ = + Agent.copy agent ~source ~destination:(Node.identity_file node) + in + Lwt.return_unit + +let yes_wallet agent = + let name = Tezt_cloud.Agent.name agent ^ "-yes-wallet" in + Yes_wallet.Agent.create ~name agent + +let init ?(arguments = []) ?data_dir ?identity_file ?dal_config ?env + ~rpc_external ~name network ~with_yes_crypto ~snapshot ?ppx_profiling cloud + agent = + toplog "Initializing an L1 node for %s" name ; + match network with + | #Network.public -> ( + let network = Network.to_public network in + (* for public networks deployments, we listen on all interfaces on both + ipv4 and ipv6 *) + let net_addr = "[::]" in + match data_dir with + | Some data_dir -> + let* node = + Node.Agent.create + ~rpc_external + ~net_addr + ~arguments + ~data_dir + ~name + cloud + agent + in + let* () = may_copy_node_identity_file agent node identity_file in + let* () = + Node.Agent.run + ?ppx_profiling + ?env + node + [Network (Network.to_octez_network_options network)] + in + let* () = Node.wait_for_ready node in + Lwt.return node + | None -> + toplog + "No data dir given, we will attempt to bootstrap the node from a \ + rolling snapshot." ; + toplog "Creating the agent %s." name ; + let* node = + Node.Agent.create + ~rpc_external + ~net_addr + ~arguments: + [ + Network (Network.to_octez_network_options network); + Expected_pow 26; + Cors_origin "*"; + ] + ?data_dir + ~name + cloud + agent + in + let* () = may_copy_node_identity_file agent node identity_file in + toplog "Initializing node configuration for %s" name ; + let* () = Node.config_init node [] in + let* snapshot_file_path = + ensure_snapshot ~agent ~name ~network snapshot + in + let* () = + import_snapshot + ~delete_snapshot_file:(snapshot = No_snapshot) + ~no_check:true + ~name + node + snapshot_file_path + in + toplog "Launching the node %s." name ; + let* () = + Node.Agent.run + ?ppx_profiling + ?env + node + (* We've just imported a rolling snapshot keeping few history. + To switch to the configured history mode, which may have + longer history, we need the --force-history-mode-switch + option. *) + (Force_history_mode_switch :: Synchronisation_threshold 1 + :: arguments) + in + toplog "Waiting for the node %s to be ready." name ; + let* () = Node.wait_for_ready node in + toplog "Node %s is ready." name ; + let* () = Node.wait_for_synchronisation ~statuses:["synced"] node in + toplog "Node %s is bootstrapped" name ; + Lwt.return node) + | _ (* private network *) -> ( + (* For sandbox deployments, we only listen on local interface, hence + no connection could be made to us from outside networks *) + let net_addr = "127.0.0.1" in + let yes_crypto_arg = + if with_yes_crypto then [Node.Allow_yes_crypto] else [] + in + match data_dir with + | None -> + let* node = + Node.Agent.create ~net_addr ~rpc_external ~name cloud agent + in + let* () = Node.config_init node [Cors_origin "*"] in + let* snapshot_path = ensure_snapshot_opt ~agent ~name snapshot in + let* snapshot_network = + match snapshot_path with + | Some path -> + let* network = get_snapshot_info_network node path in + Lwt.return_some network + | None -> Lwt.return_none + in + (* Set network *) + let* () = + Node.Config_file.update + node + (match snapshot_network with + | Some "mainnet" -> Node.Config_file.set_mainnet_network () + | Some "ghostnet" -> Node.Config_file.set_ghostnet_network () + | Some "rionet" -> Node.Config_file.set_rionet_network () + | Some "seoulnet" -> Node.Config_file.set_seoulnet_network () + | _ -> Node.Config_file.set_sandbox_network) + in + let* () = + match dal_config with + | None -> Lwt.return_unit + | Some config -> + Node.Config_file.update + node + (Node.Config_file.set_network_with_dal_config config) + in + let* () = may_copy_node_identity_file agent node identity_file in + let* () = + match snapshot_path with + | Some snapshot_path -> + import_snapshot ~no_check:true ~name node snapshot_path + | None -> Lwt.return_unit + in + let* () = + Node.Agent.run + ?ppx_profiling + ?env + node + (Node. + [ + No_bootstrap_peers; + Synchronisation_threshold 0; + Cors_origin "*"; + (* We've just imported a rolling snapshot keeping few + history. To switch to the configured history mode, which + may have longer history, we need the + --force-history-mode-switch option. *) + Force_history_mode_switch; + ] + @ yes_crypto_arg @ arguments) + in + let* () = Node.wait_for_ready node in + Lwt.return node + | Some data_dir -> + let arguments = + Node. + [No_bootstrap_peers; Synchronisation_threshold 0; Cors_origin "*"] + @ yes_crypto_arg @ arguments + in + let* node = + Node.Agent.create + ~rpc_external + ~net_addr + ~arguments + ~data_dir + ~name + cloud + agent + in + let* () = may_copy_node_identity_file agent node identity_file in + let* () = Node.Agent.run ?env ?ppx_profiling node arguments in + let* () = Node.wait_for_ready node in + Lwt.return node) diff --git a/tezt/tests/cloud/node_helpers.mli b/tezt/tests/cloud/node_helpers.mli new file mode 100644 index 0000000000000000000000000000000000000000..d6627ff08f067e2969a2c99d87de08b8ceaf5fab --- /dev/null +++ b/tezt/tests/cloud/node_helpers.mli @@ -0,0 +1,45 @@ +(*****************************************************************************) +(* *) +(* SPDX-License-Identifier: MIT *) +(* Copyright (c) 2025 Nomadic Labs, *) +(* Copyright (c) 2025 Trilitech *) +(* *) +(*****************************************************************************) + +(** This module provides high-level utilities for initializing + Tezos L1 nodes in both public and private network configurations, + as used in Tezt cloud-based scenarios. + + It wraps the lower-level [Node] and [Node.Agent] modules with additional + logic for snapshot handling, identity propagation, DAL configuration, + "yes-crypto" simulation, and automatic bootstrapping behavior. +*) + +(** Shortcut to create a "yes-wallet" for the given agent. *) +val yes_wallet : Agent.t -> Yes_wallet.t Lwt.t + +(** Initialize an L1 node for the given configuration. + + If a [~snapshot] is provided and [?data_dir] is omitted, the node will be + bootstrapped using the snapshot. Otherwise, a normal configuration + initialization is used. + + In public networks, the node listens on all interfaces ([::]), + whereas for private networks, it binds to [127.0.0.1]. +*) + +val init : + ?arguments:Node.argument list -> + ?data_dir:string -> + ?identity_file:string -> + ?dal_config:Tezos_crypto_dal_octez_dal_config.Dal_config.t -> + ?env:string String_map.t -> + rpc_external:bool -> + name:string -> + Network.t -> + with_yes_crypto:bool -> + snapshot:Snapshot_helpers.t -> + ?ppx_profiling:bool -> + Cloud.t -> + Agent.t -> + Node.t Lwt.t diff --git a/tezt/tests/cloud/yes_crypto.ml b/tezt/tests/cloud/yes_crypto.ml new file mode 100644 index 0000000000000000000000000000000000000000..000015d56a6ea391ab4184c9046c6ac66ea8276f --- /dev/null +++ b/tezt/tests/cloud/yes_crypto.ml @@ -0,0 +1,20 @@ +(*****************************************************************************) +(* *) +(* SPDX-License-Identifier: MIT *) +(* Copyright (c) 2025 Nomadic Labs, *) +(* Copyright (c) 2025 Trilitech *) +(* *) +(*****************************************************************************) + +open Scenarios_cli + +let yes_crypto_env = + String_map.singleton Tezos_crypto.Helpers.yes_crypto_environment_variable "y" + +let should_enable_yes_crypto = function + | Scatter _ | Map _ -> true + | Disabled -> false + +let may_set_yes_crypto_env = function + | Scatter _ | Map _ -> (Some yes_crypto_env, true) + | Disabled -> (None, false) diff --git a/tezt/tests/cloud/yes_crypto.mli b/tezt/tests/cloud/yes_crypto.mli new file mode 100644 index 0000000000000000000000000000000000000000..86cac33b28e8e90a5913f304d813dd8b4677f487 --- /dev/null +++ b/tezt/tests/cloud/yes_crypto.mli @@ -0,0 +1,24 @@ +(*****************************************************************************) +(* *) +(* SPDX-License-Identifier: MIT *) +(* Copyright (c) 2025 Nomadic Labs, *) +(* Copyright (c) 2025 Trilitech *) +(* *) +(*****************************************************************************) + +(** This module provides utilities for enabling the "yes-crypto" testing mode, + which bypasses certain cryptographic confirmations in Octez nodes. +*) + +open Scenarios_cli + +(** [should_enable_yes_crypto config] returns a flag + indicating whether "yes-crypto" mode should be enabled (for [Scatter] and [Map]) + or disabled (for [Disabled]). *) +val should_enable_yes_crypto : network_simulation_config -> bool + +(** [may_set_yes_crypto_env config] is similar to [should_enable_yes_crypto], + but also returns the environment variable that needs to be set to enable + the yes-crypto mechanism. *) +val may_set_yes_crypto_env : + network_simulation_config -> string String_map.t option * bool