Skip to content

Commit 89b84ea

Browse files
committed
validate registry was update with devnet config
1 parent 208fd13 commit 89b84ea

File tree

1 file changed

+97
-22
lines changed

1 file changed

+97
-22
lines changed

.github/workflows/validate-registry.yml

Lines changed: 97 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,12 @@ jobs:
4646
exit 1
4747
fi
4848
49+
# Check if devnet directory exists
50+
if [ ! -d "data/devnet" ]; then
51+
echo "❌ data/devnet directory not found"
52+
exit 1
53+
fi
54+
4955
# Validate all mainnet JSON files
5056
echo "✅ Checking mainnet JSON files..."
5157
for file in data/mainnet/*.json; do
@@ -64,6 +70,15 @@ jobs:
6470
fi
6571
done
6672
73+
# Validate all devnet JSON files
74+
echo "✅ Checking devnet JSON files..."
75+
for file in data/devnet/*.json; do
76+
if [ -f "$file" ]; then
77+
echo " Validating $(basename "$file")..."
78+
jsonlint "$file"
79+
fi
80+
done
81+
6782
# Validate schema syntax
6883
if [ -f "schema/chain-asset.schema.json" ]; then
6984
echo "✅ Checking schema syntax..."
@@ -104,6 +119,20 @@ jobs:
104119
-d "$file"
105120
fi
106121
done
122+
123+
# Validate all devnet files against schema
124+
echo "✅ Validating devnet files against schema..."
125+
for file in data/devnet/*.json; do
126+
if [ -f "$file" ]; then
127+
echo " Validating $(basename "$file") against schema..."
128+
ajv validate \
129+
--spec=draft7 \
130+
--strict=false \
131+
--all-errors \
132+
-s schema/chain-asset.schema.json \
133+
-d "$file"
134+
fi
135+
done
107136
108137
- name: Validate business rules
109138
run: |
@@ -130,6 +159,15 @@ jobs:
130159
fi
131160
done
132161
162+
# Collect all chain IDs from devnet
163+
DEVNET_CHAIN_IDS=""
164+
for file in data/devnet/*.json; do
165+
if [ -f "$file" ]; then
166+
CHAIN_ID=$(jq -r '.chainId' "$file")
167+
DEVNET_CHAIN_IDS="$DEVNET_CHAIN_IDS $CHAIN_ID"
168+
fi
169+
done
170+
133171
# Check for duplicates within mainnet
134172
MAINNET_DUPLICATES=$(echo $MAINNET_CHAIN_IDS | tr ' ' '\n' | sort | uniq -d)
135173
if [ ! -z "$MAINNET_DUPLICATES" ]; then
@@ -144,6 +182,13 @@ jobs:
144182
exit 1
145183
fi
146184
185+
# Check for duplicates within devnet
186+
DEVNET_DUPLICATES=$(echo $DEVNET_CHAIN_IDS | tr ' ' '\n' | sort | uniq -d)
187+
if [ ! -z "$DEVNET_DUPLICATES" ]; then
188+
echo "❌ Duplicate chain IDs found in devnet: $DEVNET_DUPLICATES"
189+
exit 1
190+
fi
191+
147192
# Check that all RPC/REST URLs are reachable (optional)
148193
echo "✅ Checking URL accessibility..."
149194
@@ -152,7 +197,7 @@ jobs:
152197
if [ -f "$file" ]; then
153198
CHAIN_NAME=$(basename "$file" .json)
154199
RPC_URL=$(jq -r '.rpcURL' "$file")
155-
echo "Testing $CHAIN_NAME RPC: $RPC_URL..."
200+
echo "Testing $CHAIN_NAME mainnet RPC: $RPC_URL..."
156201
if ! curl -s --connect-timeout 10 --max-time 30 "$RPC_URL" > /dev/null; then
157202
echo "⚠️ Warning: $RPC_URL may not be accessible"
158203
fi
@@ -169,13 +214,15 @@ jobs:
169214
echo "**Commit:** ${{ github.sha }}" >> validation-report.md
170215
echo "" >> validation-report.md
171216
172-
# Count mainnet chains
217+
# Count chains by network
173218
MAINNET_COUNT=$(find data/mainnet -name "*.json" -type f | wc -l)
174219
TESTNET_COUNT=$(find data/testnet -name "*.json" -type f | wc -l)
220+
DEVNET_COUNT=$(find data/devnet -name "*.json" -type f | wc -l)
175221
176222
echo "**Statistics:**" >> validation-report.md
177223
echo "- Mainnet chains: $MAINNET_COUNT" >> validation-report.md
178224
echo "- Testnet chains: $TESTNET_COUNT" >> validation-report.md
225+
echo "- Devnet chains: $DEVNET_COUNT" >> validation-report.md
179226
180227
# Count total currencies
181228
MAINNET_CURRENCIES=0
@@ -194,47 +241,69 @@ jobs:
194241
fi
195242
done
196243
244+
DEVNET_CURRENCIES=0
245+
for file in data/devnet/*.json; do
246+
if [ -f "$file" ]; then
247+
COUNT=$(jq '[.currencies[]] | length' "$file")
248+
DEVNET_CURRENCIES=$((DEVNET_CURRENCIES + COUNT))
249+
fi
250+
done
251+
197252
echo "- Mainnet currencies: $MAINNET_CURRENCIES" >> validation-report.md
198-
echo "- Testnet currencies: $TESTNET_CURRENCIES" >> validation-report.md
199253
echo "" >> validation-report.md
200254
201255
echo "**Chain Status:**" >> validation-report.md
202-
echo "**Mainnet Chains:**" >> validation-report.md
203-
204256
echo "| Chain | Network | Chain ID | Currencies |" >> validation-report.md
205257
echo "|-------|---------|----------|------------|" >> validation-report.md
206258
207259
# Mainnet chains
208260
for file in data/mainnet/*.json; do
209261
if [ -f "$file" ]; then
210-
CHAIN_NAME=$(jq -r '.chainName' "$file")
262+
CHAIN_NAME=$(basename "$file" .json)
211263
CHAIN_ID=$(jq -r '.chainId' "$file")
212264
CURRENCY_COUNT=$(jq '[.currencies[]] | length' "$file")
213265
echo "| $CHAIN_NAME | mainnet | $CHAIN_ID | $CURRENCY_COUNT |" >> validation-report.md
214266
fi
215267
done
216268
217-
echo "**Testnet Chains:**" >> validation-report.md
269+
270+
echo "" >> validation-report.md
271+
echo "- Testnet currencies: $TESTNET_CURRENCIES" >> validation-report.md
218272
echo "| Chain | Network | Chain ID | Currencies |" >> validation-report.md
219273
echo "|-------|---------|----------|------------|" >> validation-report.md
220274
221275
# Testnet chains
222276
for file in data/testnet/*.json; do
223277
if [ -f "$file" ]; then
224-
CHAIN_NAME=$(jq -r '.chainName' "$file")
278+
CHAIN_NAME=$(basename "$file" .json)
225279
CHAIN_ID=$(jq -r '.chainId' "$file")
226280
CURRENCY_COUNT=$(jq '[.currencies[]] | length' "$file")
227281
echo "| $CHAIN_NAME | testnet | $CHAIN_ID | $CURRENCY_COUNT |" >> validation-report.md
228282
fi
229283
done
230284
285+
# Devnet chains
286+
echo "" >> validation-report.md
287+
echo "- Devnet currencies: $DEVNET_CURRENCIES" >> validation-report.md
288+
echo "| Chain | Network | Chain ID | Currencies |" >> validation-report.md
289+
echo "|-------|---------|----------|------------|" >> validation-report.md
290+
291+
for file in data/devnet/*.json; do
292+
if [ -f "$file" ]; then
293+
CHAIN_NAME=$(basename "$file" .json)
294+
CHAIN_ID=$(jq -r '.chainId' "$file")
295+
CURRENCY_COUNT=$(jq '[.currencies[]] | length' "$file")
296+
echo "| $CHAIN_NAME | devnet | $CHAIN_ID | $CURRENCY_COUNT |" >> validation-report.md
297+
fi
298+
done
299+
231300
- name: Upload validation report
232301
if: always()
233302
uses: actions/upload-artifact@v4
234303
with:
235304
name: validation-report
236305
path: validation-report.md
237-
retention-days: 30
306+
retention-days: 1
238307

239308
- name: Comment PR with validation results
240309
if: github.event_name == 'pull_request'
@@ -288,13 +357,15 @@ jobs:
288357
echo "🔒 Validating SSL certificates..."
289358
290359
# Extract HTTPS URLs and check certificates from all chain files
291-
for file in data/mainnet/*.json data/testnet/*.json; do
360+
for file in data/mainnet/*.json data/testnet/*.json data/devnet/*.json; do
292361
if [ -f "$file" ]; then
293-
echo "Checking SSL certificates for $(basename "$file")..."
362+
NETWORK=$(basename $(dirname "$file"))
363+
CHAIN=$(basename "$file" .json)
364+
echo "Checking SSL certificates for $CHAIN ($NETWORK)..."
294365
jq -r '.rpcURL, .restURL' "$file" | \
295366
grep -E '^https://' | \
296367
while read url; do
297-
domain=$(echo "$url" | sed 's|https://||' | sed 's|:.*||')
368+
domain=$(echo "$url" | sed 's|https://||' | sed 's|:.*||' | sed 's|/.*||')
298369
echo " Checking SSL for $domain..."
299370
300371
if ! echo | timeout 10 openssl s_client -connect "$domain:443" -servername "$domain" 2>/dev/null | grep -q "Verify return code: 0"; then
@@ -308,6 +379,8 @@ jobs:
308379
name: Performance Test
309380
runs-on: ubuntu-latest
310381
needs: validate-schema
382+
if: github.event_name == 'pull_request'
383+
311384
steps:
312385
- name: Checkout repository
313386
uses: actions/checkout@v4
@@ -316,21 +389,22 @@ jobs:
316389
run: |
317390
echo "⚡ Testing endpoint performance..."
318391
319-
# Test RPC endpoints for all chains
320-
for file in data/mainnet/*.json; do
392+
# Test RPC endpoints for all chains across all networks
393+
for file in data/mainnet/*.json data/testnet/*.json data/devnet/*.json; do
321394
if [ -f "$file" ]; then
395+
NETWORK=$(basename $(dirname "$file"))
322396
CHAIN_NAME=$(basename "$file" .json)
323397
RPC_URL=$(jq -r '.rpcURL' "$file")
324-
echo "Testing $CHAIN_NAME ($RPC_URL)..."
398+
echo "Testing $CHAIN_NAME ($NETWORK) - $RPC_URL..."
325399
326400
response_time=$(curl -w "%{time_total}" -s -o /dev/null --connect-timeout 10 --max-time 30 "$RPC_URL" || echo "timeout")
327401
328402
if [ "$response_time" = "timeout" ]; then
329-
echo "❌ $CHAIN_NAME: Timeout"
403+
echo "❌ $CHAIN_NAME ($NETWORK): Timeout"
330404
elif (( $(echo "$response_time > 5.0" | bc -l) )); then
331-
echo "⚠️ $CHAIN_NAME: Slow response (${response_time}s)"
405+
echo "⚠️ $CHAIN_NAME ($NETWORK): Slow response (${response_time}s)"
332406
else
333-
echo "✅ $CHAIN_NAME: Fast response (${response_time}s)"
407+
echo "✅ $CHAIN_NAME ($NETWORK): Fast response (${response_time}s)"
334408
fi
335409
fi
336410
done
@@ -339,16 +413,17 @@ jobs:
339413
run: |
340414
echo "📊 Checking file sizes..."
341415
342-
# Check individual chain file sizes
343-
for file in data/mainnet/*.json data/testnet/*.json; do
416+
# Check individual chain file sizes across all networks
417+
for file in data/mainnet/*.json data/testnet/*.json data/devnet/*.json; do
344418
if [ -f "$file" ]; then
345419
FILE_SIZE=$(stat -f%z "$file" 2>/dev/null || stat -c%s "$file")
420+
NETWORK=$(basename $(dirname "$file"))
346421
CHAIN_NAME=$(basename "$file")
347-
echo "$CHAIN_NAME size: ${FILE_SIZE} bytes"
422+
echo "$CHAIN_NAME ($NETWORK) size: ${FILE_SIZE} bytes"
348423
349424
# Warn if individual files are getting too large (> 100KB)
350425
if [ "$FILE_SIZE" -gt 102400 ]; then
351-
echo "⚠️ Warning: $CHAIN_NAME is larger than 100KB"
426+
echo "⚠️ Warning: $CHAIN_NAME ($NETWORK) is larger than 100KB"
352427
fi
353428
fi
354429
done

0 commit comments

Comments
 (0)