Lazy downloading of data in try-runtime-cli #13109
Replies: 1 comment 1 reply
-
I remember we try to think about it a bit and it was not straightforward. My first idea was that the read access should use light client calls (over trie query). Doing it this way allows the client to keep his change and accessed node on a local memory db, so no session persistence would be needed on the host. IIRC the granularity might be a bit thin (one query for a single value access), and some primitives So a different direction (I think it is the one you start taking in your branch) is to assume we do not support correct root and trie, and just download the values Calls to externality first check if we got a previous query persisted or a change in layer (so probably need to store Option for a key), and if never queried then access it. And of course a third possibility could be to just have a rpc that return encoded trie node for a given hash, and plug it in a modified memorydb, the granularity really seems to small, but then we do not have redundant data in light client proofs. My opinion here is: to get something quickly the second version should be achievable, even if next_key persistence might be a bit messy (I remember storing this on an experimental branch aka keeping trace of a range of accesses, it was not really the clearest code), but the first version is more interesting generally (light primitives could be interesting and it produces correct storage root). Trying to get an acceptable solution do do storage root with the first version (that would not require a lot of changes as input and very redundant proof as a result), one can just query all the modified nodes that where not previously queried (removed values and modified values that where not accessed). Also this assume we want stateless rpc, going statefull one could just use a remote state machine backend that we update between each blocks. |
Beta Was this translation helpful? Give feedback.
-
One of the main drawbacks of try-runtime for production chains is that it is very slow to download.
We made good amount of changes in #12537 to improve this a bit, but it is still not enough.
In this branch, I tried to make the lazy-download work by integrating it into the
remote-externalities
as a new backend. But this proved to be too messy. Perhaps someone can re-try this better and do it better than my try.Alternatively, we always have the option to achieve this by overwriting host functions. But I am not sure how to achieve this. On paper, this is a simpler approach
@cheme @bkchr I am sure both of you are too busy, but you might be able to shed some light into which direction is reasonable to make.
Beta Was this translation helpful? Give feedback.
All reactions