fix(data-api): scope account stake-flow/stake-moves to hotkey or coldkey#6504
Merged
Conversation
GET /api/v1/accounts/{ss58}/stake-flow and .../stake-moves filtered
account_events on coldkey only, so any address that only ever appears
as a hotkey (e.g. a validator receiving delegations) silently returned
an all-zero flow card despite having real, current events -- confirmed
live against a validator hotkey with 1000+ StakeAdded/StakeRemoved
events. The sibling base /accounts/{ss58} route has always matched
(hotkey = $1 OR coldkey = $1); these two routes now do the same.
Deploying with
|
| Status | Name | Latest Commit | Updated (UTC) |
|---|---|---|---|
| ✅ Deployment successful! View logs |
metagraphed-data-api | 1f6d8c2 | Jul 17 2026, 12:43 PM |
|
Superagent didn't find any vulnerabilities or security issues in this PR. |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #6504 +/- ##
=======================================
Coverage 97.85% 97.85%
=======================================
Files 174 174
Lines 22196 22196
Branches 8798 8798
=======================================
Hits 21721 21721
Misses 81 81
Partials 394 394
🚀 New features to boost your workflow:
|
Contributor
|
Important 🟪🟪🟪🟪🟪🟪🟪🟪🟪🟪🟪🟪 🔍 LoopOver is reviewing…AI analysis is in progress. This comment will update when the review is complete. 🟩 Safe / merged · 🟦 Advisory · 🟨 Held for review · 🟥 Blocked / closed · 🟪 Reviewing |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
GET /api/v1/accounts/{ss58}/stake-flowandGET /api/v1/accounts/{ss58}/stake-movesfilteredaccount_eventsoncoldkey = $1only./accounts/{ss58}route, which has always matchedhotkey = $1 OR coldkey = $1) returned all zeros from both/stake-flowand/stake-moves.WHEREclauses to the same(hotkey = $1 OR coldkey = $1)convention the base account route already uses.Found during a full data-source audit following D1 retirement (unrelated to D1 -- this bug predates it and is purely a query-scoping issue in the Postgres tier).
Test plan
npx vitest run tests/data-api.test.mjs-- 474/474 passing, including 2 new regression tests asserting the(hotkey = ? OR coldkey = ?)clause for both routesnpx eslint/npx prettier --checkclean