Skip to content

jsonrpc: Add async support#558

Open
jamillambert wants to merge 4 commits intorust-bitcoin:masterfrom
jamillambert:0417-jsonrpc-async
Open

jsonrpc: Add async support#558
jamillambert wants to merge 4 commits intorust-bitcoin:masterfrom
jamillambert:0417-jsonrpc-async

Conversation

@jamillambert
Copy link
Copy Markdown
Collaborator

Pulled out of #505 and polished.

The aim is to add async support without breaking existing sync downstream. This includes keeping the reexports of the current sync Client at the crate root.

Code copy only to make it easier in the next patch to see what the
changes are for async.
Remove code related to fuzzing from the new async files. Fuzzing of the
async client can be added back later if needed.
In preparation for adding another async client change the Debug impl to
refer to the local sync Client so that there is no conflict when adding
the second async Client struct.
Copy link
Copy Markdown
Contributor

@satsfy satsfy left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

tACK 5906ce1 - Ran some async tests locally with the new client.


impl BitreqHttpTransport {
/// Constructs a new [`BitreqHttpTransport`] with default parameters.
pub fn new() -> Self { BitreqHttpTransport::default() }
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just a comment. Should we consider some validation here? So that the user cannot shoot themselves on the foot like:

use jsonrpc::bitreq_http_async::Builder;
Builder::new().url("not_a_url").is_ok();

I suppose a validation could happen at new or at fn build(self). No change required, because sync client also does it too. But it's a thought for production.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Raise an issue man, your thoughts are valuable and will be lost if left here!

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Worth raising an issue. But not_a_url is a valid URL. I'm not sure what validation would be reasonable.

Copy link
Copy Markdown
Member

@tcharding tcharding left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ACK 5906ce1 - but I know nothing about async code.

@tcharding
Copy link
Copy Markdown
Member

Since we are going to cut a release that includes code I know nothing about (async) I'd love to see PRs up that test everything before we release. Would you consider doing:

  • A release tracking PR for jsonrpc (bumps version and updates local crates that depend on it).
  • Rebase the prod RPC client and use the branch/PR created above

Then with green CI on those two PRs we'd have confidence we got things right and we can go ahead and cut the releases.

And if someone with async experience has ten minutes to cast an eye over 5906ce1 please that would be very much appreciated.

@tcharding
Copy link
Copy Markdown
Member

@satsfy have you spent much time with async code?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants