-
Notifications
You must be signed in to change notification settings - Fork 46
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
support json rpc 2.0 with author_submitAndWatchExtrinsic
trusted calls
#1623
Conversation
author_submitAndWatch
trusted callsauthor_submitAndWatchExtrinsic
trusted calls
…yhow, we can easily introduce it later.
TrustedOperation::direct_call(_) => Err(TrustedOperationError::Default { | ||
msg: "Invalid call to `perform_trusted_operation`, use `send_direct_request` directly" | ||
.into(), | ||
}), |
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.
I decided to remove this branch here. It is very impractical that all these methods have to return the same type T
. Our send_direct_request
only ever returned ()
, which by luck worked as we are trying to decode the RPCResponse
s value, which was always an empty vector, into it. But this seemed like a massive hack and code smell to me. We should separate the others in the future, see #1625
Now, we just always return the top-hash, so I had to remove it from that branch.
match receiver.recv() { | ||
Ok(response) => { | ||
debug!("received response"); |
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.
Simply remove the nesting, by replacing in match
and if let
with returning early with ?
the behavior was preserved.
author_submitAndWatchExtrinsic
trusted callsauthor_submitAndWatchExtrinsic
trusted calls
I expect that the CI should work once the storage has been freed, this commit was basically successful: da566a0 |
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
As this breaks pubic api, I suggest to bump the sdk release to 0.15 with this
@polkadot/rpc-provider
and support forauthor_submitAndWatchExtrinsic
for trusted calls encointer/encointer-js#116Changes
result
of the first RPC response must only contain the subscription ID if it is a subscription, and nothing else. This ID will be used to match subsequent messages to the corresponding subscriptions.send_direct_request
use case isauthor_submitAndWatchExtrinsic
currently this could be changed relatively easy. But this change hasn't been integrated holistically enough, we can improve the cli code in some places. Marked as a todo [cli] Refactor sending trusted operations in cli #1625.Notes: