Skip to content

Commit 598c503

Browse files
committed
Progress counter for key import
1 parent fb928a4 commit 598c503

1 file changed

Lines changed: 12 additions & 0 deletions

File tree

vc-utils/keymanager.sh

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -659,9 +659,11 @@ validator-delete() {
659659
local vc_api_tls
660660
local pubkeys=()
661661
local keys_to_array
662+
local num_keys
662663
local yn
663664
local status
664665
local file
666+
local i
665667

666668
if [[ -z "${__pubkey}" ]]; then
667669
echo "Please specify a validator public key to delete, or \"all\""
@@ -713,7 +715,11 @@ validator-delete() {
713715
else
714716
pubkeys+=( "${__pubkey}" )
715717
fi
718+
num_keys=${#pubkeys[@]}
719+
i=0
716720
for __pubkey in "${pubkeys[@]}"; do
721+
(( i+=1 ))
722+
echo "Deleting key ${i} of ${num_keys}"
717723
# Remove remote registration, with a path not to
718724
if [[ "${WEB3SIGNER}" = "true" ]]; then
719725
if [[ -z "${W3S_NOREG+x}" ]]; then
@@ -846,6 +852,7 @@ validator-import() {
846852
local keyfile
847853
local passfile
848854
local yn
855+
local i
849856

850857
__eth2_val_tools=0
851858

@@ -893,6 +900,8 @@ and secrets directories into .eth/validator_keys instead."
893900
password="${KEYSTORE_PASSWORD}"
894901
justone=1
895902
else
903+
echo "You are about to import ${num_files} keys."
904+
echo
896905
echo "WARNING - imported keys are immediately live. If these keys exist elsewhere,"
897906
echo "you WILL get slashed. If it has been less than 15 minutes since you deleted them elsewhere,"
898907
echo "you are at risk of getting slashed. Exercise caution"
@@ -934,10 +943,12 @@ and secrets directories into .eth/validator_keys instead."
934943
fi
935944
fi
936945
reg_errored=0
946+
i=0
937947
# See https://www.shellcheck.net/wiki/SC2044 as for why
938948
# Using file descriptor 3 so this doesn't conflict with the "different passwords" read
939949
# Could also use dialog, but would need to make sure it exists
940950
while IFS= read -r -u 3 keyfile; do
951+
(( i+=1 ))
941952
[[ -f "${keyfile}" ]] || continue
942953
keydir=$(dirname "${keyfile}")
943954
__pubkey=0x$(jq -r '.pubkey' "${keyfile}")
@@ -1024,6 +1035,7 @@ and secrets directories into .eth/validator_keys instead."
10241035
jq --arg keystore_value "${keystore_json}" --arg password_value "${password}" --slurpfile protect_value /tmp/protect.json '. | .keystores += [$keystore_value] | .passwords += [$password_value] | . += {slashing_protection: $protect_value[0]}' <<< '{}' >/tmp/apidata.txt
10251036
fi
10261037

1038+
echo "Importing key ${i} of ${num_files}"
10271039
if [[ "${WEB3SIGNER}" = "true" ]]; then
10281040
__token=NIL
10291041
vc_api_container=${__api_container}

0 commit comments

Comments
 (0)