paritytech/smoldot

Storage query errors: - TrieRootNotFound

gilescope opened this issue · 2 comments

In polkadot.js I can do this against a normal rpc node, but flicking over to the light client I get the error:

-32000: Error while querying block storage: Storage query errors: - TrieRootNotFound
{"id":1,"jsonrpc":"2.0","method":"state_getMetadata","params":["0xe33568bff8e6f30fee6f217a93523a6b29c31c8fe94c076d818b97b97cfd3a16"]}

(this is against the polkadot relay chain)

Is this expected behaviour - is it that smoldot can only answer requests for things that are recent?

Yes it is expected.

Nodes prune the state of old blocks, and so when the light client asks them they answer that they don't know.
There exists archive nodes, but smoldot is incapable of knowing which node is an archive node and which isn't.

To me, this is a defect in the JSON-RPC API rather than a smoldot issue. You are able to ask smoldot for the metadata of a specific block, but it has just no way to answer that request properly unless the block is very recent.

In reality, asking for the metadata of an old block is simply out of scope of smoldot.
We are working on a new version of the JSON-RPC API, in which you simply can't ask smoldot for old stuff like that. The only way to answer your request would be to ask an archive node.

Closing in favor of #2804