diff --git a/ethd b/ethd index 94435286..cf9ffb5c 100755 --- a/ethd +++ b/ethd @@ -2139,6 +2139,8 @@ __keys_usage() { echo "Call keymanager with an ACTION, one of:" echo " list" echo " Lists the public keys of all validators currently loaded into your validator client" + echo " count" + echo " Counts the keys currently loaded into your validator client" echo " import" echo " Import all keystore*.json in .eth/validator_keys while loading slashing protection data" echo " in slashing_protection*.json files that match the public key(s) of the imported validator(s)" @@ -3428,7 +3430,7 @@ __full_help() { echo " config" echo " configures ${__project_name} with your choice of Ethereum clients" echo " keys ACTION [--non-interactive]" - echo " list, delete, import keys; their fee recipients; and gas fees" + echo " list, count, delete, import keys; their fee recipients; and gas fees" echo " Run without ACTION to get help text" echo " update [--refresh-targets] [--non-interactive]" echo " updates all client versions and ${__project_name} itself" diff --git a/vc-utils/keymanager.sh b/vc-utils/keymanager.sh index bc903a75..503e3e80 100755 --- a/vc-utils/keymanager.sh +++ b/vc-utils/keymanager.sh @@ -485,6 +485,40 @@ validator-list() { fi } +validator-count() { + __api_path=eth/v1/keystores + if [ "${WEB3SIGNER}" = "true" ]; then + __token=NIL + __vc_api_container=${__api_container} + __api_container=web3signer + __vc_api_port=${__api_port} + __api_port=9000 + __vc_api_tls=${__api_tls} + __api_tls=false + else + get-token + fi + __validator-list-call + key_count=$(echo "$__result" | jq -r '.data | length') + echo "Validator keys loaded into ${__service}: $key_count" + + if [ "${WEB3SIGNER}" = "true" ]; then + get-token + __api_path=eth/v1/remotekeys + __api_container=${__vc_api_container} + __service=${__vc_service} + __api_port=${__vc_api_port} + __api_tls=${__vc_api_tls} + __validator-list-call + remote_key_count=$(echo "$__result" | jq -r '.data | length') + echo "Remote Validator keys registered with ${__service}: $remote_key_count" + if [ "${key_count}" -ne "${remote_key_count}" ]; then + echo "WARNING: The number of keys loaded into Web3signer and registered with the validator client differ." + echo "Please run \"./ethd keys register\"" + fi + fi +} + validator-delete() { if [ -z "${__pubkey}" ]; then echo "Please specify a validator public key to delete, or \"all\"" @@ -1056,6 +1090,8 @@ usage() { echo "Call keymanager with an ACTION, one of:" echo " list" echo " Lists the public keys of all validators currently loaded into your validator client" + echo " count" + echo " Counts the number of keys currently loaded into your validator client" echo " import" echo " Import all keystore*.json in .eth/validator_keys while loading slashing protection data" echo " in slashing_protection*.json files that match the public key(s) of the imported validator(s)" @@ -1206,6 +1242,9 @@ case "$3" in register) validator-register ;; + count) + validator-count + ;; get-recipient) __pubkey=$4 recipient-get