From 1084772003db21e7b1c7f7e8e78aa9434eb572bb Mon Sep 17 00:00:00 2001 From: vgorkavenko Date: Mon, 28 Oct 2024 11:11:42 +0100 Subject: [PATCH] fix: case insensitive compare addresses --- ethd | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/ethd b/ethd index 2dc4fcd7..eca3f1c8 100755 --- a/ethd +++ b/ethd @@ -3296,7 +3296,7 @@ __query_lido_obol_cluster_definition() { ${__as_owner} curl -o ./.eth/cluster_definition.tmp -s "${__cluster_definition_url}" -H "Accept: application/json" # shellcheck disable=SC2086 __cluster_definition_is_valid=$(__docompose -f ./lido-obol.yml run --rm -v "$(pwd)"/.eth/cluster_definition.tmp:/cluster_definition.json:ro curl-jq sh -c \ - "cat /cluster_definition.json | jq -r 'all(.validators[]; .fee_recipient_address == \"'${FEE_RECIPIENT}'\" and .withdrawal_address == \"'$(__lido_withdrawal_credentials_address)'\")'" | tail -n 1) + "cat /cluster_definition.json | jq -r 'all(.validators[]; ascii_downcase(.fee_recipient_address) == ascii_downcase(\"'${FEE_RECIPIENT}'\") and ascii_downcase(.withdrawal_address) == ascii_downcase(\"'$(__lido_withdrawal_credentials_address)'\"))'" | tail -n 1) set -e if [ "${__cluster_definition_is_valid}" = "true" ]; then echo "Your cluster definition url is:" "${__cluster_definition_url}" @@ -3588,7 +3588,7 @@ config() { if (whiptail --title "Lido Obol cluster exists" --yesno "Your cluster has already been created. Continue with it?" 10 60); then # shellcheck disable=SC2086 __cluster_lock_is_valid=$(__docompose -f ./lido-obol.yml run --rm -v "$(pwd)"/.eth/cluster-lock.json:/cluster-lock.json:ro curl-jq sh -c \ - "cat /cluster-lock.json | jq -r 'all(.cluster_definition.validators[]; .fee_recipient_address == \"'${FEE_RECIPIENT}'\" and .withdrawal_address == \"'$(__lido_withdrawal_credentials_address)'\")'" | tail -n 1) + "cat /cluster-lock.json | jq -r 'all(.cluster_definition.validators[]; (.fee_recipient_address | ascii_downcase) == (\"'${FEE_RECIPIENT}'\" | ascii_downcase) and (.withdrawal_address | ascii_downcase) == (\"'$(__lido_withdrawal_credentials_address)'\" | ascii_downcase))'" | tail -n 1) if [[ "${__cluster_lock_is_valid}" =~ "true" ]]; then echo "Your cluster lock is valid." else @@ -3624,7 +3624,7 @@ config() { if (whiptail --title "Lido Obol cluster creation in process" --yesno "You already have cluster definition. Use it?" 10 60); then # shellcheck disable=SC2086 __cluster_definition_is_valid=$(__docompose -f ./lido-obol.yml run --rm -v "$(pwd)"/.eth/cluster-definition.json:/cluster-definition.json:ro curl-jq sh -c \ - "cat /cluster-definition.json | jq -r 'all(.validators[]; .fee_recipient_address == \"'${FEE_RECIPIENT}'\" and .withdrawal_address == \"'$(__lido_withdrawal_credentials_address)'\")'" | tail -n 1) + "cat /cluster-definition.json | jq -r 'all(.validators[]; (.fee_recipient_address | ascii_downcase) == (\"'${FEE_RECIPIENT}'\" | ascii_downcase) and (.withdrawal_address | ascii_downcase) == (\"'$(__lido_withdrawal_credentials_address)'\" | ascii_downcase))'" | tail -n 1) if [ "${__cluster_definition_is_valid}" = "true" ]; then echo "Your cluster definition is valid." else