Skip to content

Commit 32e21be

Browse files
[S3-E.1] aptos: REST chain template fixed + L1-CLI gate bug fix
S3-E wave-E, chain 1/5 (aptos). Changes: 1. config/chains/aptos.json - rpc_methods.single: 'GET /v1' (collection root, no address) -> 'GET /v1/accounts/{addr}' (account info with address) - Added _meta.rest_paths: maps 5 logical method keys to {method, path} dicts. RestAdapter._resolve_path requires this map; without it cli.py raises ValueError 'method X not in _meta.rest_paths. Available: []'. Path templates use {address} placeholder (RestAdapter only substitutes {address}). - Added _meta.health_probe: GET /v1 + parse_jq '.block_height' (Aptos response includes x-aptos-* headers but body also has block_height, so the same endpoint serves both health probe and bench traffic shape verification). 2. tests/test_chain_adapters.py (L1-CLI gate fix) - Bug: test_cli_build_target_all_36_chains did base64.b64decode(tgt["body"]) which KeyError'd on GET targets (vegeta JSON omits "body" field for GET). aptos triggered this after S3-E.1 fix because it's the first chain to produce GET targets through the new path. Fix: tgt.get("body", "") with empty-string fallback. - Without this fix the invariant would silently mis-classify every healthy GET-only chain as broken, defeating the entire monotonic-shrink guarantee. 3. tests/test_chain_adapters.py (KNOWN_BROKEN_CLI ledger) - Removed 'aptos' entry (chain is now healthy via cli.py). - len() assertion: 16 -> 15 (1 chain fixed in S3-E.1). Verification: - L1 (unit + adapter contract): 10/10 PASS (was 10/10, no regression) - L1-CLI gate: healthy 20/36 -> 21/36, broken 16/36 -> 15/36 - L2 (cli.py batch mode): 4/4 aptos targets generated, all addresses correctly substituted into URL path - L3 (real production pipeline target_generator.sh): exit=0, "Successfully generated 4 test targets" Output file format: {"method":"GET","url":"http://.../v1/accounts/0x1","header":{}} {"method":"GET","url":"http://.../v1/accounts/0x2","header":{}} ... (4 vegeta-compatible targets) Wave S3-E progress: 1/5 chains (aptos done; algorand/hedera/tezos/ton pending) KNOWN_BROKEN_CLI invariant working as designed — caught the GET body KeyError immediately on first fix attempt.
1 parent 8f81e54 commit 32e21be

2 files changed

Lines changed: 14 additions & 6 deletions

File tree

config/chains/aptos.json

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
"tx_batch_size": "ACCOUNT_TX_BATCH_SIZE"
1818
},
1919
"rpc_methods": {
20-
"single": "GET /v1",
20+
"single": "GET /v1/accounts/{addr}",
2121
"mixed": "POST /v1/view,GET /v1,GET /v1/accounts/{addr},GET /v1/accounts/{addr}/resources,GET /v1/transactions/by_hash/{hash}"
2222
},
2323
"rpc_url": "LOCAL_RPC_URL",
@@ -58,6 +58,14 @@
5858
"original_notes": "REST 而非 JSON-RPC,POST JSON-RPC 返 405;响应自带 x-aptos-* header 免去 ledger 调用",
5959
"adapter_required": true,
6060
"adapter_family": "rest",
61-
"adapter_family_assigned_at": "2026-05-24T05:24:00.591042Z"
61+
"adapter_family_assigned_at": "2026-05-24T05:24:00.591042Z",
62+
"rest_paths": {
63+
"POST /v1/view": {"method": "POST", "path": "/v1/view"},
64+
"GET /v1": {"method": "GET", "path": "/v1"},
65+
"GET /v1/accounts/{addr}": {"method": "GET", "path": "/v1/accounts/{address}"},
66+
"GET /v1/accounts/{addr}/resources": {"method": "GET", "path": "/v1/accounts/{address}/resources"},
67+
"GET /v1/transactions/by_hash/{hash}": {"method": "GET", "path": "/v1/transactions/by_hash/{address}"}
68+
},
69+
"health_probe": {"method": "GET", "path": "/v1", "parse_jq": ".block_height"}
6270
}
6371
}

tests/test_chain_adapters.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -334,7 +334,6 @@ def test_evm_compat_5chains_standard_enum():
334334
# a real benchmark method. Fix = pick a method from param_formats
335335
# that takes an address. Pure chain-template edit, no adapter work.
336336
"algorand": ("F1", "S3-E", "single='GET /v2/status' is health-probe; use 'GET /v2/accounts/{address}'"),
337-
"aptos": ("F1", "S3-E", "single='GET /v1' returns collection root; use 'POST /v1/view' or 'GET /v1/accounts/{addr}'"),
338337
"hedera": ("F1", "S3-E", "single='mirror_account_query' is logical name, no real path; use 'mirror_balance_query' or 'eth_getBalance'"),
339338
"tezos": ("F1", "S3-E", "single='GET /chains/main/blocks/head/header' has no address; use '/contracts/{addr}/balance'"),
340339
"ton": ("F1", "S3-E", "single='getMasterchainInfo' is health-probe; use 'getAddressBalance'"),
@@ -360,7 +359,7 @@ def test_evm_compat_5chains_standard_enum():
360359
"acala": ("F3", "S3-C", "family=substrate; single='system_chain' has no address; pick eth_getBalance from param_formats"),
361360
}
362361

363-
assert len(KNOWN_BROKEN_CLI) == 16, f"KNOWN_BROKEN_CLI must have exactly 16 entries (commit 436e1d0 baseline), got {len(KNOWN_BROKEN_CLI)}"
362+
assert len(KNOWN_BROKEN_CLI) == 15, f"KNOWN_BROKEN_CLI must have exactly 15 entries (commit 436e1d0 baseline minus aptos fixed in S3-E.1), got {len(KNOWN_BROKEN_CLI)}"
364363

365364

366365
def _sample_address_for(family: str) -> str:
@@ -418,10 +417,11 @@ def test_cli_build_target_all_36_chains():
418417
if r.returncode != 0:
419418
actually_broken.add(chain)
420419
continue
421-
# Gate 2: body is valid JSON
420+
# Gate 2: body is valid JSON (body is optional for GET requests)
422421
try:
423422
tgt = json.loads(r.stdout)
424-
body = base64.b64decode(tgt["body"]).decode("utf-8", errors="replace")
423+
body_b64 = tgt.get("body", "")
424+
body = base64.b64decode(body_b64).decode("utf-8", errors="replace") if body_b64 else ""
425425
except Exception:
426426
actually_broken.add(chain)
427427
continue

0 commit comments

Comments
 (0)