Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(chainHead_v1): fake closestDescendantMerkleValue #874

Merged
merged 2 commits into from
Jan 9, 2025

Conversation

voliva
Copy link
Contributor

@voliva voliva commented Jan 8, 2025

Addresses #870

This gives support for Polkadot-API's query.watchEntries(), which subscribes to the storage using closestDescendantMerkleValue to detect changes.

As discussed in #870, chopsticks doesn't work with the merkle tree directly, but with storage diffs.

As polkadot-api doesn't really need the correct hash, but just that the value returned is different when any storage value under that branch changes, this implementation fakes the merkleValue to be based on a counter of how many changes were detected for that branch.

I have added a test with the top-level client of polkadot-api (now that it doesn't require codegen/descriptors to run) and it seems to be working as expected.

@xlc
Copy link
Member

xlc commented Jan 8, 2025

can you add some comments explaining the difference behaviour in Chopsticks vs spec?

@xlc xlc enabled auto-merge (squash) January 9, 2025 10:42
@xlc xlc merged commit 9be6b6c into AcalaNetwork:master Jan 9, 2025
5 checks passed
@voliva voliva deleted the vo-descendant-merkle branch January 9, 2025 14:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants