From b3e75e8dbec3c9de2edffb4ca4b7985f8e134919 Mon Sep 17 00:00:00 2001 From: Guillaume Genestier Date: Fri, 11 Jul 2025 11:50:34 +0200 Subject: [PATCH 1/2] Tezt/Cloud/DAL: Create client with keys when a network will be initialized --- tezt/tests/cloud/dal.ml | 67 +++++++++++++++++++++-------------------- 1 file changed, 34 insertions(+), 33 deletions(-) diff --git a/tezt/tests/cloud/dal.ml b/tezt/tests/cloud/dal.ml index 83b134a826ef..e0ae02b06ae5 100644 --- a/tezt/tests/cloud/dal.ml +++ b/tezt/tests/cloud/dal.ml @@ -2794,42 +2794,44 @@ let init_sandbox_and_activate_protocol cloud (configuration : configuration) in let* stake = configuration.stake in let* client = - Client.Agent.create - ~name:(Tezt_cloud.Agent.name agent ^ "-client") - ~endpoint:(Client.Node bootstrap_node) - agent - in - let init_yes_wallet () = - let* yes_wallet = Node.yes_wallet agent in - let* snapshot_network = - match configuration.snapshot with - | Docker_embedded path | Local_file path -> - let* network = Node.get_snapshot_info_network bootstrap_node path in - (* Yes-wallet requires the config url for protocol-specific test - networks.*) - let network = - match network with - | ("ghostnet" | "mainnet" | "sandbox") as s -> s - | s -> - (* We assume that unknown networks are protocol specific ones. *) - "https://teztnets.com/" ^ s - in - Lwt.return network - | No_snapshot -> Lwt.return "ghostnet" - in - let* _filename = - Yes_wallet.create_from_context - ~node:bootstrap_node - ~client - ~network:snapshot_network - yes_wallet - in - unit + if configuration.simulate_network = Disabled then + Client.init ~endpoint:(Node bootstrap_node) () + else + let* client = + Client.Agent.create + ~name:(Tezt_cloud.Agent.name agent ^ "-client") + ~endpoint:(Client.Node bootstrap_node) + agent + in + let* yes_wallet = Node.yes_wallet agent in + let* snapshot_network = + match configuration.snapshot with + | Docker_embedded path | Local_file path -> + let* network = Node.get_snapshot_info_network bootstrap_node path in + (* Yes-wallet requires the config url for protocol-specific test + networks.*) + let network = + match network with + | ("ghostnet" | "mainnet" | "sandbox") as s -> s + | s -> + (* We assume that unknown networks are protocol specific ones. *) + "https://teztnets.com/" ^ s + in + Lwt.return network + | No_snapshot -> Lwt.return "ghostnet" + in + let* _filename = + Yes_wallet.create_from_context + ~node:bootstrap_node + ~client + ~network:snapshot_network + yes_wallet + in + return client in let* simulated_delegates = match configuration.simulate_network with | Scatter (selected_bakers_count, baker_daemons_count) -> - let* () = init_yes_wallet () in let* all_delegates_aliases = Client.list_known_addresses client |> Lwt.map (List.map fst) in @@ -2846,7 +2848,6 @@ let init_sandbox_and_activate_protocol cloud (configuration : configuration) ( selected_bakers_count, single_key_baker_daemons_count, multiple_keys_baker_daemons_count ) -> - let* () = init_yes_wallet () in let* all_delegates_aliases = Client.list_known_addresses client |> Lwt.map (List.map fst) in -- GitLab From 662ba7aa15e3531b56949093dd65230edf2790d5 Mon Sep 17 00:00:00 2001 From: Guillaume Genestier Date: Thu, 10 Jul 2025 14:00:37 +0200 Subject: [PATCH 2/2] Tezt/Cloud/DAL: Guard yes crypto --- tezt/tests/cloud/dal.ml | 47 ++++++++++++++++++++++------------------- 1 file changed, 25 insertions(+), 22 deletions(-) diff --git a/tezt/tests/cloud/dal.ml b/tezt/tests/cloud/dal.ml index e0ae02b06ae5..23e83c49d156 100644 --- a/tezt/tests/cloud/dal.ml +++ b/tezt/tests/cloud/dal.ml @@ -2888,29 +2888,32 @@ let init_sandbox_and_activate_protocol cloud (configuration : configuration) stake in let* simulated_bakers = - (* Substitute consensus pkh with delegate pkh *) - let* yw = Node.yes_wallet agent in - let* ckm = Yes_wallet.load_consensus_key_mapping yw ~client in - List.map - (fun l -> + match configuration.simulate_network with + | Disabled -> return [] + | Map _ | Scatter _ -> + (* Substitute consensus pkh with delegate pkh *) + let* yw = Node.yes_wallet agent in + let* ckm = Yes_wallet.load_consensus_key_mapping yw ~client in List.map - (fun a -> - try - let ck = - List.find - (fun {Yes_wallet.public_key_hash; _} -> - public_key_hash = a.Account.public_key_hash) - ckm - in - { - a with - public_key_hash = ck.consensus_public_key_hash; - public_key = ck.consensus_public_key; - } - with Not_found -> a) - l) - simulated_delegates - |> return + (fun l -> + List.map + (fun a -> + try + let ck = + List.find + (fun {Yes_wallet.public_key_hash; _} -> + public_key_hash = a.Account.public_key_hash) + ckm + in + { + a with + public_key_hash = ck.consensus_public_key_hash; + public_key = ck.consensus_public_key; + } + with Not_found -> a) + l) + simulated_delegates + |> return in (* [baker_accounts] stands for the list of keys that are actually used for baking. Meaning that if a baker uses a consensus key, the baker account -- GitLab