fix(explorer): advance address-history cursor by hashes consumed#1100
Open
Tleaoo wants to merge 1 commit into
Open
fix(explorer): advance address-history cursor by hashes consumed#1100Tleaoo wants to merge 1 commit into
Tleaoo wants to merge 1 commit into
Conversation
The pagination cursor was advanced by transactions.length, which is smaller than the page size when some hashes come from transfer/log sources with no txs row. That caused duplicate rows and, for fully-missing pages, an infinite non-advancing loop. Advance by finalHashes.length instead.
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.
What happened
I was paging through the activity feed for a busy address and noticed the list
just… stopped advancing. Same rows kept coming back, and for one address the
"load more" button spun forever without ever moving past a certain point.
After digging in, here's what's going on. The address endpoint assembles a page
of hashes from a few different places — the
txstable, but also transfer rowsand emitted-log rows, plus the contract-creation tx. We then call
fetchTxDataByHashesto hydrate them, and that helper only reads thetxstable. So any hash that came from the transfer/log side has no matching tx row
and gets quietly filtered out.
That filtering is fine on its own — the trouble is what we did next. The
pagination cursor was computed from the hydrated count:
If a 20-hash page hydrates to only 15 rows, the cursor moves forward by 15, not
20. Next request starts at offset 15 and happily re-selects the five hashes we
already skipped — duplicates, stalled progress. And in the worst case (a whole
page with no tx data)
transactions.lengthis 0 whilehasMoreis still true,so the client loops on the same offset forever.