mirror of
https://github.com/pezkuwichain/pezkuwi-wallet-utils.git
synced 2026-10-23 20:16:21 +00:00
fix(chains): drop node URLs that embed Nova's Infura keys
Nova's configs carry Nova's own Infura project keys inside node URLs, and
every sync copied them into ours: Ethereum had four keyed Infura nodes and
Base one, across 43 published files. Our Android build already fills
`{INFURA_API_KEY}` from our own secret; the keyed URLs used another
organisation's quota and would break for every user when Nova rotates them.
- sync_from_nova.py strips nodes whose URL embeds an Infura key, and drops a
chain left with no node (only Ethereum - Goerli, a retired testnet, in the
dev files); merge-chains.py applies the same filter
- the published chain files are rewritten with that filter; nothing else in
them changes (each file round-trips byte for byte through json.dump)
- check_pezkuwi_integrity.py refuses a keyed Infura URL under chains/
This commit is contained in:
1 parent
8bd31ac686
commit
7f0bb6a3d3
46 files changed
+50
-1233
No files matched your search
@@ -19,6 +19,7 @@ Rules:
|
||||
"""
|
||||
|
||||
import json
|
||||
import re
|
||||
import shutil
|
||||
from pathlib import Path
|
||||
|
||||
@@ -51,6 +52,27 @@ def load_blacklist() -> set:
|
||||
return set()
|
||||
|
||||
|
||||
# Nova's configs carry Nova's own Infura project keys written into node URLs.
|
||||
# They are not ours to use: our builds fill `{INFURA_API_KEY}` from our own
|
||||
# secret, and a keyed URL breaks for every user the day Nova rotates it.
|
||||
KEYED_ENDPOINT = re.compile(r"infura\.io/.*/v3/[0-9a-f]{32}")
|
||||
|
||||
|
||||
def strip_keyed_endpoints(chains: list) -> list:
|
||||
"""Drop nodes whose URL embeds a third-party API key, and any chain left with no node."""
|
||||
out = []
|
||||
for chain in chains:
|
||||
nodes = chain.get('nodes')
|
||||
if nodes is not None:
|
||||
kept = [n for n in nodes if not KEYED_ENDPOINT.search(n.get('url', ''))]
|
||||
if not kept:
|
||||
continue
|
||||
if len(kept) != len(nodes):
|
||||
chain = {**chain, 'nodes': kept}
|
||||
out.append(chain)
|
||||
return out
|
||||
|
||||
|
||||
def merge_chains(nova_chains: list, pezkuwi_chains: list, blocked_ids: set) -> list:
|
||||
"""Pezkuwi chains first, then Nova chains. Blocked chains excluded."""
|
||||
pezkuwi_ids = {c['chainId'] for c in pezkuwi_chains}
|
||||
@@ -58,7 +80,7 @@ def merge_chains(nova_chains: list, pezkuwi_chains: list, blocked_ids: set) -> l
|
||||
c for c in nova_chains
|
||||
if c['chainId'] not in pezkuwi_ids and c['chainId'] not in blocked_ids
|
||||
]
|
||||
return pezkuwi_chains + nova_filtered
|
||||
return pezkuwi_chains + strip_keyed_endpoints(nova_filtered)
|
||||
|
||||
|
||||
def merge_xcm(nova_xcm: dict, pezkuwi_xcm: dict) -> dict:
|
||||
|
||||
Reference in new issue
Block a user