-
Notifications
You must be signed in to change notification settings - Fork 3
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
RPC to subscribe storage prefix #102
Comments
The chainHead_storage method with query type Comparing two results of the same method call is used to determine if any storage changes happened below the provided prefix. Would you also be interested in the RPC providing the key that was changed / added? |
Yeah I still need a way to figure out the added/removed/modified keys. |
Implementing this with the current API might be complicated, although not impossible. I would start by constructing a Because the current API does not offer support for your use-case at the moment, you'd need to make another Whenever a different hash is reported by Even though the API supports batch requests via the Considering the fact that This sounds indeed complicated enough and might not be feasible for smaller prefix keys, or prefix keys that have multiple storage entries below them. Considering the light-client, I don't have enough context, but I would expect this to be even difficult to implement in the server. I would be interested to hear more about your use-case, since it sounds like a complicated thing to implement 👍 // for reference, @tomaka might have more insights into this |
Here are some of my use cases.
|
FWIW I'm working on integrating a new API into the However, this task is turning out to be more complex than I first thought. One important thing to note is that the updates provided by this new API won't necessarily cover every single change as it happens on every finalized block. Ideally, it would inform the user of changes after each finalized block. But, there's no guarantee of this happening every time. This means sometimes the updates might include changes from some previous blocks all at once, rather than just the most recent one. So, if a user gets an update at block 'x', it might include all the changes that happened since block 'x-y'. This limitation makes the feature less suitable for those who need to track every single change in real-time for each finalized block. Additionally, there's another aspect to consider: the more storage map "watchers" a user sets up, the more they might experience delays in getting updates. I've thought about introducing an overload in the API that would force the library to evaluate the deltas in every single finalized block. However, this approach has a significant downside. It greatly increases the chance of triggering a 'stop' event. In conclusion, I find myself agreeing with @xlc's viewpoint: it would be really beneficial to have an API specifically designed to identify deltas for a given "partial trie path". This would be particularly useful even if it could only provide the changes a given pinned block. Otherwise, I would greatly appreciate some advice on the best approach to querying data changes. In the background, my current process involves the following steps:
Here's where I face a dilemma: What's the most efficient way to retrieve these values? Should I use The challenge is that each Currently, I’m using Like @xlc mentioned, there really should be a simpler and more efficient method to handle this process. cc: @tomaka 🙏 |
Previous issue paritytech/substrate#5790
I would like to subscribe by key prefix. This will allow me to subscribe new entries in map / double map.
The text was updated successfully, but these errors were encountered: