diff --git a/.github/scripts/prepare_deploy_plan.py b/.github/scripts/prepare_deploy_plan.py index 86e89152..d1c02978 100755 --- a/.github/scripts/prepare_deploy_plan.py +++ b/.github/scripts/prepare_deploy_plan.py @@ -20,10 +20,26 @@ def matchable_name(coin: str) -> str: return coin + "=main" -def test_coin_name(coin: str) -> str: - if coin.endswith("_archive"): - return coin[: -len("_archive")] - return coin +def load_test_coin_name(config_path: Path) -> str: + try: + config = json.loads(config_path.read_text(encoding="utf-8")) + except Exception as exc: + fail(f"cannot read {config_path}: {exc}") + + coin_cfg = config.get("coin") + if not isinstance(coin_cfg, dict): + fail(f"invalid config {config_path}: missing coin section") + + test_name = coin_cfg.get("test_name") + if test_name is None: + return config_path.stem + if not isinstance(test_name, str): + fail(f"invalid config {config_path}: coin.test_name must be a string") + + test_name = test_name.strip() + if not test_name: + fail(f"invalid config {config_path}: coin.test_name must not be empty") + return test_name def load_runner_map(vars_map: dict) -> dict: @@ -98,7 +114,7 @@ def main() -> None: if not coin_cfg_path.exists(): fail(f"unknown coin '{coin}' (missing {coin_cfg_path})") - lookup_coin = test_coin_name(coin) + lookup_coin = load_test_coin_name(coin_cfg_path) test_cfg = tests_cfg.get(lookup_coin) if not isinstance(test_cfg, dict) or "connectivity" not in test_cfg: fail( diff --git a/build/tools/templates.go b/build/tools/templates.go index 6836dd71..2148f9ec 100644 --- a/build/tools/templates.go +++ b/build/tools/templates.go @@ -50,6 +50,7 @@ type Config struct { Network string `json:"network,omitempty"` Label string `json:"label"` Alias string `json:"alias"` + TestName string `json:"test_name,omitempty"` } `json:"coin"` Ports struct { BackendRPC int `json:"backend_rpc"` diff --git a/configs/coins/arbitrum_archive.json b/configs/coins/arbitrum_archive.json index 0588eb95..5d178f36 100644 --- a/configs/coins/arbitrum_archive.json +++ b/configs/coins/arbitrum_archive.json @@ -4,7 +4,8 @@ "shortcut": "ETH", "network": "ARB", "label": "Arbitrum", - "alias": "arbitrum_archive" + "alias": "arbitrum_archive", + "test_name": "arbitrum" }, "ports": { "backend_rpc": 8306, diff --git a/configs/coins/arbitrum_nova_archive.json b/configs/coins/arbitrum_nova_archive.json index 89503787..e00d681b 100644 --- a/configs/coins/arbitrum_nova_archive.json +++ b/configs/coins/arbitrum_nova_archive.json @@ -3,7 +3,8 @@ "name": "Arbitrum Nova Archive", "shortcut": "ETH", "label": "Arbitrum Nova", - "alias": "arbitrum_nova_archive" + "alias": "arbitrum_nova_archive", + "test_name": "arbitrum_nova" }, "ports": { "backend_rpc": 8308, diff --git a/configs/coins/avalanche_archive.json b/configs/coins/avalanche_archive.json index 60781d06..e6976e74 100644 --- a/configs/coins/avalanche_archive.json +++ b/configs/coins/avalanche_archive.json @@ -3,7 +3,8 @@ "name": "Avalanche Archive", "shortcut": "AVAX", "label": "Avalanche", - "alias": "avalanche_archive" + "alias": "avalanche_archive", + "test_name": "avalanche" }, "ports": { "backend_rpc": 8099, diff --git a/configs/coins/base_archive.json b/configs/coins/base_archive.json index 9c367a1a..85ece6dd 100644 --- a/configs/coins/base_archive.json +++ b/configs/coins/base_archive.json @@ -4,7 +4,8 @@ "shortcut": "ETH", "network": "BASE", "label": "Base", - "alias": "base_archive" + "alias": "base_archive", + "test_name": "base" }, "ports": { "backend_rpc": 8211, diff --git a/configs/coins/bsc_archive.json b/configs/coins/bsc_archive.json index 45686494..d7aebbaf 100644 --- a/configs/coins/bsc_archive.json +++ b/configs/coins/bsc_archive.json @@ -4,7 +4,8 @@ "shortcut": "BNB", "network": "BSC", "label": "BNB Smart Chain", - "alias": "bsc_archive" + "alias": "bsc_archive", + "test_name": "bsc" }, "ports": { "backend_rpc": 8065, diff --git a/configs/coins/ethereum_archive.json b/configs/coins/ethereum_archive.json index dc0264ee..5fc0914b 100644 --- a/configs/coins/ethereum_archive.json +++ b/configs/coins/ethereum_archive.json @@ -3,7 +3,8 @@ "name": "Ethereum Archive", "shortcut": "ETH", "label": "Ethereum", - "alias": "ethereum_archive" + "alias": "ethereum_archive", + "test_name": "ethereum" }, "ports": { "backend_rpc": 8016, diff --git a/configs/coins/ethereum_testnet_hoodi_archive.json b/configs/coins/ethereum_testnet_hoodi_archive.json index 9eb2c9a4..8607ceac 100644 --- a/configs/coins/ethereum_testnet_hoodi_archive.json +++ b/configs/coins/ethereum_testnet_hoodi_archive.json @@ -3,7 +3,8 @@ "name": "Ethereum Testnet Hoodi Archive", "shortcut": "tHOD", "label": "Ethereum Hoodi", - "alias": "ethereum_testnet_hoodi_archive" + "alias": "ethereum_testnet_hoodi_archive", + "test_name": "ethereum_testnet_hoodi" }, "ports": { "backend_rpc": 18026, diff --git a/configs/coins/ethereum_testnet_sepolia_archive.json b/configs/coins/ethereum_testnet_sepolia_archive.json index 575ca975..be8d3488 100644 --- a/configs/coins/ethereum_testnet_sepolia_archive.json +++ b/configs/coins/ethereum_testnet_sepolia_archive.json @@ -3,7 +3,8 @@ "name": "Ethereum Testnet Sepolia Archive", "shortcut": "tSEP", "label": "Ethereum Sepolia", - "alias": "ethereum_testnet_sepolia_archive" + "alias": "ethereum_testnet_sepolia_archive", + "test_name": "ethereum_testnet_sepolia" }, "ports": { "backend_rpc": 18086, diff --git a/configs/coins/optimism_archive.json b/configs/coins/optimism_archive.json index 8cf702f1..779dde75 100644 --- a/configs/coins/optimism_archive.json +++ b/configs/coins/optimism_archive.json @@ -4,7 +4,8 @@ "shortcut": "ETH", "network": "OP", "label": "Optimism", - "alias": "optimism_archive" + "alias": "optimism_archive", + "test_name": "optimism" }, "ports": { "backend_rpc": 8202, diff --git a/configs/coins/polygon_archive.json b/configs/coins/polygon_archive.json index 1ff44f86..5737cb4d 100644 --- a/configs/coins/polygon_archive.json +++ b/configs/coins/polygon_archive.json @@ -4,7 +4,8 @@ "shortcut": "POL", "network": "POL", "label": "Polygon", - "alias": "polygon_archive_bor" + "alias": "polygon_archive_bor", + "test_name": "polygon" }, "ports": { "backend_rpc": 8072, diff --git a/docs/testing.md b/docs/testing.md index fd5c2fb7..a4626aa6 100644 --- a/docs/testing.md +++ b/docs/testing.md @@ -89,12 +89,12 @@ Example: HTTP connectivity verifies both back-end and Blockbook accessibility: * back-end: UTXO chains call `getblockchaininfo`, EVM chains call `web3_clientVersion` -* Blockbook: calls `GET /api/status` (resolved from `BB_TEST_API_URL_HTTP_` or local `ports.blockbook_public`) +* Blockbook: calls `GET /api/status` (resolved from `BB_TEST_API_URL_HTTP_` or local `ports.blockbook_public`) WebSocket connectivity also verifies both surfaces: * back-end: validates `web3_clientVersion` and opens a `newHeads` subscription -* Blockbook: connects to `/websocket` (or `BB_TEST_API_URL_WS_`) and calls `getInfo` +* Blockbook: connects to `/websocket` (or `BB_TEST_API_URL_WS_`) and calls `getInfo` ### Blockbook API end-to-end tests @@ -107,9 +107,10 @@ Phase 1 covers smoke checks for: * HTTP: `Status`, `GetBlockIndex`, `GetBlockByHeight`, `GetBlock`, `GetTransaction`, `GetTransactionSpecific`, `GetAddress`, `GetAddressTxids`, `GetAddressTxs`, `GetUtxo`, `GetUtxoConfirmedFilter` * WebSocket: `WsGetInfo`, `WsGetBlockHash`, `WsGetTransaction`, `WsGetAccountInfo`, `WsGetAccountUtxo`, `WsPing` -Endpoint resolution uses coin alias and this precedence: +Endpoint resolution uses the test name from `coin.test_name` in `configs/coins/.json` +(or the config file name when `test_name` is omitted) and this precedence: -1. `BB_TEST_API_URL_HTTP_` and `BB_TEST_API_URL_WS_` +1. `BB_TEST_API_URL_HTTP_` and `BB_TEST_API_URL_WS_` 2. localhost fallback from coin config port `ports.blockbook_public` 3. when WS env var is missing, WS URL is derived from HTTP URL with `/websocket` path