-
Notifications
You must be signed in to change notification settings - Fork 248
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
update jsonrpsee to 0.2.0-alpha.6 #266
Conversation
Output::Success(_) => { | ||
Ok(( | ||
send_back_sub, | ||
SubscriptionId::Num(request_id), |
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.
This was wrong and fixed, it would use the actual request ID. Thus dropping the subscription wouldn't unless the server had configured the actual requestID as subscription ID :)
src/rpc.rs
Outdated
@@ -294,8 +290,11 @@ impl<T: Runtime> Rpc<T> { | |||
key: &StorageKey, | |||
hash: Option<T::Hash>, | |||
) -> Result<Option<StorageData>, Error> { | |||
let params = Params::Array(vec![to_json_value(key)?, to_json_value(hash)?]); | |||
let data = self.client.request("state_getStorage", params).await?; | |||
let params: &[_] = &[to_json_value(key)?, to_json_value(hash)?]; |
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.
needed to not be treated as an reference to an array i.e, a slice.
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.
It's annoying having to add this type hint, perhaps we could extract the whole pattern of: construct params, do request, then log.
Anyway it's fine for now, hope in the future all these rpc calls can be generated with a macro. Is there an updated one in jsonrpsee client yet? When I first did this there was one but it didn't work.
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.
The macros already supported in the clients but the macros doesn't work when you have two different clients I think, then we don't from which crate the fetch types in each client, technically we wanted to avoid users to explicitly jsonrpsee types which is an "internal crate"
The way it's designed is to use the wrapper jsonrpsee crate
similar to what it was before but we don't expose the tokio 02
feature there so can't be used here unfortunately. paritytech/jsonrpsee#271
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.
Looks good but I haven't looked properly at the client changes,
I'm getting even more inclined to move that out of this repo since it is quite a bit of maintenance and we do not use it for tests here anymore. Which also means we don't actually know whether it works still - have you tested it?
src/rpc.rs
Outdated
@@ -294,8 +290,11 @@ impl<T: Runtime> Rpc<T> { | |||
key: &StorageKey, | |||
hash: Option<T::Hash>, | |||
) -> Result<Option<StorageData>, Error> { | |||
let params = Params::Array(vec![to_json_value(key)?, to_json_value(hash)?]); | |||
let data = self.client.request("state_getStorage", params).await?; | |||
let params: &[_] = &[to_json_value(key)?, to_json_value(hash)?]; |
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.
It's annoying having to add this type hint, perhaps we could extract the whole pattern of: construct params, do request, then log.
Anyway it's fine for now, hope in the future all these rpc calls can be generated with a macro. Is there an updated one in jsonrpsee client yet? When I first did this there was one but it didn't work.
No, I agree but I think we could extract that boiler plate from jsonrpsee in an async client abstraction or something |
@@ -176,28 +172,32 @@ pub enum RpcClient { | |||
|
|||
impl RpcClient { | |||
/// Start a JSON-RPC request. | |||
pub async fn request<T: DeserializeOwned>( | |||
pub async fn request<'a, T: DeserializeOwned + std::fmt::Debug>( |
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.
added debug bound here to make is possible to log here but might be more readable logging on the the concrete type
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.
LGTM. If @gregdhill can confirm the client
is working then I will go ahead and merge.
I can confirm it was working with v5, but I have not yet tested with v6. |
@gregdhill please let us know when you have tested it, because the test-node have been removed from this repo and I found no easy-way to test it 🙏 |
I have following issue with this branch:
Is it possible to make bonds a bit softer? |
It should go away once the rocco branch updates substrate, paritytech/substrate#8690 It's an exact dependency because we might introduce breaking changes as this is a "pre-release" but if you have any good ideas how to do it better I'm open for suggestions :) |
@niklasad1 I see, thank you. Hope this will fix it when rococo updated. Don’t want to block merge process. |
@niklasad1 When can this PR be merged? |
After @gregdhill has tested the |
Apologies, I've been preoccupied lately. Let me upgrade our clients tomorrow and I will verify that the latest upgrade works with the embedded client. |
@niklasad1 I can confirm that |
The rationale is behind this bump is paritytech/jsonrpsee#274 and that the client API has been changed to avoid less allocations.
Also we have released the
jsonrpsee root
crate again but it doesn't exposetokio02
feature to won't work for this repo yet :(