Skip to content

Commit

Permalink
[Lido] fix: fee recipient address case (#1967)
Browse files Browse the repository at this point in the history
* fix: fee recipient address case

* fix: case insensitive compare addresses

* fix: `cluster_definition` -> `cluster-definition`
  • Loading branch information
vgorkavenko authored Oct 28, 2024
1 parent 73f3fa4 commit 8fb84cd
Showing 1 changed file with 8 additions and 8 deletions.
16 changes: 8 additions & 8 deletions ethd
Original file line number Diff line number Diff line change
Expand Up @@ -2986,7 +2986,7 @@ __query_coinbase() {
if [[ "${__deployment}" =~ "lido_" ]]; then
case "${NETWORK}" in
"mainnet")
FEE_RECIPIENT="0x388c818ca8b9251b393131c08a736a67ccb19297"
FEE_RECIPIENT="0x388C818CA8B9251b393131C08a736A67ccB19297"
;;
"holesky")
FEE_RECIPIENT="0xE73a3602b99f1f913e72F8bdcBC235e206794Ac8"
Expand Down Expand Up @@ -3294,18 +3294,18 @@ __query_lido_obol_cluster_definition() {
fi
exitstatus=$?
if [ $exitstatus -eq 0 ]; then
${__as_owner} curl -o ./.eth/cluster_definition.tmp -s "${__cluster_definition_url}" -H "Accept: application/json"
${__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)
__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 | ascii_downcase) == (\"'${FEE_RECIPIENT}'\" | ascii_downcase) and (.withdrawal_address | ascii_downcase) == (\"'$(__lido_withdrawal_credentials_address)'\" | ascii_downcase))'" | tail -n 1)
set -e
if [ "${__cluster_definition_is_valid}" = "true" ]; then
echo "Your cluster definition url is:" "${__cluster_definition_url}"
${__as_owner} mv ./.eth/cluster_definition.tmp ./.eth/cluster-definition.json
${__as_owner} mv ./.eth/cluster-definition.tmp ./.eth/cluster-definition.json
else
whiptail --title "Lido Obol cluster creation" --msgbox "Your cluster definition is not valid.\n\nCheck that every validator has \`fee_recipient_address\` and \`withdrawal_address\` equal to Lido contracts and try again.\n\nLido fee recipient: '${FEE_RECIPIENT}'\nLido withdrawal credentials: '$(__lido_withdrawal_credentials_address)'" 14 90
echo "Your cluster definition is NOT valid."
${__as_owner} rm ./.eth/cluster_definition.tmp
${__as_owner} rm ./.eth/cluster-definition.tmp
exit 1
fi
else
Expand Down Expand Up @@ -3589,7 +3589,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
Expand Down Expand Up @@ -3625,7 +3625,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
Expand Down

0 comments on commit 8fb84cd

Please sign in to comment.