-
Notifications
You must be signed in to change notification settings - Fork 2.6k
Conversation
client/rpc/src/state/state_full.rs
Outdated
}; | ||
let client = self.client.clone(); | ||
Box::new( | ||
join_all(keys.into_iter().map(move |key| { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same here
@@ -66,6 +66,15 @@ pub trait ChildStateApi<Hash> { | |||
hash: Option<Hash>, | |||
) -> FutureResult<Option<StorageData>>; | |||
|
|||
/// 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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
storage_entries
maybe? storages
sounds weird.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Are you sure?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Again you are only requesting one key after another.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
At least it's the claim that was made in the storage
function. But I'll add a test to check it.
@@ -66,6 +66,15 @@ pub trait ChildStateApi<Hash> { | |||
hash: Option<Hash>, | |||
) -> FutureResult<Option<StorageData>>; | |||
|
|||
/// 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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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
getStorage
as it can be substituted withgetStorageEntries
now?fixes #9203