fix: correctly return LimitExceeded from reconstruct_storage_map_from_db when start block has too many entries#1825
Merged
mmagician merged 4 commits intorelease/v0.14.0-alphafrom Mar 23, 2026
Conversation
…rom_db The previous pagination fix in `select_account_storage_map_values_paged` correctly signals "no progress" by returning empty values when a single block exceeds the entry limit. But the caller (`reconstruct_storage_map_from_db`) didn't detect this because the loop exits at the top when `last_block_included == block_num` (both 0 for genesis), before reaching the progress check inside the loop body. This resulted in returning `AllEntries([])` instead of `LimitExceeded`, causing the client to import genesis accounts with empty storage maps. Add an early check after the first page: if no values were returned and we didn't advance past the starting block, the block has more entries than the limit allows, so return `LimitExceeded`. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
…tion Replace `last_block_num.saturating_sub(1)` with reading block_num from the last kept `AccountVaultValue`. Same approach as the storage map fix in #1816. No unit test added because `select_account_vault_assets` uses a hardcoded `MAX_ROWS` (~61k) derived from `MAX_RESPONSE_PAYLOAD_BYTES`, making it impractical to trigger the overflow in a test. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
LimitExceeded from reconstruct_storage_map_from_db when start block has too many entries
282a580 to
d89890b
Compare
This was referenced Mar 23, 2026
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.
It turns out that
reconstruct_storage_map_from_dbwas not returning as advertised after the fix in #1816:and instead, if
block_range_starthad too many entries, it would return::AllEntriesWhile on it, I also addressed the same pattern as with #1816 where pagination should avoid subtraction on
BlockNum.Note, that a similar pattern also exists for
select_transactions_records, but there I don't think there's a way around double allocation of collected values - and it's also a non-issue, because by definition we won't have any transactions at genesis where this could fail. I added a note.