Skip to content
This repository has been archived by the owner on Nov 15, 2023. It is now read-only.

RPC: Query multiple storage keys at single block at once #5220

Closed
tomusdrw opened this issue Mar 11, 2020 · 2 comments
Closed

RPC: Query multiple storage keys at single block at once #5220

tomusdrw opened this issue Mar 11, 2020 · 2 comments
Assignees
Labels
I4-annoyance The client behaves within expectations, however this “expected behaviour” itself is at issue.
Milestone

Comments

@tomusdrw
Copy link
Contributor

Currently it's either possible to:

  1. state_queryStorage(Vec<Key>, BlockHash, Option<BlockHash>)
  2. state_getStorageAt(Key, Option<BlockHash>)

With (1) the node has to query a range of blocks (setting from=to=latest does not seem to work at all). Also if you specify the mandatory argument from=latest_hash you are risking a race condition between querying a single block or two blocks (if a new one is imported in the meantime).

With (2) you can only query one key at the time, and the latest block is optional.

The idea would be to provide another method that allows you to query a vector of keys, but also be sure that it will fetch only the latest block data. So something like:
state_queryStorageAt(Vec<Key>, Option<BlockHash>)

Potentially we could implement state_queryStorageAt as:

fn state_queryStorageAt(&self, keys: Vec<Key>, at: Option<Hash>) -> _ {
  let block = at.unwrap_or_else(get_latest);
  self.state_queryStorage(keys, block, Some(block))
}

if we fix state_queryStorage to work with a single block in range too.

CC @jacogr

@tomusdrw tomusdrw added I4-annoyance The client behaves within expectations, however this “expected behaviour” itself is at issue. M6-rpcapi labels Mar 11, 2020
@tomusdrw tomusdrw added this to the Polkadot milestone Mar 11, 2020
@tomusdrw
Copy link
Contributor Author

CC @seunlanlege perhaps you would be interested?

@seunlanlege
Copy link
Contributor

Yeah definitely

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
I4-annoyance The client behaves within expectations, however this “expected behaviour” itself is at issue.
Projects
None yet
Development

No branches or pull requests

2 participants