forked from osmosis-labs/osmosis
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(SQS): queries and state validations scripts (osmosis-labs#7043)
* feat(SQS): queries and state validations scripts * lint
- Loading branch information
Showing
13 changed files
with
334 additions
and
32 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
#!/bin/bash | ||
|
||
validate_http_code() { | ||
local http_status=$1 | ||
local check_url=$2 | ||
# Check if the HTTP status code is 200 | ||
if [ "$http_status" -eq 200 ]; then | ||
echo "Status check successful (HTTP 200 OK) " $check_url | ||
else | ||
echo "Health check failed with HTTP $http_status" | ||
error_message=$(curl -s -o /dev/null -w "%{stderr}" $check_url) | ||
echo "Error message: $error_message" | ||
exit 1 | ||
fi | ||
} | ||
|
||
# This script performs a health check on the node by making a GET request to the health check URL | ||
# and checking if the HTTP status code is 200. If the HTTP status code is not 200, the script | ||
# will exit with a non-zero exit code and print the error message. | ||
perform_health_check() { | ||
local url=$1 | ||
|
||
health_check_url=$url/healthcheck | ||
|
||
# Make a GET request to the health check URL and capture the HTTP status code and error message | ||
code_str=$(curl --write-out '%{http_code}' --silent --output /dev/null $health_check_url) | ||
|
||
validate_http_code $code_str $health_check_url | ||
} | ||
|
||
# This script performs a status check on the node by making a POST request to the status check URL via grpc | ||
# and checking if the HTTP status code is 200. If the HTTP status code is not 200, the script | ||
# will exit with a non-zero exit code and print the error message. | ||
# It also prints height and whether a node is syncing or not. | ||
perform_status_check() { | ||
local status_check_url=$1 | ||
|
||
full_status_url=$status_check_url/status | ||
|
||
code_str=$(curl --write-out '%{http_code}' --silent --output /dev/null $full_status_url) | ||
|
||
validate_http_code $code_str $full_status_url | ||
|
||
# Make a POST request to the health check URL and capture the full response | ||
full_response=$(curl -X POST -H "Content-Type: application/json" -d '{ | ||
"jsonrpc": "2.0", | ||
"method": "status", | ||
"id": 1 | ||
}' $status_check_url) | ||
|
||
# Extract the status code using jq | ||
block_height=$(echo "$full_response" | jq .result.sync_info.latest_block_height) | ||
echo "Height" $block_height | ||
|
||
is_syncing=$(echo "$full_response" | jq .result.sync_info.catching_up) | ||
echo "Is Synching" $is_syncing | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
#!/bin/bash | ||
|
||
url=$1 | ||
|
||
# This script compares single hop quotes by running them against SQS and chain directly. | ||
|
||
chain_amount_out=$(osmosisd q poolmanager estimate-swap-exact-amount-in 1136 1000000ibc/C140AFD542AE77BD7DCC83F13FDD8C5E5BB8C4929785E6EC2F4C636F98F17901 --swap-route-pool-ids 1136 --swap-route-denoms ibc/27394FB092D2ECCD56123C74F36E4C1F926001CEADA9CA97EA622B25F41E5EB2) | ||
|
||
sqs_res=$(curl "$url/router/custom-quote?tokenIn=1000000ibc/C140AFD542AE77BD7DCC83F13FDD8C5E5BB8C4929785E6EC2F4C636F98F17901&tokenOutDenom=ibc/27394FB092D2ECCD56123C74F36E4C1F926001CEADA9CA97EA622B25F41E5EB2&poolIDs=1136") | ||
|
||
sqs_amount_out=$(echo $sqs_res | jq .amount_out) | ||
|
||
echo "chain_amount_out: $chain_amount_out" | ||
echo "sqs_amount_out: $sqs_amount_out" |
Oops, something went wrong.