Open olanod opened 3 years ago
I'd propose an alternative solution: don't query the storage directly, but query the sate root at a certain block. With a storage root, users can submit the storage proof as well as the raw data to your blockchain, and it reduced the data transferred in the middle (especially useful for HRMP)
Parachains might want to reliably read the storage of another parachain and this could be done with XCM. Chains have the option of querying the other parachain state with an RPC client from an off-chain worker but is not very efficient and doesn't come with the same delivery guaranties or securities of XCM.
XCM being completely asynchronous means such querying protocol would work as a kind of subscription system where chain A tells chain B that it wants to know the value of one or more storage keys, it can also tell if it's a one time subscription or if it should be updated whenever the values of the key or keys change and it should also specify a "callback" path similar to how webhooks work but in this case it would be what dispatchable call should the chain A execute to process the incoming data.