Add childstate_getStorageEntries RPC#9459
Conversation
client/rpc/src/state/state_full.rs
Outdated
| }; | ||
| let client = self.client.clone(); | ||
| Box::new( | ||
| join_all(keys.into_iter().map(move |key| { |
|
|
||
| /// Returns child storage entries for multiple keys at a specific block's state. | ||
| #[rpc(name = "childstate_getStorages")] | ||
| fn storages( |
There was a problem hiding this comment.
storage_entries maybe? storages sounds weird.
There was a problem hiding this comment.
Yes, that's better.
Another question is if we should deprecate storage because of the overlapping functionality?
client/rpc/src/state/state_light.rs
Outdated
| let fetcher = self.fetcher.clone(); | ||
| let block = self.block_or_best(block); | ||
| Box::new(join_all(keys.into_iter().map(move |key| { | ||
| storage(&*remote_blockchain, fetcher.clone(), block, vec![key.0.clone()]) |
There was a problem hiding this comment.
You should request all keys in one request and not one request per key.
client/rpc/src/state/state_light.rs
Outdated
| .map(move |mut values| { | ||
| values | ||
| .remove(&key) | ||
| .expect("successful request has entries for all requested keys; qed") |
There was a problem hiding this comment.
At least it's the claim that was made in the storage function. But I'll add a test to check it.
client/rpc/src/state/state_light.rs
Outdated
| block, | ||
| header, | ||
| storage_key, | ||
| keys: vec![key.0.clone()], |
There was a problem hiding this comment.
Again you are only requesting one key after another.
hirschenberger
left a comment
There was a problem hiding this comment.
followup PR coming...
client/rpc/src/state/state_light.rs
Outdated
| .map(move |mut values| { | ||
| values | ||
| .remove(&key) | ||
| .expect("successful request has entries for all requested keys; qed") |
There was a problem hiding this comment.
At least it's the claim that was made in the storage function. But I'll add a test to check it.
|
|
||
| /// Returns child storage entries for multiple keys at a specific block's state. | ||
| #[rpc(name = "childstate_getStorages")] | ||
| fn storages( |
There was a problem hiding this comment.
Yes, that's better.
Another question is if we should deprecate storage because of the overlapping functionality?
|
Can I have another review, please? |
|
@bkchr Can I have another review? |
bkchr
left a comment
There was a problem hiding this comment.
Sorry for the delay. Some last nitpicks, then we are good to merge this
childstate_getStorageEntries RPC
Co-authored-by: Bastian Köcher <bkchr@users.noreply.github.com>
Co-authored-by: Bastian Köcher <bkchr@users.noreply.github.com>
Co-authored-by: Bastian Köcher <bkchr@users.noreply.github.com>
Co-authored-by: Bastian Köcher <bkchr@users.noreply.github.com>
Co-authored-by: Bastian Köcher <bkchr@users.noreply.github.com>
Co-authored-by: Bastian Köcher <bkchr@users.noreply.github.com>
Co-authored-by: Bastian Köcher <bkchr@users.noreply.github.com>
This reverts commit d840015.
This reverts commit 5813b43.
|
Should be ready now. |
|
@hirschenberger please run |
|
bot merge |
|
Waiting for commit status. |
|
Bot will approve on the behalf of @bkchr, since they are a team lead, in an attempt to reach the minimum approval count |
|
Merge failed: Could not recover from: |
|
@bkchr There's some CI issue here? |
|
bot merge |
|
Trying merge. |
Maybe it would make sense to deprecate
getStorageas it can be substituted withgetStorageEntriesnow?fixes #9203