fix(api): respect historical block in v2 storage entries - #754
Open
rossbulat wants to merge 1 commit into
Open
Conversation
Contributor
There was a problem hiding this comment.
🟢 Approval recommended
The change correctly forwards the historical block hash to chainHead.storage in the affected path and includes a targeted regression test covering the reported failure mode.
Pull request overview
This PR fixes a JSON-RPC v2 historical query correctness bug where storage map enumeration (entries(), via descendantsValues) could silently resolve against the latest chain state instead of the block specified by an api.at(blockHash) client.
Changes:
- Forward
atBlockHashtochainHead.storagefor V2 storage map enumeration (descendantsValues) so results are resolved at the intended historical block. - Add a regression test asserting that
entries()uses the historical block hash from the client when callingchainHead.storage.
File summaries
| File | Description |
|---|---|
| packages/api/src/executor/v2/StorageQueryExecutorV2.ts | Passes this.atBlockHash into chainHead.storage for descendantsValues map enumeration. |
| packages/api/src/executor/tests/StorageQueryExecutorV2.spec.ts | Adds a regression test validating the historical block hash is forwarded during entries() calls. |
Review details
- Files reviewed: 2/2 changed files
- Comments generated: 0
- Review effort level: Lite
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
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.
Fixes #753.
Summary
atBlockHashwhen V2 storage map enumeration callschainHead.storageentries()uses the block hash from anapi.at(...)clientWithout the hash,
descendantsValuesresolves against the latest state, so historical map enumeration can silently return current entries even though keyed historical queries are correct.Tests
yarn workspace @dedot/api test StorageQueryExecutorV2.spec.tsyarn build