From 56378e8c8dbc13403502fa86d67b8c1879060e03 Mon Sep 17 00:00:00 2001 From: Adam Allombert-Goget Date: Thu, 22 May 2025 14:20:31 +0200 Subject: [PATCH] tezt/client: update import_public_key helper function --- tezt/lib_tezos/client.ml | 10 ++++------ tezt/lib_tezos/client.mli | 2 +- tezt/tests/cloud/layer1.ml | 7 +++---- tezt/tests/companion_key.ml | 6 ++++-- tezt/tests/consensus_key.ml | 6 ++++-- 5 files changed, 16 insertions(+), 15 deletions(-) diff --git a/tezt/lib_tezos/client.ml b/tezt/lib_tezos/client.ml index 41f478970ccc..0260f594ab22 100644 --- a/tezt/lib_tezos/client.ml +++ b/tezt/lib_tezos/client.ml @@ -599,11 +599,9 @@ let import_encrypted_secret_key ?hooks ?force ?endpoint client let* () = Lwt_io.close output_channel in Process.check process -let spawn_import_public_key ?(force = false) ?endpoint client - (public_key : Account.secret_key) ~alias = - let pk_uri = - "unencrypted:" ^ Account.require_unencrypted_secret_key ~__LOC__ public_key - in +let spawn_import_public_key ?(force = false) ?endpoint client public_key ~alias + = + let pk_uri = "unencrypted:" ^ public_key in let force = if force then ["--force"] else [] in spawn_command ?endpoint @@ -644,7 +642,7 @@ let import_signer_key ?endpoint ?force ?signer ~public_key_hash ~alias client = client |> Process.check -let import_public_key ?force ?endpoint client public_key ~alias = +let import_public_key ?force ?endpoint client ~public_key ~alias = spawn_import_public_key ?force ?endpoint client public_key ~alias |> Process.check diff --git a/tezt/lib_tezos/client.mli b/tezt/lib_tezos/client.mli index de8a984147d2..2f23c53201ac 100644 --- a/tezt/lib_tezos/client.mli +++ b/tezt/lib_tezos/client.mli @@ -451,7 +451,7 @@ val import_public_key : ?force:bool -> ?endpoint:endpoint -> t -> - Account.secret_key -> + public_key:string -> alias:string -> unit Lwt.t diff --git a/tezt/tests/cloud/layer1.ml b/tezt/tests/cloud/layer1.ml index b99a3e7e39e8..df94149a790a 100644 --- a/tezt/tests/cloud/layer1.ml +++ b/tezt/tests/cloud/layer1.ml @@ -268,9 +268,8 @@ module Node = struct let* yes_wallet = yes_wallet agent in let* () = Lwt_list.iter_s - (fun {pkh; pk} -> - let alias = pkh in - Client.import_public_key ~alias client @@ Unencrypted pk) + (fun {pkh = alias; pk = public_key} -> + Client.import_public_key ~alias ~public_key client) accounts in let* () = Yes_wallet.convert_wallet_inplace ~client yes_wallet in @@ -291,7 +290,7 @@ module Node = struct let* client = client ~node agent in let* yes_wallet = yes_wallet agent in let* () = Client.forget_all_keys client in - let* () = Client.import_public_key ~alias:pkh client @@ Unencrypted pk in + let* () = Client.import_public_key ~alias:pkh ~public_key:pk client in let* () = Yes_wallet.convert_wallet_inplace ~client yes_wallet in let* accounts = Client.stresstest_gen_keys diff --git a/tezt/tests/companion_key.ml b/tezt/tests/companion_key.ml index 8e492327e842..1da0ca8523a9 100644 --- a/tezt/tests/companion_key.ml +++ b/tezt/tests/companion_key.ml @@ -342,8 +342,10 @@ let test_update_companion_key_with_external_pop = Log.info "Import the key on the first client" ; let* () = - Client.import_public_key ~alias:"companion_key" client - @@ Unencrypted companion_key_bls.public_key + Client.import_public_key + ~alias:"companion_key" + ~public_key:companion_key_bls.public_key + client in Log.info "Updating companion key without secret key nor proof possession" ; let* () = diff --git a/tezt/tests/consensus_key.ml b/tezt/tests/consensus_key.ml index cc43338da66a..1d8d9877697f 100644 --- a/tezt/tests/consensus_key.ml +++ b/tezt/tests/consensus_key.ml @@ -903,8 +903,10 @@ let test_update_consensus_key_with_external_pop = Log.info "Import the key on the first client" ; let* () = - Client.import_public_key ~alias:"consensus_key" client - @@ Unencrypted consensus_key_bls.public_key + Client.import_public_key + ~alias:"consensus_key" + ~public_key:consensus_key_bls.public_key + client in Log.info "Updating consensus key without secret key nor proof of possession" ; let* () = -- GitLab