store: limit number of requested storage map keys / smt proofs returned#1517
Merged
store: limit number of requested storage map keys / smt proofs returned#1517
Conversation
Returns `LimitExceeded` when the number of requested keys exceeds `MAX_SMT_PROOF_ENTRIES`. Closes #1514
… proofs When opening a storage map for specific keys, now returns all entries instead of individual SMT proofs when the total proof nodes would exceed the number of entries. This reduces response size and CPU cost. Adds `StorageMapResponse` enum and `storage_map_response()` helper.
…than SMT proofs" This reverts commit 67bb0cc.
Mirko-von-Leipzig
approved these changes
Jan 16, 2026
bobbinth
reviewed
Jan 16, 2026
Comment on lines
+438
to
+442
| /// Maximum number of SMT proofs that can be returned in a single response. | ||
| /// | ||
| /// This limit is more restrictive than [`Self::MAX_RETURN_ENTRIES`] because SMT proofs | ||
| /// are larger (up to 64 inner nodes each) and more CPU-intensive to generate. | ||
| pub const MAX_SMT_PROOF_ENTRIES: usize = 16; |
Contributor
There was a problem hiding this comment.
We should also be checking this on the request side - i.e., if the user requests 1000 proofs, this should be rejected by the RPC rather than being forwarded to the store. And ideally we'd use the same constant in both places. Let's create an issue for this.
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.
Closes #1514