6

Substrate Storage reads and writes are expensive and the runtime should always be optimized around minimizing such cost, which is quantified in terms of runtime computation for traversing the Merkle Trie.

When a light client needs to access some storage item, there's an extra networking cost, given that the Merkle Trie traversal happens over the network connection with its peers.


There's a Sub0 workshop about building a parachain, called the Adz chain, and front-end application using Substrate Connect — the library and browser extension designed to build applications that generate and use their own in-browser light client.

In the workshop, Martin goes through the different storage items of the parachain he's built, implying careful decisions he's made about the way he's designed the storage for it to be optimized for light client users.


Assuming a runtime has taken care of all possible storage access optimizations in terms of runtime computation to its fullest, are there any extra factors that would influence potential optimizations in the context of the networking round trips to make it as light-client friendly as possible?

1 Answer 1

2

In the context of runtime, merkle tree traversal is costly because of the multiple database read/write operations that need to happen.

In the context of a light client, each database read is accompanied by a networking round trip.

If the runtime is optimized for storage read/write, it can also be considered optimized for light clients.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.