Remove unused

This commit is contained in:
Jakob Notland 2026-06-09 13:56:45 +02:00
parent a622d48b29
commit 8d46dc3159

View file

@ -1,101 +0,0 @@
#!/usr/bin/env bash
# Compare price/<token>/at/<ts> between a local instance and production.
# Usage: ./compare_price.sh [local_base] [prod_base]
# Defaults: localhost:8000 indexer.riften.net
LOCAL="${1:-http://localhost:8000}"
PROD="${2:-https://indexer.riften.net}"
TOKENS=(
"422134612b1914d7f7ff2cf9b793f5b5356a424ca195887a0458e55b38017d71"
"b38a33f750f84c5c169a6f23cb873e6e79605021585d4f3408789689ed87f366"
)
# One timestamp per month from Jun 2024 through Mar 2026
TIMESTAMPS=(
1717200000 # 2024-06-01
1719878400 # 2024-07-02
1722470400 # 2024-08-01
1725148800 # 2024-09-01
1727740800 # 2024-10-01
1730419200 # 2024-11-01
1733011200 # 2024-12-01
1735689600 # 2025-01-01
1738368000 # 2025-02-01
1741046400 # 2025-03-04
1743724800 # 2025-04-04
1746316800 # 2025-05-04
1748736000 # 2025-06-01
1751328000 # 2025-07-01
1754006400 # 2025-08-01
1756684800 # 2025-09-01
1759276800 # 2025-10-01
1761955200 # 2025-11-01
1764547200 # 2025-12-01
1767225600 # 2026-01-01
1769904000 # 2026-02-01
1772323200 # 2026-03-01
)
query() {
local base="$1" token="$2" ts="$3"
curl -sf --max-time 8 "$base/cauldron/price/$token/at/$ts" 2>/dev/null \
|| echo '{"error":"no_response"}'
}
price_of() {
echo "$1" | python3 -c "
import sys, json
d = json.load(sys.stdin)
if 'price' in d:
print(f\"{d['price']:.6f}\")
elif 'error' in d:
code = d['error'].get('code', d['error']) if isinstance(d['error'], dict) else d['error']
print(f'ERR:{code}')
else:
print('ERR:unknown')
"
}
print_header() {
local token="$1"
echo ""
echo "━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━"
echo "Token: ${token:0:16}"
echo "━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━"
printf "%-14s %-22s %-22s %s\n" "Date" "Local" "Prod" "Diff?"
printf "%-14s %-22s %-22s %s\n" "--------------" "----------------------" "----------------------" "------"
}
DIVERGED=0
for token in "${TOKENS[@]}"; do
print_header "$token"
for ts in "${TIMESTAMPS[@]}"; do
date_label=$(python3 -c "import datetime; print(datetime.datetime.utcfromtimestamp($ts).strftime('%Y-%m-%d'))")
local_resp=$(query "$LOCAL" "$token" "$ts")
prod_resp=$(query "$PROD" "$token" "$ts")
local_price=$(price_of "$local_resp")
prod_price=$(price_of "$prod_resp")
diff_marker=""
if [ "$local_price" != "$prod_price" ]; then
diff_marker="<-- DIFF"
DIVERGED=1
fi
printf "%-14s %-22s %-22s %s\n" "$date_label" "$local_price" "$prod_price" "$diff_marker"
done
done
echo ""
if [ "$DIVERGED" -eq 1 ]; then
echo "DIVERGENCE FOUND — fix is exercised for at least one timestamp."
echo "Local returning price where prod returns ERR:PRICE_NOT_FOUND"
echo "means a withdrawn pool is correctly included in the historical query."
else
echo "No divergence found. Either:"
echo " - Neither token ever had a withdrawn pool, or"
echo " - Local is not running the fixed build, or"
echo " - Prod is already updated."
fi