node-facts.sh: operator-verified rewrite (python; parallel; fixture self-test) - see ansible_showcase/node-facts-plan.md
This commit is contained in:
@@ -1,11 +0,0 @@
|
||||
version: "3"
|
||||
services:
|
||||
client:
|
||||
image: ava-labs/avalanchego:v1.10.0
|
||||
labels:
|
||||
- "traefik.http.routers.avalanche-mainnet-go.rule=PathPrefix(`/avalanche-mainnet-go`)"
|
||||
- "traefik.http.middlewares.avalanche-mainnet-go.stripprefix.prefixes=/avalanche-mainnet-go"
|
||||
x-upstreams:
|
||||
network: avalanche
|
||||
chain: avalanche-mainnet
|
||||
chain: avalanche-mainnet
|
||||
@@ -0,0 +1,5 @@
|
||||
services:
|
||||
avalanche-mainnet:
|
||||
image: ${AVALANCHE_GO_IMAGE:-avaplatform/avalanchego}:${AVALANCHE_MAINNET_GO_VERSION:-v1.15.0}
|
||||
labels:
|
||||
- "traefik.http.middlewares.avalanche-mainnet-stripprefix.stripprefix.prefixes=/avalanche-mainnet"
|
||||
@@ -1,11 +0,0 @@
|
||||
version: "3"
|
||||
services:
|
||||
client:
|
||||
image: ethereum/client-go:v1.13.0
|
||||
labels:
|
||||
- "traefik.http.routers.ethereum-mainnet-geth-pruned.rule=PathPrefix(`/ethereum-mainnet-geth-pruned`)"
|
||||
- "traefik.http.middlewares.ethereum-mainnet-geth-pruned.stripprefix.prefixes=/ethereum-mainnet-geth-pruned"
|
||||
x-upstreams:
|
||||
network: ethereum
|
||||
chain: ethereum-mainnet
|
||||
chain: ethereum-mainnet
|
||||
@@ -1,11 +0,0 @@
|
||||
version: "3"
|
||||
services:
|
||||
client:
|
||||
image: sigp/lighthouse:v5.3.0
|
||||
labels:
|
||||
- "traefik.http.routers.ethereum-mainnet-lighthouse.rule=PathPrefix(`/ethereum-mainnet-lighthouse`)"
|
||||
- "traefik.http.middlewares.ethereum-mainnet-lighthouse.stripprefix.prefixes=/ethereum-mainnet-lighthouse"
|
||||
x-upstreams:
|
||||
network: ethereum
|
||||
chain: ethereum-mainnet
|
||||
chain: ethereum-mainnet
|
||||
@@ -0,0 +1,10 @@
|
||||
services:
|
||||
ethereum-mainnet-geth:
|
||||
image: ethereum/client-go:v1.17.4
|
||||
labels:
|
||||
- "traefik.http.middlewares.ethereum-mainnet-geth-stripprefix.stripprefix.prefixes=/ethereum-mainnet-geth"
|
||||
ethereum-mainnet-geth-node:
|
||||
image: statusim/nimbus-eth2:multiarch-v26.8.0
|
||||
labels:
|
||||
- "traefik.http.middlewares.ethereum-mainnet-geth-node-stripprefix.stripprefix.prefixes=/ethereum-mainnet-geth"
|
||||
- "traefik.http.routers.ethereum-mainnet-geth-node.rule=Host(`$DOMAIN`) && PathPrefix(`/ethereum-mainnet-geth/eth`)"
|
||||
@@ -0,0 +1 @@
|
||||
{"jsonrpc":"2.0","id":1,"result":{"protocols":{"eth":{"config":{"homesteadBlock":1150000,"shanghaiTime":1681338455,"cancunTime":1710338135,"pragueTime":1746612311}}}}}
|
||||
@@ -0,0 +1 @@
|
||||
{"jsonrpc":"2.0","id":1,"result":[{"name":"Geth/v1.17.7-stable/linux-amd64"},{"name":"Geth/v1.17.7-stable/linux-amd64"},{"name":"reth/v2.7.0-abc/x86_64"},{"name":"Geth/v1.16.9-stable/linux"}]}
|
||||
@@ -0,0 +1,5 @@
|
||||
[{"container":"rpc-avalanche-mainnet-1","image":"avaplatform/avalanchego:v1.15.0","service":"avalanche-mainnet","files":""},
|
||||
{"container":"rpc-op-mainnet-op-reth-pruned-1","image":"us-docker.pkg.dev/oplabs-tools-artifacts/images/op-reth:v2.5.0","service":"op-mainnet-op-reth-pruned","files":""},
|
||||
{"container":"rpc-op-mainnet-op-reth-pruned-node-1","image":"us-docker.pkg.dev/oplabs-tools-artifacts/images/kona-node:v1.7.0","service":"op-mainnet-op-reth-pruned-node","files":""},
|
||||
{"container":"rpc-ethereum-mainnet-geth-1","image":"ethereum/client-go:v1.17.4","service":"ethereum-mainnet-geth","files":""},
|
||||
{"container":"rpc-ethereum-mainnet-geth-node-1","image":"statusim/nimbus-eth2:multiarch-v26.8.0","service":"ethereum-mainnet-geth-node","files":""}]
|
||||
@@ -0,0 +1 @@
|
||||
{"jsonrpc":"2.0","id":1,"result":{"number":"0x18ec9c7","timestamp":"0x68e3a1f0"}}
|
||||
@@ -0,0 +1 @@
|
||||
{"jsonrpc":"2.0","id":1,"result":false}
|
||||
@@ -0,0 +1 @@
|
||||
{"jsonrpc":"2.0","id":1,"result":{"acps":{"194":{"supportWeight":"1","supporters":["a","b"],"objectors":[],"abstainers":[]}}}}
|
||||
@@ -0,0 +1 @@
|
||||
{"jsonrpc":"2.0","id":1,"result":{"version":"avalanchego/1.15.0","databaseVersion":"v1.4.5","vmVersions":{"evm":"v1.15.0"}}}
|
||||
@@ -0,0 +1 @@
|
||||
{"jsonrpc":"2.0","id":1,"result":{"numPeers":3,"peers":[{"version":"avalanchego/1.15.0"},{"version":"avalanchego/1.15.1"},{"version":"avalanchego/1.15.1"}]}}
|
||||
@@ -0,0 +1 @@
|
||||
{"jsonrpc":"2.0","id":1,"result":{"etnaTime":"2024-12-16T17:00:00Z","heliconTime":"2026-09-22T15:00:00Z"}}
|
||||
@@ -0,0 +1 @@
|
||||
{"jsonrpc":"2.0","id":1,"result":{"peers":{"p1":{"userAgent":"kona"},"p2":{"userAgent":"optimism"},"p3":{"userAgent":"kona"}}}}
|
||||
@@ -0,0 +1 @@
|
||||
{"jsonrpc":"2.0","id":1,"result":{"canyon_time":1704992401,"ecotone_time":1710374401,"isthmus_time":1746806401,"karst_time":1783180801}}
|
||||
@@ -0,0 +1 @@
|
||||
{"jsonrpc":"2.0","id":1,"result":{"unsafe_l2":{"number":157836486,"timestamp":1791353000},"safe_l2":{"number":157836400}}}
|
||||
@@ -0,0 +1 @@
|
||||
{"jsonrpc":"2.0","id":1,"result":"v1.7.0-abcdef"}
|
||||
@@ -0,0 +1 @@
|
||||
{"data":{"ALTAIR_FORK_EPOCH":"74240","ELECTRA_FORK_EPOCH":"364032","FULU_FORK_EPOCH":"411392","FAR_FUTURE":"18446744073709551615"}}
|
||||
@@ -0,0 +1 @@
|
||||
{"data":[{"state":"connected"},{"state":"connected"},{"state":"disconnected"}]}
|
||||
@@ -0,0 +1 @@
|
||||
{"data":{"head_slot":"15370643","is_syncing":false}}
|
||||
@@ -0,0 +1 @@
|
||||
{"data":{"version":"Nimbus/v26.8.0-404a00-stateofus"}}
|
||||
@@ -0,0 +1 @@
|
||||
{"jsonrpc":"2.0","id":1,"result":"Geth/v1.17.4-stable/linux-amd64/go1.24"}
|
||||
@@ -1,11 +0,0 @@
|
||||
version: "3"
|
||||
services:
|
||||
node:
|
||||
image: us-docker.pkg.dev/oplabs/op-node:v1.19.0
|
||||
labels:
|
||||
- "traefik.http.routers.op-base-mainnet.rule=PathPrefix(`/op-base-mainnet`)"
|
||||
- "traefik.http.middlewares.op-base-mainnet.stripprefix.prefixes=/op-base-mainnet"
|
||||
x-upstreams:
|
||||
network: base
|
||||
chain: op-base-mainnet
|
||||
chain: op-base-mainnet
|
||||
@@ -0,0 +1,10 @@
|
||||
services:
|
||||
op-mainnet-op-reth-pruned:
|
||||
image: us-docker.pkg.dev/oplabs-tools-artifacts/images/op-reth:${OP_MAINNET_RETH_VERSION:-v2.5.0}
|
||||
labels:
|
||||
- "traefik.http.middlewares.op-mainnet-op-reth-pruned-stripprefix.stripprefix.prefixes=/op-mainnet-op-reth-pruned"
|
||||
op-mainnet-op-reth-pruned-node:
|
||||
image: us-docker.pkg.dev/oplabs-tools-artifacts/images/kona-node:v1.7.0
|
||||
labels:
|
||||
- "traefik.http.middlewares.op-mainnet-op-reth-pruned-node-stripprefix.stripprefix.prefixes=/op-mainnet-op-reth-pruned/node"
|
||||
- "traefik.http.routers.op-mainnet-op-reth-pruned-node.rule=Host(`$DOMAIN`) && PathPrefix(`/op-mainnet-op-reth-pruned/node`)"
|
||||
@@ -1,7 +1,2 @@
|
||||
lighthouse
|
||||
prism
|
||||
prysm
|
||||
beacon
|
||||
nimbus
|
||||
ws
|
||||
-node
|
||||
-de
|
||||
health
|
||||
|
||||
@@ -1,127 +0,0 @@
|
||||
#!/bin/bash
|
||||
|
||||
# Simple stub curl for node-facts.sh testing
|
||||
# Returns minimal valid JSON responses
|
||||
|
||||
# Extract the URL (last http/https argument)
|
||||
URL=""
|
||||
METHOD=""
|
||||
for arg in "$@"; do
|
||||
if [[ "$arg" == http* || "$arg" == https* ]]; then
|
||||
URL="$arg"
|
||||
fi
|
||||
# Look for method in JSON data arguments
|
||||
if echo "$arg" | grep -q "method"; then
|
||||
METHOD=$(echo "$arg" | sed -n 's/.*"method":"\([^"]*\)".*/\1/p' | head -1)
|
||||
[ -n "$METHOD" ] && break
|
||||
fi
|
||||
done
|
||||
|
||||
# If method not found in data args, try to extract from the URL
|
||||
if [ -z "$METHOD" ]; then
|
||||
# Extract method from URL path for REST endpoints
|
||||
case "$URL" in
|
||||
*eth/v1/node/version*) METHOD="eth/v1/node/version" ;;
|
||||
*eth/v1/node/peers*) METHOD="eth/v1/node/peers" ;;
|
||||
*eth/v1/config/spec*) METHOD="eth/v1/config/spec" ;;
|
||||
*eth/v1/node/syncing*) METHOD="eth/v1/node/syncing" ;;
|
||||
*eth/v1/node/head*) METHOD="eth/v1/node/head" ;;
|
||||
*optimism_version*) METHOD="optimism_version" ;;
|
||||
*opp2p_peers*) METHOD="opp2p_peers" ;;
|
||||
*optimism_rollupConfig*) METHOD="optimism_rollupConfig" ;;
|
||||
*optimism_syncStatus*) METHOD="optimism_syncStatus" ;;
|
||||
esac
|
||||
fi
|
||||
|
||||
# Respond based on URL and method
|
||||
case "$URL" in
|
||||
*avalanche-mainnet-go*)
|
||||
case "$METHOD" in
|
||||
info.getNodeVersion)
|
||||
echo '{"jsonrpc":"2.0","result":{"version":"avalanche/1.10.0","databaseVersion":"1.0.0"},"id":1}'
|
||||
;;
|
||||
info.peers)
|
||||
echo '{"jsonrpc":"2.0","result":[{"version":"avalanche/1.10.0"},{"version":"avalanche/1.9.0"}],"id":1}'
|
||||
;;
|
||||
info.upgrades)
|
||||
echo '{"jsonrpc":"2.0","result":{"apricotPhase1Time":4200000},"id":1}'
|
||||
;;
|
||||
*)
|
||||
# For /ext/info without method, return version info
|
||||
if [[ "$URL" == *"/ext/info"* ]]; then
|
||||
echo '{"jsonrpc":"2.0","result":{"version":"avalanche/1.10.0","databaseVersion":"1.0.0"},"id":1}'
|
||||
else
|
||||
echo '{"jsonrpc":"2.0","error":{"code":-32601,"message":"Method not found"},"id":1}'
|
||||
fi
|
||||
;;
|
||||
esac
|
||||
;;
|
||||
*ethereum-mainnet-lighthouse* | *beacon* | *lighthouse*)
|
||||
case "$METHOD" in
|
||||
eth/v1/node/version*)
|
||||
echo '{"version":"Lighthouse/v5.3.0"}'
|
||||
;;
|
||||
eth/v1/node/peers*)
|
||||
echo '{"data":[]}'
|
||||
;;
|
||||
eth/v1/config/spec*)
|
||||
echo '{"data":{}}'
|
||||
;;
|
||||
eth/v1/node/syncing*)
|
||||
echo '{"data":{"head_slot":"100","syncing":false}}'
|
||||
;;
|
||||
eth/v1/node/head*)
|
||||
echo '{"data":{"slot":"100","timestamp":"2026-10-06T12:00:00Z"}}'
|
||||
;;
|
||||
*)
|
||||
echo '{"message":"Not found"}'
|
||||
;;
|
||||
esac
|
||||
;;
|
||||
*op-base-mainnet* | *op-node* | *kona*)
|
||||
case "$METHOD" in
|
||||
optimism_version* | */node*)
|
||||
echo '{"result":"v1.19.0"}'
|
||||
;;
|
||||
opp2p_peers*)
|
||||
echo '{"result":[]}'
|
||||
;;
|
||||
optimism_rollupConfig*)
|
||||
echo '{"result":{}}'
|
||||
;;
|
||||
optimism_syncStatus*)
|
||||
echo '{"result":{"current_block_number":"100","syncing":false}}'
|
||||
;;
|
||||
*)
|
||||
echo '{"message":"Not found"}'
|
||||
;;
|
||||
esac
|
||||
;;
|
||||
*ethereum-mainnet-geth* | *geth*)
|
||||
case "$METHOD" in
|
||||
web3_clientVersion)
|
||||
echo '{"jsonrpc":"2.0","result":"Geth/v1.13.0-stable","id":1}'
|
||||
;;
|
||||
admin_peers)
|
||||
echo '{"jsonrpc":"2.0","result":[{"clientId":"Geth/v1.13.0"},{"clientId":"Geth/v1.12.0"}],"id":1}'
|
||||
;;
|
||||
eth_blockNumber)
|
||||
echo '{"jsonrpc":"2.0","result":"0x64","id":1}'
|
||||
;;
|
||||
eth_getBlockByNumber)
|
||||
echo '{"jsonrpc":"2.0","result":{"timestamp":"0x65a6b3d4","number":"0x64"},"id":1}'
|
||||
;;
|
||||
eth_syncing)
|
||||
echo '{"jsonrpc":"2.0","result":false,"id":1}'
|
||||
;;
|
||||
*)
|
||||
echo '{"jsonrpc":"2.0","error":{"code":-32601,"message":"Method not found"},"id":1}'
|
||||
;;
|
||||
esac
|
||||
;;
|
||||
*)
|
||||
echo '{"jsonrpc":"2.0","error":{"code":-32601,"message":"Unknown endpoint"},"id":1}'
|
||||
;;
|
||||
esac
|
||||
|
||||
exit 0
|
||||
Reference in New Issue
Block a user