Record Chain 138 GRU v2 mesh rollout state
This commit is contained in:
170
scripts/verify/reconcile-gru-v2-full-mesh-status.py
Normal file
170
scripts/verify/reconcile-gru-v2-full-mesh-status.py
Normal file
@@ -0,0 +1,170 @@
|
||||
#!/usr/bin/env python3
|
||||
import json
|
||||
import pathlib
|
||||
|
||||
|
||||
ROOT = pathlib.Path("/home/intlc/projects/proxmox")
|
||||
TRACKER = ROOT / "config/gru-v2-full-mesh-pool-tracker.json"
|
||||
DEPLOYMENT = ROOT / "cross-chain-pmm-lps/config/deployment-status.json"
|
||||
OUT_JSON = ROOT / "reports/status/gru_v2_full_mesh_status_report.json"
|
||||
OUT_MD = ROOT / "docs/04-configuration/GRU_V2_FULL_MESH_LIVE_STATUS_REPORT.md"
|
||||
|
||||
|
||||
CHAIN138_EXACT = {
|
||||
"cUSDT V2 / cUSDC V2": "0x9e89bAe009adf128782E19e8341996c596ac40dC",
|
||||
"cUSDT V2 / USDT": "0x866Cb44b59303d8dc5f4F9E3E7A8e8b0bf238d66",
|
||||
"cUSDC V2 / USDC": "0xc39B7D0F40838cbFb54649d327f49a6DAC964062",
|
||||
"cEURC V2 / cUSDC V2": "0x5efD4771e35B9A101Bc0f4E44905b3c77292D95D",
|
||||
"cEURT V2 / cUSDC V2": "0xC479ad0c2333c7738DFA13Ef9E0d3eD2De53F191",
|
||||
"cGBPC V2 / cUSDC V2": "0xb7fe7C3B71580f9BcE496076dc8b0B4B40A06edd",
|
||||
"cGBPT V2 / cUSDC V2": "0x77aEfcd4E25eFf32A680057879fB176aF4a66838",
|
||||
"cAUDC V2 / cUSDC V2": "0x034B89E3F050F48849139E37813EdFd048253876",
|
||||
"cJPYC V2 / cUSDC V2": "0xD6a83bb947Ea062580c220e03B37E44C9532FA2c",
|
||||
"cCHFC V2 / cUSDC V2": "0x9fd00d9875cBd1b8F54F51e153ade0D7DC87f05B",
|
||||
"cCADC V2 / cUSDC V2": "0xf9dEd79Ff2a481C1c6aD6Bfb2114b488Aba567F5",
|
||||
"cXAUC V2 / cUSDC V2": "0xDC4968F0B665ccDffBba6eB23902e95b5b3B097B",
|
||||
"cXAUT V2 / cUSDC V2": "0x8C7874d1040377be410c1140A1B5E1B869fbBe30",
|
||||
"cEURC V2 / cEURT V2": "0x0F2f82bf28e7844898BFABf35A5566681fC2f7ab",
|
||||
"cGBPC V2 / cGBPT V2": "0x7B3CD08B46b7b1EAD9F5cB5AcEaf1Db298A39db5",
|
||||
"cXAUC V2 / cXAUT V2": "0x89e0304B724E87F816A1c72e716949d4DbC9c4d5",
|
||||
}
|
||||
|
||||
|
||||
def load_json(path: pathlib.Path):
|
||||
return json.loads(path.read_text())
|
||||
|
||||
|
||||
def normalize_pair(pair: str) -> str:
|
||||
return " / ".join(part.strip() for part in pair.split("/"))
|
||||
|
||||
|
||||
def deployment_pair_map(chain_data: dict):
|
||||
out = {}
|
||||
for key in ["pmmPools", "pmmPoolsVolatile"]:
|
||||
for row in chain_data.get(key, []):
|
||||
pair = f"{row['base']} / {row['quote']}"
|
||||
out[normalize_pair(pair)] = {
|
||||
"address": row.get("poolAddress"),
|
||||
"publicRoutingEnabled": row.get("publicRoutingEnabled"),
|
||||
"source": key,
|
||||
}
|
||||
return out
|
||||
|
||||
|
||||
def reconcile():
|
||||
tracker = load_json(TRACKER)
|
||||
deployment = load_json(DEPLOYMENT)
|
||||
chain1_pairs = deployment_pair_map(deployment["chains"]["1"])
|
||||
|
||||
report = {
|
||||
"statusDate": tracker["statusDate"],
|
||||
"summary": {
|
||||
"chain138": {"exactLive": 0, "plannedOnly": 0},
|
||||
"651940": {"exactLive": 0, "plannedOnly": 0},
|
||||
"publicMesh": {"exactLive": 0, "plannedOnly": 0},
|
||||
},
|
||||
"chain138": [],
|
||||
"allMainnet651940": [],
|
||||
"publicMesh": {},
|
||||
}
|
||||
|
||||
for row in tracker["chain138"]["entries"]:
|
||||
pair = row["pair"]
|
||||
if pair in CHAIN138_EXACT:
|
||||
status = "exact_live"
|
||||
report["summary"]["chain138"]["exactLive"] += 1
|
||||
observed = {"address": CHAIN138_EXACT[pair]}
|
||||
else:
|
||||
status = "planned_only"
|
||||
report["summary"]["chain138"]["plannedOnly"] += 1
|
||||
observed = None
|
||||
report["chain138"].append({
|
||||
"pair": pair,
|
||||
"priority": row.get("priority"),
|
||||
"status": status,
|
||||
"observed": observed,
|
||||
})
|
||||
|
||||
for row in tracker["allMainnet651940"]["entries"]:
|
||||
report["summary"]["651940"]["plannedOnly"] += 1
|
||||
report["allMainnet651940"].append({
|
||||
"pair": row["pair"],
|
||||
"priority": row.get("priority"),
|
||||
"status": "planned_only",
|
||||
"observed": None,
|
||||
})
|
||||
|
||||
for chain, bucket in tracker["publicMesh"].items():
|
||||
report["publicMesh"][chain] = []
|
||||
override = bucket.get("statusOverride")
|
||||
for pair in bucket["entries"]:
|
||||
normalized = normalize_pair(pair)
|
||||
if chain == "1" and normalized in chain1_pairs:
|
||||
status = "exact_live"
|
||||
report["summary"]["publicMesh"]["exactLive"] += 1
|
||||
observed = chain1_pairs[normalized]
|
||||
else:
|
||||
status = "planned_only" if override == "planned" or chain != "1" else "planned_only"
|
||||
report["summary"]["publicMesh"]["plannedOnly"] += 1
|
||||
observed = None
|
||||
report["publicMesh"][chain].append({
|
||||
"pair": normalized,
|
||||
"status": status,
|
||||
"observed": observed,
|
||||
})
|
||||
|
||||
return report
|
||||
|
||||
|
||||
def render_markdown(report: dict) -> str:
|
||||
lines = []
|
||||
lines.append("# GRU v2 Full Mesh Live Status Report")
|
||||
lines.append("")
|
||||
lines.append(f"**Status date:** {report['statusDate']}")
|
||||
lines.append("")
|
||||
lines.append("## Summary")
|
||||
lines.append("")
|
||||
lines.append(f"- Chain `138`: `{report['summary']['chain138']['exactLive']}` exact live rows, `{report['summary']['chain138']['plannedOnly']}` planned-only")
|
||||
lines.append(f"- ALL Mainnet `651940`: `{report['summary']['651940']['plannedOnly']}` planned-only")
|
||||
lines.append(f"- Public `cW*` mesh: `{report['summary']['publicMesh']['exactLive']}` exact live rows, `{report['summary']['publicMesh']['plannedOnly']}` planned-only")
|
||||
lines.append("")
|
||||
lines.append("## Chain 138")
|
||||
lines.append("")
|
||||
lines.append("| Pair | Status | Observed |")
|
||||
lines.append("|---|---|---|")
|
||||
for row in report["chain138"]:
|
||||
observed = row["observed"]["address"] if row["observed"] else ""
|
||||
lines.append(f"| `{row['pair']}` | `{row['status']}` | `{observed}` |")
|
||||
lines.append("")
|
||||
lines.append("## ALL Mainnet 651940")
|
||||
lines.append("")
|
||||
lines.append("| Pair | Status |")
|
||||
lines.append("|---|---|")
|
||||
for row in report["allMainnet651940"]:
|
||||
lines.append(f"| `{row['pair']}` | `{row['status']}` |")
|
||||
lines.append("")
|
||||
lines.append("## Public cW* Mesh")
|
||||
lines.append("")
|
||||
for chain, rows in report["publicMesh"].items():
|
||||
lines.append(f"### Chain `{chain}`")
|
||||
lines.append("")
|
||||
lines.append("| Pair | Status | Observed |")
|
||||
lines.append("|---|---|---|")
|
||||
for row in rows:
|
||||
observed = row["observed"]["address"] if row["observed"] else ""
|
||||
lines.append(f"| `{row['pair']}` | `{row['status']}` | `{observed}` |")
|
||||
lines.append("")
|
||||
return "\n".join(lines)
|
||||
|
||||
|
||||
def main():
|
||||
report = reconcile()
|
||||
OUT_JSON.parent.mkdir(parents=True, exist_ok=True)
|
||||
OUT_JSON.write_text(json.dumps(report, indent=2) + "\n")
|
||||
OUT_MD.write_text(render_markdown(report) + "\n")
|
||||
print(f"Wrote {OUT_JSON}")
|
||||
print(f"Wrote {OUT_MD}")
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
main()
|
||||
Reference in New Issue
Block a user