fix(store): handle AllEntries pagination for genesis block storage maps#1816
Draft
mmagician wants to merge 2 commits into0xMiden:nextfrom
Draft
fix(store): handle AllEntries pagination for genesis block storage maps#1816mmagician wants to merge 2 commits into0xMiden:nextfrom
mmagician wants to merge 2 commits into0xMiden:nextfrom
Conversation
…sis block When all storage map entries exceed the pagination limit and reside in a single block (e.g. genesis block 0), `take_while` produces empty results since all rows share the same block_num. Previously this led to `last_block_num.saturating_sub(1)` = -1 (i64) which failed BlockNumber::from_raw_sql, returning an internal error to the client. Now when take_while yields no values (all entries in one block), we return block_range.start() as last_block_included with empty values. The caller (reconstruct_storage_map_from_db) interprets this as no pagination progress and returns limit_exceeded, which is the correct response for maps exceeding the entry limit. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
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
GetAccountRPC withAllEntries(true)returns an internal error for storage maps with entries exceeding the pagination limit when all entries are in genesis block 0select_account_storage_map_values_pagedcomputeslast_block_num.saturating_sub(1)= -1 (i64) when all entries share the same block, which failsBlockNumber::from_raw_sqltake_whileyields empty results (single-block overflow), returnblock_range.start()to signal no pagination progress, triggeringlimit_exceededin the callerDiscovered via 0xMiden/miden-client#1926
Test plan
select_storage_map_sync_values_all_entries_in_genesis_blockthat reproduces the bug (fails without fix, passes with fix)miden-node-storetest suite passes (121 tests)🤖 Generated with Claude Code