New apis#2
Conversation
|
@claude review this PR |
|
Claude finished @Andrew-Pohl's task in 2m 25s —— View job PR Review: New APIsTodo List:
SummaryThis is a solid expansion of the backend API surface. The overall structure is clean and consistent across modules (model → task → view). Below are the findings, grouped by severity. 🔴 Bugs / Correctness Issues1. Falsy check incorrectly rejects
if not node or not start or not end: # line 63
if not node or not start or not end or not bp: # line 201If if node is None or start is None or end is None:In practice churn heights won't be 0, but this is still a latent bug. 2.
print(f'[mimir] Synced {len(response.json())} parameters')
data = response.json()
row.data = json.dumps(data)
...
print(f'[mimir] Synced {len(data)} parameters')3. Wrong HTTP status for "no data found"
return jsonify({'message': f'No data between churns {start}-{end}'}), 500A missing record is a 4. Misleading 503 when cache is populated but filter matches nothing
🟡 Security / Reliability Issues5. Unauthenticated All four modules expose
Any external caller can trigger repeated data refreshes, creating unnecessary load on THORNode/Midgard. These should require authentication or at minimum be rate-limited. 6. Hardcoded THORNODE_URL in
response_API = requests.get('https://thornode.ninerealms.com/thorchain/nodes') # line 21
response_API = requests.get('https://thornode.ninerealms.com/thorchain/nodes') # line 132Should use 7.
MIDGARD_URL = 'https://midgard.ninerealms.com' #os.getenv('MIDGARD_URL')
8. Unhandled exceptions in sync view endpoints
🟡 Code Quality Issues9. Unused import:
10.
11. Scheduler starts before blueprints are registered
12. PR description lists endpoints not in changed files The PR description mentions 🟢 Positive Notes
| |
Pull Request: Add comprehensive Thorchain data modules and endpoints
Summary
This PR significantly expands the backend API surface by incorporating nearly the entire Thornode REST API suite. New modules, models, services, views and scheduled tasks have been added to capture, store and expose vault, pool, saver, LP and other network data. Additionally, proxy endpoints were created for quick fetches of transactions, queue, rune‑pool, mimir, etc.
What’s New
Vaults
/vaults,/vaults/asgard,/vaults/yggdrasil,/vaults/vault/<pub_key>.Pools
/pools,/pools/pool/<asset>.Savers
/savers/pool/<asset>/savers,/savers/pool/<asset>/saver/<address>.Liquidity Providers
/lps/pool/<asset>/liquidity_providers,/lps/pool/<asset>/liquidity_provider/<address>.Transactions (proxy)
/tx/<hash>,/tx/<hash>/signers.Queue (proxy)
/queue,/queue/outbound.RUNE Pool (proxy)
/rune/runepool,/rune/rune_provider/<address>.Mimir (proxy)
/mimir,/mimir/key/<key>.Configuration & Scheduling
THORNODE_URLand updatedconfig.py.General
POST /historic/node/generateBPReportfor bond-provider earningsGET /historic/node/grabBPsForNode/<node>to list bond providers seen on a node across churns.