Commit f63af5f
[Session Rollovers] Simplify & Consolidate Timeouts (#389)
Testing script:
```bash
#!/bin/bash
# Script to monitor XRPL EVM testnet block number every 0.2 seconds
# Usage: ./block_monitor.sh [--local]
# --local: Use localhost endpoint instead of remote
# Parse command line arguments
USE_LOCAL=false
for arg in "$@"; do
case $arg in
--local)
USE_LOCAL=true
shift
;;
*)
echo "Unknown option: $arg"
echo "Usage: $0 [--local]"
exit 1
;;
esac
done
# Print configuration mode at the beginning
if [ "$USE_LOCAL" = true ]; then
echo "🔧 MODE: LOCAL"
else
echo "🌐 MODE: REMOTE"
fi
echo ""
# Set endpoint based on flag
if [ "$USE_LOCAL" = true ]; then
ENDPOINT="http://localhost:3070/v1"
HEADERS='-H "Target-Service-Id: xrplevm" -H "Authorization: test_api_key"'
echo "Starting XRPL EVM testnet block number monitor (LOCAL)..."
else
ENDPOINT="https://xrpl-evm-testnet.rpc.grove.city/v1/6c5de5ff"
HEADERS='-H "Content-Type: application/json"'
echo "Starting XRPL EVM testnet block number monitor (REMOTE)..."
fi
echo "Press Ctrl+C to stop"
echo ""
# Initialize variables for delta calculation
last_request_time=0
while true; do
# Get current timestamp for display and delta calculation
current_time=$(date +%s.%N)
timestamp=$(date '+%Y-%m-%d %H:%M:%S')
# Calculate delta from last request
if [ "$last_request_time" != "0" ]; then
delta=$(echo "$current_time - $last_request_time" | bc -l)
delta_formatted=$(printf "%.2f" "$delta")
# Color code based on delta (assuming 1s target interval)
# Green: <= 1.2s (quick), Yellow: 1.2-2.0s (moderate), Red: > 2.0s (slow)
if (( $(echo "$delta <= 1" | bc -l) )); then
delta_color="\033[32m" # Green
delta_status="⚡"
elif (( $(echo "$delta <= 3" | bc -l) )); then
delta_color="\033[33m" # Yellow
delta_status="⏱️"
else
delta_color="\033[31m" # Red
delta_status="🐌"
fi
reset_color="\033[0m"
delta_display=" ${delta_color}[Δ${delta_formatted}s ${delta_status}]${reset_color}"
else
delta_display=""
fi
# Make the curl request and capture both response and error
if [ "$USE_LOCAL" = true ]; then
response=$(curl -s "$ENDPOINT" \
-H "Target-Service-Id: xrplevm" \
-H "Authorization: test_api_key" \
-d '{"jsonrpc": "2.0", "id": 1, "method": "eth_blockNumber" }' 2>&1)
else
response=$(curl -s "$ENDPOINT" \
-X POST \
-H "Content-Type: application/json" \
--data '{"method":"eth_blockNumber","params":[],"id":1,"jsonrpc":"2.0"}' 2>&1)
fi
# Check if curl command was successful
curl_exit_code=$?
if [ $curl_exit_code -ne 0 ]; then
echo -e "❌ [$timestamp] ERROR: curl failed with exit code $curl_exit_code: $response$delta_display"
else
# Check if response contains an error
if echo "$response" | grep -q '"error"'; then
echo -e "❌ [$timestamp] API ERROR: $response$delta_display"
else
# Extract block number from response (remove 0x prefix and convert from hex)
block_hex=$(echo "$response" | grep -o '"result":"0x[^"]*"' | cut -d'"' -f4)
if [ -z "$block_hex" ]; then
echo -e "❌ [$timestamp] PARSE ERROR: Could not extract block number from response: $response$delta_display"
else
# Convert hex to decimal, handle potential conversion errors
if block_decimal=$((16#${block_hex#0x})) 2>/dev/null; then
echo -e "✅ [$timestamp] Block: $block_decimal (hex: $block_hex)$delta_display"
else
echo -e "❌ [$timestamp] CONVERSION ERROR: Could not convert hex $block_hex to decimal$delta_display"
fi
fi
fi
fi
# Update last request time for next iteration
last_request_time="$current_time"
# Wait 0.5 seconds
sleep 0.5
done
```
---------
Co-authored-by: Arash Deshmeh <[email protected]>1 parent c617913 commit f63af5f
File tree
22 files changed
+198
-166
lines changed- config
- data
- gateway
- observation/protocol
- protocol
- shannon
- proto/path/protocol
- qos
- cosmos
- evm
- noop
- solana
- router
22 files changed
+198
-166
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
45 | 45 | | |
46 | 46 | | |
47 | 47 | | |
48 | | - | |
49 | | - | |
50 | | - | |
51 | | - | |
52 | | - | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
53 | 54 | | |
54 | 55 | | |
55 | 56 | | |
| |||
131 | 132 | | |
132 | 133 | | |
133 | 134 | | |
134 | | - | |
135 | | - | |
136 | | - | |
137 | | - | |
138 | | - | |
| 135 | + | |
| 136 | + | |
| 137 | + | |
| 138 | + | |
| 139 | + | |
| 140 | + | |
139 | 141 | | |
140 | 142 | | |
141 | 143 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
2 | 2 | | |
3 | 3 | | |
| 4 | + | |
4 | 5 | | |
5 | 6 | | |
6 | 7 | | |
| |||
14 | 15 | | |
15 | 16 | | |
16 | 17 | | |
17 | | - | |
18 | | - | |
19 | | - | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
20 | 23 | | |
21 | | - | |
22 | 24 | | |
23 | | - | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
24 | 29 | | |
25 | 30 | | |
26 | 31 | | |
27 | 32 | | |
28 | 33 | | |
29 | 34 | | |
30 | 35 | | |
31 | | - | |
32 | | - | |
33 | | - | |
34 | | - | |
35 | | - | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
36 | 42 | | |
37 | 43 | | |
38 | 44 | | |
| |||
54 | 60 | | |
55 | 61 | | |
56 | 62 | | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
57 | 69 | | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
59 | 59 | | |
60 | 60 | | |
61 | 61 | | |
62 | | - | |
63 | | - | |
64 | | - | |
65 | | - | |
66 | | - | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
67 | 68 | | |
68 | 69 | | |
69 | 70 | | |
| |||
72 | 73 | | |
73 | 74 | | |
74 | 75 | | |
75 | | - | |
76 | | - | |
77 | | - | |
78 | | - | |
79 | | - | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
80 | 82 | | |
81 | 83 | | |
82 | 84 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
13 | 13 | | |
14 | 14 | | |
15 | 15 | | |
16 | | - | |
17 | | - | |
| 16 | + | |
| 17 | + | |
18 | 18 | | |
19 | 19 | | |
20 | 20 | | |
| |||
63 | 63 | | |
64 | 64 | | |
65 | 65 | | |
66 | | - | |
| 66 | + | |
67 | 67 | | |
68 | 68 | | |
69 | 69 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
60 | 60 | | |
61 | 61 | | |
62 | 62 | | |
63 | | - | |
| 63 | + | |
64 | 64 | | |
65 | 65 | | |
66 | 66 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
32 | 32 | | |
33 | 33 | | |
34 | 34 | | |
35 | | - | |
36 | | - | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
37 | 41 | | |
38 | 42 | | |
39 | 43 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
4 | 4 | | |
5 | 5 | | |
6 | 6 | | |
| 7 | + | |
7 | 8 | | |
8 | 9 | | |
9 | 10 | | |
| |||
89 | 90 | | |
90 | 91 | | |
91 | 92 | | |
92 | | - | |
| 93 | + | |
| 94 | + | |
93 | 95 | | |
94 | 96 | | |
95 | 97 | | |
| |||
112 | 114 | | |
113 | 115 | | |
114 | 116 | | |
| 117 | + | |
| 118 | + | |
| 119 | + | |
115 | 120 | | |
116 | | - | |
| 121 | + | |
117 | 122 | | |
118 | 123 | | |
119 | 124 | | |
120 | 125 | | |
121 | 126 | | |
122 | | - | |
123 | | - | |
| 127 | + | |
| 128 | + | |
124 | 129 | | |
125 | 130 | | |
126 | 131 | | |
127 | 132 | | |
128 | 133 | | |
| 134 | + | |
129 | 135 | | |
130 | 136 | | |
131 | | - | |
| 137 | + | |
132 | 138 | | |
133 | 139 | | |
134 | 140 | | |
135 | | - | |
| 141 | + | |
136 | 142 | | |
137 | 143 | | |
138 | 144 | | |
139 | 145 | | |
140 | 146 | | |
141 | 147 | | |
| 148 | + | |
| 149 | + | |
| 150 | + | |
| 151 | + | |
| 152 | + | |
| 153 | + | |
| 154 | + | |
| 155 | + | |
| 156 | + | |
142 | 157 | | |
143 | 158 | | |
144 | 159 | | |
| |||
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
100 | 100 | | |
101 | 101 | | |
102 | 102 | | |
| 103 | + | |
| 104 | + | |
| 105 | + | |
| 106 | + | |
| 107 | + | |
| 108 | + | |
103 | 109 | | |
| 110 | + | |
104 | 111 | | |
105 | 112 | | |
| 113 | + | |
| 114 | + | |
| 115 | + | |
| 116 | + | |
| 117 | + | |
106 | 118 | | |
107 | 119 | | |
108 | 120 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
8 | 8 | | |
9 | 9 | | |
10 | 10 | | |
11 | | - | |
12 | | - | |
13 | | - | |
14 | | - | |
15 | | - | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
16 | 15 | | |
17 | 16 | | |
18 | 17 | | |
| |||
27 | 26 | | |
28 | 27 | | |
29 | 28 | | |
30 | | - | |
31 | | - | |
32 | | - | |
33 | | - | |
34 | | - | |
35 | | - | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
36 | 34 | | |
37 | 35 | | |
0 commit comments